问:
java.sql.SQLIntegrityConstraintViolationException: Column '*' cannot be null - Java Persistence - JPA - Hibernate
I want to add a new Ticket to my SQL Database.
Ticket has 2 PK: event and code;

I created Entitys with Composite Keys and want to execute POST requests. I always get "Column 'seller' cannot be null". Anyone here knows how to work with Java Persistence and so on?

I tried it with IdClass and Embeddable but I get errors for both. It's just the inserting of a new Object in the Database. GET Requests work fine...
I tried different annotations but for now nothing worked. I probably don't really understand the concept of Java Persistence, but I also dont have to time to go trough it the whole way. So of it's obvious, please explain a little what it does... Thanks in advance!

My Entities:

Event.java

```<code>@Entity
@Table(name="events")
@NamedQuery(name="Event.findAll", query="SELECT e FROM Event e")
public class Event implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private long id;

    private String category;

    private String city;

    @Temporal(TemporalType.DATE)
    private Date date;

    @Column(name="image_path")
    private String imagePath;

    private String name;

    private String venue;

    //bi-directional one-to-many association to Ticket
    @OneToMany(mappedBy="eventBean")
    @JsonManagedReference(value="eventBean")
    private List<Ticket> tickets;

    public Event() {
    }
</code>```

Ticket.java

```<code>@Entity
@Table(name="tickets")
@IdClass(TicketPK.class)
//@NamedQuery(name="Ticket.findAll", query="SELECT t FROM Ticket t")
public class Ticket implements Serializable{
    private static final long serialVersionUID = 1L;

    @Id
    private long code;

    @Id
    private long event;

    private float price;

    private String type;

    //@Column(insertable=false, updatable=false)
    //private long event;

    //bi-directional many-to-one association to Event
    //One Event can have many tickets
    @ManyToOne(fetch = FetchType.EAGER)
    @JsonBackReference(value="eventBean")
    @JoinColumn(name="event",nullable = false,insertable=false,updatable=false)
    private Event eventBean;

    //bi-directional many-to-one association to User
    //One User can have many tickets
    @ManyToOne(fetch = FetchType.LAZY)
    @JsonBackReference(value="seller")
    @JoinColumn(name="seller", referencedColumnName = "alias")
    private User user;

    public Ticket() {
    }

    public Ticket(long event, float price, Event eventBean, User user) {
        this.event = event;
        this.price = price;
        this.eventBean = eventBean;
        this.user = user;
    }

   //getters and setters

</code>```
```<code>public class TicketPK implements Serializable {
    //default serial version id, required for serializable classes.
    private static final long serialVersionUID = 1L;

    //@Basic
    //@GeneratedValue(strategy = GenerationType.AUTO)
    //@Column(name="code", nullable=false)
    private long code;

    //@Basic
    //@Column(name="event",insertable=false)
    private long event;

    public TicketPK() {
    }

    public TicketPK(long code, long event) {
        this.code = code;
        this.event = event;
    }

//getters and setters

    public boolean equals(Object other) {
        if (this.equals(other)) {
            return true;
        }
        if (!(other instanceof TicketPK)) {
            return false;
        }
        TicketPK castOther = (TicketPK)other;
        return
            (this.code == castOther.code)
            && (this.event == castOther.event);
    }

    public int hashCode() {
        final int prime = 31;
        int hash = 17;
        hash = hash * prime + ((int) (this.code ^ (this.code >>> 32)));
        hash = hash * prime + ((int) (this.event ^ (this.event >>> 32)));

        return hash;
    }

}
</code>```

User.java

```<code>@Entity
@Table(name="users")
@NamedQuery(name="User.findAll", query="SELECT u FROM User u")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private String alias;

    private String address;

    @Column(name="admin_status")
    private byte adminStatus;

    private String name;

    private String password;

    @Column(name="phone_number")
    private int phoneNumber;

    //bi-directional one-to-many association to Ticket
    //One User can have many Tickets
    @OneToMany(mappedBy="user")
    @JsonManagedReference(value="seller")
    private List<Ticket> tickets;

    public User() {
    }
</code>```

DAO

TicketDAO

```<code>public interface TicketDAO extends CrudRepository<Ticket, TicketPK>{

    public List<Ticket> findAll();
}
</code>```

Controller

```<code>@Controller
@CrossOrigin
public class MyController {

    @Autowired
    TicketDAO daoticket;

    /****************** OPERATIONS ON Tickets ************************************/

    @RequestMapping(value="/tickets", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Ticket> createTicket(@RequestBody Ticket ticket) {

        ResponseEntity<Ticket> response;

        Ticket newTicket = daoticket.save(ticket);
        if (newTicket == null) {
            response = new ResponseEntity<>(HttpStatus.NOT_MODIFIED);
        } else {
            response = new ResponseEntity<>(newTicket, HttpStatus.CREATED);
        }
        return response;
    }
}
</code>```

SQL Database

```<code>CREATE DATABASE IF NOT EXISTS `BD89_03_ticketsell`;
USE `BD89_03_ticketsell`;

DROP TABLE IF EXISTS `TICKETS`;
DROP TABLE IF EXISTS `EVENTS`;
DROP TABLE IF EXISTS `USERS`;

CREATE TABLE `users` (
    `name` varchar(100),
    `alias` varchar(100) NOT NULL UNIQUE,
    `password` varchar(100) NOT NULL,
    `address` varchar(100),
    `phone_number` int(10),
    `admin_status` boolean NOT NULL,
    PRIMARY KEY(`alias`)
);

CREATE TABLE `events`(
    `id` bigint NOT NULL UNIQUE AUTO_INCREMENT,
    `name` varchar(100) NOT NULL,
    `category` varchar(100) NOT NULL,
    `date` date NOT NULL,
    `city`varchar(100) NOT NULL,
    `venue` varchar(100) NOT NULL,
    `image_path` varchar(300) NOT NULL,
    PRIMARY KEY(`id`)
);

CREATE TABLE `tickets`(
    `code` bigint NOT NULL,
    `event` bigint NOT NULL,
    `type` varchar(100),
    `price` FLOAT(10,2) NOT NULL,
    `seller` varchar(100) NOT NULL,
    PRIMARY KEY(`code`, `event`),
    FOREIGN KEY(`seller`) REFERENCES `users`(`alias`),
    FOREIGN KEY(`event`) REFERENCES `events`(`id`)
);

INSERT INTO events (`name`, `category`, `date`, `city`, `venue`, `image_path`)
VALUES ('Cut Cupy', 'indie dance', '2024-01-22', 'Madrid', 'La Riviera', 'images/CUT-COPY2.png'),
('Dub Inc Tour 2022', 'reggae', '2021-05-03', 'Madrid', 'Sala Sol', 'images/DUB-INC-TOUR.jpg'),
('Kodaline', 'folk', '2022-03-15', 'Sevilla', 'Tablao el gitanillo', 'images/Kodaline.png');

INSERT INTO users (`name`,`alias`,`password`,`address`,`phone_number`, `admin_status`)
VALUES ('pepe', 'pepe', 'password', '17 Calle', '628791051', TRUE),
('pepe2', 'pepe2', 'password', '0 Calle', '628791052', FALSE),
('elisa', 'elisacool', 'contraseña', '3 Calle', '628791053', FALSE);

INSERT INTO tickets (`code`,`event`,`type`,`price`,`seller`)
VALUES ('1234', '1', 'palco', '17.5', 'pepe'),
('666666', '3', 'silla', '20', 'elisacool'),
('666666', '1', 'anfiteatro', '12', 'pepe2'),
('222222', '2', 'palco 3', '21.47', 'elisacool'),
('444666', '3', 'plató', '5', 'pepe'),
('111111', '2', 'palco 2', '40.99', 'elisacool');
</code>```

Console Error

```<code>2022-12-06 15:52:46.186  WARN 9656 --- [io-10303-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 1048, SQLState: 23000
2022-12-06 15:52:46.186 ERROR 9656 --- [io-10303-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : Column 'seller' cannot be null
2022-12-06 15:52:46.186  INFO 9656 --- [io-10303-exec-2] o.h.e.j.b.internal.AbstractBatchImpl     : HHH000010: On release of batch it still contained JDBC statements
2022-12-06 15:52:46.199 ERROR 9656 --- [io-10303-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement] with root cause

java.sql.SQLIntegrityConstraintViolationException: Column 'seller' cannot be null
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:117) ~[mysql-connector-j-8.0.31.jar:8.0.31]
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-j-8.0.31.jar:8.0.31]
    at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) ~[mysql-connector-j-8.0.31.jar:8.0.31]

.
.
.
</code>```

Body:
I want to add a new Ticket to my SQL Database.
Ticket has 2 PK: event and code;

I created Entitys with Composite Keys and want to execute POST requests. I always get "Column 'seller' cannot be null". Anyone here knows how to work with Java Persistence and so on?

I tried it with IdClass and Embeddable but I get errors for both. It's just the inserting of a new Object in the Database. GET Requests work fine...
I tried different annotations but for now nothing worked. I probably don't really understand the concept of Java Persistence, but I also dont have to time to go trough it the whole way. So of it's obvious, please explain a little what it does... Thanks in advance!

My Entities:

Event.java

@Entity
@Table(name="events")
@NamedQuery(name="Event.findAll", query="SELECT e FROM Event e")
public class Event implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private long id;

    private String category;

    private String city;

    @Temporal(TemporalType.DATE)
    private Date date;

    @Column(name="image_path")
    private String imagePath;

    private String name;

    private String venue;

    //bi-directional one-to-many association to Ticket
    @OneToMany(mappedBy="eventBean")
    @JsonManagedReference(value="eventBean")
    private List<Ticket> tickets;

    public Event() {
    }

Ticket.java

@Entity
@Table(name="tickets")
@IdClass(TicketPK.class)
//@NamedQuery(name="Ticket.findAll", query="SELECT t FROM Ticket t")
public class Ticket implements Serializable{
    private static final long serialVersionUID = 1L;

    @Id
    private long code;

    @Id
    private long event;

    private float price;

    private String type;

    //@Column(insertable=false, updatable=false)
    //private long event;

    //bi-directional many-to-one association to Event
    //One Event can have many tickets
    @ManyToOne(fetch = FetchType.EAGER)
    @JsonBackReference(value="eventBean")
    @JoinColumn(name="event",nullable = false,insertable=false,updatable=false)
    private Event eventBean;

    //bi-directional many-to-one association to User
    //One User can have many tickets
    @ManyToOne(fetch = FetchType.LAZY)
    @JsonBackReference(value="seller")
    @JoinColumn(name="seller", referencedColumnName = "alias")
    private User user;

    public Ticket() {
    }

    public Ticket(long event, float price, Event eventBean, User user) {
        this.event = event;
        this.price = price;
        this.eventBean = eventBean;
        this.user = user;
    }

   //getters and setters

public class TicketPK implements Serializable {
    //default serial version id, required for serializable classes.
    private static final long serialVersionUID = 1L;

    //@Basic
    //@GeneratedValue(strategy = GenerationType.AUTO)
    //@Column(name="code", nullable=false)
    private long code;

    //@Basic
    //@Column(name="event",insertable=false)
    private long event;

    public TicketPK() {
    }

    public TicketPK(long code, long event) {
        this.code = code;
        this.event = event;
    }

//getters and setters

    public boolean equals(Object other) {
        if (this.equals(other)) {
            return true;
        }
        if (!(other instanceof TicketPK)) {
            return false;
        }
        TicketPK castOther = (TicketPK)other;
        return
            (this.code == castOther.code)
            && (this.event == castOther.event);
    }

    public int hashCode() {
        final int prime = 31;
        int hash = 17;
        hash = hash * prime + ((int) (this.code ^ (this.code >>> 32)));
        hash = hash * prime + ((int) (this.event ^ (this.event >>> 32)));

        return hash;
    }

}

User.java

@Entity
@Table(name="users")
@NamedQuery(name="User.findAll", query="SELECT u FROM User u")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private String alias;

    private String address;

    @Column(name="admin_status")
    private byte adminStatus;

    private String name;

    private String password;

    @Column(name="phone_number")
    private int phoneNumber;

    //bi-directional one-to-many association to Ticket
    //One User can have many Tickets
    @OneToMany(mappedBy="user")
    @JsonManagedReference(value="seller")
    private List<Ticket> tickets;

    public User() {
    }

DAO

TicketDAO

public interface TicketDAO extends CrudRepository<Ticket, TicketPK>{

    public List<Ticket> findAll();
}

Controller

@Controller
@CrossOrigin
public class MyController {

    @Autowired
    TicketDAO daoticket;

    /****************** OPERATIONS ON Tickets ************************************/

    @RequestMapping(value="/tickets", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Ticket> createTicket(@RequestBody Ticket ticket) {

        ResponseEntity<Ticket> response;

        Ticket newTicket = daoticket.save(ticket);
        if (newTicket == null) {
            response = new ResponseEntity<>(HttpStatus.NOT_MODIFIED);
        } else {
            response = new ResponseEntity<>(newTicket, HttpStatus.CREATED);
        }
        return response;
    }
}

SQL Database

CREATE DATABASE IF NOT EXISTS `BD89_03_ticketsell`;
USE `BD89_03_ticketsell`;

DROP TABLE IF EXISTS `TICKETS`;
DROP TABLE IF EXISTS `EVENTS`;
DROP TABLE IF EXISTS `USERS`;

CREATE TABLE `users` (
    `name` varchar(100),
    `alias` varchar(100) NOT NULL UNIQUE,
    `password` varchar(100) NOT NULL,
    `address` varchar(100),
    `phone_number` int(10),
    `admin_status` boolean NOT NULL,
    PRIMARY KEY(`alias`)
);

CREATE TABLE `events`(
    `id` bigint NOT NULL UNIQUE AUTO_INCREMENT,
    `name` varchar(100) NOT NULL,
    `category` varchar(100) NOT NULL,
    `date` date NOT NULL,
    `city`varchar(100) NOT NULL,
    `venue` varchar(100) NOT NULL,
    `image_path` varchar(300) NOT NULL,
    PRIMARY KEY(`id`)
);

CREATE TABLE `tickets`(
    `code` bigint NOT NULL,
    `event` bigint NOT NULL,
    `type` varchar(100),
    `price` FLOAT(10,2) NOT NULL,
    `seller` varchar(100) NOT NULL,
    PRIMARY KEY(`code`, `event`),
    FOREIGN KEY(`seller`) REFERENCES `users`(`alias`),
    FOREIGN KEY(`event`) REFERENCES `events`(`id`)
);

INSERT INTO events (`name`, `category`, `date`, `city`, `venue`, `image_path`)
VALUES ('Cut Cupy', 'indie dance', '2024-01-22', 'Madrid', 'La Riviera', 'images/CUT-COPY2.png'),
('Dub Inc Tour 2022', 'reggae', '2021-05-03', 'Madrid', 'Sala Sol', 'images/DUB-INC-TOUR.jpg'),
('Kodaline', 'folk', '2022-03-15', 'Sevilla', 'Tablao el gitanillo', 'images/Kodaline.png');

INSERT INTO users (`name`,`alias`,`password`,`address`,`phone_number`, `admin_status`)
VALUES ('pepe', 'pepe', 'password', '17 Calle', '628791051', TRUE),
('pepe2', 'pepe2', 'password', '0 Calle', '628791052', FALSE),
('elisa', 'elisacool', 'contraseña', '3 Calle', '628791053', FALSE);

INSERT INTO tickets (`code`,`event`,`type`,`price`,`seller`)
VALUES ('1234', '1', 'palco', '17.5', 'pepe'),
('666666', '3', 'silla', '20', 'elisacool'),
('666666', '1', 'anfiteatro', '12', 'pepe2'),
('222222', '2', 'palco 3', '21.47', 'elisacool'),
('444666', '3', 'plató', '5', 'pepe'),
('111111', '2', 'palco 2', '40.99', 'elisacool');

Console Error

2022-12-06 15:52:46.186  WARN 9656 --- [io-10303-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 1048, SQLState: 23000
2022-12-06 15:52:46.186 ERROR 9656 --- [io-10303-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : Column 'seller' cannot be null
2022-12-06 15:52:46.186  INFO 9656 --- [io-10303-exec-2] o.h.e.j.b.internal.AbstractBatchImpl     : HHH000010: On release of batch it still contained JDBC statements
2022-12-06 15:52:46.199 ERROR 9656 --- [io-10303-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement] with root cause

java.sql.SQLIntegrityConstraintViolationException: Column 'seller' cannot be null
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:117) ~[mysql-connector-j-8.0.31.jar:8.0.31]
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-j-8.0.31.jar:8.0.31]
    at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) ~[mysql-connector-j-8.0.31.jar:8.0.31]

.
.
.


来源: stackexchange

问:
How can I efficiently process many slices of a dataframe in Polars?
I have a dataset of time series data similar to the following:

    let series_one = Series::new(
        "a",
        (0..4).into_iter().map(|v| v as f64).collect::<Vec<_>>(),
    );
    let series_two = Series::new(
        "b",
        (4..8).into_iter().map(|v| v as f64).collect::<Vec<_>>(),
    );
    let series_three = Series::new(
        "c",
        (8..12).into_iter().map(|v| v as f64).collect::<Vec<_>>(),
    );

    let series_dates = Series::new(
        "date",
        (0..4)
            .into_iter()
            .map(|v| NaiveDate::default() + Duration::days(2 * v))
            .collect::<Vec<_>>(),
    );
    let df = DataFrame::new(vec![series_one, series_two, series_three, series_dates]).unwrap();
```
<p>Which has the following shape:</p>
```shape: (4, 4)
┌─────┬─────┬──────┬────────────┐
│ a   ┆ b   ┆ c    ┆ date       │
│ --- ┆ --- ┆ ---  ┆ ---        │
│ f64 ┆ f64 ┆ f64  ┆ date       │
╞═════╪═════╪══════╪════════════╡
│ 0.0 ┆ 4.0 ┆ 8.0  ┆ 1970-01-01 │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 1.0 ┆ 5.0 ┆ 9.0  ┆ 1970-01-02 │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 2.0 ┆ 6.0 ┆ 10.0 ┆ 1970-01-03 │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 3.0 ┆ 7.0 ┆ 11.0 ┆ 1970-01-04 │
└─────┴─────┴──────┴────────────┘

```
<p>I would like to apply some function which operates on a slice of the dataframe that contains all previous rows for every row in the dataframe.</p>
<p>If I have some function <code>some_fn</code>:</p>
<pre class="lang-rust prettyprint-override"><code>fn some_fn(_df: DataFrame) -> DataFrame {
    // Do some operation with the dataframe slice that doesn't need to mutate any data and returns a
    // new dataframe with some results
    DataFrame::new(vec![
        Series::new("a_result", vec![1.0, 2.0, 3.0, 4.0]),
        Series::new("b_result", vec![5.0, 6.0, 7.0, 8.0]),
        Series::new("c_result", vec![9.0, 10.0, 11.0, 12.0]),
    ])
    .unwrap()
}
</code>```

and I attempt to do the following:

    let size = df.column("a").unwrap().len();
    let results = (0..size)
        .into_iter()
        .map(|i| {
            let t = df.head((i + 1).into());
            some_fn(t)
        })
        .reduce(|acc, b| acc.vstack(&b).unwrap())
        .unwrap();
```

I find that it is exceedingly slow, taking about 1ms to process just 3000 rows this way (this is just benchmarking an empty function, so the time here is not due to some heavy computation, just the slicing time).  What is the right way to take full advantage of polars and do this processing efficiently?

ContentLicense: CC BY-SA 4.0

Body:
I have a dataset of time series data similar to the following:

    let series_one = Series::new(
        "a",
        (0..4).into_iter().map(|v| v as f64).collect::<Vec<_>>(),
    );
    let series_two = Series::new(
        "b",
        (4..8).into_iter().map(|v| v as f64).collect::<Vec<_>>(),
    );
    let series_three = Series::new(
        "c",
        (8..12).into_iter().map(|v| v as f64).collect::<Vec<_>>(),
    );

    let series_dates = Series::new(
        "date",
        (0..4)
            .into_iter()
            .map(|v| NaiveDate::default() + Duration::days(2 * v))
            .collect::<Vec<_>>(),
    );
    let df = DataFrame::new(vec![series_one, series_two, series_three, series_dates]).unwrap();

Which has the following shape:

shape: (4, 4)
┌─────┬─────┬──────┬────────────┐
│ a   ┆ b   ┆ c    ┆ date       │
│ --- ┆ --- ┆ ---  ┆ ---        │
│ f64 ┆ f64 ┆ f64  ┆ date       │
╞═════╪═════╪══════╪════════════╡
│ 0.0 ┆ 4.0 ┆ 8.0  ┆ 1970-01-01 │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 1.0 ┆ 5.0 ┆ 9.0  ┆ 1970-01-02 │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 2.0 ┆ 6.0 ┆ 10.0 ┆ 1970-01-03 │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 3.0 ┆ 7.0 ┆ 11.0 ┆ 1970-01-04 │
└─────┴─────┴──────┴────────────┘

I would like to apply some function which operates on a slice of the dataframe that contains all previous rows for every row in the dataframe.

If I have some function some_fn:

fn some_fn(_df: DataFrame) -> DataFrame {
    // Do some operation with the dataframe slice that doesn't need to mutate any data and returns a
    // new dataframe with some results
    DataFrame::new(vec![
        Series::new("a_result", vec![1.0, 2.0, 3.0, 4.0]),
        Series::new("b_result", vec![5.0, 6.0, 7.0, 8.0]),
        Series::new("c_result", vec![9.0, 10.0, 11.0, 12.0]),
    ])
    .unwrap()
}

and I attempt to do the following:

    let size = df.column("a").unwrap().len();
    let results = (0..size)
        .into_iter()
        .map(|i| {
            let t = df.head((i + 1).into());
            some_fn(t)
        })
        .reduce(|acc, b| acc.vstack(&b).unwrap())
        .unwrap();

I find that it is exceedingly slow, taking about 1ms to process just 3000 rows this way (this is just benchmarking an empty function, so the time here is not due to some heavy computation, just the slicing time).  What is the right way to take full advantage of polars and do this processing efficiently?


问:
Add a column that is numeric and corresponds to an existing string column
I have this DF:

```<code>df = pd.DataFrame({"A":[1,2,3,4,5], "B":[100,200,300,400,500], "C":["Cat", "Dog","Cat","Cat","Dog"]})
</code>```

I need a new column that is an integer value corresponding to the values in column "C". It would be 1,2,1,1,2.

```<code>    A   B       C       D
0   1   100     Cat     1
1   2   200     Dog     2
2   3   300     Cat     1
3   4   400     Cat     1
4   5   500     Dog     2
</code>```

Body:
I have this DF:

df = pd.DataFrame({"A":[1,2,3,4,5], "B":[100,200,300,400,500], "C":["Cat", "Dog","Cat","Cat","Dog"]})

I need a new column that is an integer value corresponding to the values in column "C". It would be 1,2,1,1,2.

    A   B       C       D
0   1   100     Cat     1
1   2   200     Dog     2
2   3   300     Cat     1
3   4   400     Cat     1
4   5   500     Dog     2


问:
Odd syntax for setting an object's property in JavaScript
What is happening in the code on line 10 ({[last]: newObj}) in the following snippet:
How is JS able to use the value of parameter last instead of using last as the property name?

```<code>let first = 'first';
let last = 'last';

function foo(first, last) {
  let newObj = {
    name: 'newObj'
  };
  let obj = {};

  Object.assign(obj, {[last]: newObj});

  return obj;
}

console.log(foo('bye', 'hey'));  // { hey: { name: 'newObj' } }
</code>```

Thanks.

Body:
What is happening in the code on line 10 ({[last]: newObj}) in the following snippet:
How is JS able to use the value of parameter last instead of using last as the property name?

let first = 'first';
let last = 'last';

function foo(first, last) {
  let newObj = {
    name: 'newObj'
  };
  let obj = {};

  Object.assign(obj, {[last]: newObj});

  return obj;
}

console.log(foo('bye', 'hey'));  // { hey: { name: 'newObj' } }

Thanks.


问:
Is it possible to access key-value pair from secret manager file?
I have a secret manager file in GCP which stores different secrets like db_username,db_password,gcp_project_id etc. The secret file would look something like this

```<code>db_username=admin
db_password=admin
gcp_project_id= my-project-2345
</code>```

Is it possible to create a single secret with name dev-secret and then access individual key value pair like dev-secret.db_username ? I want to have one secret file and it will have multiple config and then access this using CloudRun secrets which will be accessed as an environment variable

Body:
I have a secret manager file in GCP which stores different secrets like db_username,db_password,gcp_project_id etc. The secret file would look something like this

db_username=admin
db_password=admin
gcp_project_id= my-project-2345

Is it possible to create a single secret with name dev-secret and then access individual key value pair like dev-secret.db_username ? I want to have one secret file and it will have multiple config and then access this using CloudRun secrets which will be accessed as an environment variable


问:
Connect Dropbox with react-native
I have react-native app for mobile and web.
I have Dropbox section that I need to connect with backend. On toggle button I need to show Dropbox modal to signIn.

```<code><View style={{ paddingHorizontal: 15 }}>
        <AccordionComponent label="DropBox" type="toggle" content={<></>} />
      </View>
</code>```

I've tried to use this but it's show me error and I think it's only for mobile
https://docs.expo.dev/guides/authentication/#dropbox

Also I found this
https://github.com/FormidableLabs/react-native-app-auth/blob/main/docs/config-examples/dropbox.md#note-about-client-secrets
but don't know how to use it.

thank u

Title: Connect Dropbox with react-native

Body:
I have react-native app for mobile and web.
I have Dropbox section that I need to connect with backend. On toggle button I need to show Dropbox modal to signIn.

<View style={{ paddingHorizontal: 15 }}>
        <AccordionComponent label="DropBox" type="toggle" content={<></>} />
      </View>

I've tried to use this but it's show me error and I think it's only for mobile
https://docs.expo.dev/guides/authentication/#dropbox

Also I found this
https://github.com/FormidableLabs/react-native-app-auth/blob/main/docs/config-examples/dropbox.md#note-about-client-secrets
but don't know how to use it.

thank u


问:
How to parse all variables in R?
in python to parse all the variables that have a name ending for example with "_df"
I would use something similar to what I found here. How to do a similar thing in R?
Namely, I have several variables ending with _df and I have to do some actions to these.
Thanks</p>

Title: How to parse all variables in R?


问:
Writing an Excel cell with row=i and column=1
I'm new to Python and using openpyxl.

I've learned how to write and read and exact cell using ws.cell(row=1, column=1).value = something but what I want now is a while cycle where it reads all the values from one column and write in another column a value that I get from a function.
When I try to do so instead of using ws.cell(row=i, column=1).value = something but when I do so I get an error saying that row value must be between 1 and 1048576.

while cell != 'None':
    cell = ws['A' + str(i)].value
    i = i + 1
```

In this case I want to find the first cell that as no value in it, not the first cell that contains "None"

Any suggestion?

Body:
I'm new to Python and using openpyxl.

I've learned how to write and read and exact cell using ws.cell(row=1, column=1).value = something but what I want now is a while cycle where it reads all the values from one column and write in another column a value that I get from a function.
When I try to do so instead of using ws.cell(row=i, column=1).value = something but when I do so I get an error saying that row value must be between 1 and 1048576.

while cell != 'None':
    cell = ws['A' + str(i)].value
    i = i + 1

In this case I want to find the first cell that as no value in it, not the first cell that contains "None"

Any suggestion?


问:
There is a error coming while we download punkt(nltk.download('punkt') in nltk that is connection timed out
There is a error coming while we download punkt(nltk.download('punkt') in nltk that is connection timed out party didn't responded.

Do tell the solution

Expecting to get nltk downloader window trying in windows python interactive mode in administrative mode


问:
StoreKit 2 Sandbox user subscriptions wrong productID issue
Strange behavior was found for subscription upgrades/downgrades for Sandbox users.

Step 1: Select from the internal app UI productId.

Step 2: Get the product from StoreKit by Product.products(for: [productID])

Step 3: Purchase fetched product: product.purchase(options: [options])

Step 4: Analyze the received Product.PurchaseResult.

And what we have here:
Works perfectly on the first try. The correct and successful transaction was received.
But when tried to change the subscription, using the same flow,  in Step 4 received a successful transaction with a different productID. Usually the previous subscription productID.

Can't get how it can be. Request purchase with one productID, but receive successful result with another.

Any ideas of what is going on would be appreciated.


问:
Access two different S3 buckets with two different credentials in Spark
I have a scenario where I read data from S3 Bucket from Account 1. This works as expected as I use TemporaryAWSCredentialsProvider. I have another S3 bucket in AWS Account 2 which is where I am running Spark (Spark on EKS). How to configure credentials for Spark to access or write event logs to S3 bucket in Account 2? I was using InstanceProfileCredentialsProvider since credentials for both the buckets are different and the IAM role is configured to allow the EKS instances/pods to have access to the bucket in this account, which seems to not work as expected and I think this is because I have both InstanceProfileCredentialsProvider and TemporaryAWSCredentialsProvider in the same SparkConf which might not be allowed. Is there a way to achieve this?


问:
PNG metadata 0 dpi
Our printers are looking at the dpi of some of our formatted png files for the purposes of digital garment printing. The files show 300 dpi in Photoshop, but when the same png file is opened in ImageMagick the metadata shows 0 dpi even though the image is clearly present. What could cause this?

My team has no idea where to even start with correcting this problem because it seems to have just started out of nowhere.

Title: PNG metadata 0 dpi


问:
How to maintain the same socket connection on two different pages?
I am creating a page to play a card game, this is for several players who can connect to different rooms. I am having problems in the lobby, where you can see which players are connected to a room. It happens that using the sockets I call the io() function in a section, this connection that is generated is used to connect the client to a room when requested, as I need to use the connection (socket) in another section, I import it with javascript, but this makes me call the io() function again and create a new connection and this is not connected to the room that I had already specified.

This is my code of one of the client parts:

```<code>const socket = io();

$("#createParty").click(() => {
  const code = newCode();
  socket.emit("client: newParty", {userName: sessionStorage.getItem("userName"), code: code});
  window.location.href = "/room";
});

$("#connectParty").click(() => {
  const codeConnect = $("#txt-codeConnect").val();
  socket.emit("client: tryConnectParty", {userName: sessionStorage.getItem("userName"), codeConnect: codeConnect});
  window.location.href = "/room";
});

export default socket;
</code>```

There are two buttons, one that creates the room or party and another one that connects you to one of them, both emit different events to the server.

Here is my server side code:

```<code>// Import for server...
import { Server as WebSocketServer } from "socket.io";
import http from "http";
import app from "./app.js";

const server = http.createServer(app);
const io = new WebSocketServer(server);

var rooms = [];
export var usersRoom = [];

// Events socket...
io.on("connection", (socket) => {
  console.log("New conection:", socket.id);

  socket.on("client: newParty", (data) => { // data = {userName, code}
    const code = data.code;

    socket.join("room-"+ code);
    rooms.push(
      {
        room: code,
        users: [
          data.userName
        ]
      }
    );
  });

  socket.on("client: tryConnectParty", (data) => { // data = {userName, codeConnect}
    const code = data.codeConnect;
    for (let i = 0; i < rooms.length; i++) {
      if (rooms[i].room == code) {
        const userName = data.userName;
        const room = "room-"+ code;
        socket.join(room);
        rooms[i].users.push(userName);
        usersRoom = rooms[i].users;
        socket.to(room).emit("server: newConnection", userName);
      }
    }
  });
});

export default server;
</code>```

I use a variable called rooms, that is composed by the existing rooms and the users connected in it, this is so that the new player that connects can see all the players already connected, the problem is for the players that were already connected at the moment that a new one enters.

As you can see the server receives the two different events, in the event "tryConnectParty" the server checks if the code of the room is in the rooms variable, when it finds it, it emits an event to that room.

This is my code from another part of the client:

```<code>import socket from "/main.js";

const userName = sessionStorage.getItem("userName");
$("#txt-userName").html(`<b class='text-white'>${userName}</b>`);
$("#txt-codeRoom").html(`<b>${sessionStorage.getItem("code")}</b>`);

var divPlayers = $("#players");

socket.on("server: newConnection", (userName) => {
  divPlayers.append(createCard(userName));
});

function createCard(user) {
  return `
      <div class="card d-inline-flex text-center" style="width: 300px;">
          <div class="card-body">
          <span class="h1 text-dark">${user}</span>
          </div>
          <img class="card-img-bottom" src="img/avatar.png" alt="avatar">
      </div>
    `;
}
</code>```

This javascript code is called by a html one:

```<code><script src="/logic/players.js" type="module"> </script>
</code>```

This is the "room" section, here you can receive the "newConnection" event that creates a card with the name of the new user so that the user can see the new player.

The event "newConnection" never arrives or is received. I was checking several times the code and it was when I realized that when the "socket" is imported is when the io() function is called again and the connection is lost, as this is a new connection and the event is only sent to those who are in the room.

I want to know if there is a better way to do it or how I could solve this, since I can't move forward without this.

Body:
I am creating a page to play a card game, this is for several players who can connect to different rooms. I am having problems in the lobby, where you can see which players are connected to a room. It happens that using the sockets I call the io() function in a section, this connection that is generated is used to connect the client to a room when requested, as I need to use the connection (socket) in another section, I import it with javascript, but this makes me call the io() function again and create a new connection and this is not connected to the room that I had already specified.

This is my code of one of the client parts:

const socket = io();

$("#createParty").click(() => {
  const code = newCode();
  socket.emit("client: newParty", {userName: sessionStorage.getItem("userName"), code: code});
  window.location.href = "/room";
});

$("#connectParty").click(() => {
  const codeConnect = $("#txt-codeConnect").val();
  socket.emit("client: tryConnectParty", {userName: sessionStorage.getItem("userName"), codeConnect: codeConnect});
  window.location.href = "/room";
});

export default socket;

There are two buttons, one that creates the room or party and another one that connects you to one of them, both emit different events to the server.

Here is my server side code:

// Import for server...
import { Server as WebSocketServer } from "socket.io";
import http from "http";
import app from "./app.js";

const server = http.createServer(app);
const io = new WebSocketServer(server);

var rooms = [];
export var usersRoom = [];

// Events socket...
io.on("connection", (socket) => {
  console.log("New conection:", socket.id);

  socket.on("client: newParty", (data) => { // data = {userName, code}
    const code = data.code;

    socket.join("room-"+ code);
    rooms.push(
      {
        room: code,
        users: [
          data.userName
        ]
      }
    );
  });

  socket.on("client: tryConnectParty", (data) => { // data = {userName, codeConnect}
    const code = data.codeConnect;
    for (let i = 0; i < rooms.length; i++) {
      if (rooms[i].room == code) {
        const userName = data.userName;
        const room = "room-"+ code;
        socket.join(room);
        rooms[i].users.push(userName);
        usersRoom = rooms[i].users;
        socket.to(room).emit("server: newConnection", userName);
      }
    }
  });
});

export default server;

I use a variable called rooms, that is composed by the existing rooms and the users connected in it, this is so that the new player that connects can see all the players already connected, the problem is for the players that were already connected at the moment that a new one enters.

As you can see the server receives the two different events, in the event "tryConnectParty" the server checks if the code of the room is in the rooms variable, when it finds it, it emits an event to that room.

This is my code from another part of the client:

import socket from "/main.js";

const userName = sessionStorage.getItem("userName");
$("#txt-userName").html(`<b class='text-white'>${userName}</b>`);
$("#txt-codeRoom").html(`<b>${sessionStorage.getItem("code")}</b>`);

var divPlayers = $("#players");

socket.on("server: newConnection", (userName) => {
  divPlayers.append(createCard(userName));
});

function createCard(user) {
  return `

          ${user}

    `;
}

This javascript code is called by a html one:

This is the "room" section, here you can receive the "newConnection" event that creates a card with the name of the new user so that the user can see the new player.

The event "newConnection" never arrives or is received. I was checking several times the code and it was when I realized that when the "socket" is imported is when the io() function is called again and the connection is lost, as this is a new connection and the event is only sent to those who are in the room.

I want to know if there is a better way to do it or how I could solve this, since I can't move forward without this.


问:
Running setup.py install for lxml did not run successfully
When installing two different pip packages (pandas_datareader & yfinance) the same error occurs:

```<code>C:\Users\Gwyn>py -m pip install yfinance
Collecting yfinance
  Using cached yfinance-0.1.87-py2.py3-none-any.whl (29 kB)
Requirement already satisfied: pandas>=0.24.0 in c:\python\python311\lib\site-packages (from yfinance) (1.5.2)
Requirement already satisfied: numpy>=1.15 in c:\python\python311\lib\site-packages (from yfinance) (1.23.5)
Collecting requests>=2.26
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting multitasking>=0.0.7
  Using cached multitasking-0.0.11-py3-none-any.whl (8.5 kB)
Collecting lxml>=4.5.1
  Using cached lxml-4.9.1.tar.gz (3.4 MB)
  Preparing metadata (setup.py) ... done
Collecting appdirs>=1.4.4
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\python\python311\lib\site-packages (from pandas>=0.24.0->yfinance) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in c:\python\python311\lib\site-packages (from pandas>=0.24.0->yfinance) (2022.6)
Collecting charset-normalizer<3,>=2
  Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\python\python311\lib\site-packages (from requests>=2.26->yfinance) (1.26.13)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.9.24-py3-none-any.whl (161 kB)
Requirement already satisfied: six>=1.5 in c:\python\python311\lib\site-packages (from python-dateutil>=2.8.1->pandas>=0.24.0->yfinance) (1.16.0)
Installing collected packages: multitasking, appdirs, lxml, idna, charset-normalizer, certifi, requests, yfinance
  DEPRECATION: lxml is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for lxml ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lxml did not run successfully.
  │ exit code: 1
  ╰─> [96 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running install
      C:\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\builder.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\cssselect.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\doctestcompare.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\ElementInclude.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\sax.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\_elementpath.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\__init__.py -> build\lib.win-amd64-cpython-311\lxml
      creating build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.py -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\clean.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\defs.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\diff.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\formfill.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\html5parser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\soupparser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\__init__.py -> build\lib.win-amd64-cpython-311\lxml\html
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\config.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      creating build\temp.win-amd64-cpython-311\Release\src\lxml
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc\lxml\includes -IC:\Python\Python311\include -IC:\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcsrc\lxml\etree.c /Fobuild\temp.win-amd64-cpython-311\Release\src\lxml\etree.obj -w
      cl : Command line warning D9025 : overriding '/W3' with '/w'
      etree.c
      C:\Users\Gwyn\AppData\Local\Temp\pip-install-kmrbjeph\lxml_11adbf217f4049398f72a7b7b8500206\src\lxml\includes/etree_defs.h(14): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
      Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      creating Users
      creating Users\Gwyn
      creating Users\Gwyn\AppData
      creating Users\Gwyn\AppData\Local
      creating Users\Gwyn\AppData\Local\Temp
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /TcC:\Users\Gwyn\AppData\Local\Temp\xmlXPathInitynuhlmxr.c /FoUsers\Gwyn\AppData\Local\Temp\xmlXPathInitynuhlmxr.obj
      xmlXPathInitynuhlmxr.c
      C:\Users\Gwyn\AppData\Local\Temp\xmlXPathInitynuhlmxr.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lxml

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
</code>```

I am not sure what to do at this point. I am able to install other pips successfully and it is updated.

I just want to successfully install the pip, I have never had this problem before and my other computer does not have this problem.  I am currently running windows 11 while my other computer is running a past version.

I am not sure what to do at this point. I am able to install other pips successfully and the pip is updated. I am not sure if it is the lxml or wheel or both. Has anyone else experianced this?

Body:
When installing two different pip packages (pandas_datareader & yfinance) the same error occurs:

C:\Users\Gwyn>py -m pip install yfinance
Collecting yfinance
  Using cached yfinance-0.1.87-py2.py3-none-any.whl (29 kB)
Requirement already satisfied: pandas>=0.24.0 in c:\python\python311\lib\site-packages (from yfinance) (1.5.2)
Requirement already satisfied: numpy>=1.15 in c:\python\python311\lib\site-packages (from yfinance) (1.23.5)
Collecting requests>=2.26
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting multitasking>=0.0.7
  Using cached multitasking-0.0.11-py3-none-any.whl (8.5 kB)
Collecting lxml>=4.5.1
  Using cached lxml-4.9.1.tar.gz (3.4 MB)
  Preparing metadata (setup.py) ... done
Collecting appdirs>=1.4.4
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\python\python311\lib\site-packages (from pandas>=0.24.0->yfinance) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in c:\python\python311\lib\site-packages (from pandas>=0.24.0->yfinance) (2022.6)
Collecting charset-normalizer<3,>=2
  Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\python\python311\lib\site-packages (from requests>=2.26->yfinance) (1.26.13)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.9.24-py3-none-any.whl (161 kB)
Requirement already satisfied: six>=1.5 in c:\python\python311\lib\site-packages (from python-dateutil>=2.8.1->pandas>=0.24.0->yfinance) (1.16.0)
Installing collected packages: multitasking, appdirs, lxml, idna, charset-normalizer, certifi, requests, yfinance
  DEPRECATION: lxml is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for lxml ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lxml did not run successfully.
  │ exit code: 1
  ╰─> [96 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running install
      C:\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\builder.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\cssselect.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\doctestcompare.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\ElementInclude.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\sax.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\_elementpath.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\__init__.py -> build\lib.win-amd64-cpython-311\lxml
      creating build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.py -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\clean.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\defs.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\diff.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\formfill.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\html5parser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\soupparser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\__init__.py -> build\lib.win-amd64-cpython-311\lxml\html
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\config.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      creating build\temp.win-amd64-cpython-311\Release\src\lxml
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc\lxml\includes -IC:\Python\Python311\include -IC:\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcsrc\lxml\etree.c /Fobuild\temp.win-amd64-cpython-311\Release\src\lxml\etree.obj -w
      cl : Command line warning D9025 : overriding '/W3' with '/w'
      etree.c
      C:\Users\Gwyn\AppData\Local\Temp\pip-install-kmrbjeph\lxml_11adbf217f4049398f72a7b7b8500206\src\lxml\includes/etree_defs.h(14): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
      Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      creating Users
      creating Users\Gwyn
      creating Users\Gwyn\AppData
      creating Users\Gwyn\AppData\Local
      creating Users\Gwyn\AppData\Local\Temp
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /TcC:\Users\Gwyn\AppData\Local\Temp\xmlXPathInitynuhlmxr.c /FoUsers\Gwyn\AppData\Local\Temp\xmlXPathInitynuhlmxr.obj
      xmlXPathInitynuhlmxr.c
      C:\Users\Gwyn\AppData\Local\Temp\xmlXPathInitynuhlmxr.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lxml

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I am not sure what to do at this point. I am able to install other pips successfully and it is updated.

I just want to successfully install the pip, I have never had this problem before and my other computer does not have this problem.  I am currently running windows 11 while my other computer is running a past version.

I am not sure what to do at this point. I am able to install other pips successfully and the pip is updated. I am not sure if it is the lxml or wheel or both. Has anyone else experianced this?


问:
Jersey Test framework unable to trigger the POST Method
I am trying to build the REST API JSON Media type using jersey also using jersey test framework for Junit testing.

I have create the GET Method and POST method, while doing JUnit test Get method works fine.
but when try to test the post method through JUnit test method POST Actual Method is not trigger.

Note:  when I pass null here target("addresses").request().post(null); I can able to access the actual method. what goes wrong unable to find.

Test Method

```<code>    @Test
    public void testCreateAddressWithoutMandatoryFields() {
    TestPojo addressRequest = new TestPojo();
    addressRequest.setAddressId(333);
    Entity<TestPojo>  entiry = Entity.entity(addressRequest, MediaType.APPLICATION_JSON);
    Response response = target("addresses").request().post(entiry);
    assertEquals("Http Response should be 201 ", Status.CREATED.getStatusCode(), response.getStatus());

}
</code>```

Actual Method

```<code>@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createAddress(@Context TestPojo addressRequest) {
    try {
System.out.println("am i here" );
addressRequest.getAddressId();
    }catch(Exception e) {
        e.printStackTrace();
    }
        return Response.status(200).entity(null).build();
}
</code>```

Body:
I am trying to build the REST API JSON Media type using jersey also using jersey test framework for Junit testing.

I have create the GET Method and POST method, while doing JUnit test Get method works fine.
but when try to test the post method through JUnit test method POST Actual Method is not trigger.

Note:  when I pass null here target("addresses").request().post(null); I can able to access the actual method. what goes wrong unable to find.

Test Method

    @Test
    public void testCreateAddressWithoutMandatoryFields() {
    TestPojo addressRequest = new TestPojo();
    addressRequest.setAddressId(333);
    Entity<TestPojo>  entiry = Entity.entity(addressRequest, MediaType.APPLICATION_JSON);
    Response response = target("addresses").request().post(entiry);
    assertEquals("Http Response should be 201 ", Status.CREATED.getStatusCode(), response.getStatus());

}

Actual Method

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createAddress(@Context TestPojo addressRequest) {
    try {
System.out.println("am i here" );
addressRequest.getAddressId();
    }catch(Exception e) {
        e.printStackTrace();
    }
        return Response.status(200).entity(null).build();
}


问:
How to load a html file containing plotly graph instantly without any visible resize delay (like a picture) using iframe?
Hi I am a beginner and working on a Angular project. I am trying to load an html file (containing plotly graph) via iframe but i notice some delay in the plot to resize.As soon as i click on tab Header 3 i see the plot is small and then it becomes bigger.

app.component.html

```<code><p-tabView>
  <p-tabPanel header="Header 1" style="width: 100%; height: 100%">
    Content 1
  </p-tabPanel>
  <p-tabPanel header="Header 2" style="width: 100%; height: 100%">
    Content 2
  </p-tabPanel>
  <p-tabPanel header="Header 3" style="width: 100%; height: 100%">
    <div style="height: 100%; width: 100%; display: flex; flex-direction: row">
      <div
        style="
          height: 100%;
          width: 100%;
          display: flex;
          flex-direction: column;
          position: relative;
        "
      >
        <iframe style="width: 100%; height: 2000px" [src]="url | safe"></iframe>
      </div>
    </div>
  </p-tabPanel>
</p-tabView>
</code>```

app.component.ts

```<code>import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  title = 'demo_project';
  url?:string;

  ngOnInit(){
    this.url = './assets/plotly_graph.html';
    //this.url = './assets/plotly_graph.png';
  }

}
</code>```

I am using the plot from below link (downloaded as html)
https://plotly.com/python/interactive-html-export/

```<code>package.json
</code>```

{
"name": "demo-project",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^15.0.0",
"@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/forms": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0",
"plotly": "^1.0.6",
"primeflex": "^3.3.0",
"primeicons": "^6.0.1",
"primeng": "^15.0.0-rc.1",
"quill": "^1.3.7",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"web-animations-js": "^2.3.2",
"zone.js": "~0.12.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.2",
"@angular/cli": "~15.0.2",
"@angular/compiler-cli": "^15.0.0",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.5.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.8.2"
}
}

```<code>

I tried using different styles for the div and iframe. I then tried using a png of the plot instead the html.I observed that the png resizes instantaniously. I observed that say if there are multiple tabs and each tab has an embedded html(with plot) , then the resizing is not observed for the tab which is selected at initially.
</code>```

Body:
Hi I am a beginner and working on a Angular project. I am trying to load an html file (containing plotly graph) via iframe but i notice some delay in the plot to resize.As soon as i click on tab Header 3 i see the plot is small and then it becomes bigger.

app.component.html

    Content 1

    Content 2

app.component.ts

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  title = 'demo_project';
  url?:string;

  ngOnInit(){
    this.url = './assets/plotly_graph.html';
    //this.url = './assets/plotly_graph.png';
  }

}

I am using the plot from below link (downloaded as html)
https://plotly.com/python/interactive-html-export/

package.json

{
"name": "demo-project",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^15.0.0",
"@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/forms": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0",
"plotly": "^1.0.6",
"primeflex": "^3.3.0",
"primeicons": "^6.0.1",
"primeng": "^15.0.0-rc.1",
"quill": "^1.3.7",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"web-animations-js": "^2.3.2",
"zone.js": "~0.12.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.2",
"@angular/cli": "~15.0.2",
"@angular/compiler-cli": "^15.0.0",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.5.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.8.2"
}
}

I tried using different styles for the div and iframe. I then tried using a png of the plot instead the html.I observed that the png resizes instantaniously. I observed that say if there are multiple tabs and each tab has an embedded html(with plot) , then the resizing is not observed for the tab which is selected at initially.


问:
Custom fuzzy search
Good afternoon everyone. There is a parser, which the text receives as input, it is necessary to determine the category in this text by keywords before writing to the database. At the moment the algorithm is as follows:

I bring everything to lowercase

I remove the excess with a regular expression ([^a-za-z])

I delete all words that consist of less than 4 characters (category name 4+ characters)

I break the line into words

I remove duplicate words

In the cycle, I go through all the categories and use the Levenshtein (fuzzywuzzy library) algorithm to determine the most suitable one.

There will be about 100 categories, and each category will have 100 keywords.

What tools or algorithms can be used to more effectively solve the problem?

```<code>def detect_category(post):
    tech_categories = ["macbook", "ноутбук", "процессор", "экран", "оперативная память", "видеокарта", "аккумулятор"]

    result = re.sub(r'[^a-zа-я ]+', '', post)

    post_without_small_words = ' '.join([w for w in result.split() if len(w) > 3])

    words = post_without_small_words.split(' ')
    unique_words = sorted(set(words), key=words.index)

    good = []
    for tech_category in tech_categories:
        ratios = process.extract(tech_category, unique_words)

        for ration in ratios:
            if ration[1] > 90:
                # print(ration)
                good.append(ration)

    return good
</code>```

Title: Custom fuzzy search

Body:
Good afternoon everyone. There is a parser, which the text receives as input, it is necessary to determine the category in this text by keywords before writing to the database. At the moment the algorithm is as follows:

I bring everything to lowercase

I remove the excess with a regular expression ([^a-za-z])

I delete all words that consist of less than 4 characters (category name 4+ characters)

I break the line into words

I remove duplicate words

In the cycle, I go through all the categories and use the Levenshtein (fuzzywuzzy library) algorithm to determine the most suitable one.

There will be about 100 categories, and each category will have 100 keywords.

What tools or algorithms can be used to more effectively solve the problem?

def detect_category(post):
    tech_categories = ["macbook", "ноутбук", "процессор", "экран", "оперативная память", "видеокарта", "аккумулятор"]

    result = re.sub(r'[^a-zа-я ]+', '', post)

    post_without_small_words = ' '.join([w for w in result.split() if len(w) > 3])

    words = post_without_small_words.split(' ')
    unique_words = sorted(set(words), key=words.index)

    good = []
    for tech_category in tech_categories:
        ratios = process.extract(tech_category, unique_words)

        for ration in ratios:
            if ration[1] > 90:
                # print(ration)
                good.append(ration)

    return good


问:
Block adult sites ending with number using etc/hosts
I am trying to block/redirect the adult sites to loopback using etc/hosts file in my computer.
like,

```<code>127.0.0.1 www.someadultsite1.com
127.0.0.1 someadultsite1.com
</code>```

But the sites keeps changing the number which is at the end of domain name, for eg. www.someadultsite1.com gets changed to www.someadultsite2.com after few days making it harder to keep chaning the etc/hosts file every now and then.

Is ther a way to block all the same sites ending with anynumber
like www.someadultsite*.com or something?

Body:
I am trying to block/redirect the adult sites to loopback using etc/hosts file in my computer.
like,

127.0.0.1 www.someadultsite1.com
127.0.0.1 someadultsite1.com

But the sites keeps changing the number which is at the end of domain name, for eg. www.someadultsite1.com gets changed to www.someadultsite2.com after few days making it harder to keep chaning the etc/hosts file every now and then.

Is ther a way to block all the same sites ending with anynumber
like www.someadultsite*.com or something?


问:
How to convert CSV to AVRO in python?
How to convert CSV to AVRO in python?

This is a very open-ended question.

I thought initially to get into CSV  Schema.

Trying to use hive locally to convert. But the hive keeps crashing locally.

but is there a simpler way without getting into Schema like a library that takes input and performs the conversion to AVRO to a certain path?

Any other development pattern or idea?

Trying to use hive locally to convert. But the hive keeps crashing locally.

Title: How to convert CSV to AVRO in python?


问:
package extension in python 2.7
Hi I am working with an old version of python 2.7 and the following code has the following packages:

```<code>
from __future__ import division
from extension import Syntax, Template, processcmd
import spssaux, spss, spssdata, operator
</code>```

I have the horrible task of updating this script but just the last two packages I do not find them, another point is when I use the program in spss works partially there are functions that do not run well will be by those packages?

Title: package extension in python 2.7

Body:
Hi I am working with an old version of python 2.7 and the following code has the following packages:

from __future__ import division
from extension import Syntax, Template, processcmd
import spssaux, spss, spssdata, operator

I have the horrible task of updating this script but just the last two packages I do not find them, another point is when I use the program in spss works partially there are functions that do not run well will be by those packages?


问:
How to use insert before and insert after to add new element to table js
I have this homework where I need to add new element to table but i have 2 radios one that says insert at the beginning of the table, and the other is to insert at the end of the table, I already did the add function here i will insert the code and what Im asked to do :
here is the radios i have

here is my add code :

```<code>function Ajouter(){
  var p1=document.getElementById("txt").value;
  //on cree ligne
  var element = document.createElement("tr");
  //on cree les colonnes
  var case1= document.createElement("td");
  case1.innerHTML=p1; //hna chno andiro f td li ajoutinah , p1 andefiniwha lfo9
  element.appendChild(case1); //hna we link colonne b ligne
  //creating d'une autre colonne
  var case2=document.createElement("td");
        element.appendChild(case2);
        case2.innerHTML='<button>Modifier</button> <button>Supprimer</button>';
  //now we need to append tr to table
  var table=document.getElementById("MyTable");
  table.appendChild(element);
 }
</code>```

dont mind the comments they're on my mother language.here are the radios in my code:

```<code><input type="radio" name="test" id="input1"> Au début
<input type="radio" name="test" id="input2"> A la fin
</code>```

I would appreciate any help thank you

Body:
I have this homework where I need to add new element to table but i have 2 radios one that says insert at the beginning of the table, and the other is to insert at the end of the table, I already did the add function here i will insert the code and what Im asked to do :
here is the radios i have

here is my add code :

function Ajouter(){
  var p1=document.getElementById("txt").value;
  //on cree ligne
  var element = document.createElement("tr");
  //on cree les colonnes
  var case1= document.createElement("td");
  case1.innerHTML=p1; //hna chno andiro f td li ajoutinah , p1 andefiniwha lfo9
  element.appendChild(case1); //hna we link colonne b ligne
  //creating d'une autre colonne
  var case2=document.createElement("td");
        element.appendChild(case2);
        case2.innerHTML='<button>Modifier</button> <button>Supprimer</button>';
  //now we need to append tr to table
  var table=document.getElementById("MyTable");
  table.appendChild(element);
 }

dont mind the comments they're on my mother language.here are the radios in my code:

<input type="radio" name="test" id="input1"> Au début
<input type="radio" name="test" id="input2"> A la fin

I would appreciate any help thank you


问:
How to extract the table "as-is" from the document
I am looking to extract number values from an excel table but the numbers are all over the place and the order is not similar to the table one.

My goal is to reach this table.

enter image description here

The data is found here:

Search "Avalon Acton" and the PDF will download.

https://app.quotemedia.com/data/downloadFiling?webmasterId=90423&ref=117043847&type=PDF&symbol=AVB&companyName=AvalonBay+Communities+Inc.&formType=10-Q&formDescription=General+form+for+quarterly+reports+under+Section+13+or+15%28d%29&dateFiled=2022-11-08&CK=915912

I am trying the formula:

=LET(rng, A3:A100, input, FILTER(rng, rng <>""), IFERROR(DROP(REDUCE(0, input,
LAMBDA(acc,text, LET(split, 1*TEXTSPLIT(text," "),
nums, FILTER(split, ISNUMBER(split),""), VSTACK(acc, nums)))),1),"")

And the data is showing like this, not organized at all.

enter image description here

Please Help on this prompt. Thanks!


问:
How can I login with Cypress in a site that uses Google Auth?
I need to login with Cypress to a site that has Google Authenticator as a 2FV. I can enter mail & pass, but after this I need to complete the Authentication passcode shown in the app (Which changes constantly)

Is there any way to do this?

```<code>describe('empty spec', () => {
  it('passes', () => {
    cy.visit('website')
    cy.get('[data-selenium-id="email"]').click()
    cy.get('[name="email"]').type("mail")
    cy.get('[name="password"]').type("Pass")
    cy.get('[data-selenium-id="signInForm.signInButton"]').click()

  })
})
</code>```

After that, the passcode is needed to continue:
(https://i.stack.imgur.com/q9rKD.png)

I am expecting to skip this 2FV in anyway so that I can continue with my test using Cypress

Body:
I need to login with Cypress to a site that has Google Authenticator as a 2FV. I can enter mail & pass, but after this I need to complete the Authentication passcode shown in the app (Which changes constantly)

Is there any way to do this?

describe('empty spec', () => {
  it('passes', () => {
    cy.visit('website')
    cy.get('[data-selenium-id="email"]').click()
    cy.get('[name="email"]').type("mail")
    cy.get('[name="password"]').type("Pass")
    cy.get('[data-selenium-id="signInForm.signInButton"]').click()

  })
})

After that, the passcode is needed to continue:
(https://i.stack.imgur.com/q9rKD.png)

I am expecting to skip this 2FV in anyway so that I can continue with my test using Cypress


问:
Get bean name by the object
I have two bean configurations:

```<code>@Bean("name1")
public RabbitTemplate template1(RabbitProperties properties, ConnectionFactory factory) {
    return rabbitCreateOneTemplate(factory, properties.getTemplate());
}

@Bean("name2")
public RabbitTemplate template2(RabbitProperties properties, ConnectionFactory factory) {
    return rabbitCreateTwoTemplate(factory, properties.getTemplate());
}
</code>```

And inject

```<code>private final RabbitTemplate template;

public Const( @Qualifier("name1") RabbitTemplate template){
    this.template = template
}
</code>```

I want by object template to get it name, how to get it?

I know the is getBeanDefinitionNames() but it will return the names of all beans, but I need to get the bean name of only a specific object. I want to give template  and get "name1", is it possible to do this?

Title: Get bean name by the object

Body:
I have two bean configurations:

@Bean("name1")
public RabbitTemplate template1(RabbitProperties properties, ConnectionFactory factory) {
    return rabbitCreateOneTemplate(factory, properties.getTemplate());
}

@Bean("name2")
public RabbitTemplate template2(RabbitProperties properties, ConnectionFactory factory) {
    return rabbitCreateTwoTemplate(factory, properties.getTemplate());
}

And inject

private final RabbitTemplate template;

public Const( @Qualifier("name1") RabbitTemplate template){
    this.template = template
}

I want by object template to get it name, how to get it?

I know the is getBeanDefinitionNames() but it will return the names of all beans, but I need to get the bean name of only a specific object. I want to give template  and get "name1", is it possible to do this?


问:
Reorder object hierarchy and group by time in JSONata
Although I'm not a total JSONata noob, I'm having a hard time finding an elegant solution to the following desired transformation. The starting point is a set of time-series data in a format like this:

{
  "series1": {
    "data": [
         {"time": "2022-01-01T00:00:00Z", "value": 22},
         {"time": "2022-01-02T00:00:00Z", "value": 23}
    ]
  },
  "series2": {
    "data": [
         {"time": "2022-01-01T00:00:00Z","value": 220},
         {"time": "2022-01-02T00:00:00Z","value": 230}
    ]
  }
}
```
<p>I need to "flip the hierarchy", and group these datapoints by timestamp, into an array of objects, like follows:</p>
<pre class="lang-json prettyprint-override"><code>[
  {
    "time": "2022-01-01T00:00:00Z",
    "series1": 22,
    "series2": 220
  },
  {
    "time": "2022-01-02T00:00:00Z",
    "series1": 23,
    "series2": 230
  }
]
</code>```

I currently have this working with the expression

$each($, function($v, $s) {
  [$v.data.{
    'series': $s,
    'time':$.time,
    'value': $.value
  }]
}).*{
  `time`: {
    `series`: value
  }
}
~> $each(function($v, $t) {
  $merge([
    $v,
    {'time': $t}
  ])
})
```

(playground link: https://try.jsonata.org/8CaggujJk)

...and...I can't help but feel that there must be a better way!

For reference, my current expression basically does this in three consecutive steps:

The first $each() function, which splits up the original object into an array of datapoints, with a series name, timestamp, and value of each.

A grouping operator which makes time a key, and gathers all values for a given timestamp together.

A second $each() function, which transforms the object into an array of objects where time is a value again, rather than a key - and merges the time key-value alongside the series values.

I've seen some wonderfully elegant solutions to similar problems on here, but am not sure how to approach this in a better way. Any tips appreciated!

Body:
Although I'm not a total JSONata noob, I'm having a hard time finding an elegant solution to the following desired transformation. The starting point is a set of time-series data in a format like this:

{
  "series1": {
    "data": [
         {"time": "2022-01-01T00:00:00Z", "value": 22},
         {"time": "2022-01-02T00:00:00Z", "value": 23}
    ]
  },
  "series2": {
    "data": [
         {"time": "2022-01-01T00:00:00Z","value": 220},
         {"time": "2022-01-02T00:00:00Z","value": 230}
    ]
  }
}

I need to "flip the hierarchy", and group these datapoints by timestamp, into an array of objects, like follows:

[
  {
    "time": "2022-01-01T00:00:00Z",
    "series1": 22,
    "series2": 220
  },
  {
    "time": "2022-01-02T00:00:00Z",
    "series1": 23,
    "series2": 230
  }
]

I currently have this working with the expression

$each($, function($v, $s) {
  [$v.data.{
    'series': $s,
    'time':$.time,
    'value': $.value
  }]
}).*{
  `time`: {
    `series`: value
  }
}
~> $each(function($v, $t) {
  $merge([
    $v,
    {'time': $t}
  ])
})

(playground link: https://try.jsonata.org/8CaggujJk)

...and...I can't help but feel that there must be a better way!

For reference, my current expression basically does this in three consecutive steps:

The first $each() function, which splits up the original object into an array of datapoints, with a series name, timestamp, and value of each.

A grouping operator which makes time a key, and gathers all values for a given timestamp together.

A second $each() function, which transforms the object into an array of objects where time is a value again, rather than a key - and merges the time key-value alongside the series values.

I've seen some wonderfully elegant solutions to similar problems on here, but am not sure how to approach this in a better way. Any tips appreciated!


问:
How to require and display images dynamically in React?
I'm facing an issue when I try to display images inside my React App component

I have all the images I need, divided by set, in this path src/cards_images/ inside root folder.
In this way I can reach for cards in different sets like:

src/cards_images/set1_MyFirstSetName_MyCard1.jpg

src/cards_images/set2_MySecondSetName_MyCard1234.jpg

I need to create images dynamically, because on this component I pass an array of objects, with the right source path. If I hard-code the same source path, it works, but if I dynamically try to create the path, React says it can't find the module.

I can't put every image inside Public folder because we are talking about several thousands of 200kb images and it won't load. Neither I can import/require every image in bulk, because it will not work aswell (still, how to filter/show them?). It has to be dynamically required and showed. How can I do it? Am I doing anything wrong on this?

```<code>import React , {Component}from 'react';

function CardDisplay({ sets }) {

return (
    <div id="myDeckCardPickerContainer">
        {sets?.map(settino => {

            // Gives error "Module not found"
             var temp = require(settino.url)
             return <div key={settino.key} className='cardImageContainer'><img className='cardImagePreview' src={temp} alt={settino.Name}></img><div><span className='addCardToDeck'>➕</span>{settino.name}<span className='removeCardFromDeck'>➖</span></div></div>

            // Gives error "Module not found"
             return <div key={settino.key} className='cardImageContainer'><img className='cardImagePreview' src={require(settino.url)} alt={settino.Name}></img><div><span className='addCardToDeck'>➕</span>{settino.name}<span className='removeCardFromDeck'>➖</span></div></div>

            // Works fine
             return <div key={settino.key} className='cardImageContainer'><img className='cardImagePreview' src={require('../cards_images/set1_MyFirstSetName_MyCard1.jpg')} alt={settino.Name}></img><div><span className='addCardToDeck'>➕</span>{settino.name}<span className='removeCardFromDeck'>➖</span></div></div>
        })}
    </div>
  )}

export default CardDisplay;
</code>```

Body:
I'm facing an issue when I try to display images inside my React App component

I have all the images I need, divided by set, in this path src/cards_images/ inside root folder.
In this way I can reach for cards in different sets like:

src/cards_images/set1_MyFirstSetName_MyCard1.jpg

src/cards_images/set2_MySecondSetName_MyCard1234.jpg

I need to create images dynamically, because on this component I pass an array of objects, with the right source path. If I hard-code the same source path, it works, but if I dynamically try to create the path, React says it can't find the module.

I can't put every image inside Public folder because we are talking about several thousands of 200kb images and it won't load. Neither I can import/require every image in bulk, because it will not work aswell (still, how to filter/show them?). It has to be dynamically required and showed. How can I do it? Am I doing anything wrong on this?

import React , {Component}from 'react';

function CardDisplay({ sets }) {

return (

        {sets?.map(settino => {

            // Gives error "Module not found"
             var temp = require(settino.url)
             return

➕{settino.name}➖

            // Gives error "Module not found"
             return

➕{settino.name}➖

            // Works fine
             return

➕{settino.name}➖

        })}

  )}

export default CardDisplay;