问:
How can I insert data to two different tables from the same form?
the problem I have is the following:
I have a form to register in a web, which must send data to two tables (users_data and users_login).
The users_data table has as PK idUser
The users_login table has as FK idUser, to relate it with users_data.
How can I do so that when filling the form, it sends each data to its corresponding table?
I attach the code below

HTML - FORM

```<code><div class="container-form">
            <h4>REGISTRO DE USUARIO</h4>
            <form class="form" method="post" action="./router.php">
                <label>Nombre</label>
                <input class="controls" type="text" name="nombre" placeholder="Ingrese su nombre" required>
                <label>Apellidos</label>
                <input class="controls" type="text" name="apellidos" placeholder="Ingrese sus apellidos" required>
                <label>Correo electrónico</label>
                <input class="controls" type="email" name="email" placeholder="Ingrese su correo electrónico" title="example@example.com" required>
                <label>Teléfono</label>
                <input class="controls" maxlength="9" minlength="9" name="telefono" title="Sólo números" type="tel"  placeholder="Ingrese su número de teléfono" required pattern="[0-9]+">
                <label>Fecha de nacimiento</label>
                <input class="controls" type="date" name="fnac" placeholder="Ingrese su fecha de nacimiento" required title="DD/MM/YYYY">
                <label>Dirección</label>
                <input class="controls" type="text" name="direccion" placeholder="Ingrese su dirección">
                <label>Sexo</label>
                <input class="controls" type="text" name="sexo" placeholder="Ingrese su sexo">
                <label>Contraseña</label>
                <input class="controls" type="password" name="contrasena" required>
                <input class="btn btn-outline-primary btn-lg w-100 mt-4" type="submit" name="registrarse" value="Registrarme">
            </form>
            <div class="text-center mt-3">
                <p>¿Ya tienes una cuenta?</p>
                <a class="text-center" href="./login.php">Inicia sesión aqui</a>
            </div>
        </div>

const SERVIDOR = 'localhost';
const BD = 'trabajo_final_php';
const USUARIO = 'root';
const PASSWORD = 'root';

class DB
{

    public static function conn()
    {
        // conexión a la base de datos
        try {
            $conn = new PDO("mysql:host=" . SERVIDOR . ";dbname=" . BD, USUARIO, PASSWORD);
            $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            return $conn;
        } catch (PDOException $e) {
            echo 'HA FALLADO LA CONEXIÓN: ' . $e->getMessage();
        }
    }

    /**
     * Comprueba que un usuario existe en la DB y devuelve un array de objetos con los registros de la tupla (id,nombre,email,contrasena,rol)
     * @param type $email;
     * @return array
     */

    public static function comprobarUsuario($email)
    {
        $result = [];
        $conexion = self::conn();
        $sentencia = "SELECT * FROM users_data WHERE email = :email";
        $consulta = $conexion->prepare($sentencia);
        $consulta->execute(array(":email" => $email));
        while ($fila = $consulta->fetch(PDO::FETCH_OBJ)) {
            array_push($result, $fila);
        }
        $consulta->closeCursor();
        $conexion = null;
        return $result;
    }

    /**
     * Comprueba que un usuario existe en la DB y devuelve un array de objetos con los registros de la tupla (id,nombre,email,contrasena,rol)
     * @param type $id;
     * @return array
     */

    public static function buscarId($id)
    {
        $result = [];
        $conexion = self::conn();
        $sentencia = "SELECT * FROM users_data WHERE id = :id";
        $consulta = $conexion->prepare($sentencia);
        $consulta->execute(array(":id" => $id));
        while ($fila = $consulta->fetch(PDO::FETCH_OBJ)) {
            array_push($result, $fila);
        }
        $consulta->closeCursor();
        $conexion = null;
        return $result;
    }

    /**
     * inserta usuario en la tabla users_data (registro)
     * @param type $nombre; @param type $apellidos; @param type $email; @param type $telefono;
     * @param type $fnac; @param type $direccion; @param type $sexo; @param type $contrasena;
     */

    public static function registrar($nombre, $apellidos, $email, $telefono, $fnac, $direccion, $sexo)
    {
        $conexion = self::conn();
        $sentencia = "INSERT INTO users_data (nombre, apellidos, email, telefono, fnac, direccion, sexo) VALUES (:nombre, :apellidos, :email, :telefono, :fnac, :direccion, :sexo)";
        $consulta = $conexion->prepare($sentencia);
        $consulta->bindParam(":nombre", $nombre);
        $consulta->bindParam(":apellidos", $apellidos);
        $consulta->bindParam(":email", $email);
        $consulta->bindParam(":telefono", $telefono);
        $consulta->bindParam(":fnac", $fnac);
        $consulta->bindParam(":direccion", $direccion);
        $consulta->bindParam(":sexo", $sexo);
        $consulta->execute();
        $consulta->closeCursor();
        $conexion = null;
    }

    /**
     * inserta en la tabla users_login
     * @param type $contrasena
     * @param type $rol
     */

    public static function loginUsers($contrasena, $rol)
    {
        $conexion = self::conn();
        $sentencia = "INSERT INTO users_login (contrasena, rol) VALUES (:contrasena, :rol)";
        $rol = "user";
        $consulta = $conexion->prepare($sentencia);
        $consulta->bindParam(":contrasena", $contrasena);
        $consulta->bindParam(":rol", $rol);
        $consulta->execute();
        $consulta->closeCursor();
        $conexion = null;
    }

}

include './DB.php';

class ControllerLogin
{

    public function __construct()
    {
        session_start();
    }

    /**
     * inserta usuario en users_data (registro) si no lo esta ya registrado
     * @param type $nombre; @param type $apellidos; @param type $email; @param type $telefono;
     * @param type $fnac; @param type $direccion; @param type $sexo; @param type $contrasena;
     */

    public function registrarUsuario($nombre, $apellidos, $email, $telefono, $fnac, $direccion, $sexo, $contrasena, $rol)
    {
        $result = $this->buscarUsuario($email);
        if ($result[0]) {
            header('location:registro.php?registro=ko');
            exit();
        } else {
            DB::registrar($nombre, $apellidos, $email, $telefono, $fnac, $direccion, $sexo, $contrasena);
            DB::loginUsers($contrasena, $rol);
            $user = DB::comprobarUsuario($email);
            $_SESSION['usuario'] = [$user[0]->id, $user[0]->nombre, $user[0]->rol];
            header('location:./ControlPanel.php?registro=ok');
        }
    }

    /**
     * comprueba el login con el email y la contraseña
     * @param type $email;
     * @param type $contrasena;
     * @return type
     */

    public function comprobarUsuario($email, $contrasena = null)
    {
        // si encuentra el usuario la variable found devuelve true
        $found = false;
        $result = DB::comprobarUsuario($email);
        if (count($result) === 1) {
            if ($email === $result[0]->email && password_verify($contrasena, $result[0]->contrasena)) {
                $found = true;
            }
        }
        return [$found, ['id' => $result[0]->id, 'rol' => $result[0]->rol]];
    }

    /**
     * devuelve true si encuentra el usuario mediante el email
     * @param type $email;
     * @return type
     */

    public function buscarUsuario($email)
    {
        $found = false;
        $result = DB::comprobarUsuario($email);
        if (count($result) === 1) {
            $found = true;
        }
        return [$found];
    }
}

include './controllerLogin.php';

if (isset($_POST['registrarse'])) {
   $nombre = htmlspecialchars($_POST['nombre']);
   $apellidos = htmlspecialchars($_POST['apellidos']);
   $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
   $telefono = filter_input(INPUT_POST, 'telefono', FILTER_SANITIZE_NUMBER_INT);
   $fnac = htmlspecialchars($_POST['fnac']);
   $direccion = htmlspecialchars($_POST['direccion']);
   $sexo = htmlspecialchars($_POST['sexo']);
   $pass = htmlspecialchars($_POST['contrasena']);
   $contrasena = password_hash($pass, PASSWORD_BCRYPT);

   $reg = new ControllerLogin();
   $reg->registrarUsuario($nombre, $apellidos, $email, $telefono, $fnac, $direccion, $sexo, $contrasena, $rol);
   unset($reg);
}
</code>```

MYSQL

users_data contains the following data: idUser(PK), nombre, apellidos, email, telefono, fecha de nacimiento, direccion, sexo

users-login contains the following data: idLogin(PK), idUser(FK), usuario, contrasena, rol

in the users_login table, I would like the 'usuario' data to be the 'email' with which you register and insert in the users_data table

How can I insert each data in its corresponding table?
thank you in advance :)

I don't understand how to do this

Body:
the problem I have is the following:
I have a form to register in a web, which must send data to two tables (users_data and users_login).
The users_data table has as PK idUser
The users_login table has as FK idUser, to relate it with users_data.
How can I do so that when filling the form, it sends each data to its corresponding table?
I attach the code below

HTML - FORM

REGISTRO DE USUARIO

            <form class="form" method="post" action="./router.php">
                Nombre
                <input class="controls" type="text" name="nombre" placeholder="Ingrese su nombre" required>
                Apellidos
                <input class="controls" type="text" name="apellidos" placeholder="Ingrese sus apellidos" required>
                Correo electrónico
                <input class="controls" type="email" name="email" placeholder="Ingrese su correo electrónico" title="example@example.com" required>
                Teléfono
                <input class="controls" maxlength="9" minlength="9" name="telefono" title="Sólo números" type="tel"  placeholder="Ingrese su número de teléfono" required pattern="[0-9]+">
                Fecha de nacimiento
                <input class="controls" type="date" name="fnac" placeholder="Ingrese su fecha de nacimiento" required title="DD/MM/YYYY">
                Dirección
                <input class="controls" type="text" name="direccion" placeholder="Ingrese su dirección">
                Sexo
                <input class="controls" type="text" name="sexo" placeholder="Ingrese su sexo">
                Contraseña
                <input class="controls" type="password" name="contrasena" required>
                <input class="btn btn-outline-primary btn-lg w-100 mt-4" type="submit" name="registrarse" value="Registrarme">
            </form>

¿Ya tienes una cuenta?

                Inicia sesión aqui

const SERVIDOR = 'localhost';
const BD = 'trabajo_final_php';
const USUARIO = 'root';
const PASSWORD = 'root';

class DB
{

    public static function conn()
    {
        // conexión a la base de datos
        try {
            $conn = new PDO("mysql:host=" . SERVIDOR . ";dbname=" . BD, USUARIO, PASSWORD);
            $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            return $conn;
        } catch (PDOException $e) {
            echo 'HA FALLADO LA CONEXIÓN: ' . $e->getMessage();
        }
    }

    /**
     * Comprueba que un usuario existe en la DB y devuelve un array de objetos con los registros de la tupla (id,nombre,email,contrasena,rol)
     * @param type $email;
     * @return array
     */

    public static function comprobarUsuario($email)
    {
        $result = [];
        $conexion = self::conn();
        $sentencia = "SELECT * FROM users_data WHERE email = :email";
        $consulta = $conexion->prepare($sentencia);
        $consulta->execute(array(":email" => $email));
        while ($fila = $consulta->fetch(PDO::FETCH_OBJ)) {
            array_push($result, $fila);
        }
        $consulta->closeCursor();
        $conexion = null;
        return $result;
    }

    /**
     * Comprueba que un usuario existe en la DB y devuelve un array de objetos con los registros de la tupla (id,nombre,email,contrasena,rol)
     * @param type $id;
     * @return array
     */

    public static function buscarId($id)
    {
        $result = [];
        $conexion = self::conn();
        $sentencia = "SELECT * FROM users_data WHERE id = :id";
        $consulta = $conexion->prepare($sentencia);
        $consulta->execute(array(":id" => $id));
        while ($fila = $consulta->fetch(PDO::FETCH_OBJ)) {
            array_push($result, $fila);
        }
        $consulta->closeCursor();
        $conexion = null;
        return $result;
    }

    /**
     * inserta usuario en la tabla users_data (registro)
     * @param type $nombre; @param type $apellidos; @param type $email; @param type $telefono;
     * @param type $fnac; @param type $direccion; @param type $sexo; @param type $contrasena;
     */

    public static function registrar($nombre, $apellidos, $email, $telefono, $fnac, $direccion, $sexo)
    {
        $conexion = self::conn();
        $sentencia = "INSERT INTO users_data (nombre, apellidos, email, telefono, fnac, direccion, sexo) VALUES (:nombre, :apellidos, :email, :telefono, :fnac, :direccion, :sexo)";
        $consulta = $conexion->prepare($sentencia);
        $consulta->bindParam(":nombre", $nombre);
        $consulta->bindParam(":apellidos", $apellidos);
        $consulta->bindParam(":email", $email);
        $consulta->bindParam(":telefono", $telefono);
        $consulta->bindParam(":fnac", $fnac);
        $consulta->bindParam(":direccion", $direccion);
        $consulta->bindParam(":sexo", $sexo);
        $consulta->execute();
        $consulta->closeCursor();
        $conexion = null;
    }

    /**
     * inserta en la tabla users_login
     * @param type $contrasena
     * @param type $rol
     */

    public static function loginUsers($contrasena, $rol)
    {
        $conexion = self::conn();
        $sentencia = "INSERT INTO users_login (contrasena, rol) VALUES (:contrasena, :rol)";
        $rol = "user";
        $consulta = $conexion->prepare($sentencia);
        $consulta->bindParam(":contrasena", $contrasena);
        $consulta->bindParam(":rol", $rol);
        $consulta->execute();
        $consulta->closeCursor();
        $conexion = null;
    }

}

include './DB.php';

class ControllerLogin
{

    public function __construct()
    {
        session_start();
    }

    /**
     * inserta usuario en users_data (registro) si no lo esta ya registrado
     * @param type $nombre; @param type $apellidos; @param type $email; @param type $telefono;
     * @param type $fnac; @param type $direccion; @param type $sexo; @param type $contrasena;
     */

    public function registrarUsuario($nombre, $apellidos, $email, $telefono, $fnac, $direccion, $sexo, $contrasena, $rol)
    {
        $result = $this->buscarUsuario($email);
        if ($result[0]) {
            header('location:registro.php?registro=ko');
            exit();
        } else {
            DB::registrar($nombre, $apellidos, $email, $telefono, $fnac, $direccion, $sexo, $contrasena);
            DB::loginUsers($contrasena, $rol);
            $user = DB::comprobarUsuario($email);
            $_SESSION['usuario'] = [$user[0]->id, $user[0]->nombre, $user[0]->rol];
            header('location:./ControlPanel.php?registro=ok');
        }
    }

    /**
     * comprueba el login con el email y la contraseña
     * @param type $email;
     * @param type $contrasena;
     * @return type
     */

    public function comprobarUsuario($email, $contrasena = null)
    {
        // si encuentra el usuario la variable found devuelve true
        $found = false;
        $result = DB::comprobarUsuario($email);
        if (count($result) === 1) {
            if ($email === $result[0]->email && password_verify($contrasena, $result[0]->contrasena)) {
                $found = true;
            }
        }
        return [$found, ['id' => $result[0]->id, 'rol' => $result[0]->rol]];
    }

    /**
     * devuelve true si encuentra el usuario mediante el email
     * @param type $email;
     * @return type
     */

    public function buscarUsuario($email)
    {
        $found = false;
        $result = DB::comprobarUsuario($email);
        if (count($result) === 1) {
            $found = true;
        }
        return [$found];
    }
}

include './controllerLogin.php';

if (isset($_POST['registrarse'])) {
   $nombre = htmlspecialchars($_POST['nombre']);
   $apellidos = htmlspecialchars($_POST['apellidos']);
   $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
   $telefono = filter_input(INPUT_POST, 'telefono', FILTER_SANITIZE_NUMBER_INT);
   $fnac = htmlspecialchars($_POST['fnac']);
   $direccion = htmlspecialchars($_POST['direccion']);
   $sexo = htmlspecialchars($_POST['sexo']);
   $pass = htmlspecialchars($_POST['contrasena']);
   $contrasena = password_hash($pass, PASSWORD_BCRYPT);

   $reg = new ControllerLogin();
   $reg->registrarUsuario($nombre, $apellidos, $email, $telefono, $fnac, $direccion, $sexo, $contrasena, $rol);
   unset($reg);
}

MYSQL

users_data contains the following data: idUser(PK), nombre, apellidos, email, telefono, fecha de nacimiento, direccion, sexo

users-login contains the following data: idLogin(PK), idUser(FK), usuario, contrasena, rol

in the users_login table, I would like the 'usuario' data to be the 'email' with which you register and insert in the users_data table

How can I insert each data in its corresponding table?
thank you in advance :)

I don't understand how to do this


来源: stackexchange

问:
How to append logs in TimedRotatingFileHandler log?
I have created a log with timedrotatingfilehandler (). And my scenario is it will log 30 minutes once. but every 30 mins while logging , the log file gets overwritten instead of appending to old logged ones.

```<code>logHandler = handlers.TimedRotatingFileHandler(log_file, when='D', interval=1, backupCount=1)
</code>```

Is my syntax is right?

ContentLicense: CC BY-SA 4.0

Body:
I have created a log with timedrotatingfilehandler (). And my scenario is it will log 30 minutes once. but every 30 mins while logging , the log file gets overwritten instead of appending to old logged ones.

logHandler = handlers.TimedRotatingFileHandler(log_file, when='D', interval=1, backupCount=1)

Is my syntax is right?


问:
NotImplementedError when try to start Playwright browser via NiceGui
Error NotImplementedError raises when I try to start Playwright browser "context" by clicking NiceGui button. I also use Thread for multibrowsing in future.

nicegui_program.py

    from nicegui import ui
    from threading import Thread
    from example import start_browser

    ui.button('Start browser', on_click=browser)
    def browser():
        thread2 = Thread(target=start_browser)
        thread2.start()
```
<p>example.py</p>
<pre class="lang-py prettyprint-override"><code>    from playwright.async_api import async_playwright

    def start_browser():
      asyncio.run(main())

    async def main():
      browser_instance = await async_playwright().start()
</code>```

Last row raises the error NotImplementedError exception: no description

using the "with" construction also raises the error

async with async_playwright() as p:
```

Body:
Error NotImplementedError raises when I try to start Playwright browser "context" by clicking NiceGui button. I also use Thread for multibrowsing in future.

nicegui_program.py

    from nicegui import ui
    from threading import Thread
    from example import start_browser

    ui.button('Start browser', on_click=browser)
    def browser():
        thread2 = Thread(target=start_browser)
        thread2.start()

example.py

    from playwright.async_api import async_playwright

    def start_browser():
      asyncio.run(main())

    async def main():
      browser_instance = await async_playwright().start()

Last row raises the error NotImplementedError exception: no description

using the "with" construction also raises the error

async with async_playwright() as p:


问:
How to import TXT name lists into MYSQL column from beginning
I have a table categories having 12 rows all are having data.

I created a new column name_eslang and trying to import name.txt file which is havng:

```<code>apple
banana
orange
kiwi
</code>```

each names is in next line.

Using:

```<code>LOAD DATA INFILE 'name.txt' INTO TABLE categories
  FIELDS TERMINATED BY ''
  LINES TERMINATED BY '\r\n' (name_eslang);
</code>```

Problem: all values from name.txt file are inserted but after ID 7, and I want it to be inserted from ID 1 to 6 instead.

My table catgeories:

```<code>CREATE TABLE `categories` (
  `id` int(11) UNSIGNED NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `name_eslang` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

INSERT INTO `categories` (`id`, `name`, `name_eslang`) VALUES
(1, 'Accessories', ''),
(2, 'Cover', ''),
(3, 'Logos', ''),
(4, 'Story', ''),
(5, 'Editing', ''),
(6, 'Gaming', '');

ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `id` (`id`),
  ADD KEY `name` (`name`);

ALTER TABLE `categories`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
</code>```

Body:
I have a table categories having 12 rows all are having data.

I created a new column name_eslang and trying to import name.txt file which is havng:

apple
banana
orange
kiwi

each names is in next line.

Using:

LOAD DATA INFILE 'name.txt' INTO TABLE categories
  FIELDS TERMINATED BY ''
  LINES TERMINATED BY '\r\n' (name_eslang);

Problem: all values from name.txt file are inserted but after ID 7, and I want it to be inserted from ID 1 to 6 instead.

My table catgeories:

CREATE TABLE `categories` (
  `id` int(11) UNSIGNED NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `name_eslang` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

INSERT INTO `categories` (`id`, `name`, `name_eslang`) VALUES
(1, 'Accessories', ''),
(2, 'Cover', ''),
(3, 'Logos', ''),
(4, 'Story', ''),
(5, 'Editing', ''),
(6, 'Gaming', '');

ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `id` (`id`),
  ADD KEY `name` (`name`);

ALTER TABLE `categories`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;


问:
Date field and React Select inside MUI Drawer resets when the drawer closes React.js
I have a drawer that pops out when I click on a button and it contains some filtering fields. The fields I have are HTML input field, date field and React-Select field. What I do is I open the drawer, I apply the filter and then get back to my table by clicking away from the drawer and everything works fine.
The problem arises when I re-open the drawer. The filters are still applied but the selected filtering options are cleared out of their respective filter fields. For example: I open the drawer and choose a date from the date filter then I can see the table is rearranged to reflect the filter, then I close the filter but when I re-open the drawer the date field is showing an empty field but the filter is still applied.
So my question is can I make the selected filter value stick even if I close and re-open the drawer. I have added the drawer code if it helps my case

```<code>        <Drawer
            anchor="right"
            onClose={handleDrawerToggle}
            open={isDrawerOpen}
            PaperProps={{
                sx: {
                    width: 280
                }
            }}
        >
            <PerfectScrollbar component="div" style={{"padding": "20px 10px"}}>
                <Grid container rowSpacing={2}>
                    // HERE ARE THE FILTER FIELDS
                </Grid>
            </PerfectScrollbar>
        </Drawer>
</code>```

Funny enough input fields with "text" type do not reset.

Body:
I have a drawer that pops out when I click on a button and it contains some filtering fields. The fields I have are HTML input field, date field and React-Select field. What I do is I open the drawer, I apply the filter and then get back to my table by clicking away from the drawer and everything works fine.
The problem arises when I re-open the drawer. The filters are still applied but the selected filtering options are cleared out of their respective filter fields. For example: I open the drawer and choose a date from the date filter then I can see the table is rearranged to reflect the filter, then I close the filter but when I re-open the drawer the date field is showing an empty field but the filter is still applied.
So my question is can I make the selected filter value stick even if I close and re-open the drawer. I have added the drawer code if it helps my case

        <Drawer
            anchor="right"
            onClose={handleDrawerToggle}
            open={isDrawerOpen}
            PaperProps={{
                sx: {
                    width: 280
                }
            }}
        >
            <PerfectScrollbar component="div" style={{"padding": "20px 10px"}}>
                <Grid container rowSpacing={2}>
                    // HERE ARE THE FILTER FIELDS
                </Grid>
            </PerfectScrollbar>
        </Drawer>

Funny enough input fields with "text" type do not reset.


问:
How to index match for calculations in python and or pandas?
I'm trying to perform calculations between two dataframes (DF).
I want to divide all numbers in DF2 by the matching letter numbers in DF1 and produce DF3 with those results.
DF1 acts as a "dictionary" of values while DF2 has 1000 values for each column/index.

DF1 (I dont' mind having it in different format, or if it is an object other than a dataframe)
| A | B | C |
| - | - | - |
| 2 | 3 | 4 |

DF2 (assume it has 10000 rows for each letter)
| A | B | C |
| - | - | - |
| 8 | 7 | 9 |
| 4 | 2 | 3 |
| 6 | 5 | 6 |

So again, I'm looking to divide all row values in DF2 A column by the corresponding A value (2) in DF1 and so for the other letters.
I know I can figure out a loop for this but I was wondering if there is a celaner or more efficient method.


问:
Git fatal: failed to expand user dir in: '~.-gitignore_global'
I'm a newbie and tried to create a gitignore file, instead of that I run this command:

```<code>$ git config --global core.excludesfile ~/.gitignore_global
</code>```

I don't see my repo anymore, please send help.

Don't know what to do.

Body:
I'm a newbie and tried to create a gitignore file, instead of that I run this command:

$ git config --global core.excludesfile ~/.gitignore_global

I don't see my repo anymore, please send help.

Don't know what to do.


问:
Getting unauthorized_client response when creating social login with Microsoft using python package drf-msal-jwt
When trying to create social login with django and python package drf-msal-jwt using Azure I get the following error

I tried many ways. This is my apps manifest page is there anything i need to change.

```<code>{
"id": "1234567-1234-12l3-afe5-b01aa8cea588",
"acceptMappedClaims": null,
"accessTokenAcceptedVersion": 2,
"addIns": [],
"allowPublicClient": null,
"appId": "de345rft-iok8-42hy-86bb-3124ahhgfts4d",
"appRoles": [],
"oauth2AllowUrlPathMatching": false,
"createdDateTime": "2020-12-14T12:06:13Z",
"description": null,
"certification": null,
"disabledByMicrosoftStatus": null,
"groupMembershipClaims": null,
"identifierUris": [],
"informationalUrls": {
"termsOfService": null,
"support": null,
"privacy": null,
"marketing": null
},
"keyCredentials": [],
"knownClientApplications": [],
"logoUrl": null,
"logoutUrl": null,
"name": "app",
"notes": null,
"oauth2AllowIdTokenImplicitFlow": false,
"oauth2AllowImplicitFlow": false,
"oauth2Permissions": [],
"oauth2RequirePostResponse": false,
"optionalClaims": null,
"orgRestrictions": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [
{
"customKeyIdentifier": null,
"endDate": "2024-12-14T12:09:51.944Z",
"keyId": "e1fe6rrr-ba31-4d61-89e7-12345iy5697j",
"startDate": "2022-12-14T12:09:51.944Z",
"value": null,
"createdOn": "2022-12-14T12:10:32.7193321Z",
"hint": "T9w",
"displayName": "secret"
}
],
"preAuthorizedApplications": [],
"publisherDomain": "testemail@outlook.com",
"replyUrlsWithType": [
{
"url": "http://localhost:8000/",
"type": "Web"
},
{
"url": "http://localhost:5000/getAToken",
"type": "Web"
}
],
"requiredResourceAccess": [
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "e1fe6dd8-ba31-4d61-89e7-88639iy5697j",
"type": "Scope"
}
]
}
],
"samlMetadataUrl": null,
"signInUrl": null,
"signInAudience": "AzureADandPersonalMicrosoftAccount",
"tags": [],
"tokenEncryptionKeyId": null
}

</code>```

What i needed was when a new user visits our website we will be get a registration page with
a button with text "Sign in with Microsoft" and when the user clicks on this button
he will be redirected to a Microsoft login page,
where the user will give his Microsoft credentials(outlook email account credentials),
after that the user will be successfully signed in

For this purpose I wanted these API's

A GET API to get the redirect page link after the user clicks the "Sign in with Microsoft"

A POST API verify the code and state and get the access token

A POST API to get the refresh token

After Login with the response of the 1st API i get the above error.
What I want is that I want to login successfully.

Body:
When trying to create social login with django and python package drf-msal-jwt using Azure I get the following error

I tried many ways. This is my apps manifest page is there anything i need to change.

{
"id": "1234567-1234-12l3-afe5-b01aa8cea588",
"acceptMappedClaims": null,
"accessTokenAcceptedVersion": 2,
"addIns": [],
"allowPublicClient": null,
"appId": "de345rft-iok8-42hy-86bb-3124ahhgfts4d",
"appRoles": [],
"oauth2AllowUrlPathMatching": false,
"createdDateTime": "2020-12-14T12:06:13Z",
"description": null,
"certification": null,
"disabledByMicrosoftStatus": null,
"groupMembershipClaims": null,
"identifierUris": [],
"informationalUrls": {
"termsOfService": null,
"support": null,
"privacy": null,
"marketing": null
},
"keyCredentials": [],
"knownClientApplications": [],
"logoUrl": null,
"logoutUrl": null,
"name": "app",
"notes": null,
"oauth2AllowIdTokenImplicitFlow": false,
"oauth2AllowImplicitFlow": false,
"oauth2Permissions": [],
"oauth2RequirePostResponse": false,
"optionalClaims": null,
"orgRestrictions": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [
{
"customKeyIdentifier": null,
"endDate": "2024-12-14T12:09:51.944Z",
"keyId": "e1fe6rrr-ba31-4d61-89e7-12345iy5697j",
"startDate": "2022-12-14T12:09:51.944Z",
"value": null,
"createdOn": "2022-12-14T12:10:32.7193321Z",
"hint": "T9w",
"displayName": "secret"
}
],
"preAuthorizedApplications": [],
"publisherDomain": "testemail@outlook.com",
"replyUrlsWithType": [
{
"url": "http://localhost:8000/",
"type": "Web"
},
{
"url": "http://localhost:5000/getAToken",
"type": "Web"
}
],
"requiredResourceAccess": [
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "e1fe6dd8-ba31-4d61-89e7-88639iy5697j",
"type": "Scope"
}
]
}
],
"samlMetadataUrl": null,
"signInUrl": null,
"signInAudience": "AzureADandPersonalMicrosoftAccount",
"tags": [],
"tokenEncryptionKeyId": null
}

What i needed was when a new user visits our website we will be get a registration page with
a button with text "Sign in with Microsoft" and when the user clicks on this button
he will be redirected to a Microsoft login page,
where the user will give his Microsoft credentials(outlook email account credentials),
after that the user will be successfully signed in

For this purpose I wanted these API's

A GET API to get the redirect page link after the user clicks the "Sign in with Microsoft"

A POST API verify the code and state and get the access token

A POST API to get the refresh token

After Login with the response of the 1st API i get the above error.
What I want is that I want to login successfully.


问:
Cypress Component Testing does not use the customWebpackConfig in NX Workspace with my angular application
I am trying to set up cypress component testing in my NX workspace with an angular application.

It does work so far, the only issue I have right now, is that it does not use my custom-webpack configuration, where I am adding a yaml loader to the angular webpack config.

I already upgraded my angular.json to the newer standard, where it creates project.json files within the apps, but nothing worked so far.

Here are my current configurations:

webpack.custom.js

module.exports = (config) => {

  config.module.rules.push({
    test: /\.yaml$/,
    use: [
      {
        loader: "json-loader"
      },
      {
        loader: "yaml-loader"
      }
    ]
  });

  return config;
};
```
<p><strong>project.json</strong></p>
```
{
  "projectType": "application",
  "generators": {
    "@schematics/angular:component": {
      "style": "scss"
    }
  },
  "sourceRoot": "apps/test-appliction/src",
  "prefix": "app",
  "targets": {
    "build": {
      "executor": "@nrwl/angular:webpack-browser",
      "options": {
        "optimization": false,
        "sourceMap": true,
        "customWebpackConfig": {
          "path": "../../webpack.custom.js"
        },
        "outputPath": "dist/apps/test-appliction",
        "index": "apps/test-appliction/src/index.html",
        "main": "apps/test-appliction/src/client",
        "polyfills": "apps/test-appliction/src/polyfills.ts",
        "tsConfig": "apps/test-appliction/tsconfig.browser.json",
        "aot": true,
      }
    },
    "component-test": {
      "executor": "@nrwl/cypress:cypress",
      "options": {
        "cypressConfig": "apps/tes-application/cypress.config.ts",
        "testingType": "component",
        "skipServe": true,
        "devServerTarget": "test-application:build"
      }
    }
  }
}

```
<p><strong>cypress.config.ts</strong></p>
<pre class="lang-js prettyprint-override"><code>import { defineConfig } from 'cypress';
import { nxComponentTestingPreset } from '@nrwl/angular/plugins/component-testing';

export default defineConfig({
  e2e: { baseUrl: 'http://localhost:4000' },
  component: {
    ...nxComponentTestingPreset(__filename),
    // extra options here
    viewportWidth: 1024,
    viewportHeight: 768

  }
});
</code>```

The behaviour I see is that the custom-webpack config is just ignored. If I start the angular-application with nx serve the custom configuration is used and it works fine.
But if I start the component-test build it doesnt use the config, and my yaml-files are not loaded.

I debugged into the cypress.config.ts and the result of defineConfig(...) has an object which looks like this:

```<code>devServer.options.projectConfig.buildOptions.customWebpackConfig = { path: "../../webpack.custom.js" }
</code>```

Still, the custom config is not used.

Is anybody having the same issue, with custom webpack configurations and component testing in cypress and angular?

Is there another method I could add my yaml-loader to the webpack config?

Thanks in advance

Body:
I am trying to set up cypress component testing in my NX workspace with an angular application.

It does work so far, the only issue I have right now, is that it does not use my custom-webpack configuration, where I am adding a yaml loader to the angular webpack config.

I already upgraded my angular.json to the newer standard, where it creates project.json files within the apps, but nothing worked so far.

Here are my current configurations:

webpack.custom.js

module.exports = (config) => {

  config.module.rules.push({
    test: /\.yaml$/,
    use: [
      {
        loader: "json-loader"
      },
      {
        loader: "yaml-loader"
      }
    ]
  });

  return config;
};

project.json

{
  "projectType": "application",
  "generators": {
    "@schematics/angular:component": {
      "style": "scss"
    }
  },
  "sourceRoot": "apps/test-appliction/src",
  "prefix": "app",
  "targets": {
    "build": {
      "executor": "@nrwl/angular:webpack-browser",
      "options": {
        "optimization": false,
        "sourceMap": true,
        "customWebpackConfig": {
          "path": "../../webpack.custom.js"
        },
        "outputPath": "dist/apps/test-appliction",
        "index": "apps/test-appliction/src/index.html",
        "main": "apps/test-appliction/src/client",
        "polyfills": "apps/test-appliction/src/polyfills.ts",
        "tsConfig": "apps/test-appliction/tsconfig.browser.json",
        "aot": true,
      }
    },
    "component-test": {
      "executor": "@nrwl/cypress:cypress",
      "options": {
        "cypressConfig": "apps/tes-application/cypress.config.ts",
        "testingType": "component",
        "skipServe": true,
        "devServerTarget": "test-application:build"
      }
    }
  }
}

cypress.config.ts

import { defineConfig } from 'cypress';
import { nxComponentTestingPreset } from '@nrwl/angular/plugins/component-testing';

export default defineConfig({
  e2e: { baseUrl: 'http://localhost:4000' },
  component: {
    ...nxComponentTestingPreset(__filename),
    // extra options here
    viewportWidth: 1024,
    viewportHeight: 768

  }
});

The behaviour I see is that the custom-webpack config is just ignored. If I start the angular-application with nx serve the custom configuration is used and it works fine.
But if I start the component-test build it doesnt use the config, and my yaml-files are not loaded.

I debugged into the cypress.config.ts and the result of defineConfig(...) has an object which looks like this:

devServer.options.projectConfig.buildOptions.customWebpackConfig = { path: "../../webpack.custom.js" }

Still, the custom config is not used.

Is anybody having the same issue, with custom webpack configurations and component testing in cypress and angular?

Is there another method I could add my yaml-loader to the webpack config?

Thanks in advance


问:
How to run files from every folder in PHP?
I have a main folder project name socialNetwork. In this folder, I have 3 folder name application, database, and view. folder view has 2 folders views and page. These folders have files php. Now if I want to run the file from view folder I have to be inPSC:\PhpstormProject\socialNetwork\> and use php view/page/profile.php. If I run PSC:\PhpstormProject\socialNetwork\view> and use php page/profile.php show me the error Could not open input file: page/profile.php. So what can I do to run files from every folder, because now I can only from the main project folder?


问:
RTMP Stream from Android Device to Wowza
I want to stream RTMP from my Android application to my Wowza server. How would this be possible?

Thanks

ContentLicense: CC BY-SA 3.0


问:
"Unhandled error" appears in the console while the error is well handled
I started to learn how to use the Vue.js framework a little while ago, and I got stuck with this situation.

I use the jQuery.ajax() method to make requests to a web api. For each of these ajax requests (I'll use the login request as an example), in case of error, I redirect the code to a function called callbackError like this:

```<code>async login() {
    await $.ajax({
        type: 'post',
        url: `${this.$ROOT_API}/Users/login/${this.username}/${this.password}`,
        dataType: 'text',
        success: this.loginSuccessCallback,
        error: this.callbackError
    });
}
</code>```

The callbackError() function simply displays an error popup.

```<code>callbackError(request, status, error) {
    Swal.fire({
        title: 'Error',
        icon: 'error',
        text: `${request} ${status} ${error}`,
        confirmButtonText: '<i class="fa-solid fa-check"></i>',
        background: this.$COLORS.navbar,
        color: this.$COLORS.font,
        confirmButtonColor: this.$COLORS.primary
    })
}
</code>```

Now, if I cause an error during the connection by entering a wrong password, the popup is displayed correctly (I know it's not very telling, I'll fix it later).

But despite the fact that the popup was displayed, which proves that the error was handled, I still have these error messages in the console that tell me that there was an unhandled error:

Honestly I don't even know what to try to fix the problem I just feel like my browser is blatantly lying to me that I didn't handle the error.

PS : I don't have the Ghostery extension so I don't think it's the same problem as on this question:
"A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received", What does that mean?

UPDATE :

I now use the axios library to make my requests to the web api, and it works fine.

```<code>async loginAsync() {
    await axios({
        method: 'post',
        url: `api/Users/login/${this.username}/${this.password}`
    })
    .then(response => this.loginSuccessCallback(response))
    .catch(error => this.$CALLBACK_ERROR(error))
}
</code>```

Body:
I started to learn how to use the Vue.js framework a little while ago, and I got stuck with this situation.

I use the jQuery.ajax() method to make requests to a web api. For each of these ajax requests (I'll use the login request as an example), in case of error, I redirect the code to a function called callbackError like this:

async login() {
    await $.ajax({
        type: 'post',
        url: `${this.$ROOT_API}/Users/login/${this.username}/${this.password}`,
        dataType: 'text',
        success: this.loginSuccessCallback,
        error: this.callbackError
    });
}

The callbackError() function simply displays an error popup.

callbackError(request, status, error) {
    Swal.fire({
        title: 'Error',
        icon: 'error',
        text: `${request} ${status} ${error}`,
        confirmButtonText: '',
        background: this.$COLORS.navbar,
        color: this.$COLORS.font,
        confirmButtonColor: this.$COLORS.primary
    })
}

Now, if I cause an error during the connection by entering a wrong password, the popup is displayed correctly (I know it's not very telling, I'll fix it later).

But despite the fact that the popup was displayed, which proves that the error was handled, I still have these error messages in the console that tell me that there was an unhandled error:

Honestly I don't even know what to try to fix the problem I just feel like my browser is blatantly lying to me that I didn't handle the error.

PS : I don't have the Ghostery extension so I don't think it's the same problem as on this question:
"A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received", What does that mean?

UPDATE :

I now use the axios library to make my requests to the web api, and it works fine.

async loginAsync() {
    await axios({
        method: 'post',
        url: `api/Users/login/${this.username}/${this.password}`
    })
    .then(response => this.loginSuccessCallback(response))
    .catch(error => this.$CALLBACK_ERROR(error))
}


问:
How do I check in javascript if my html checkbox is checked in html
I'm currently working on a library project, where you have a form where you put different information about a book, and also you have to check a checkbox if you have read the book. Well, the thing that I want to do is, if the checkbox is checked, I want the text content that is gonna be displayed in the html to be Read or if the checbox ain't checked the text content to be Not read. Thanks in advance, and sorry if this question bothers anyone

function intakeFormData() {
  let Title = document.getElementById("Title").value;
  let Author = document.getElementById("Author").value;
  let Pages = document.getElementById("Pages").value;
  let Read = document.getElementById("Read").value;
  if (Read === true) {
    Read.textContent = "Read";

  } else {
    Read.textContent = "Not read";
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><body>
  <div class="container">
    <div class="form-heading">
      <h1>Add new book to the library</h1>
    </div>
    <div class="books-heading">
      <h1>Current books in the library</h1>
    </div>
    <div class="form">
      <button class="add-book-button">Add new book</button>
      <div id="add-book-form" style="display:none">
        <form id="add-book">
          <label for="Title">Title:</label>
          <input type="text" id="Title" name="Title" />
          <label for="Author">Author:</label>
          <input type="text" id="Author" name="Author" />
          <label for="Pages">Pages:</label>
          <input type="number" id="Pages" name="Pages" />
          <div class="is-read"><label for="Read">Have you read it?</label>
            <input class="checkbox" type="checkbox" id="Read" name="Read" />
          </div>

        </form>
        <button type="submit" class="submit-button">Submit to library</button>
        <button type="reset" class="reset-button">Reset</button>
      </div>
    </div>
    <div class="books"></div>
  </div>
</body></code>```

Body:
I'm currently working on a library project, where you have a form where you put different information about a book, and also you have to check a checkbox if you have read the book. Well, the thing that I want to do is, if the checkbox is checked, I want the text content that is gonna be displayed in the html to be Read or if the checbox ain't checked the text content to be Not read. Thanks in advance, and sorry if this question bothers anyone

function intakeFormData() {
  let Title = document.getElementById("Title").value;
  let Author = document.getElementById("Author").value;
  let Pages = document.getElementById("Pages").value;
  let Read = document.getElementById("Read").value;
  if (Read === true) {
    Read.textContent = "Read";

  } else {
    Read.textContent = "Not read";
  }
}

Add new book to the library

Current books in the library

      <button class="add-book-button">Add new book</button>

        <form id="add-book">
          Title:
          <input type="text" id="Title" name="Title" />
          Author:
          <input type="text" id="Author" name="Author" />
          Pages:
          <input type="number" id="Pages" name="Pages" />

Have you read it?
            <input class="checkbox" type="checkbox" id="Read" name="Read" />

        </form>
        <button type="submit" class="submit-button">Submit to library</button>
        <button type="reset" class="reset-button">Reset</button>


问:
Nuxt build errors (sass loader related?) when running run build but run dev compiles
My repo for anyone to have a look: https://gitlab.com/gkurl/vapedcrusader

Node version 16.18.1.

Getting a nuxt build error when I run yarn run build (dev works fine):

```<code>ERROR in ./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss& (./node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--7-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--7-oneOf-1-3!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss&)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
ParserError: Syntax Error at line: 1, column 23
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/components/AppNavigation.vue:1:198660
    at Parser.error (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:127:11)
    at Parser.operator (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:162:20)
    at Parser.parseTokens (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:245:14)
    at Parser.loop (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:132:12)
    at Parser.parse (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:51:17)
    at parse (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-custom-properties/index.cjs.js:47:30)
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-custom-properties/index.cjs.js:333:24
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:194:18
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:139:18
    at Rule.each (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:105:16)
    at Rule.walk (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:135:17)
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:152:24
    at Root.each (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:105:16)
    at Root.walk (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:135:17)
    at Root.walkDecls (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:192:19)
    at transformProperties (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-custom-properties/index.cjs.js:330:8)
    at Object.syncTransform [as plugin] (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-custom-properties/index.cjs.js:522:5)
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-preset-env/index.js:459:97
 @ ./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss& (./node_modules/vue-style-loader??ref--7-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--7-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--7-oneOf-1-3!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss&) 4:14-450
 @ ./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss&
 @ ./components/AppNavigation.vue
 @ ./layouts/default.vue
 @ ./.nuxt/App.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/client.js

 FATAL  Nuxt build error                                                                                12:39:57

  at WebpackBundler.webpackCompile (node_modules/@nuxt/webpack/dist/webpack.js:2127:21)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:2076:5)
  at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:327:5)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-build.js:110:7)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:413:7)
</code>```

Tried different sass-loader tweaks etc. Not to sure what the issue is. Any insight would be appreciated.

Body:
My repo for anyone to have a look: https://gitlab.com/gkurl/vapedcrusader

Node version 16.18.1.

Getting a nuxt build error when I run yarn run build (dev works fine):

ERROR in ./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss& (./node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--7-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--7-oneOf-1-3!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss&)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
ParserError: Syntax Error at line: 1, column 23
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/components/AppNavigation.vue:1:198660
    at Parser.error (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:127:11)
    at Parser.operator (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:162:20)
    at Parser.parseTokens (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:245:14)
    at Parser.loop (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:132:12)
    at Parser.parse (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-values-parser/lib/parser.js:51:17)
    at parse (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-custom-properties/index.cjs.js:47:30)
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-custom-properties/index.cjs.js:333:24
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:194:18
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:139:18
    at Rule.each (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:105:16)
    at Rule.walk (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:135:17)
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:152:24
    at Root.each (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:105:16)
    at Root.walk (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:135:17)
    at Root.walkDecls (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss/lib/container.js:192:19)
    at transformProperties (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-custom-properties/index.cjs.js:330:8)
    at Object.syncTransform [as plugin] (/Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-custom-properties/index.cjs.js:522:5)
    at /Users/gkurl/Documents/vapedcrusader-frontend/vapedcrusader/node_modules/postcss-preset-env/index.js:459:97
 @ ./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss& (./node_modules/vue-style-loader??ref--7-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--7-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--7-oneOf-1-3!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss&) 4:14-450
 @ ./components/AppNavigation.vue?vue&type=style&index=0&id=15d18dee&prod&lang=scss&
 @ ./components/AppNavigation.vue
 @ ./layouts/default.vue
 @ ./.nuxt/App.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/client.js

 FATAL  Nuxt build error                                                                                12:39:57

  at WebpackBundler.webpackCompile (node_modules/@nuxt/webpack/dist/webpack.js:2127:21)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:2076:5)
  at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:327:5)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-build.js:110:7)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:413:7)

Tried different sass-loader tweaks etc. Not to sure what the issue is. Any insight would be appreciated.


问:
How can I set the x-axis label of the error bar not to overlap in ggplot?
How do I set each category of values on the x-axis not to overlap?(cen-con-lib)

Also, I want to change the color of each category (e.g., assigning con to red) How can I change it?
enter image description here
`

```<code>## Visualization
STM_estimate %>%
  ggplot(aes(x=covariate.value, y=estimate, color= covariate.value))+
  geom_point(size=2)+
  geom_errorbar(aes(ymin=ci.lower, ymax=ci.upper),width = .2)+ #error bar-geom_errorbar
  theme_bw()+
  scale_color_fivethirtyeight()+
  facet_grid(~topic)
</code>```

`

Thank you in advance!!

Body:
How do I set each category of values on the x-axis not to overlap?(cen-con-lib)

Also, I want to change the color of each category (e.g., assigning con to red) How can I change it?
enter image description here
`

## Visualization
STM_estimate %>%
  ggplot(aes(x=covariate.value, y=estimate, color= covariate.value))+
  geom_point(size=2)+
  geom_errorbar(aes(ymin=ci.lower, ymax=ci.upper),width = .2)+ #error bar-geom_errorbar
  theme_bw()+
  scale_color_fivethirtyeight()+
  facet_grid(~topic)

`

Thank you in advance!!


问:
Using imgkit to convert hindi content HTML to image
I am converting an HTML string

```<code><!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8" />
            <title>HTML, CSS and JavaScript demo</title>
            <link rel="preconnect" href="https://fonts.googleapis.com">
            <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
            <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@300;400&display=swap" rel="stylesheet">
            <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;700&display=swap" rel="stylesheet">
            <link href='https://fonts.googleapis.com/css?family=Anek Latin:wght@300;400;700&display=swap' rel='stylesheet'>
        </head>
        <body style="font-family: "Anek Latin","Cairo", sans-serif;line-height: 1.0;font-size: 55px;">
            <!-- Start your code here -->
            <section class="section content" style="padding: 24px 36px;">
            <div class="row-1" style="display: flex">
                <div class="tags" style="display: flex;font-size: 27px;text-transform: uppercase;line-height: normal;">
                <p style="padding: 0; margin: 2px 2px; font-weight: 400;margin-left:40px;">World</p>
                <p style="padding: 0; margin: 2px 2px; font-weight: 400;">></p>
                <p style="padding: 0; margin: 2px 2px; font-weight: 400;">India &nbsp|</p>
                </div>
                &nbsp
                <div class="image-credits" style="display: flex;font-size: 27px;text-transform: uppercase;line-height: normal;">
                <p style="padding: 0; margin: 2px 2px">Photo Credit:</p>
                <p style="padding: 0; margin: 2px 2px"></p>
                </div>
            </div>
            <p class="title" style="color: #6d44bc;padding: 0;margin: 2px 2px;margin-left:40px;font-weight: 600;line-height: 1.0;">
                बड़ी टेक कंपनियों में बड़े पैमाने पर छंटनी जारी है
            </p>
            <div class="summary" style="font-size: 38px;line-height:1.3;">
                <ul style="margin: 4px 4px;">

    <li>
        <p style='font-weight: 400 !important;margin: 10px 0 !important;'>
        फेसबुक, इंस्टाग्राम और व्हाट्सएप की मूल कंपनी ने अपने कार्यबल में 13 प्रतिशत की कमी की और अगले साल की पहली तिमाही तक हायरिंग फ्रीज को बढ़ा दिया।</p>
    </li>

    <li>
        <p style='font-weight: 400 !important;margin: 10px 0 !important;'>
        छंटनी विभागों और क्षेत्रों में की गई, भर्ती और व्यावसायिक टीमों जैसे क्षेत्रों में दूसरों की तुलना में अधिक प्रभावित हुए।</p>
    </li>

    <li>
        <p style='font-weight: 400 !important;margin: 10px 0 !important;'>
        फेसबुक, इंस्टाग्राम और व्हाट्सएप की मूल कंपनी ने अपने कार्यबल में 13 प्रतिशत की कमी की और अगले साल की पहली तिमाही तक हायरिंग फ्रीज को बढ़ा दिया।</p>
    </li>

                </ul>
            </div>
            <div class="image-credits footer" style="display: flex;font-size: 27px;margin-left:40px;text-transform: uppercase;line-height: normal;padding-inline-start: 40px;">
                <p style="padding: 0; margin: 2px 2px"; font-weight: 400;>Content Credit:</p>
                <p style="padding: 0; margin: 2px 2px"; font-weight: 400;> | </p>
            </div>
            </section>
        </body>
    </html>
</code>```

I am using following code snippet to convert it to image.

```<code>options = {
        "format": 'jpg',
        "xvfb": "",
        "zoom": 1,
        "width": 964,
        "height": 1000,
        "quality": 100,
        "encoding": "UTF-8"
    }
imgkit.from_string(html_body, HTML_IMAGE_TEMP_LOCATION["full_url"], options=options)
</code>```

where html_body contains the HTML string provided above and HTML_IMAGE_TEMP_LOCATION["full_url"] is the full path to temporary image file.

The resulting output is:

I've tried including different fonts that support hindi script but the response is same. Is there something I am missing on ?

Body:
I am converting an HTML string

<!DOCTYPE html>

            <meta charset="UTF-8" />
            <title>HTML, CSS and JavaScript demo</title>
            <link rel="preconnect" href="https://fonts.googleapis.com">
            <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
            <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@300;400&display=swap" rel="stylesheet">
            <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;700&display=swap" rel="stylesheet">
            <link href='https://fonts.googleapis.com/css?family=Anek Latin:wght@300;400;700&display=swap' rel='stylesheet'>

World

>

India &nbsp|

                &nbsp

Photo Credit:

                बड़ी टेक कंपनियों में बड़े पैमाने पर छंटनी जारी है

        फेसबुक, इंस्टाग्राम और व्हाट्सएप की मूल कंपनी ने अपने कार्यबल में 13 प्रतिशत की कमी की और अगले साल की पहली तिमाही तक हायरिंग फ्रीज को बढ़ा दिया।

        छंटनी विभागों और क्षेत्रों में की गई, भर्ती और व्यावसायिक टीमों जैसे क्षेत्रों में दूसरों की तुलना में अधिक प्रभावित हुए।

        फेसबुक, इंस्टाग्राम और व्हाट्सएप की मूल कंपनी ने अपने कार्यबल में 13 प्रतिशत की कमी की और अगले साल की पहली तिमाही तक हायरिंग फ्रीज को बढ़ा दिया।

Content Credit:

 |

I am using following code snippet to convert it to image.

options = {
        "format": 'jpg',
        "xvfb": "",
        "zoom": 1,
        "width": 964,
        "height": 1000,
        "quality": 100,
        "encoding": "UTF-8"
    }
imgkit.from_string(html_body, HTML_IMAGE_TEMP_LOCATION["full_url"], options=options)

where html_body contains the HTML string provided above and HTML_IMAGE_TEMP_LOCATION["full_url"] is the full path to temporary image file.

The resulting output is:

I've tried including different fonts that support hindi script but the response is same. Is there something I am missing on ?


问:
How to start data visualization of a mat-table at an x value and create load more button. (Angular/Typescript)
When starting the page, I need the table as printed below to show 10 items/lines and when the user clicks on the "Load More" button, it loads another 10 items, or the amount in which there is, if all the items are loaded, the button disappears and the message "All items loaded" appears. How can I do this?

Component TS

```<code>    export interface PeriodicElement {
        event: string;
        professional: string;
        job: number;
        checkOut: string;
        value: string;
    }

    const ELEMENT_DATA: PeriodicElement[] = [
        {professional: '87.737.817/0001-25', event: 'Lollapaloza', job: 638, checkOut: '18 set 2021 - 22h15', value: 'R$ 540,00'},
        {professional: '87.737.817/0001-25', event: 'Lollapaloza', job: 638, checkOut: '18 set 2021 - 22h15', value: 'R$ 540,00'},
        {professional: '87.737.817/0001-25', event: 'Lollapaloza', job: 638, checkOut: '18 set 2021 - 22h15', value: 'R$ 540,00'},
    ];

export class PaymentsComponent implements OnInit {

    public displayedColumns: string[] = ['professional', 'event', 'job', 'checkOut', 'value', 'actionsColumn3icons'];
    public dataSource: MatTableDataSource<PeriodicElement> = new MatTableDataSource(ELEMENT_DATA); //FAKE TABLE
</code>```

Component HTML

```<code>    <!-- TABLE -->
<div class="scroll-table" *ngIf="dataSource?.data?.length > 0">
    <table mat-table [dataSource]="dataSource" class="invoice-table">

        <!-- Professional Column -->
        <ng-container matColumnDef="professional">
          <th mat-header-cell *matHeaderCellDef><div>{{ 'payments.professional' | translate }}</div></th>
          <td mat-cell *matCellDef="let element" class="first-column">
            <div class="fill-background">
                <img class="user-img" [src]="element?.image" alt="avatar">
                <div class="user-data-container">
                    <span class="value-bold fill-margin">{{ element?.freelancer }}</span>
                    <span>{{ element?.limit_date_expired }}</span>
                </div>
            </div>
          </td>
        </ng-container>

        <!-- Event Column -->
        <ng-container matColumnDef="event">
            <th mat-header-cell *matHeaderCellDef><div>{{ 'payments.event' | translate }}</div></th>
            <td mat-cell *matCellDef="let element">
                <div class="fill-background custom-pad">
                    <div class="user-data-container">
                        <span class="color-tint fill-margin">{{ element?.event }}</span>
                        <span class="color-tint">{{ element?.event }}</span>
                    </div>
                </div>
            </td>
        </ng-container>

        <!-- Job Column -->
        <ng-container matColumnDef="job">
            <th mat-header-cell *matHeaderCellDef><div>{{ 'payments.job' | translate }}</div></th>
            <td mat-cell *matCellDef="let element">
                <div class="fill-background under-pad">
                    <div class="user-data-container">
                        <span class="color-tint">{{ element?.job_id }}</span>
                    </div>
                </div>
            </td>
        </ng-container>

        <!-- Check-out Column -->
        <ng-container matColumnDef="checkOut">
            <th mat-header-cell *matHeaderCellDef><div>{{ 'payments.checkOut' | translate }}</div></th>
            <td mat-cell *matCellDef="let element">
                <div class="fill-background under-pad">
                    <div class="user-data-container">
                        <span class="color-tint">{{ element?.checkout_date }}</span>
                    </div>
                </div>
            </td>
        </ng-container>

        <!-- Value Column -->
        <ng-container matColumnDef="value">
            <th mat-header-cell *matHeaderCellDef><div>{{ 'payments.value' | translate }}</div></th>
            <td mat-cell *matCellDef="let element">
                <div class="fill-background under-pad">
                    <div class="user-data-container">
                        <span class="color-tint">{{ element?.value }}</span>
                    </div>
                </div>
            </td>
        </ng-container>

        <!-- Icons Column -->
        <ng-container matColumnDef="actionsColumn3icons">
            <th mat-header-cell *matHeaderCellDef></th>
            <td mat-cell *matCellDef="let element" class="last-column">
                <div class="fill-background custom-pad">
                    <mat-icon class="svg-icon primary-dark inline-self" svgIcon="document-download"></mat-icon>
                    <div class="centered">
                        <span class="color-tint-bold">{{ 'payments.toView' | translate }}</span>
                        <button class="btn small danger" (click)="openRejectModal()">
                            <mat-icon class="svg-icon" svgIcon="close-circle"></mat-icon>
                            {{ 'payments.reject' | translate }}
                        </button>
                        <button class="btn small tertiary" (click)="updateStatusInvoice('refused')">
                            <mat-icon class="svg-icon" svgIcon="tick-circle"></mat-icon>
                            {{ 'payments.approved' | translate }}
                        </button>
                    </div>
                </div>
            </td>
        </ng-container>
        <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
    </table>
</div>
<button class="btn small primary">
    Load More
</button>
</code>```

Body:
When starting the page, I need the table as printed below to show 10 items/lines and when the user clicks on the "Load More" button, it loads another 10 items, or the amount in which there is, if all the items are loaded, the button disappears and the message "All items loaded" appears. How can I do this?

Component TS

    export interface PeriodicElement {
        event: string;
        professional: string;
        job: number;
        checkOut: string;
        value: string;
    }

    const ELEMENT_DATA: PeriodicElement[] = [
        {professional: '87.737.817/0001-25', event: 'Lollapaloza', job: 638, checkOut: '18 set 2021 - 22h15', value: 'R$ 540,00'},
        {professional: '87.737.817/0001-25', event: 'Lollapaloza', job: 638, checkOut: '18 set 2021 - 22h15', value: 'R$ 540,00'},
        {professional: '87.737.817/0001-25', event: 'Lollapaloza', job: 638, checkOut: '18 set 2021 - 22h15', value: 'R$ 540,00'},
    ];

export class PaymentsComponent implements OnInit {

    public displayedColumns: string[] = ['professional', 'event', 'job', 'checkOut', 'value', 'actionsColumn3icons'];
    public dataSource: MatTableDataSource<PeriodicElement> = new MatTableDataSource(ELEMENT_DATA); //FAKE TABLE

Component HTML

 0">

        <ng-container matColumnDef="professional">

{{ 'payments.professional' | translate }}

                    {{ element?.freelancer }}
                    {{ element?.limit_date_expired }}

        </ng-container>

        <ng-container matColumnDef="event">

{{ 'payments.event' | translate }}

                        {{ element?.event }}
                        {{ element?.event }}

        </ng-container>

        <ng-container matColumnDef="job">

{{ 'payments.job' | translate }}

                        {{ element?.job_id }}

        </ng-container>

        <ng-container matColumnDef="checkOut">

{{ 'payments.checkOut' | translate }}

                        {{ element?.checkout_date }}

        </ng-container>

        <ng-container matColumnDef="value">

{{ 'payments.value' | translate }}

                        {{ element?.value }}

        </ng-container>

        <ng-container matColumnDef="actionsColumn3icons">

                    <mat-icon class="svg-icon primary-dark inline-self" svgIcon="document-download"></mat-icon>

                        {{ 'payments.toView' | translate }}
                        <button class="btn small danger" (click)="openRejectModal()">
                            <mat-icon class="svg-icon" svgIcon="close-circle"></mat-icon>
                            {{ 'payments.reject' | translate }}
                        </button>
                        <button class="btn small tertiary" (click)="updateStatusInvoice('refused')">
                            <mat-icon class="svg-icon" svgIcon="tick-circle"></mat-icon>
                            {{ 'payments.approved' | translate }}
                        </button>

        </ng-container>

<button class="btn small primary">
    Load More
</button>


问:
Swift : generic combination of two operations
I'd like to implement an aux class to build a chain of Operations. For this I have a code :

```<code>import Foundation

protocol OperationDataInterface {
    associatedtype In
    associatedtype Out

    var inData: In { get set }
    var outData: Out { get set }
}

typealias CombinedOperation = Operation & OperationDataInterface

class CombinationsOfTwoOperations {
    private var firstOperation: any CombinedOperation
    private var secondOperation: any CombinedOperation
    private var joinOperation: Operation

    init(firstOp: any CombinedOperation, secondOp: any CombinedOperation) {
        firstOperation = firstOp
        secondOperation = secondOp
    }

    func build() {
        joinOperation = BlockOperation() { [unowned self] in
            self.secondOperation.inData = self.firstOperation.outData
        }

        joinOperation.addDependency(firstOperation)
        secondOperation.addDependency(joinOperation)
    }
}
</code>```

But I get a compilation issue :

Is it prohibited to assign generics to each other? Is it possible to overcome this problem?

Body:
I'd like to implement an aux class to build a chain of Operations. For this I have a code :

import Foundation

protocol OperationDataInterface {
    associatedtype In
    associatedtype Out

    var inData: In { get set }
    var outData: Out { get set }
}

typealias CombinedOperation = Operation & OperationDataInterface

class CombinationsOfTwoOperations {
    private var firstOperation: any CombinedOperation
    private var secondOperation: any CombinedOperation
    private var joinOperation: Operation

    init(firstOp: any CombinedOperation, secondOp: any CombinedOperation) {
        firstOperation = firstOp
        secondOperation = secondOp
    }

    func build() {
        joinOperation = BlockOperation() { [unowned self] in
            self.secondOperation.inData = self.firstOperation.outData
        }

        joinOperation.addDependency(firstOperation)
        secondOperation.addDependency(joinOperation)
    }
}

But I get a compilation issue :

Is it prohibited to assign generics to each other? Is it possible to overcome this problem?


问:
How to trigger the Linux IRQ handler thread again when it finishes if there was same IRQ triggered while it was running

int request_threaded_irq(unsigned int irq,
    irq_handler_t handler,
    irq_handler_t thread_fn,
    unsigned long irqflags,
    const char *devname,
    void *dev_id);
```

How can we the IRQ handler thread calling thread_fn again when it finishes, if there was another same IRQ generated and its hard IRQ handler calling handler was executed and returned IRQ_WAKE_THREAD?

In the above situation, IRQ_WAKE_THREAD for same IRQ can be ignored. This is problematic when the same IRQ generation and the end of hard IRQ handler for it returns IRQ_WAKE_THREAD during the IRQ handler thread is exiting. Then, the previous interrupt request will be ignored and cannot be processed by the handler until the same IRQ is generated again.

Body:
int request_threaded_irq(unsigned int irq,
    irq_handler_t handler,
    irq_handler_t thread_fn,
    unsigned long irqflags,
    const char *devname,
    void *dev_id);

How can we the IRQ handler thread calling thread_fn again when it finishes, if there was another same IRQ generated and its hard IRQ handler calling handler was executed and returned IRQ_WAKE_THREAD?

In the above situation, IRQ_WAKE_THREAD for same IRQ can be ignored. This is problematic when the same IRQ generation and the end of hard IRQ handler for it returns IRQ_WAKE_THREAD during the IRQ handler thread is exiting. Then, the previous interrupt request will be ignored and cannot be processed by the handler until the same IRQ is generated again.


问:
Error while Running Docker Image for Robot Framework Appium
```<code>FROM python:3.10.0a6-buster
ENV env=/root/env
ENV PATH="$env/bin:$PATH"
WORKDIR  /root

# Copy relevant files to work directory
COPY Resources .
COPY results .
COPY Tests .

#install robotframework
RUN python3 -m pip install robotframework==5.0.1
RUN python3 -m pip install --upgrade pip
RUN pip install robotframework-appiumlibrary==2.0.0

#install appium
from node:latest
RUN npm install -g appium

# Execute file
CMD ["appium"]
EXPOSE 4723
#CMD ["appium --port 4723"]

CMD ["robot", "-d", "results", "login.robot"]

</code>```
```<code>**Getting below error while running the docker image**

</code>```

node:internal/modules/cjs/loader:1042
throw err;
^

Error: Cannot find module '/robot'
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:82:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Node.js v19.2.0

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

Body:
FROM python:3.10.0a6-buster
ENV env=/root/env
ENV PATH="$env/bin:$PATH"
WORKDIR  /root

# Copy relevant files to work directory
COPY Resources .
COPY results .
COPY Tests .

#install robotframework
RUN python3 -m pip install robotframework==5.0.1
RUN python3 -m pip install --upgrade pip
RUN pip install robotframework-appiumlibrary==2.0.0

#install appium
from node:latest
RUN npm install -g appium

# Execute file
CMD ["appium"]
EXPOSE 4723
#CMD ["appium --port 4723"]

CMD ["robot", "-d", "results", "login.robot"]

**Getting below error while running the docker image**

node:internal/modules/cjs/loader:1042
throw err;
^

Error: Cannot find module '/robot'
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:82:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Node.js v19.2.0


问:
Pyplot bar chart dynamic height basing on the amount of data
I am working with matoplotlib.pyplot and am trying to load data from a dataframe and visualize it. However, my chart gets compressed due to too much data.

How can i automatically adjust the height and make the labels readable?

This is what i have managed to do

```<code>df = pd.DataFrame(qs)

facilities = df['facility']
rates = df['rate']

plt.switch_backend('AGG')
plt.figure(figsize=(8, 2))
plt.xlabel("Rates")
plt.ylabel("Facilities")
plt.title("Facilities with their Rates in percentages")
plt.barh(facilities, rates, color='#3CB371')

</code>```

How can i solve this

Body:
I am working with matoplotlib.pyplot and am trying to load data from a dataframe and visualize it. However, my chart gets compressed due to too much data.

How can i automatically adjust the height and make the labels readable?

This is what i have managed to do

df = pd.DataFrame(qs)

facilities = df['facility']
rates = df['rate']

plt.switch_backend('AGG')
plt.figure(figsize=(8, 2))
plt.xlabel("Rates")
plt.ylabel("Facilities")
plt.title("Facilities with their Rates in percentages")
plt.barh(facilities, rates, color='#3CB371')

How can i solve this


问:
getting data from mysql database by using thread in vb.,net
I'm trying to get data from database but I got an error:

There is already an open DataReader associated with this Connection
which must be closed first

what I did is the following codes:

1: I have a module that contains the following sub:

```<code>Public Function CheckServerConn() As Boolean
        Try
            _ServerConnStr = New MySqlConnection(My.Settings.DbPath)
            If _ServerConnStr.State = ConnectionState.Open Then
                _ServerConnStr.Close()
            End If

            If _ServerConnStr.State = ConnectionState.Closed Then
                _ServerConnStr.Open()
                Return True
            End If

        Catch ex As Exception
            MsgBox("Check The Conn " & ex.Message, Me_MsgInfoStyle, Me_MsgCaptionStr)
            Return False
        End Try
#Disable Warning BC42353 ' Function doesn't return a value on all code paths
    End Function
</code>```

2: I have this subroutine in class called "ClsMySql":

```<code>'GetData
    Public Sub GetData(ByVal SqlStr As String, ByVal xDt As DataTable, ByVal xPar() As MySqlParameter)
        Using xCmd As New MySqlCommand() With {
                    .CommandType = CommandType.Text,
                    .CommandText = SqlStr,
                    .Connection = _ServerConnStr,
                    .CommandTimeout = 5000000
                    }

            If xPar IsNot Nothing Then
                For i As Integer = 0 To xPar.Length - 1
                    xCmd.Parameters.Add(xPar(i))
                Next
            End If

            Using xDa As New MySqlDataAdapter(xCmd)
                xDa.Fill(xDt)
            End Using
            xDt.Dispose()
        End Using
    End Sub
</code>```

3: I have a class for the table that have the following method:

```<code>Public Sub MySql_Get_Daf()
    xClsMySql = New ClsMySql
    Dim SqlStr As String = "SELECT RegID,RegType, tblregs1.`RegRef`,`RegDate`, COUNT(`RegdID`) AS xCount
                        ,IF(COUNT(`RegdID`) =3,'Ok','Error') AS xResult FROM tblregs1
                        INNER JOIN tblregs2 ON tblregs2.RegRef = tblregs1.RegRef
                        WHERE `RegType` = 'Daf'
                        GROUP BY tblregs1.`RegRef`
                        ORDER BY COUNT(`RegdID`)  ASC"
    Dt_Get_Daf = New DataTable()
    xClsMySql.GetData(SqlStr, Dt_Get_Daf, Nothing)

End Sub

Public Sub MySql_Get_Qbd()
    xClsMySql = New ClsMySql
    Dim SqlStr As String = "SELECT RegID,RegType, tblregs1.`RegRef`,`RegDate`, COUNT(`RegdID`) AS xCount
                        ,IF(COUNT(`RegdID`) =3,'Ok','Error') AS xResult FROM tblregs1
                        INNER JOIN tblregs2 ON tblregs2.RegRef = tblregs1.RegRef
                        WHERE `RegType` = 'Qbd'
                        GROUP BY tblregs1.`RegRef`
                        ORDER BY COUNT(`RegdID`)  ASC"
    Dt_Get_Qbd = New DataTable()
    xClsMySql.GetData(SqlStr, Dt_Get_Qbd, Nothing)
End Sub

Public Sub MySql_Get_All()
    Dim xThread As Thread = New Thread(Sub() MySql_Get_Daf())
    Dim xThread2 As Thread = New Thread(Sub() MySql_Get_Qbd())

    xThread.Start()
    xThread2.Start()

End Sub
</code>```

when I call MySql_Get_All by a button it gives me the next error:

There is already an open DataReader associated with this Connection
which must be closed first

can anybody tell me what's the wrong here

Body:
I'm trying to get data from database but I got an error:

There is already an open DataReader associated with this Connection
which must be closed first

what I did is the following codes:

1: I have a module that contains the following sub:

Public Function CheckServerConn() As Boolean
        Try
            _ServerConnStr = New MySqlConnection(My.Settings.DbPath)
            If _ServerConnStr.State = ConnectionState.Open Then
                _ServerConnStr.Close()
            End If

            If _ServerConnStr.State = ConnectionState.Closed Then
                _ServerConnStr.Open()
                Return True
            End If

        Catch ex As Exception
            MsgBox("Check The Conn " & ex.Message, Me_MsgInfoStyle, Me_MsgCaptionStr)
            Return False
        End Try
#Disable Warning BC42353 ' Function doesn't return a value on all code paths
    End Function

2: I have this subroutine in class called "ClsMySql":

'GetData
    Public Sub GetData(ByVal SqlStr As String, ByVal xDt As DataTable, ByVal xPar() As MySqlParameter)
        Using xCmd As New MySqlCommand() With {
                    .CommandType = CommandType.Text,
                    .CommandText = SqlStr,
                    .Connection = _ServerConnStr,
                    .CommandTimeout = 5000000
                    }

            If xPar IsNot Nothing Then
                For i As Integer = 0 To xPar.Length - 1
                    xCmd.Parameters.Add(xPar(i))
                Next
            End If

            Using xDa As New MySqlDataAdapter(xCmd)
                xDa.Fill(xDt)
            End Using
            xDt.Dispose()
        End Using
    End Sub

3: I have a class for the table that have the following method:

Public Sub MySql_Get_Daf()
    xClsMySql = New ClsMySql
    Dim SqlStr As String = "SELECT RegID,RegType, tblregs1.`RegRef`,`RegDate`, COUNT(`RegdID`) AS xCount
                        ,IF(COUNT(`RegdID`) =3,'Ok','Error') AS xResult FROM tblregs1
                        INNER JOIN tblregs2 ON tblregs2.RegRef = tblregs1.RegRef
                        WHERE `RegType` = 'Daf'
                        GROUP BY tblregs1.`RegRef`
                        ORDER BY COUNT(`RegdID`)  ASC"
    Dt_Get_Daf = New DataTable()
    xClsMySql.GetData(SqlStr, Dt_Get_Daf, Nothing)

End Sub

Public Sub MySql_Get_Qbd()
    xClsMySql = New ClsMySql
    Dim SqlStr As String = "SELECT RegID,RegType, tblregs1.`RegRef`,`RegDate`, COUNT(`RegdID`) AS xCount
                        ,IF(COUNT(`RegdID`) =3,'Ok','Error') AS xResult FROM tblregs1
                        INNER JOIN tblregs2 ON tblregs2.RegRef = tblregs1.RegRef
                        WHERE `RegType` = 'Qbd'
                        GROUP BY tblregs1.`RegRef`
                        ORDER BY COUNT(`RegdID`)  ASC"
    Dt_Get_Qbd = New DataTable()
    xClsMySql.GetData(SqlStr, Dt_Get_Qbd, Nothing)
End Sub

Public Sub MySql_Get_All()
    Dim xThread As Thread = New Thread(Sub() MySql_Get_Daf())
    Dim xThread2 As Thread = New Thread(Sub() MySql_Get_Qbd())

    xThread.Start()
    xThread2.Start()

End Sub

when I call MySql_Get_All by a button it gives me the next error:

There is already an open DataReader associated with this Connection
which must be closed first

can anybody tell me what's the wrong here


问:
Facebook - disable comments on post
Can I use facebook API to make posts on a page where the comments are turned off.

In the apidoc https://developers.facebook.com/docs/graph-api/reference/v15.0/comment there is a can_comment field but is it readonly?

Title: Facebook - disable comments on post


问:
Writing a CSV, or reading a CSV changes my pandas data frame from float16 into float64. How can I avoid this?
I have a data frame test_df with the following information

```<code>test_df.info()

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 100 entries, 0 to 99
Columns: 4097 entries, index to 4095
dtypes: float16(4096), object(1)
memory usage: 800.9+ KB
</code>```

Clearly, all the columns are of data type float16 except the first column and the total size of the data frame is about 800 MB. Now I save this data frame as a CSV file using Watson Studio as follows

```<code># import the lib
from ibm_watson_studio_lib import access_project_or_space
wslib = access_project_or_space()
# save the data frame as csv
wslib.save_data("test_df.csv", test_df.to_csv(index=False, header=False).encode())
</code>```

Checking the size of the CSV, it is suddenly 1.8 MB. For some reason the size doubled.

Now, when reading in the same CSV again with the following code

```<code>import itc_utils.flight_service as itcfs
readClient = itcfs.get_flight_client()

nb_data_request = {
    'data_name': """test_df.csv""",
    'interaction_properties': {
        #'row_limit': 500,
        'infer_schema': 'true',
        'infer_as_varchar': 'false'
    }
}

flightInfo = itcfs.get_flight_info(readClient, nb_data_request=nb_data_request)

test_df = itcfs.read_pandas_and_concat(readClient, flightInfo, timeout=10000)

test_df.index.name = None
# rename first column to 'index'
test_df.rename(columns = {'COLUMN1':'index'}, inplace = True)

# rename the rest of columns as a consecutive integer
new_columns = {}
for i in range(len(test_df.columns)-1):
    new_columns[test_df.columns[i+1]] = str(i)
test_df = test_df.rename(columns=new_columns)
</code>```

And checking info now gives

```<code>test_df.info()

Time taken: 0.0468 minutes
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 100 entries, 0 to 99
Columns: 4097 entries, index to 4095
dtypes: float64(4096), object(1)
memory usage: 3.1+ MB
</code>```

Now the data type is float64 and it's 3.1 MB. How can avoid this?

Body:
I have a data frame test_df with the following information

test_df.info()

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 100 entries, 0 to 99
Columns: 4097 entries, index to 4095
dtypes: float16(4096), object(1)
memory usage: 800.9+ KB

Clearly, all the columns are of data type float16 except the first column and the total size of the data frame is about 800 MB. Now I save this data frame as a CSV file using Watson Studio as follows

# import the lib
from ibm_watson_studio_lib import access_project_or_space
wslib = access_project_or_space()
# save the data frame as csv
wslib.save_data("test_df.csv", test_df.to_csv(index=False, header=False).encode())

Checking the size of the CSV, it is suddenly 1.8 MB. For some reason the size doubled.

Now, when reading in the same CSV again with the following code

import itc_utils.flight_service as itcfs
readClient = itcfs.get_flight_client()

nb_data_request = {
    'data_name': """test_df.csv""",
    'interaction_properties': {
        #'row_limit': 500,
        'infer_schema': 'true',
        'infer_as_varchar': 'false'
    }
}

flightInfo = itcfs.get_flight_info(readClient, nb_data_request=nb_data_request)

test_df = itcfs.read_pandas_and_concat(readClient, flightInfo, timeout=10000)

test_df.index.name = None
# rename first column to 'index'
test_df.rename(columns = {'COLUMN1':'index'}, inplace = True)

# rename the rest of columns as a consecutive integer
new_columns = {}
for i in range(len(test_df.columns)-1):
    new_columns[test_df.columns[i+1]] = str(i)
test_df = test_df.rename(columns=new_columns)

And checking info now gives

test_df.info()

Time taken: 0.0468 minutes
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 100 entries, 0 to 99
Columns: 4097 entries, index to 4095
dtypes: float64(4096), object(1)
memory usage: 3.1+ MB

Now the data type is float64 and it's 3.1 MB. How can avoid this?


问:
Cordova (v.11) - AJAX petition not working on browser platform
I am trying to make a petition to an API using Cordova v11 but when trying (in Chrome) I get the following errors:

> Access to XMLHttpRequest at 'https://google.com/' from origin
'http://localhost:8000' has been blocked by CORS policy: Response to
preflight request doesn't pass access control check: No 'Access-
Control-Allow-Origin' header is present on the requested resource.

> POST https://google.com/ net::ERR_FAILED
```
<p>The petition works correctly if I try with the Android platform.</p>
<p>Here is the configuration I tried on the config.xml file (I know it's not safe, I would change it once I get it to work):</p>
```<allow-intent href="*" />
<allow-navigation href="*" />
<access origin="*" />
<preference name="AndroidInsecureFileModeEnabled" value="true"/>
```
<p>And here is the AJAX petition:</p>
```$.ajax({
    type: "POST",
    data: dataToSend,
    crossDomain: true,
    url: "https://google.com",
    success: function (response) {
        alert(response);
    }, error: function (request, status, error) {
        alert("Error: " + request.responseText + " / " + status + " / " + error);
    }
});
```

I've found other similar questions but none of the answers worked for me as they used older versions of Cordova.

Body:
I am trying to make a petition to an API using Cordova v11 but when trying (in Chrome) I get the following errors:

> Access to XMLHttpRequest at 'https://google.com/' from origin
'http://localhost:8000' has been blocked by CORS policy: Response to
preflight request doesn't pass access control check: No 'Access-
Control-Allow-Origin' header is present on the requested resource.

> POST https://google.com/ net::ERR_FAILED

The petition works correctly if I try with the Android platform.

Here is the configuration I tried on the config.xml file (I know it's not safe, I would change it once I get it to work):

<allow-intent href="*" />
<allow-navigation href="*" />
<access origin="*" />
<preference name="AndroidInsecureFileModeEnabled" value="true"/>

And here is the AJAX petition:

$.ajax({
    type: "POST",
    data: dataToSend,
    crossDomain: true,
    url: "https://google.com",
    success: function (response) {
        alert(response);
    }, error: function (request, status, error) {
        alert("Error: " + request.responseText + " / " + status + " / " + error);
    }
});

I've found other similar questions but none of the answers worked for me as they used older versions of Cordova.


问:
How to remove xsi:type information form an XML element generated via JaxB?
I have got an legacy application using Xstream for serialization/de-serialization of Java classes having property declared with interface type as shown in sample below:

```<code>interface Address{
// ...
}
class CurrentAddress implements Address{
// ...
}

class PermanentAddress implements Address{
// ....
}

@XmlRootElement
class Student{

 private Address address;

 @XmlElement(type = Object.class)
 public getAddress(){
  // ...
 }
}
</code>```

While Xstream was getting used the xml was generated as:

```<code><student>
 <address class="package.for.CurrentAddress">24, North Avenue</address>
</student>
</code>```

However, with above Java JaxB code our xml is generated as:

```<code><student>
     <address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="currentAddress">24, North Avenue</address>
    </student>
</code>```

How can I get an xml equivalent to what is being generated through XStream. I tried multiple ways but not getting a way of generating xml as generated using XStream.

Thank you !

Body:
I have got an legacy application using Xstream for serialization/de-serialization of Java classes having property declared with interface type as shown in sample below:

interface Address{
// ...
}
class CurrentAddress implements Address{
// ...
}

class PermanentAddress implements Address{
// ....
}

@XmlRootElement
class Student{

 private Address address;

 @XmlElement(type = Object.class)
 public getAddress(){
  // ...
 }
}

While Xstream was getting used the xml was generated as:

<student>
 <address class="package.for.CurrentAddress">24, North Avenue</address>
</student>

However, with above Java JaxB code our xml is generated as:

<student>
     <address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="currentAddress">24, North Avenue</address>
    </student>

How can I get an xml equivalent to what is being generated through XStream. I tried multiple ways but not getting a way of generating xml as generated using XStream.

Thank you !


问:
Importing an excel file using TransferSpreadsheet not working if file is not opened
Im trying to import an excel file into access using VBA using "TransferSpreadsheet" however it does not work if the excel file is not already open.   Is there a workaround this?

Tried google searches and looked at microsoft online search.    I am expecting to be able to use the function TransferSpreadsheet on a file that is not opened.


问:
Sagemaker Studio -Land cover segmentation - unable to upload geojson
I went to geojson.io and selected a rectangle over a random area on the map. I then downloaded the geojson and uploaded it to Sagemaker's Studio's spatial - Land cover segmentation portal. I then received the following error:

```<code>"Invalid GeoJson format
Uploaded file cannot be a Feature or Feature Collection GeoJson. Please upload a GeoJson with a 'type' of 'Polygon'"
</code>```

How else can I pick a piece of land from anywhere on the globe and feed it to sagemaker studio, if not with geojson.io? thanks

Body:
I went to geojson.io and selected a rectangle over a random area on the map. I then downloaded the geojson and uploaded it to Sagemaker's Studio's spatial - Land cover segmentation portal. I then received the following error:

"Invalid GeoJson format
Uploaded file cannot be a Feature or Feature Collection GeoJson. Please upload a GeoJson with a 'type' of 'Polygon'"

How else can I pick a piece of land from anywhere on the globe and feed it to sagemaker studio, if not with geojson.io? thanks