问:
React JS Show Proper Modals
I have a registration form where if successful a success modal message pops up and if a error specifically same username or email is used an error modal message pops up. Yet for some reason if registration process is fine (no duplicate username or email) the error message still appears. See code below:</p>
```<code>export default function Register() {

    const [show, setShow] = useState(null)

    const [ error, setError]  = useState(null)

    const [showError, setShowError] = useState(null)

    const handleClose = function () {
        setShow(false)
     }

     const handleSubmit = function () {
        setShowError(false)
     }

      const dataSet = useFormik({
          initialValues: {
               name: '',
               surname: '',
               username: '',
               email: '',
               passcode: '',
               confirm: ''
             },
        })

       const validate = Yup.object().shape({
           name: Yup.string().required('Name is required'),
           surname: Yup.string().required('Surname is required'),
           username: Yup.string().required('A Username is required')
              .min(5, 'Username must be at least 5 characters')
              .max(20, 'Username must not exceed more than 20 characters'),
           email: Yup.string().required('Email is required')
             .email('Email is Invalid'),
           passcode: Yup.string().required('Passcode is required')
              .min(5, 'Passcode at least 5 characters')
    .max(10, 'Passcode must not exceed 20 characters'),
    confirm: Yup.string().required('Confirmation Passcode is required')
    .oneOf([Yup.ref('passcode'), null], 'Confirm Passcode does not match')
})

    return (
             <div className='register-form'>
          <Formik initialValues={{dataSet}} validationSchema={validate} validateOnChange={true}
                onSubmit={ async (values, actions) => {
                     try {
                             await axios.post('/auth/register', values)
                            setShow(true)
                           setShowError(false)
                            actions.setSubmitting(false)
                    actions.resetForm({
                        values:{
                            name: '',
                            surname: '',
                            username: '',
                            email: '',
                            passcode: '',
                            confirm: ''
                        }
                    })
                } catch (error) {
                    setError(error.response.data)
                    if(error) {
                        setShowError(true)
                        setShow(false)
                    }
                }
            }}>
                {({handleSubmit, handleChange,  values, touched, isValid, errors }) => (

                 <Form noValidate onSubmit={handleSubmit} >
                  <h1>Admin Panel Register</h1>
                    <Row>
                        <Form.Group as={Col}  controlId='formGridName' className='position-relative'>
                            <Form.Label>Name</Form.Label>
                            <Form.Control type={'text'}
                                name={'name'}
                                placeholder={'Type Name'}
                                value={values.name}
                                onChange={handleChange}
                                isValid={touched.name}
                                isInvalid={!!errors.name} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.name}</Form.Control.Feedback>
                        </Form.Group>

                        <Form.Group as={Col} controlId='formGridSurname' className='position-relative'>
                            <Form.Label>Surname</Form.Label>
                            <Form.Control type={'text'}
                                name={'surname'}
                                placeholder={'Type Surname'}
                                value={values.surname}
                                onChange={handleChange}
                                isValid={touched.surname}
                                isInvalid={!!errors.surname} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.surname}</Form.Control.Feedback>
                        </Form.Group>
                    </Row>

                    <Row>
                        <Form.Group as={Col} md='6' controlId='formGridEmail' className='position-relative'>
                            <Form.Label>Email</Form.Label>
                            <Form.Control type={'email'}
                                name={'email'}
                                placeholder={'Type Email'}
                                value={values.email}
                                onChange={handleChange}
                                isInvalid={!!errors.email}/>
                            <Form.Control.Feedback type='invalid' tooltip>{errors.email}</Form.Control.Feedback>
                        </Form.Group>

                        <Form.Group controlId='formGridUsername' className='position-relative mb-3'>
                            <Form.Label>Username</Form.Label>
                            <Form.Control type={'text'}
                                name={'username'}
                                placeholder={'Enter Userame'}
                                value={values.username}
                                onChange={handleChange}
                                isInvalid={!!errors.username} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.username}</Form.Control.Feedback>
                        </Form.Group>

                        <Form.Group controlId='formGridPasscode' className='position-relative mb-3'>
                            <Form.Label>Passcode</Form.Label>
                            <Form.Control type={'password'}
                                name={'passcode'}
                                placeholder={'Enter Passcode'}
                                value={values.passcode}
                                onChange={handleChange}
                                isInvalid={!!errors.passcode} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.passcode}</Form.Control.Feedback>
                        </Form.Group>

                        <Form.Group as={Col} controlId='formGridConfirm' className='position-relative mb-3'>
                            <Form.Label>Confirm</Form.Label>
                            <Form.Control type={'password'}
                                name={'confirm'}
                                placeholder={'Confirm Passcode'}
                                value={values.confirm}
                                onChange={handleChange}
                                isInvalid={!!errors.confirm} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.confirm}</Form.Control.Feedback>
                        </Form.Group>
                    </Row>
                    <Form.Group as={Col} controlId='formGridSubmit'>
                            <Button variant={'primary'} type={'submit'} >Submit</Button>
                    </Form.Group>
               </Form>
            )}
            </Formik>

       { error ? (<Modal show={showError} onHide={handleSubmit}>
                <Modal.Header closeButton>
                    <Modal.Title><ErrorOutlineOutlined />{" "}Error</Modal.Title>
                </Modal.Header>
                <Modal.Body>{error && <p>{error}</p>}</Modal.Body>
                <Modal.Footer>
                </Modal.Footer>
                </Modal>):( <Modal show={show} onHide={handleClose}>
                <Modal.Header>
                    <Modal.Title><InfoOutlined />{"  "}Info</Modal.Title>
                </Modal.Header>
                <Modal.Body>Registration Complete</Modal.Body>
                <Modal.Footer>
                    <Button href={'/admin/login'}>Go to Login </Button>
                </Modal.Footer>
            </Modal>)}
           </div>)
         }
</code>```

Title: React JS Show Proper Modals

Body:
I have a registration form where if successful a success modal message pops up and if a error specifically same username or email is used an error modal message pops up. Yet for some reason if registration process is fine (no duplicate username or email) the error message still appears. See code below:

export default function Register() {

    const [show, setShow] = useState(null)

    const [ error, setError]  = useState(null)

    const [showError, setShowError] = useState(null)

    const handleClose = function () {
        setShow(false)
     }

     const handleSubmit = function () {
        setShowError(false)
     }

      const dataSet = useFormik({
          initialValues: {
               name: '',
               surname: '',
               username: '',
               email: '',
               passcode: '',
               confirm: ''
             },
        })

       const validate = Yup.object().shape({
           name: Yup.string().required('Name is required'),
           surname: Yup.string().required('Surname is required'),
           username: Yup.string().required('A Username is required')
              .min(5, 'Username must be at least 5 characters')
              .max(20, 'Username must not exceed more than 20 characters'),
           email: Yup.string().required('Email is required')
             .email('Email is Invalid'),
           passcode: Yup.string().required('Passcode is required')
              .min(5, 'Passcode at least 5 characters')
    .max(10, 'Passcode must not exceed 20 characters'),
    confirm: Yup.string().required('Confirmation Passcode is required')
    .oneOf([Yup.ref('passcode'), null], 'Confirm Passcode does not match')
})

    return (

          <Formik initialValues={{dataSet}} validationSchema={validate} validateOnChange={true}
                onSubmit={ async (values, actions) => {
                     try {
                             await axios.post('/auth/register', values)
                            setShow(true)
                           setShowError(false)
                            actions.setSubmitting(false)
                    actions.resetForm({
                        values:{
                            name: '',
                            surname: '',
                            username: '',
                            email: '',
                            passcode: '',
                            confirm: ''
                        }
                    })
                } catch (error) {
                    setError(error.response.data)
                    if(error) {
                        setShowError(true)
                        setShow(false)
                    }
                }
            }}>
                {({handleSubmit, handleChange,  values, touched, isValid, errors }) => (

                 <Form noValidate onSubmit={handleSubmit} >

Admin Panel Register

                    <Row>
                        <Form.Group as={Col}  controlId='formGridName' className='position-relative'>
                            <Form.Label>Name</Form.Label>
                            <Form.Control type={'text'}
                                name={'name'}
                                placeholder={'Type Name'}
                                value={values.name}
                                onChange={handleChange}
                                isValid={touched.name}
                                isInvalid={!!errors.name} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.name}</Form.Control.Feedback>
                        </Form.Group>

                        <Form.Group as={Col} controlId='formGridSurname' className='position-relative'>
                            <Form.Label>Surname</Form.Label>
                            <Form.Control type={'text'}
                                name={'surname'}
                                placeholder={'Type Surname'}
                                value={values.surname}
                                onChange={handleChange}
                                isValid={touched.surname}
                                isInvalid={!!errors.surname} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.surname}</Form.Control.Feedback>
                        </Form.Group>
                    </Row>

                    <Row>
                        <Form.Group as={Col} md='6' controlId='formGridEmail' className='position-relative'>
                            <Form.Label>Email</Form.Label>
                            <Form.Control type={'email'}
                                name={'email'}
                                placeholder={'Type Email'}
                                value={values.email}
                                onChange={handleChange}
                                isInvalid={!!errors.email}/>
                            <Form.Control.Feedback type='invalid' tooltip>{errors.email}</Form.Control.Feedback>
                        </Form.Group>

                        <Form.Group controlId='formGridUsername' className='position-relative mb-3'>
                            <Form.Label>Username</Form.Label>
                            <Form.Control type={'text'}
                                name={'username'}
                                placeholder={'Enter Userame'}
                                value={values.username}
                                onChange={handleChange}
                                isInvalid={!!errors.username} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.username}</Form.Control.Feedback>
                        </Form.Group>

                        <Form.Group controlId='formGridPasscode' className='position-relative mb-3'>
                            <Form.Label>Passcode</Form.Label>
                            <Form.Control type={'password'}
                                name={'passcode'}
                                placeholder={'Enter Passcode'}
                                value={values.passcode}
                                onChange={handleChange}
                                isInvalid={!!errors.passcode} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.passcode}</Form.Control.Feedback>
                        </Form.Group>

                        <Form.Group as={Col} controlId='formGridConfirm' className='position-relative mb-3'>
                            <Form.Label>Confirm</Form.Label>
                            <Form.Control type={'password'}
                                name={'confirm'}
                                placeholder={'Confirm Passcode'}
                                value={values.confirm}
                                onChange={handleChange}
                                isInvalid={!!errors.confirm} />
                            <Form.Control.Feedback type='invalid' tooltip>{errors.confirm}</Form.Control.Feedback>
                        </Form.Group>
                    </Row>
                    <Form.Group as={Col} controlId='formGridSubmit'>
                            <Button variant={'primary'} type={'submit'} >Submit</Button>
                    </Form.Group>
               </Form>
            )}
            </Formik>

       { error ? (<Modal show={showError} onHide={handleSubmit}>
                <Modal.Header closeButton>
                    <Modal.Title><ErrorOutlineOutlined />{" "}Error</Modal.Title>
                </Modal.Header>
                <Modal.Body>{error &&
{error}
}</Modal.Body>
                <Modal.Footer>
                </Modal.Footer>
                </Modal>):( <Modal show={show} onHide={handleClose}>
                <Modal.Header>
                    <Modal.Title><InfoOutlined />{"  "}Info</Modal.Title>
                </Modal.Header>
                <Modal.Body>Registration Complete</Modal.Body>
                <Modal.Footer>
                    <Button href={'/admin/login'}>Go to Login </Button>
                </Modal.Footer>
            </Modal>)}

)
         }


来源: stackexchange

问:
Compare 2 same named columns in different pandas, get the rows that has same data in Same Named Column
df1:

A
B

1
10

2
20

3
30

4
40

5
50

df2:

A
D

2
D1

4
D2

100
D3

Here is the code to create:

```<code>import pandas as pd
df1 = pd.DataFrame({'A':[1,2,3,4,5],
                    'B':[10,20,30,40,50]})
df2 = pd.DataFrame({'A':[2,4,100],
                    'D':['D1','D2','D3']})
</code>```

What I want to do is, check if df2['A'] has the same data with df1['A']. If it does, then get all the row that data is in. for example. df1['A'] = 2 is also in df2['A']. df2['A'] = 2 has D = D1 and A = 2.(Same applies for A=4)

What I tried:

```<code>traindatalist = [df2[df2['A']==dtA].drop('A',axis=1) for dtA in df1['A']]
</code>```

ContentLicense: CC BY-SA 4.0

Body:
df1:

A
B

1
10

2
20

3
30

4
40

5
50

df2:

A
D

2
D1

4
D2

100
D3

Here is the code to create:

import pandas as pd
df1 = pd.DataFrame({'A':[1,2,3,4,5],
                    'B':[10,20,30,40,50]})
df2 = pd.DataFrame({'A':[2,4,100],
                    'D':['D1','D2','D3']})

What I want to do is, check if df2['A'] has the same data with df1['A']. If it does, then get all the row that data is in. for example. df1['A'] = 2 is also in df2['A']. df2['A'] = 2 has D = D1 and A = 2.(Same applies for A=4)

What I tried:

traindatalist = [df2[df2['A']==dtA].drop('A',axis=1) for dtA in df1['A']]


问:
FIlter using a string
I have the following Query:

from(bucket: "BUCKET") |\> range(start: v.timeRangeStart, stop: v.timeRangeStop) |\> filter(fn: (r) =\> r\["\_measurement"\] == "STK_KG_HK_SystaSmartC_SCH" or r\["\_measurement"\] == "STK_EG_KU_Kuehlschrank_SCH" or r\["\_measurement"\] == "STK_EG_EZ_Aussenwand_links_SCH") |\> filter(fn: (r) =\> r\["\_field"\] == "Stromwert") |\> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false) |\> yield(name: "mean")

I want to optimize that a litte bit.

How can I change the following line, so that I wil get all the objects with -- *_SCH - ?

filter(fn: (r) => r["_measurement"] == "STK_KG_HK_SystaSmartC_SCH" or r["_measurement"] == "STK_EG_KU_Kuehlschrank_SCH" or r["_measurement"] == "STK_EG_EZ_Aussenwand_links_SCH"

Best regrads

Tim

Title: FIlter using a string


问:
vba automate chromedriver control pdf loaded webpage to scrolldown to page6
I would like vba to scroll a pdf-loaded webpage to page5 and do screencapture.

I tried ExecuteScript, not working in this case.

It only works in normal webpages, such as yahoo.com

does anyone know how to scroll the webpage down using chromedriver?? Thanks!!
https://www.spf.com.tw/upload/sinopac/researchContent/184f5b44c0b000007e04.pdf

```<code>Sub screencapture_pdfpages()
        Dim cd As Selenium.ChromeDriver
        Set cd = New Selenium.ChromeDriver
        cd.AddArgument "start-maximized"
        cd.Start
        cd.Wait 1000
        cd.Get "https://www.spf.com.tw/upload/sinopac/researchContent/184f5b44c0b000007e04.pdf"
        cd.Wait "9000"
' not working
        cd.ExecuteScript ("window.scrollTo(0, document.body.scrollHeight);") 'full pagedown not work
        cd.ExecuteScript ("window.scrollTo(0, 510);") 'scroll not work
end sub
</code>```

Body:
I would like vba to scroll a pdf-loaded webpage to page5 and do screencapture.

I tried ExecuteScript, not working in this case.

It only works in normal webpages, such as yahoo.com

does anyone know how to scroll the webpage down using chromedriver?? Thanks!!
https://www.spf.com.tw/upload/sinopac/researchContent/184f5b44c0b000007e04.pdf

Sub screencapture_pdfpages()
        Dim cd As Selenium.ChromeDriver
        Set cd = New Selenium.ChromeDriver
        cd.AddArgument "start-maximized"
        cd.Start
        cd.Wait 1000
        cd.Get "https://www.spf.com.tw/upload/sinopac/researchContent/184f5b44c0b000007e04.pdf"
        cd.Wait "9000"
' not working
        cd.ExecuteScript ("window.scrollTo(0, document.body.scrollHeight);") 'full pagedown not work
        cd.ExecuteScript ("window.scrollTo(0, 510);") 'scroll not work
end sub


问:
How clean architecture project web get reference of core project
I m really curious about to know how you core project class can be called into web project, I see there is no reference project called in Project Reference only showing Infrastructure project?

how it is working? I tried multiple time in other project but still showing me in references


问:
Rails merit-gem cannot score points on confirmations
I tried following the Wiki about the badge grant on confirmation but no luck. Is it supported for points as well? it doesn't explicitly mention in the Wiki.

```<code>[merit] no target found: uninitialized constant Users::Confirmation
Did you mean?  Users::ConfirmationsController.
</code>```

My devise routes:

```<code>  devise_for :users, controllers: {
    sessions: 'sessions',
    omniauth_callbacks: 'users/omniauth_callbacks',
    confirmations: 'users/confirmations',
    passwords: 'passwords'
  }
</code>```

My confirmations controller:

```<code>module Users
  class ConfirmationsController < Devise::ConfirmationsController
    layout 'new_confirmation', only: %i[new create]
    layout 'edit_confirmation', only: %i[edit update]

    def show
      super
      @confirmation = resource # Needed for Merit / Must be AFTER the super
    end
</code>```

My Points rules:

```<code>module Merit
  class PointRules
    include Merit::PointRulesMethods

    def initialize
      score 1_000_000_000, on: 'users/confirmations#show', category: 'account_activity', &:confirmed?
    end
  end
end
</code>```

Body:
I tried following the Wiki about the badge grant on confirmation but no luck. Is it supported for points as well? it doesn't explicitly mention in the Wiki.

[merit] no target found: uninitialized constant Users::Confirmation
Did you mean?  Users::ConfirmationsController.

My devise routes:

  devise_for :users, controllers: {
    sessions: 'sessions',
    omniauth_callbacks: 'users/omniauth_callbacks',
    confirmations: 'users/confirmations',
    passwords: 'passwords'
  }

My confirmations controller:

module Users
  class ConfirmationsController < Devise::ConfirmationsController
    layout 'new_confirmation', only: %i[new create]
    layout 'edit_confirmation', only: %i[edit update]

    def show
      super
      @confirmation = resource # Needed for Merit / Must be AFTER the super
    end

My Points rules:

module Merit
  class PointRules
    include Merit::PointRulesMethods

    def initialize
      score 1_000_000_000, on: 'users/confirmations#show', category: 'account_activity', &:confirmed?
    end
  end
end


问:
MozJPEG vs Browser JPEG for blogs
I'd like to ask about the extension which combines small size and good quality, is it .MozJPEG or Browser .JPEG? Also the one thath has no problem with whatever browser?
Thanks in advance

I am expecting to know the most practical one for a wordpress website

Title: MozJPEG vs Browser JPEG for blogs


问:
name list does not include my class name error
I defined matrix class in matrix.h
and I include it and implement it in matrix.cpp
but in matrix.cpp compiler says that 'matrix' is not a class, namespace, or enumeration. this error is shown in only constructor and private functions implementation.
what's the problem..
*matrix.h

```<code>#ifndef MATRIXH
#define MATRIXH

#include <bits/stdc++.h>

using namespace std;

typedef long long biginteger;

template <typename element_type>
class matrix{
    typedef function<element_type *(matrix &, biginteger, biginteger)> accessor_type;
private:
    biginteger rows,columns;
    element_type *pos;
    accessor_type accessor;
    void allocate_memory();
    void set_basic_accessor();
public:
    // constructors
    matrix();
    matrix(biginteger rows);
    matrix(biginteger rows,biginteger columns);

    matrix(biginteger rows,biginteger columns, element_type x);
    matrix(biginteger rows,biginteger columns, function<element_type(biginteger, biginteger)> f);
    matrix(biginteger rows,biginteger columns, const matrix &m);

    matrix(biginteger rows,biginteger columns, element_type *pos);
    matrix(biginteger rows,biginteger columns, accessor_type accessor);
    matrix(biginteger rows,biginteger columns, element_type *pos, accessor_type accessor);

    // getters
    element_type *get_pos();
    biginteger get_rows();
    biginteger get_columns();
    accessor_type get_accessor();

    //setters
    void set_pos(element_type *pos);
    void set_accessor(accessor_type accessor);

    //operators
    element_type &operator ()(biginteger i, biginteger j);//^element accessor
    matrix operator ()(biginteger idx);//^row accessor
    matrix operator[](biginteger idx);//^column accessor

    matrix operator * (matrix a);
    matrix operator + (matrix a);
    matrix operator - (matrix a);

    //utilities
    void free();

    element_type max_value();
    element_type min_value();

    matrix foreach_calculate (function<element_type(const element_type &, const element_type &)> f, matrix a);
    matrix pass(function<element_type(element_type)> f);
    matrix pass(function<element_type(biginteger,biginteger,element_type)> f);

    matrix t();

    string size_info();
    string info();

    bool check_pos(biginteger i, biginteger j);
    bool check_multipliable(matrix &m);
    bool is_same_size(matrix &m);

    biginteger calculate_relpos(biginteger i, biginteger j);
};
#endif
</code>```

*matrix.cpp

```<code>#include <bits/stdc++.h>
using namespace std;

#include "matrix.h"

// constructors

matrix::matrix() :rows(1), columns(1) {
    allocate_memory();
    set_basic_accessor();
} //error here
matrix::matrix(biginteger rows) : rows(rows),columns(1){
    allocate_memory();
    set_basic_accessor();
} //error here
matrix::matrix(biginteger rows,biginteger columns) : rows(rows),columns(columns){
    allocate_memory();
    set_basic_accessor();
} //error here

matrix::matrix(biginteger rows,biginteger columns, element_type x) : rows(rows),columns(columns){
    allocate_memory();
    set_basic_accessor();
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=rows;j++){
            (*this)(i,j)=x;
        }
    }
} //error here

matrix::matrix(biginteger rows,biginteger columns, const matrix &m) : rows(rows),columns(columns){
    allocate_memory();
    set_basic_accessor();
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=rows;j++){
            (*this)(i,j)=m(i,j);
        }
    }
} //error here

matrix::matrix(biginteger rows,biginteger columns, element_type * pos) : rows(rows),columns(columns), pos(pos) {
    set_basic_accessor();}
matrix::matrix(biginteger rows,biginteger columns, accessor_type accessor) : rows(rows),columns(columns), accessor(accessor){
    allocate_memory();
} //error here
matrix::matrix(biginteger rows,biginteger columns, element_type * pos, accessor_type accessor) : rows(rows),columns(columns), pos(pos), accessor(accessor) {}
matrix::matrix(biginteger rows,biginteger columns, function<element_type(biginteger, biginteger)> f){
    allocate_memory();
    set_basic_accessor();
    for (biginteger i = 1; i <= rows; i++) {
        for (biginteger j = 1; j <= columns; j++) {
            (*this)(i,j) = f(i, j);
        }
    }
} //error here

void matrix::allocate_memory() {
    pos = (element_type *)malloc(sizeof(element_type)*rows*columns);
} //error here

void matrix::set_basic_accessor() {
    accessor = [=](matrix &m, biginteger i,biginteger j) -> element_type* {
        return  m.get_pos()+calculate_relpos(i,j);
    };
} //error here
// getters
element_type matrix::*get_pos() {
    return pos;
}
biginteger matrix::get_rows() {
    return rows;
}
biginteger matrix::get_columns() {
    return columns;
}
accessor_type matrix::get_accessor(){
    return accessor;
}

//setters
void matrix::set_pos(element_type *pos){
    pos=pos;
}
void matrix::set_accessor(accessor_type accessor){
    accessor=accessor;
}

element_type &operator matrix::()(biginteger i, biginteger j){
    if(!check_pos(i,j)){
        throw runtime_error("invalid idx - in element reference");
    }
    return *accessor((*this),i,j);
} //^element accessor
matrix operator matrix::()(biginteger idx){
    if(rows==1){
        return (*this)(1,idx);
    }
    if(columns==1){
        return (*this)(idx,1);
    }
    if(idx<1 or idx>rows){
        throw runtime_error("invalid idx - in row vector refference");
    }
    return matrix(1, columns, pos, [=](matrix &m, biginteger i, biginteger j){
        return pos+calculate_relpos(i,idx);
    });
} //^row accessor
matrix operator matrix::[](biginteger idx) {
    if(rows==1){
        return (*this)(1,idx);
    }
    if(columns==1){
        return (*this)(idx,1);
    }
    if(idx<1 or idx>columns){
        throw runtime_error("in column vector reference");
    }
    return matrix(rows, 1, pos, [=](matrix &m, biginteger i,biginteger j){
        return pos+calculate_relpos(i,idx);
    });
} //^column accessor
matrix operator matrix::* (matrix a) {
    if(!check_multipliable(a)){
        throw runtime_error("in multiply operation, matrix sizes do not match\nfirst matrix:\n"+info()+"second matrix:\n"+a.info());
    }
    matrix<element_type> ret(rows, a.get_columns());
    for (biginteger i = 1; i <= rows; i++) {
        for (biginteger j = 1; j <= a.columns; j++) {
            for (biginteger k = 1; k <= columns; k++) {
                ret(i,j) = ret(i,j) + (*this)(i,k) * a(k,j);
            }
        }
    }
    return ret;
}
matrix operator matrix::+ (matrix a) {
    if(!is_same_size(a)){
        throw runtime_error("in add operation, matrix sizes do not match\nfirst matrix:\n"+info()+"second matrix:\n"+a.info());
    }
    matrix<element_type> ret(rows, columns);
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= columns; j++) {
            ret(i,j) = (*this)(i,j) + a(i,j);
        }
    }
    return ret;
}
matrix operator matrix::- (matrix a) {
    if(!is_same_size(a)){
        throw runtime_error("in sub operation, matrix sizes does not match\nfirst matrix:\n"+info()+"second matrix:\n"+a.info());
    }
    matrix<element_type> ret(rows, columns);
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= columns; j++) {
            ret(i,j) = (*this)(i,j) - a(i,j);
        }
    }
    return ret;
}

//utilities
void matrix::free() {
    free(pos);
    pos = NULL;
}
element_type matrix::max_value() {
    element_type ret = (*this)(1,1);
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=columns;j++){
            if((*this)(i,j)>ret){
                ret=(*this)(i,j);
            }
        }
    }
    return ret;
}
element_type matrix::min_value() {
    element_type ret = (*this)(1,1);
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=columns;j++){
            if((*this)(i,j)<ret){
                ret=(*this)(i,j);
            }
        }
    }
    return ret;
}
matrix matrix::foreach_calculate (function<element_type(const element_type &, const element_type &)> f, matrix a) {
    if (!is_same_size(a)) {
        throw runtime_error("in foreach calculate call, matrix sizes does not match\nfirst matrix:\n"+info()+"second matrix:\n"+a.info());
    }
    matrix ret(rows, columns);
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=columns;j++){
            ret(i,j)=f((*this)(i,j),a(i,j));
        }
    }
    return ret;
}
matrix matrix::pass(function<element_type(element_type)> f) {
    matrix ret(rows, columns);
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= columns; j++) {
            ret(i,j)=f((*this)(i,j));
        }
    }
    return ret;
}
matrix matrix::pass(function<element_type(biginteger,biginteger,element_type)> f) {
    matrix ret(rows, columns);
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= columns; j++) {
            ret(i,j)=f(i,j,(*this)(i,j));
        }
    }
    return ret;
}
string matrix::size_info(){
    return "("+to_string(rows)+"*"+to_string(columns)+") ";
}
string matrix::info() {
    string ret="matrix("+to_string(rows)+"*"+to_string(columns)+")\n(";
    try{
        for (int i = 1; i <= rows; i++) {
            for (int j = 1; j <= columns; j++) {
                ret+=to_string((*this)(i,j)) + " ";
            }
            if(i==rows) ret+=")";
            ret+= "\n";
        }
        return ret;
    }
    catch(exception *e)
    {
        throw runtime_error("cannot covert type "+to_string(*(typeid(element_type).name()))+" to string.");
    }
}
biginteger matrix::calculate_relpos(biginteger i, biginteger j){
    return sizeof(element_type)*((i-1)*columns+(j-1));
}
bool matrix::check_pos(biginteger i, biginteger j){
    return (1<=i && i<=rows) &&(1<=j && j<=columns);
}
bool matrix::check_multipliable(matrix &m){
    return columns==m.rows;
}
bool matrix::is_same_size(matrix &m){
    return rows==m.get_rows() and columns==m.get_columns();
}
matrix matrix::t(){
    matrix<element_type> ret(columns,rows);
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=columns;j++){
            ret(i,j)=(*this)(j,i);
        }
    }
    return ret;
}

</code>```

I don't know why compiler says that matrix class is not defined.

Body:
I defined matrix class in matrix.h
and I include it and implement it in matrix.cpp
but in matrix.cpp compiler says that 'matrix' is not a class, namespace, or enumeration. this error is shown in only constructor and private functions implementation.
what's the problem..
*matrix.h

#ifndef MATRIXH
#define MATRIXH

#include <bits/stdc++.h>

using namespace std;

typedef long long biginteger;

template <typename element_type>
class matrix{
    typedef function<element_type *(matrix &, biginteger, biginteger)> accessor_type;
private:
    biginteger rows,columns;
    element_type *pos;
    accessor_type accessor;
    void allocate_memory();
    void set_basic_accessor();
public:
    // constructors
    matrix();
    matrix(biginteger rows);
    matrix(biginteger rows,biginteger columns);

    matrix(biginteger rows,biginteger columns, element_type x);
    matrix(biginteger rows,biginteger columns, function<element_type(biginteger, biginteger)> f);
    matrix(biginteger rows,biginteger columns, const matrix &m);

    matrix(biginteger rows,biginteger columns, element_type *pos);
    matrix(biginteger rows,biginteger columns, accessor_type accessor);
    matrix(biginteger rows,biginteger columns, element_type *pos, accessor_type accessor);

    // getters
    element_type *get_pos();
    biginteger get_rows();
    biginteger get_columns();
    accessor_type get_accessor();

    //setters
    void set_pos(element_type *pos);
    void set_accessor(accessor_type accessor);

    //operators
    element_type &operator ()(biginteger i, biginteger j);//^element accessor
    matrix operator ()(biginteger idx);//^row accessor
    matrix operator[](biginteger idx);//^column accessor

    matrix operator * (matrix a);
    matrix operator + (matrix a);
    matrix operator - (matrix a);

    //utilities
    void free();

    element_type max_value();
    element_type min_value();

    matrix foreach_calculate (function<element_type(const element_type &, const element_type &)> f, matrix a);
    matrix pass(function<element_type(element_type)> f);
    matrix pass(function<element_type(biginteger,biginteger,element_type)> f);

    matrix t();

    string size_info();
    string info();

    bool check_pos(biginteger i, biginteger j);
    bool check_multipliable(matrix &m);
    bool is_same_size(matrix &m);

    biginteger calculate_relpos(biginteger i, biginteger j);
};
#endif

*matrix.cpp

#include <bits/stdc++.h>
using namespace std;

#include "matrix.h"

// constructors

matrix::matrix() :rows(1), columns(1) {
    allocate_memory();
    set_basic_accessor();
} //error here
matrix::matrix(biginteger rows) : rows(rows),columns(1){
    allocate_memory();
    set_basic_accessor();
} //error here
matrix::matrix(biginteger rows,biginteger columns) : rows(rows),columns(columns){
    allocate_memory();
    set_basic_accessor();
} //error here

matrix::matrix(biginteger rows,biginteger columns, element_type x) : rows(rows),columns(columns){
    allocate_memory();
    set_basic_accessor();
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=rows;j++){
            (*this)(i,j)=x;
        }
    }
} //error here

matrix::matrix(biginteger rows,biginteger columns, const matrix &m) : rows(rows),columns(columns){
    allocate_memory();
    set_basic_accessor();
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=rows;j++){
            (*this)(i,j)=m(i,j);
        }
    }
} //error here

matrix::matrix(biginteger rows,biginteger columns, element_type * pos) : rows(rows),columns(columns), pos(pos) {
    set_basic_accessor();}
matrix::matrix(biginteger rows,biginteger columns, accessor_type accessor) : rows(rows),columns(columns), accessor(accessor){
    allocate_memory();
} //error here
matrix::matrix(biginteger rows,biginteger columns, element_type * pos, accessor_type accessor) : rows(rows),columns(columns), pos(pos), accessor(accessor) {}
matrix::matrix(biginteger rows,biginteger columns, function<element_type(biginteger, biginteger)> f){
    allocate_memory();
    set_basic_accessor();
    for (biginteger i = 1; i <= rows; i++) {
        for (biginteger j = 1; j <= columns; j++) {
            (*this)(i,j) = f(i, j);
        }
    }
} //error here

void matrix::allocate_memory() {
    pos = (element_type *)malloc(sizeof(element_type)*rows*columns);
} //error here

void matrix::set_basic_accessor() {
    accessor = [=](matrix &m, biginteger i,biginteger j) -> element_type* {
        return  m.get_pos()+calculate_relpos(i,j);
    };
} //error here
// getters
element_type matrix::*get_pos() {
    return pos;
}
biginteger matrix::get_rows() {
    return rows;
}
biginteger matrix::get_columns() {
    return columns;
}
accessor_type matrix::get_accessor(){
    return accessor;
}

//setters
void matrix::set_pos(element_type *pos){
    pos=pos;
}
void matrix::set_accessor(accessor_type accessor){
    accessor=accessor;
}

element_type &operator matrix::()(biginteger i, biginteger j){
    if(!check_pos(i,j)){
        throw runtime_error("invalid idx - in element reference");
    }
    return *accessor((*this),i,j);
} //^element accessor
matrix operator matrix::()(biginteger idx){
    if(rows==1){
        return (*this)(1,idx);
    }
    if(columns==1){
        return (*this)(idx,1);
    }
    if(idx<1 or idx>rows){
        throw runtime_error("invalid idx - in row vector refference");
    }
    return matrix(1, columns, pos, [=](matrix &m, biginteger i, biginteger j){
        return pos+calculate_relpos(i,idx);
    });
} //^row accessor
matrix operator matrix::[](biginteger idx) {
    if(rows==1){
        return (*this)(1,idx);
    }
    if(columns==1){
        return (*this)(idx,1);
    }
    if(idx<1 or idx>columns){
        throw runtime_error("in column vector reference");
    }
    return matrix(rows, 1, pos, [=](matrix &m, biginteger i,biginteger j){
        return pos+calculate_relpos(i,idx);
    });
} //^column accessor
matrix operator matrix::* (matrix a) {
    if(!check_multipliable(a)){
        throw runtime_error("in multiply operation, matrix sizes do not match\nfirst matrix:\n"+info()+"second matrix:\n"+a.info());
    }
    matrix<element_type> ret(rows, a.get_columns());
    for (biginteger i = 1; i <= rows; i++) {
        for (biginteger j = 1; j <= a.columns; j++) {
            for (biginteger k = 1; k <= columns; k++) {
                ret(i,j) = ret(i,j) + (*this)(i,k) * a(k,j);
            }
        }
    }
    return ret;
}
matrix operator matrix::+ (matrix a) {
    if(!is_same_size(a)){
        throw runtime_error("in add operation, matrix sizes do not match\nfirst matrix:\n"+info()+"second matrix:\n"+a.info());
    }
    matrix<element_type> ret(rows, columns);
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= columns; j++) {
            ret(i,j) = (*this)(i,j) + a(i,j);
        }
    }
    return ret;
}
matrix operator matrix::- (matrix a) {
    if(!is_same_size(a)){
        throw runtime_error("in sub operation, matrix sizes does not match\nfirst matrix:\n"+info()+"second matrix:\n"+a.info());
    }
    matrix<element_type> ret(rows, columns);
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= columns; j++) {
            ret(i,j) = (*this)(i,j) - a(i,j);
        }
    }
    return ret;
}

//utilities
void matrix::free() {
    free(pos);
    pos = NULL;
}
element_type matrix::max_value() {
    element_type ret = (*this)(1,1);
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=columns;j++){
            if((*this)(i,j)>ret){
                ret=(*this)(i,j);
            }
        }
    }
    return ret;
}
element_type matrix::min_value() {
    element_type ret = (*this)(1,1);
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=columns;j++){
            if((*this)(i,j)<ret){
                ret=(*this)(i,j);
            }
        }
    }
    return ret;
}
matrix matrix::foreach_calculate (function<element_type(const element_type &, const element_type &)> f, matrix a) {
    if (!is_same_size(a)) {
        throw runtime_error("in foreach calculate call, matrix sizes does not match\nfirst matrix:\n"+info()+"second matrix:\n"+a.info());
    }
    matrix ret(rows, columns);
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=columns;j++){
            ret(i,j)=f((*this)(i,j),a(i,j));
        }
    }
    return ret;
}
matrix matrix::pass(function<element_type(element_type)> f) {
    matrix ret(rows, columns);
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= columns; j++) {
            ret(i,j)=f((*this)(i,j));
        }
    }
    return ret;
}
matrix matrix::pass(function<element_type(biginteger,biginteger,element_type)> f) {
    matrix ret(rows, columns);
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= columns; j++) {
            ret(i,j)=f(i,j,(*this)(i,j));
        }
    }
    return ret;
}
string matrix::size_info(){
    return "("+to_string(rows)+"*"+to_string(columns)+") ";
}
string matrix::info() {
    string ret="matrix("+to_string(rows)+"*"+to_string(columns)+")\n(";
    try{
        for (int i = 1; i <= rows; i++) {
            for (int j = 1; j <= columns; j++) {
                ret+=to_string((*this)(i,j)) + " ";
            }
            if(i==rows) ret+=")";
            ret+= "\n";
        }
        return ret;
    }
    catch(exception *e)
    {
        throw runtime_error("cannot covert type "+to_string(*(typeid(element_type).name()))+" to string.");
    }
}
biginteger matrix::calculate_relpos(biginteger i, biginteger j){
    return sizeof(element_type)*((i-1)*columns+(j-1));
}
bool matrix::check_pos(biginteger i, biginteger j){
    return (1<=i && i<=rows) &&(1<=j && j<=columns);
}
bool matrix::check_multipliable(matrix &m){
    return columns==m.rows;
}
bool matrix::is_same_size(matrix &m){
    return rows==m.get_rows() and columns==m.get_columns();
}
matrix matrix::t(){
    matrix<element_type> ret(columns,rows);
    for(biginteger i=1;i<=rows;i++){
        for(biginteger j=1;j<=columns;j++){
            ret(i,j)=(*this)(j,i);
        }
    }
    return ret;
}

I don't know why compiler says that matrix class is not defined.


问:
Button not clicking with scrapy playwright
I am attempting to click on an sso login for a platform by testing its button functionality with scrapy playwright. I have inputted an incorrect email and so after clicking the button, it should throw a text error that the email is incorrect. However, nothing seems to happen.

For example:

```<code>import scrapy
from scrapy_playwright.page import PageMethod
from path import Path

class telSpider(scrapy.Spider):
    name = 'tel'
    start_urls = 'https://my.tealiumiq.com/login/sso/'

    customer_settings = {
        'USER-AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15',
        'CONNECTION': 'keep-alive',
        'ACCEPT': 'application/json, text/javascript, */*; q=0.01'
    }

    def start_requests(self):
        yield scrapy.Request(
            self.start_urls,
            meta = dict(
                    playwright = True,
                    playwright_include_page = True,
                    playwright_page_methods = [

                        PageMethod('waitForLoadState', state = 'domcontentloaded'),
                        PageMethod("fill", selector = '#email', value = "incorrect@email.com"),
                        PageMethod('wait_for_selector', selector = "span[data-i18n='login.form.btn_submit']", state = 'visible'),
                        PageMethod("click", selector = "#submitBtn", button = "middle",  delay = 2000, force=True),
                        PageMethod("waitForEvent", event = "click"),
                        PageMethod("screenshot", path=Path(__file__).parent / "tealium.png", full_page=True),
                        ]
                ),
                callback = self.parse
        )
    def parse(self, response):
        print(response)
</code>```

I have attempted evaluate instead but this for some reason will only do one or the other event. For example, it either inputs email first or clicks, not one after the other or both.

```<code>
"""(function() {
    const setValue = Object.getOwnPropertyDescriptor(
    window.HTMLInputElement.prototype,
    "value"
    ).set;
    const modifyInput = (name, value) => {
    const input = document.getElementsByName(name)[0]
    setValue.call(input, value)
    input.dispatchEvent(new Event('input', { bubbles: true}))
    };
    modifyInput('email', "incorrect@email.com");
    document.querySelector("#submitBtn").click();
    }());"""
</code>```

Expected output:

Body:
I am attempting to click on an sso login for a platform by testing its button functionality with scrapy playwright. I have inputted an incorrect email and so after clicking the button, it should throw a text error that the email is incorrect. However, nothing seems to happen.

For example:

import scrapy
from scrapy_playwright.page import PageMethod
from path import Path

class telSpider(scrapy.Spider):
    name = 'tel'
    start_urls = 'https://my.tealiumiq.com/login/sso/'

    customer_settings = {
        'USER-AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15',
        'CONNECTION': 'keep-alive',
        'ACCEPT': 'application/json, text/javascript, */*; q=0.01'
    }

    def start_requests(self):
        yield scrapy.Request(
            self.start_urls,
            meta = dict(
                    playwright = True,
                    playwright_include_page = True,
                    playwright_page_methods = [

                        PageMethod('waitForLoadState', state = 'domcontentloaded'),
                        PageMethod("fill", selector = '#email', value = "incorrect@email.com"),
                        PageMethod('wait_for_selector', selector = "span[data-i18n='login.form.btn_submit']", state = 'visible'),
                        PageMethod("click", selector = "#submitBtn", button = "middle",  delay = 2000, force=True),
                        PageMethod("waitForEvent", event = "click"),
                        PageMethod("screenshot", path=Path(__file__).parent / "tealium.png", full_page=True),
                        ]
                ),
                callback = self.parse
        )
    def parse(self, response):
        print(response)

I have attempted evaluate instead but this for some reason will only do one or the other event. For example, it either inputs email first or clicks, not one after the other or both.

"""(function() {
    const setValue = Object.getOwnPropertyDescriptor(
    window.HTMLInputElement.prototype,
    "value"
    ).set;
    const modifyInput = (name, value) => {
    const input = document.getElementsByName(name)[0]
    setValue.call(input, value)
    input.dispatchEvent(new Event('input', { bubbles: true}))
    };
    modifyInput('email', "incorrect@email.com");
    document.querySelector("#submitBtn").click();
    }());"""

Expected output:


问:
How to animate a card flipping in javafx 3d?
I've tried to modelise a simple card in javafx with two faces. My goal is that, when clicked, the card does a little animation where it turns on itself. To do so, I've tried two unsuccessfull methods. I'll first explain the methods then i'll show my code.

The first one consists in a Group containing two ImageView (respectivelly the front and the back of the card).

front image

back image

When the Group is clicked, there is an animation asking the Group to turn around. But when the animation begins and the Group starts to turn, only the card on the top layer of the group is showing.

preview

The second one consists in using the Box class.
with this code, I can definitly see the box turning around itself when I click it, the problem is that it seems that there is no way to put an Imageview or any Node in a specific face of the box, so I can't put the images on the box like I'd like to ...

Here is the code for both methods

method 1 :

public void start(Stage stage) throws Exception {
        ImageView front = new ImageView(new Image("cardImages/front.png"));
        ImageView back = new ImageView(new Image("cardImages/back.png"));

        Group images = new Group(back, front);
        for (ImageView i : new ImageView[]{front, back}){
            i.setFitWidth(400);
            i.setPreserveRatio(true);
        }

        // Animation
        RotateTransition flip = new RotateTransition(Duration.seconds(1), images);
        flip.setFromAngle(0);
        flip.setToAngle(360);
        flip.setCycleCount(1);
        flip.setAutoReverse(true);

        // axis
        flip.setAxis(Rotate.Y_AXIS);

        images.setOnMouseClicked(event -> {
            // turn the card
            flip.play();
        });

        BorderPane root = new BorderPane();
        root.setPrefSize(800, 700);
        root.setCenter(images);
        stage.setScene(new Scene(root));
        stage.show();
}
```
<ul>
<li>method 2 :</li>
</ul>
<pre class="lang-java prettyprint-override"><code>public void start(Stage stage) throws Exception {

        //Drawing a Box
        Box box = new Box();

        //Setting the properties of the Box
        box.setWidth(1080.0);
        box.setHeight(1920.0);
        box.setDepth(20.0);

        // reducing box size
        box.setScaleX(0.2);
        box.setScaleY(0.2);

        //Setting the material of the box
        PhongMaterial material = new PhongMaterial();
        material.setDiffuseColor(Color.BURLYWOOD);

        //Setting the diffuse color material to box
        box.setMaterial(material);

        //Setting the rotation animation to the box
        RotateTransition rotateTransition = new RotateTransition();

        //Setting the duration for the transition
        rotateTransition.setDuration(Duration.seconds(1));

        //Setting the node for the transition
        rotateTransition.setNode(box);

        //Setting the axis of the rotation
        rotateTransition.setAxis(Rotate.Y_AXIS);

        //Setting the angle of the rotation
        rotateTransition.setByAngle(180);

        //Setting the cycle count for the transition
        rotateTransition.setCycleCount(0);

        //Setting auto reverse value to false
        rotateTransition.setAutoReverse(false);

        // play transion
        box.setOnMouseClicked(e->{
            rotateTransition.play();
        });

        //Creating a Group object
        Group group = new Group(box);
        BorderPane root = new BorderPane();
        root.setCenter(group);

        //Creating a scene object
        Scene scene = new Scene(root, 800, 500);

        //Setting title to the Stage
        stage.setTitle("javafx box exemple");

        //Adding scene to the stage
        stage.setScene(scene);

        //Displaying the contents of the stage
        stage.show();
}

</code>```

Body:
I've tried to modelise a simple card in javafx with two faces. My goal is that, when clicked, the card does a little animation where it turns on itself. To do so, I've tried two unsuccessfull methods. I'll first explain the methods then i'll show my code.

The first one consists in a Group containing two ImageView (respectivelly the front and the back of the card).

front image

back image

When the Group is clicked, there is an animation asking the Group to turn around. But when the animation begins and the Group starts to turn, only the card on the top layer of the group is showing.

preview

The second one consists in using the Box class.
with this code, I can definitly see the box turning around itself when I click it, the problem is that it seems that there is no way to put an Imageview or any Node in a specific face of the box, so I can't put the images on the box like I'd like to ...

Here is the code for both methods

method 1 :

public void start(Stage stage) throws Exception {
        ImageView front = new ImageView(new Image("cardImages/front.png"));
        ImageView back = new ImageView(new Image("cardImages/back.png"));

        Group images = new Group(back, front);
        for (ImageView i : new ImageView[]{front, back}){
            i.setFitWidth(400);
            i.setPreserveRatio(true);
        }

        // Animation
        RotateTransition flip = new RotateTransition(Duration.seconds(1), images);
        flip.setFromAngle(0);
        flip.setToAngle(360);
        flip.setCycleCount(1);
        flip.setAutoReverse(true);

        // axis
        flip.setAxis(Rotate.Y_AXIS);

        images.setOnMouseClicked(event -> {
            // turn the card
            flip.play();
        });

        BorderPane root = new BorderPane();
        root.setPrefSize(800, 700);
        root.setCenter(images);
        stage.setScene(new Scene(root));
        stage.show();
}

method 2 :

public void start(Stage stage) throws Exception {

        //Drawing a Box
        Box box = new Box();

        //Setting the properties of the Box
        box.setWidth(1080.0);
        box.setHeight(1920.0);
        box.setDepth(20.0);

        // reducing box size
        box.setScaleX(0.2);
        box.setScaleY(0.2);

        //Setting the material of the box
        PhongMaterial material = new PhongMaterial();
        material.setDiffuseColor(Color.BURLYWOOD);

        //Setting the diffuse color material to box
        box.setMaterial(material);

        //Setting the rotation animation to the box
        RotateTransition rotateTransition = new RotateTransition();

        //Setting the duration for the transition
        rotateTransition.setDuration(Duration.seconds(1));

        //Setting the node for the transition
        rotateTransition.setNode(box);

        //Setting the axis of the rotation
        rotateTransition.setAxis(Rotate.Y_AXIS);

        //Setting the angle of the rotation
        rotateTransition.setByAngle(180);

        //Setting the cycle count for the transition
        rotateTransition.setCycleCount(0);

        //Setting auto reverse value to false
        rotateTransition.setAutoReverse(false);

        // play transion
        box.setOnMouseClicked(e->{
            rotateTransition.play();
        });

        //Creating a Group object
        Group group = new Group(box);
        BorderPane root = new BorderPane();
        root.setCenter(group);

        //Creating a scene object
        Scene scene = new Scene(root, 800, 500);

        //Setting title to the Stage
        stage.setTitle("javafx box exemple");

        //Adding scene to the stage
        stage.setScene(scene);

        //Displaying the contents of the stage
        stage.show();
}


问:
how to convert a adobe pdf file to png file using adobe reader do that I can have a png file
I couldn't convert adobe pdf file to png file using adobe reader

I'm expecting to change my adobe pdf file to pdf file


问:
How do I resolve this? (Error Incomplete expression stargazer)
*This came up
Error: Incomplete expression: stargazer(df_analysis[c("YRSCHOOL", "SCHOOL", "CHBORN_MOM", "AGE", 'CAPITALCITY", "NOINCOME_MOM", "NOINCOME_DAD", "MALE")], type = "text", summary.stat = c("n","mean","sd", "min", "max"), covariate.labels = c("Years Of Schooling", "School Attendance", "Number of Children", "Age", "Capital City", "Mother Has No income", "Father Has No Income", "Male"), digits = 2, title="Summary Statistics", notes="Note: Data are 1% sample of individual aged 5-21 from 1980 Thailand census. Source: IPUMS International")

Does anyone know whats wrong?

*I ran this
stargazer(df_analysis[c("YRSCHOOL", "SCHOOL", "CHBORN_MOM", "AGE", 'CAPITALCITY", "NOINCOME_MOM", "NOINCOME_DAD", "MALE")], type = "text", summary.stat = c("n","mean","sd", "min", "max"), covariate.labels = c("Years Of Schooling", "School Attendance", "Number of Children", "Age", "Capital City", "Mother Has No income", "Father Has No Income", "Male"), digits = 2, title="Summary Statistics", notes="Note: Data are 1% sample of individual aged 5-21 from 1980 Thailand census. Source: IPUMS International")


问:
problems using the ART library with a from scratch trained model
I am a student of artificial intelligence.
I am trying to use the ART library to perform attacks on a binary classifier doing speaker recognition. However, due to some technical problems, I had to resort to training from scratch, using a Keras tutorial. Now, even trying a trivial attack like FGSM, I notice some ambiguous behaviour.
First, the security evaluation curve decreases, then peaks and then decreases again, which makes my nose twitch. After that, the classifier's performance on the attacked samples does not fall below 50 per cent, which should not be correct.

I wanted to know if anyone else had experienced this problem and if so how they solved it.
Thank you very much in advance.


问:
How can I make the display data only show if the keys match?
I want to make it so that I can write any text, then encrypt it and generate a key with which I can get the already decrypted text!

I found a guide, but I can’t figure out how to make a comparison, that if the key is correct, it gives me a decrypted message, if it’s wrong, an error

Guide Link: https://nitratine.net/blog/post/encryption-and-decryption-in-python/#what-is-symmetric-encryption

```<code>from cryptography.fernet import Fernet
from tkinter import *

window = Tk()
window.geometry("300x300")

lbl0 = Label(window, text="Enter the key")
lbl0.pack(pady=10)

ent = Entry()
ent.pack()

lbl1 = Label(window, text="Result:")
lbl1.pack(pady=10)

lbl2 = Label(window, text="")
lbl2.pack(pady=10)

global key

def write_key():
    key = Fernet.generate_key()
    with open("key.key", "wb") as key_file:
        key_file.write(key)

def load_key():
    return open("key.key", "rb").read()

def generate():
    message = ent.get().encode()
    write_key()
    key = load_key()

    f = Fernet(key)

def compare():
    if key == ent.get():
        print("Success")
    else:
        print("Fail")

btn1 = Button(text="generate", command=generate)
btn1.pack()

btn2 = Button(text="compare", command=compare)
btn2.pack()

window.mainloop()
</code>```

Body:
I want to make it so that I can write any text, then encrypt it and generate a key with which I can get the already decrypted text!

I found a guide, but I can’t figure out how to make a comparison, that if the key is correct, it gives me a decrypted message, if it’s wrong, an error

Guide Link: https://nitratine.net/blog/post/encryption-and-decryption-in-python/#what-is-symmetric-encryption

from cryptography.fernet import Fernet
from tkinter import *

window = Tk()
window.geometry("300x300")

lbl0 = Label(window, text="Enter the key")
lbl0.pack(pady=10)

ent = Entry()
ent.pack()

lbl1 = Label(window, text="Result:")
lbl1.pack(pady=10)

lbl2 = Label(window, text="")
lbl2.pack(pady=10)

global key

def write_key():
    key = Fernet.generate_key()
    with open("key.key", "wb") as key_file:
        key_file.write(key)

def load_key():
    return open("key.key", "rb").read()

def generate():
    message = ent.get().encode()
    write_key()
    key = load_key()

    f = Fernet(key)

def compare():
    if key == ent.get():
        print("Success")
    else:
        print("Fail")

btn1 = Button(text="generate", command=generate)
btn1.pack()

btn2 = Button(text="compare", command=compare)
btn2.pack()

window.mainloop()


问:
IronPython, Python .NET (or anything else) to edit an xml table inside Excel? Openpyxl seems to corrupt the file
I have to do something really simple, and so complicated at the same time.
I have two files, one with data. like this:
file1

And the other one is a template, with an xml table headings on A3 and the first row has to be the same always, like this:
file2

So what I need to do (in simple words) is to select all in file1, copy and paste in A5 in file2, right? so simple.

First I tried with Openpyxl in Python, with this code:

```<code>import openpyxl

wb = openpyxl.load_workbook('file1.xlsx')
sheet1 = wb.active
filas = sheet1.max_row

wb2 = openpyxl.load_workbook('file2.xlsx')
sheet2 = wb2.active

for fila in range(5,filas+5):
    sheet2["A"+ str(fila)] = sheet1["A"+ str(fila-4)].value
    sheet2["B"+ str(fila)] = "AFP"
    sheet2["C"+ str(fila)] = "FRA"
    sheet2["D"+ str(fila)] = "NAC"
    sheet2["E"+ str(fila)] = "NAC"
    sheet2["F"+ str(fila)] = "CBR"
    sheet2["G"+ str(fila)] = "WHT2.5"
    sheet2["H"+ str(fila)] = "2.5"

    wb2.save('file3.xlsx')
    wb2.close()
</code>```

But the new file3.xlsx looks corrupted, and a warning pops up when I open the file:

We found a problem with some content in file3.xlsx. Do you want us to try to recover as much as we can?

Looks like Excel is trying to help, but it erases /xl/tables/table1.xml and the xml template is gone.
Another aproach I did was with VBA, inside Excel itself, with this code:

```<code>Sub Replace()
'
' Macro to fill template

    Workbooks.Open (ThisWorkbook.Path & "file1.xlsx")
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Workbooks.Open (ThisWorkbook.Path & "file2.xlsx")
    Range("A5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveWorkbook.SaveAs Filename:= _
    ThisWorkbook.Path & "file3.xlsx"
End Sub
</code>```

It works perfect, no file corrupted, but now I have to implement this on a server with Linux, and soon as a serverless microservice, so I can't install Wine, Windows, Office and so on...

Is there a way to do this on Linux? Maybe with IronPython or Phython.NET, preserving the file like in BVA?

Body:
I have to do something really simple, and so complicated at the same time.
I have two files, one with data. like this:
file1

And the other one is a template, with an xml table headings on A3 and the first row has to be the same always, like this:
file2

So what I need to do (in simple words) is to select all in file1, copy and paste in A5 in file2, right? so simple.

First I tried with Openpyxl in Python, with this code:

import openpyxl

wb = openpyxl.load_workbook('file1.xlsx')
sheet1 = wb.active
filas = sheet1.max_row

wb2 = openpyxl.load_workbook('file2.xlsx')
sheet2 = wb2.active

for fila in range(5,filas+5):
    sheet2["A"+ str(fila)] = sheet1["A"+ str(fila-4)].value
    sheet2["B"+ str(fila)] = "AFP"
    sheet2["C"+ str(fila)] = "FRA"
    sheet2["D"+ str(fila)] = "NAC"
    sheet2["E"+ str(fila)] = "NAC"
    sheet2["F"+ str(fila)] = "CBR"
    sheet2["G"+ str(fila)] = "WHT2.5"
    sheet2["H"+ str(fila)] = "2.5"

    wb2.save('file3.xlsx')
    wb2.close()

But the new file3.xlsx looks corrupted, and a warning pops up when I open the file:

We found a problem with some content in file3.xlsx. Do you want us to try to recover as much as we can?

Looks like Excel is trying to help, but it erases /xl/tables/table1.xml and the xml template is gone.
Another aproach I did was with VBA, inside Excel itself, with this code:

Sub Replace()
'
' Macro to fill template

    Workbooks.Open (ThisWorkbook.Path & "file1.xlsx")
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Workbooks.Open (ThisWorkbook.Path & "file2.xlsx")
    Range("A5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveWorkbook.SaveAs Filename:= _
    ThisWorkbook.Path & "file3.xlsx"
End Sub

It works perfect, no file corrupted, but now I have to implement this on a server with Linux, and soon as a serverless microservice, so I can't install Wine, Windows, Office and so on...

Is there a way to do this on Linux? Maybe with IronPython or Phython.NET, preserving the file like in BVA?


Title: bond daily yield data calculate daily 1-year returns pandas

Body:
I have logarithmic bond yields for zero coupon bonds maturity 1-year to 10-year. Data is like below

SVENY01 SVENY02 SVENY03 SVENY04 SVENY05 SVENY06 SVENY07 SVENY08 SVENY09 SVENY10
Date
1961-06-14  2.9825  3.3771  3.5530  3.6439  3.6987  3.7351  3.7612  NaN NaN NaN
1961-06-15  2.9941  3.4137  3.5981  3.6930  3.7501  3.7882  3.8154  NaN NaN NaN
1961-06-16  3.0012  3.4142  3.5994  3.6953  3.7531  3.7917  3.8192  NaN NaN NaN
1961-06-19  2.9949  3.4386  3.6252  3.7199  3.7768  3.8147  3.8418  NaN NaN NaN
1961-06-20  2.9833  3.4101  3.5986  3.6952  3.7533  3.7921  3.8198  NaN NaN NaN
... ... ... ... ... ... ... ... ... ... ...
2008-12-25  NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
2008-12-26  0.4723  0.6343  0.8918  1.1947  1.5087  1.8117  2.0899  2.3359  2.5461  2.7201
2008-12-29  0.3692  0.5401  0.8089  1.1241  1.4510  1.7668  2.0573  2.3148  2.5356  2.7191
2008-12-30  0.3349  0.5234  0.8043  1.1267  1.4566  1.7720  2.0596  2.3123  2.5271  2.7039
2008-12-31  0.3850  0.5713  0.8642  1.2057  1.5568  1.8928  2.1988  2.4668  2.6936  2.8791

I want to calculate daily 1-year returns and plot them for all 10 different maturities. I have tried different codes but don't know which one is correct.

data['Y01return']=(data['SVENY01'].shift(-365)-data['SVENY01'])/data['SVENY01']
data['Y02return']=(data['SVENY02'].shift(-365)-data['SVENY02'])/data['SVENY02']
data['Y03return']=(data['SVENY03'].shift(-365)-data['SVENY03'])/data['SVENY03']
data['Y04return']=(data['SVENY04'].shift(-365)-data['SVENY04'])/data['SVENY04']
data['Y05return']=(data['SVENY05'].shift(-365)-data['SVENY05'])/data['SVENY05']
data['Y06return']=(data['SVENY06'].shift(-365)-data['SVENY06'])/data['SVENY06']
data['Y07return']=(data['SVENY07'].shift(-365)-data['SVENY07'])/data['SVENY07']
data['Y08return']=(data['SVENY08'].shift(-365)-data['SVENY08'])/data['SVENY08']
data['Y09return']=(data['SVENY09'].shift(-365)-data['SVENY09'])/data['SVENY09']
data['Y10return']=(data['SVENY10'].shift(-365)-data['SVENY10'])/data['SVENY10']
data[['Y01return','Y02return','Y03return','Y04return','Y05return','Y06return','Y07return','Y08return','Y09return','Y10return']].plot()

Above was my first try it gave me a plot fluctuating around -1 and 2.5. Is this correct? Should I multiply the values with 100 or not?
My second guess is the following, which also gives me a plot fluctuating between -.1 and 1. Which one is correct?

data.resample('Y').ffill().pct_change().plot()


问:
Wall (obstacle) following ROS Nodes
I have mobile robot (just a two wheels squarish ) in gazebo and the robot is in the middle of a trapezoid wall.The robot has 5 sonar ultrasonic sensors, which measure distance from obstacles, as well as one an IMU (Inertial Measurement Unit) of 9 degrees freedom, which
measures rotational speeds, linear accelerations, and
rotation around each axis. The robot and dimensions are here

The starting orientation of the robot (rotation with respect to the z axis) which can be set in the launch file is:

angle = mod(X,π) (in rad)

I would like to creates ROS nodes that track (follow) the wall (obstacle) . In the nodes the direction of rotation (the direction in which the obstacle
will be tracked) is determined. More specifically, if X is an even number, then the
obstacle should be tracked clockwise (CW) with respect to the global coordinate system,
while if it is odd the obstacle should be tracked anti-clockwise (CCW).

Here is the launch file with

```<code><launch>

  <!-- these are the arguments you can pass this launch file, for example paused:=true -->
  <arg name="paused" default="false"/>
  <arg name="use_sim_time" default="true"/>
  <arg name="gui" default="true"/>
  <arg name="headless" default="false"/>
  <arg name="debug" default="false"/>
  <arg name="yaw_init" default="0.0"/>

  <!-- Load the URDF into the ROS Parameter Server -->
  <param name="robot_description"
command="$(find xacro)/xacro '$(find mymobibot_description)/urdf/mymobibot.xacro'" />

  <!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find mymobibot_gazebo)/worlds/mymobibot_wf.world"/>
    <arg name="debug" value="$(arg debug)" />
    <arg name="gui" value="$(arg gui)" />
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="$(arg use_sim_time)"/>
    <arg name="headless" value="$(arg headless)"/>
  </include>

  <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model mymobibot -Y $(arg yaw_init) -param robot_description"/>

  <!-- Run RVIZ-->
  <!--node name="$(anon rviz)" pkg="rviz" type="rviz" args="$(find mymobibot_gazebo)/mymobibot.rviz" output="screen"/-->

  <!-- ros_control mymobibot launch file -->
  <include file="$(find mymobibot_control)/launch/mymobibot_control.launch" />

</launch>
</code>```

And the control launch

```<code><launch>

  <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find mymobibot_control)/config/mymobibot_control.yaml" command="load"/>

  <!-- load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/mymobibot" args="joint_state_controller
 rightWheel_effort_controller
 leftWheel_effort_controller"/>

  <!-- convert joint states to TF transforms for rviz, etc -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
respawn="false" output="screen">
    <param name="robot_description" command="$(find xacro)/xacro '$(find mymobibot_description)/urdf/mymobibot.xacro'" />
    <remap from="/joint_states" to="/mymobibot/joint_states" />
  </node>

</launch>
</code>```

Any help with the obstacle (wall) following node?

Thanks

Title: Wall (obstacle) following ROS Nodes

Body:
I have mobile robot (just a two wheels squarish ) in gazebo and the robot is in the middle of a trapezoid wall.The robot has 5 sonar ultrasonic sensors, which measure distance from obstacles, as well as one an IMU (Inertial Measurement Unit) of 9 degrees freedom, which
measures rotational speeds, linear accelerations, and
rotation around each axis. The robot and dimensions are here

The starting orientation of the robot (rotation with respect to the z axis) which can be set in the launch file is:

angle = mod(X,π) (in rad)

I would like to creates ROS nodes that track (follow) the wall (obstacle) . In the nodes the direction of rotation (the direction in which the obstacle
will be tracked) is determined. More specifically, if X is an even number, then the
obstacle should be tracked clockwise (CW) with respect to the global coordinate system,
while if it is odd the obstacle should be tracked anti-clockwise (CCW).

Here is the launch file with

<launch>

  <arg name="paused" default="false"/>
  <arg name="use_sim_time" default="true"/>
  <arg name="gui" default="true"/>
  <arg name="headless" default="false"/>
  <arg name="debug" default="false"/>
  <arg name="yaw_init" default="0.0"/>

  <param name="robot_description"
command="$(find xacro)/xacro '$(find mymobibot_description)/urdf/mymobibot.xacro'" />

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find mymobibot_gazebo)/worlds/mymobibot_wf.world"/>
    <arg name="debug" value="$(arg debug)" />
    <arg name="gui" value="$(arg gui)" />
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="$(arg use_sim_time)"/>
    <arg name="headless" value="$(arg headless)"/>
  </include>

  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model mymobibot -Y $(arg yaw_init) -param robot_description"/>

  <include file="$(find mymobibot_control)/launch/mymobibot_control.launch" />

</launch>

And the control launch

<launch>

  <rosparam file="$(find mymobibot_control)/config/mymobibot_control.yaml" command="load"/>

  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/mymobibot" args="joint_state_controller
 rightWheel_effort_controller
 leftWheel_effort_controller"/>

  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
respawn="false" output="screen">
    <param name="robot_description" command="$(find xacro)/xacro '$(find mymobibot_description)/urdf/mymobibot.xacro'" />
    <remap from="/joint_states" to="/mymobibot/joint_states" />
  </node>

</launch>

Any help with the obstacle (wall) following node?

Thanks


问:
Docker multi-stage, Java simple class
I have aproblem when creating multi assembly in Docker. I get this error error invalid or corrupt jarfile</p>
```<code>FROM openjdk:18-jdk-alpine AS build
ARG JAR_FILE
COPY ${JAR_FILE} /app/app.jar
COPY . /app/source
WORKDIR /app/source
EXPOSE 8001

FROM openjdk:18-jdk-alpine AS runtime
COPY --from=build /app/source/ /app/app.jar
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
</code>```

Title: Docker multi-stage, Java simple class

Body:
I have aproblem when creating multi assembly in Docker. I get this error error invalid or corrupt jarfile

FROM openjdk:18-jdk-alpine AS build
ARG JAR_FILE
COPY ${JAR_FILE} /app/app.jar
COPY . /app/source
WORKDIR /app/source
EXPOSE 8001

FROM openjdk:18-jdk-alpine AS runtime
COPY --from=build /app/source/ /app/app.jar
ENTRYPOINT ["java", "-jar", "/app/app.jar"]


问:
Models' rotation changes when i move my character in circular motion
I am making a game (TPP) i have a character who can walk. It moves smoothly, no error occurs.
When i rapidly tap to W,A,S,D keys(move in circular motion) the characters model rotation on x changes.
I move via script(apply root motion is inactive).

Move Script:

```<code>    void InputMove()
    {
        horizontal = Input.GetAxisRaw("Horizontal");
        vertical = Input.GetAxisRaw("Vertical");
    }

    void MovePlayer()
    {
        moveDir = orientation.forward * vertical + orientation.right * horizontal;
        rb.AddForce(moveDir.normalized * moveSpeed * 10f, ForceMode.Force);

    }

    private void SpeedControl()
    {
        Vector3 flatVel = new Vector3(rb.velocity.x, 0f, rb.velocity.z);

        if (flatVel.magnitude > moveSpeed)
        {
            Vector3 limitedVel = flatVel.normalized * moveSpeed;
            rb.velocity = new Vector3(limitedVel.x, rb.velocity.y, limitedVel.z);
        }
    }
</code>```

Camera Script:

```<code>void Update()
    {
        // Rotation

        Vector3 viewDir = player.position - new Vector3(transform.position.x, player.position.y, transform.position.z);
        orientation.forward = viewDir.normalized;
        float vertical = Input.GetAxis("Vertical");
        float horizontal = Input.GetAxis("Horizontal");
        inputDir = orientation.forward * vertical + orientation.right * horizontal;

        if (inputDir != Vector3.zero)
        {
            playerObj.forward = Vector3.Slerp(playerObj.forward, inputDir.normalized, Time.deltaTime * rotationSpeed);

        }

    }
</code>```

I may try to set its Rotation on x to zero. But i couldnt do it. I didnt understand the quaternions.
Can you help me?

Body:
I am making a game (TPP) i have a character who can walk. It moves smoothly, no error occurs.
When i rapidly tap to W,A,S,D keys(move in circular motion) the characters model rotation on x changes.
I move via script(apply root motion is inactive).

Move Script:

    void InputMove()
    {
        horizontal = Input.GetAxisRaw("Horizontal");
        vertical = Input.GetAxisRaw("Vertical");
    }

    void MovePlayer()
    {
        moveDir = orientation.forward * vertical + orientation.right * horizontal;
        rb.AddForce(moveDir.normalized * moveSpeed * 10f, ForceMode.Force);

    }

    private void SpeedControl()
    {
        Vector3 flatVel = new Vector3(rb.velocity.x, 0f, rb.velocity.z);

        if (flatVel.magnitude > moveSpeed)
        {
            Vector3 limitedVel = flatVel.normalized * moveSpeed;
            rb.velocity = new Vector3(limitedVel.x, rb.velocity.y, limitedVel.z);
        }
    }

Camera Script:

void Update()
    {
        // Rotation

        Vector3 viewDir = player.position - new Vector3(transform.position.x, player.position.y, transform.position.z);
        orientation.forward = viewDir.normalized;
        float vertical = Input.GetAxis("Vertical");
        float horizontal = Input.GetAxis("Horizontal");
        inputDir = orientation.forward * vertical + orientation.right * horizontal;

        if (inputDir != Vector3.zero)
        {
            playerObj.forward = Vector3.Slerp(playerObj.forward, inputDir.normalized, Time.deltaTime * rotationSpeed);

        }

    }

I may try to set its Rotation on x to zero. But i couldnt do it. I didnt understand the quaternions.
Can you help me?


问:
Having a trouble integrating a html script to React app
I want to add this script to my Local React app

```
<p>I already tried to use the <code>react-helmet</code> library and do this code but I got <code>Parsing error: '}' expected.</code> error on this <code>RemoteCalc</code> function.</p>
<pre class="lang-js prettyprint-override"><code>import {Helmet} from "react-helmet";

const PositionSizeCalculator = () => {
  return (
    <div id="position-size-calculator-956132">
      <Helmet>
      <script type="text/javascript" src="https://www.cashbackforex.com/Content/remote/remote-widgets.js"></script>
      <script type="text/javascript"> RemoteCalc({"Url":"https://www.cashbackforex.com", "TopPaneStyle":"YmFja2dyb3VuZDogbGluZWFyLWdyYWRpZW50KCMzNDM1NDAgMCUsICMyNDI4MzEgMTAwJSk7IGNvbG9yOiB3aGl0ZTsgYm9yZGVyLWJvdHRvbTogbm9uZTs=","BottomPaneStyle":"YmFja2dyb3VuZDogIzE1MTgxZDsgYm9yZGVyOiBzb2xpZCAwcHggIzJhMmUzOTsgY29sb3I6ICM5MTk0YTE7","ButtonStyle":"YmFja2dyb3VuZDogIzM0MzU0MDsgY29sb3I6IHdoaXRlOyBib3JkZXItcmFkaXVzOiAyMHB4Ow==","TitleStyle":"dGV4dC1hbGlnbjogbGVmdDsgZm9udC1zaXplOiA0MHB4OyBmb250LXdlaWdodDogNTAwOw==","TextboxStyle":"YmFja2dyb3VuZDogIzE1MTgxZDsgY29sb3I6ICM5MTk0YTE7IGJvcmRlcjogc29saWQgMHB4ICM5MTk0YTE7","ContainerWidth":"665","DefaultInstrument":"EUR-USD","HighlightColor":"rgba(0,0,0,1.0)","IsDisplayTitle":false,"IsShowChartLinks":true,"IsShowEmbedButton":true,"CompactType":"large","Calculator":"position-size-calculator","ContainerId":"position-size-calculator-956132"});</script>
      </Helmet>
    </div>
  )
}
</code>```

PS: This script work well on html file

Body:
I want to add this script to my Local React app

I already tried to use the react-helmet library and do this code but I got Parsing error: '}' expected. error on this RemoteCalc function.

import {Helmet} from "react-helmet";

const PositionSizeCalculator = () => {
  return (

      <Helmet>

      </Helmet>

  )
}

PS: This script work well on html file


问:
How to fix "can not find script file .vbs" error?
I formatted the PC. After formatted, I installed obs-studio and uninstalled it. Then I got this error can not find the script file error. I checked its task manager and it was from a Windows/System32/wscript.exe file. Should I delete that file or how to prevent that pop-up error (run time error)? Any help?enter image description here</p>


问:
Sentry invitation link shows server's IP address
When I want to send an invitation link to a new user the generated invitation link shows the server's IP address instead of the domain that I have set for my server. My question is how can I config it so that it shows the specified name server?
Thank you in advance.</p>


问:
Error in if (file.exists(file.path(saga.path, "modules"))) { :
I am using the RSAGA package for R, I have downloaded SAGA GIS that is required to run these tools in R. I am running a couple of tools in the beginning that works or I do get output files but after I try to create raster object of slope raster I get an error code that says:

```<code>Error in if (file.exists(file.path(saga.path, "modules"))) { :
</code>```

This is my env- settings:

```<code>dir.saga <- "C:/Program Files/saga-8.4.1_x64"

myenv=rsaga.env(workspace=work_dir,
                path="C:/Program Files/saga-8.4.1_x64",
                modules="C:/Program Files/saga-8.4.1_x64/RSAGA/man")
</code>```

As earlier stated I am new to R :) Thank you for all the tips!
Liza

I am trying to get potential release areas for avalanches by using Rstudio and RSAGA, so everything is helpful!

Body:
I am using the RSAGA package for R, I have downloaded SAGA GIS that is required to run these tools in R. I am running a couple of tools in the beginning that works or I do get output files but after I try to create raster object of slope raster I get an error code that says:

Error in if (file.exists(file.path(saga.path, "modules"))) { :

This is my env- settings:

dir.saga <- "C:/Program Files/saga-8.4.1_x64"

myenv=rsaga.env(workspace=work_dir,
                path="C:/Program Files/saga-8.4.1_x64",
                modules="C:/Program Files/saga-8.4.1_x64/RSAGA/man")

As earlier stated I am new to R :) Thank you for all the tips!
Liza

I am trying to get potential release areas for avalanches by using Rstudio and RSAGA, so everything is helpful!


问:
amcharts worldmap: rounded image marker
i managed to add custom marker images using this:

```<code>pointSeries.bullets.push(function() {
      return am5.Bullet.new(root, {
        sprite: am5.Picture.new(root, {
          templateField: "pictureSettings"
        })
      })
    })

 pointSeries.data.setAll([{
    geometry: { type: "Point", coordinates: [20.703790, 40.416775] },
    pictureSettings: {
        src: "/validators/example0.png",
        width: 50,
        height: 50,
        centerX: am5.p50,
        centerY: am5.p50
      }
    }])
</code>```

but i can't find a way to make the image rounded as a circle. I tried the "radius" property but it doesn't seem to work. Any idea?

Title: amcharts worldmap: rounded image marker

Body:
i managed to add custom marker images using this:

pointSeries.bullets.push(function() {
      return am5.Bullet.new(root, {
        sprite: am5.Picture.new(root, {
          templateField: "pictureSettings"
        })
      })
    })

 pointSeries.data.setAll([{
    geometry: { type: "Point", coordinates: [20.703790, 40.416775] },
    pictureSettings: {
        src: "/validators/example0.png",
        width: 50,
        height: 50,
        centerX: am5.p50,
        centerY: am5.p50
      }
    }])

but i can't find a way to make the image rounded as a circle. I tried the "radius" property but it doesn't seem to work. Any idea?


问:
Google Apps Script asks for permissions every week
I have a script in Google Apps Script that needs permissions for "Connect to an external service" and "See, edit, create, and delete all your Google Sheets spreadsheets". I also use Google Cloud Logging for the script's log. It runs every 1 min by trigger.

It mostly works fine but about a week after I give permissions, it fails for permission error. Then, if I give permission again (by running the function in the editor view, then giving permissions), it starts working in the intended way, but it fails again one week after that.

How could I fix this?

I tried reducing the frequency of the run, but still there is the same issue.


问:
reactstrap multi item carousel
I am trying to create a multi item reactstrap carousel but I'm new to react and in all honesty don't really know how to approach this. I have done extensive research and so far haven't managed to find any examples and would really appreciate your help.

This is my scroller component jsx file:

```<code>import React, { useState } from 'react';
import {
    Carousel,
    CarouselItem,
    CarouselControl,
    CarouselIndicators,
    Card
} from 'reactstrap';
import './LogoScroller.css';

const items = [
    {
        src: '/assets/images/logos/dno.svg',
        altText: 'DNO',
        key: 0
    },
    {
        src: '/assets/images/logos/danagas.svg',
        altText: 'Danagas',
        key: 1
    },
    {
        src: '/assets/images/logos/gasprom.svg',
        altText: 'Gasprom',
        key: 2
    },
    {
        src: '/assets/images/logos/hkn.svg',
        altText: 'HKN',
        key: 3
    },
    {
        src: '/assets/images/logos/k.svg',
        altText: 'K',
        key: 4
    },
    {
        src: '/assets/images/logos/rosneft.svg',
        altText: 'Rosneft',
        key: 5
    },
    {
        src: '/assets/images/logos/taqa.svg',
        altText: 'Taqa',
        key: 6
    }
];

function LogoScroller(args) {
    const [activeIndex, setActiveIndex] = useState(0);
    const [animating, setAnimating] = useState(false);

    const next = () => {
        if (animating) return;
        const nextIndex = activeIndex === items.length - 1 ? 0 : activeIndex + 1;
        setActiveIndex(nextIndex);
    };

    const previous = () => {
        if (animating) return;
        const nextIndex = activeIndex === 0 ? items.length - 1 : activeIndex - 1;
        setActiveIndex(nextIndex);
    };

    const goToIndex = (newIndex) => {
        if (animating) return;
        setActiveIndex(newIndex);
    };

    const slides = items.map((item) => {
        return (
            <CarouselItem
                onExiting={() => setAnimating(true)}
                onExited={() => setAnimating(false)}
                key={item.key}
            >
                <div className="hstack h-100 justify-content-center align-items-center gap-3">
                    <Card>
                        <img src={item.src} alt={item.altText} />
                    </Card>
                </div>
            </CarouselItem>
        );
    });

    return (
        <Carousel
            activeIndex={activeIndex}
            next={next}
            previous={previous}
            {...args}
        >
            <CarouselIndicators
                items={items}
                activeIndex={activeIndex}
                onClickHandler={goToIndex}
            />
            {slides}
            <CarouselControl
                direction="prev"
                directionText="Previous"
                onClickHandler={previous}
            />
            <CarouselControl
                direction="next"
                directionText="Next"
                onClickHandler={next}
            />
        </Carousel>
    );
}

export default LogoScroller;
</code>```

And the css:

```<code>.carousel-inner {
    padding: 1em;
}

.card {
    margin: 0 2.2em;
    padding: 2rem;
    background: #FFFFFF;
    border: 1px solid #EDEDED;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.05);
    border-radius: 25px;
}

.carousel-control-prev,
.carousel-control-next {
    background-color: #e1e1e1;
    width: 6vh;
    height: 6vh;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

@media (min-width: 768px) {
    .carousel-item {
        margin-right: 0;
        flex: 0 0 25%;
        display: block;
    }

    .carousel-inner {
        display: flex;
    }
}

.card img {
    max-height: 100%;
}

</code>```

And the scroller would display on this page:

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

import LogoScroller from '../components/LogoScroller/LogoScroller';

export class Home extends Component {
  static displayName = Home.name;

    render() {
        return (

                <div>
                    <Container>
                        <LogoScroller />
                    </Container>
                </div>

        );
    }
}
</code>```

It's displaying as I wish, 4 items are visible but I don't know how to make them scroll to other items and would appreciate any lights on this.

Title: reactstrap multi item carousel

Body:
I am trying to create a multi item reactstrap carousel but I'm new to react and in all honesty don't really know how to approach this. I have done extensive research and so far haven't managed to find any examples and would really appreciate your help.

This is my scroller component jsx file:

import React, { useState } from 'react';
import {
    Carousel,
    CarouselItem,
    CarouselControl,
    CarouselIndicators,
    Card
} from 'reactstrap';
import './LogoScroller.css';

const items = [
    {
        src: '/assets/images/logos/dno.svg',
        altText: 'DNO',
        key: 0
    },
    {
        src: '/assets/images/logos/danagas.svg',
        altText: 'Danagas',
        key: 1
    },
    {
        src: '/assets/images/logos/gasprom.svg',
        altText: 'Gasprom',
        key: 2
    },
    {
        src: '/assets/images/logos/hkn.svg',
        altText: 'HKN',
        key: 3
    },
    {
        src: '/assets/images/logos/k.svg',
        altText: 'K',
        key: 4
    },
    {
        src: '/assets/images/logos/rosneft.svg',
        altText: 'Rosneft',
        key: 5
    },
    {
        src: '/assets/images/logos/taqa.svg',
        altText: 'Taqa',
        key: 6
    }
];

function LogoScroller(args) {
    const [activeIndex, setActiveIndex] = useState(0);
    const [animating, setAnimating] = useState(false);

    const next = () => {
        if (animating) return;
        const nextIndex = activeIndex === items.length - 1 ? 0 : activeIndex + 1;
        setActiveIndex(nextIndex);
    };

    const previous = () => {
        if (animating) return;
        const nextIndex = activeIndex === 0 ? items.length - 1 : activeIndex - 1;
        setActiveIndex(nextIndex);
    };

    const goToIndex = (newIndex) => {
        if (animating) return;
        setActiveIndex(newIndex);
    };

    const slides = items.map((item) => {
        return (
            <CarouselItem
                onExiting={() => setAnimating(true)}
                onExited={() => setAnimating(false)}
                key={item.key}
            >

                    <Card>

                    </Card>

            </CarouselItem>
        );
    });

    return (
        <Carousel
            activeIndex={activeIndex}
            next={next}
            previous={previous}
            {...args}
        >
            <CarouselIndicators
                items={items}
                activeIndex={activeIndex}
                onClickHandler={goToIndex}
            />
            {slides}
            <CarouselControl
                direction="prev"
                directionText="Previous"
                onClickHandler={previous}
            />
            <CarouselControl
                direction="next"
                directionText="Next"
                onClickHandler={next}
            />
        </Carousel>
    );
}

export default LogoScroller;

And the css:

.carousel-inner {
    padding: 1em;
}

.card {
    margin: 0 2.2em;
    padding: 2rem;
    background: #FFFFFF;
    border: 1px solid #EDEDED;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.05);
    border-radius: 25px;
}

.carousel-control-prev,
.carousel-control-next {
    background-color: #e1e1e1;
    width: 6vh;
    height: 6vh;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

@media (min-width: 768px) {
    .carousel-item {
        margin-right: 0;
        flex: 0 0 25%;
        display: block;
    }

    .carousel-inner {
        display: flex;
    }
}

.card img {
    max-height: 100%;
}

And the scroller would display on this page:

import React, { Component } from 'react';

import LogoScroller from '../components/LogoScroller/LogoScroller';

export class Home extends Component {
  static displayName = Home.name;

    render() {
        return (

                    <Container>
                        <LogoScroller />
                    </Container>

        );
    }
}

It's displaying as I wish, 4 items are visible but I don't know how to make them scroll to other items and would appreciate any lights on this.


问:
"HTTP Status 404 - result 'null' not found" exporting XLS with JasperReport's Web Services (May have nothing to do with Jasper)
(There is a chance that this has nothing to do with Jasper, but it only happens with my web services implementation, NOT with the normal JasperServer interface)

I have implemented web services and when I export to XLS I am seeing very strange behavior (no problems with XLSX, CSV, PDF). When the report returns a small number results it will not export. Instead my browser gives: "HTTP Status 404 - result 'null' not found". When there are a large number of results it will export correctly. I have been unable to find a log messages that give any hints.

So I removed all report bands except for the details and was able to determine that 43 or more rows will export XLS correctly, but 42 or less will cause the error. I figured this out by process of elimination changing my query from "select TOP 10 ..." to  "select TOP 20 ..." to "select TOP 30 ...", etc, etc etc. 43 is a strange number so I thought it might have to do with pixels. I played with the number of pixels on my details band and of the entire report, but the 42 vs 43 row problem persisted.

At this time my report was displaying three fields, so I removed two of them ran the report and the problem returned. I didn't bother honing in on the exact number of rows, but now the magic number was somewhere between 60 and 80 rows.

You can see a snippet of my code here: http://pastebin.com/MyPYMju4

```<code>        JasperPrint print; = client.runReport(rd, reportInputMap);
        response.setHeader("Content-Disposition", " inline; filename=report" + (new Date()).getTime() + "." + format.toLowerCase());
        JRAbstractExporter myExporter;

        /// ... if/else code to determine what file to export to ...

        myExporter = new JRXlsExporter();
        response.setContentType(FORMAT_CONTENTTYPE_MAP.get(format));
        myExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, response.getOutputStream());
        myExporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
        myExporter.exportReport();
</code>```

ContentLicense: CC BY-SA 3.0

Body:
(There is a chance that this has nothing to do with Jasper, but it only happens with my web services implementation, NOT with the normal JasperServer interface)

I have implemented web services and when I export to XLS I am seeing very strange behavior (no problems with XLSX, CSV, PDF). When the report returns a small number results it will not export. Instead my browser gives: "HTTP Status 404 - result 'null' not found". When there are a large number of results it will export correctly. I have been unable to find a log messages that give any hints.

So I removed all report bands except for the details and was able to determine that 43 or more rows will export XLS correctly, but 42 or less will cause the error. I figured this out by process of elimination changing my query from "select TOP 10 ..." to  "select TOP 20 ..." to "select TOP 30 ...", etc, etc etc. 43 is a strange number so I thought it might have to do with pixels. I played with the number of pixels on my details band and of the entire report, but the 42 vs 43 row problem persisted.

At this time my report was displaying three fields, so I removed two of them ran the report and the problem returned. I didn't bother honing in on the exact number of rows, but now the magic number was somewhere between 60 and 80 rows.

You can see a snippet of my code here: http://pastebin.com/MyPYMju4

        JasperPrint print; = client.runReport(rd, reportInputMap);
        response.setHeader("Content-Disposition", " inline; filename=report" + (new Date()).getTime() + "." + format.toLowerCase());
        JRAbstractExporter myExporter;

        /// ... if/else code to determine what file to export to ...

        myExporter = new JRXlsExporter();
        response.setContentType(FORMAT_CONTENTTYPE_MAP.get(format));
        myExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, response.getOutputStream());
        myExporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
        myExporter.exportReport();