问:
New to SQL - Need to search more than 1 column but can't seem to get it to work with the AND OR coding
The below is the code for the single ID Column search. Can someone help me rewrite this to search other columns in the table please. I need to add LastName, Rank, and EmployerID as searchable as well:

```<code>string find = "select * from SDEmployee where (Id like '%' +@Id+ '%')";

            SqlCommand cmd = new SqlCommand(find, con);
            cmd.Parameters.Add("@Id", SqlDbType.NVarChar).Value = TextBox16.Text;
            cmd.ExecuteNonQuery();

            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd;
            DataSet ds = new DataSet();
            da.Fill(ds, "Id");

            GridView1.DataSourceID = null;
            GridView1.DataSource = ds;
            GridView1.DataBind();

            con.Close();
            Label1.Text = "Data has been found.";
</code>```

I tried using the Where, AND OR lines but maybe did not write them correctly. Not sure. I am thinking this might work but need some new eyes in it to check my thinking:

string find = "select * from SDEmployee where (Id like '%' +@Id+ '%' AND 2ndColumn like @var2)";

```<code>        SqlCommand cmd = new SqlCommand(find, con);
        cmd.Parameters.Add("@Id", SqlDbType.NVarChar).Value = TextBox16.Text;
</code>```

cmd.Parameters.Add(@var2, SqlDbType.NVarChar).Value = TextBoxVar2.Text
cmd.ExecuteNonQuery();

```<code>        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = cmd;
        DataSet ds = new DataSet();
        da.Fill(ds, "Id");

        GridView1.DataSourceID = null;
        GridView1.DataSource = ds;
        GridView1.DataBind();

        con.Close();
        Label1.Text = "Data has been found.";
</code>```

Body:
The below is the code for the single ID Column search. Can someone help me rewrite this to search other columns in the table please. I need to add LastName, Rank, and EmployerID as searchable as well:

string find = "select * from SDEmployee where (Id like '%' +@Id+ '%')";

            SqlCommand cmd = new SqlCommand(find, con);
            cmd.Parameters.Add("@Id", SqlDbType.NVarChar).Value = TextBox16.Text;
            cmd.ExecuteNonQuery();

            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd;
            DataSet ds = new DataSet();
            da.Fill(ds, "Id");

            GridView1.DataSourceID = null;
            GridView1.DataSource = ds;
            GridView1.DataBind();

            con.Close();
            Label1.Text = "Data has been found.";

I tried using the Where, AND OR lines but maybe did not write them correctly. Not sure. I am thinking this might work but need some new eyes in it to check my thinking:

string find = "select * from SDEmployee where (Id like '%' +@Id+ '%' AND 2ndColumn like @var2)";

        SqlCommand cmd = new SqlCommand(find, con);
        cmd.Parameters.Add("@Id", SqlDbType.NVarChar).Value = TextBox16.Text;

cmd.Parameters.Add(@var2, SqlDbType.NVarChar).Value = TextBoxVar2.Text
cmd.ExecuteNonQuery();

        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = cmd;
        DataSet ds = new DataSet();
        da.Fill(ds, "Id");

        GridView1.DataSourceID = null;
        GridView1.DataSource = ds;
        GridView1.DataBind();

        con.Close();
        Label1.Text = "Data has been found.";


来源: stackexchange

问:
Jest cannot find module in workspace
I have an NPM project structured in workspaces:

```<code>proj/
+-node_modules/
+-packages/
  +-pkg1/
    +-src/
      |-c1.ts
      |-c1.test.ts
    |-package.json
    |-jest.config.js
  +-pkg2/
    +-src/
      |-c2.ts
    |-package.json
+-apps/
|-package.json
</code>```

The project's package.json:

```<code>{
  "name": "proj",
  "scripts": {
    ...
    "test:pkg1": "npm test -w packages/pkg1",
  },
  "workspaces": [
    "packages/*",
    "apps/*"
  ]
}
</code>```

The package.json inside pkg1:

```<code>{
  "name": "@proj/pkg1",
  "scripts": {
    ...
    "test": "jest --config=jest.config.js",
  },
  "devDependencies": {
    "@types/pegjs": "0.10.3",
    "@types/jest": "29.1.1",
    "ts-loader": "9.3.1",
    "typescript": "4.8.3",
    "webpack": "5.74.0",
    "webpack-cli": "4.10.0",
    "jest": "29.1.2",
    "ts-jest": "29.0.3"
  },
  "dependencies": {
    "@proj/pkg2": "1.0.0"
  }
}
</code>```

The test file c1.test.ts is:

```<code>import { Component1 } from "@proj/pkg2";

describe("some tests", () => {
    test("a test case", () => {
        // Arrange ...
        // Act ...
        // Assert ...
    });
});

</code>```

The problem

When, from the project's root, I run: npm run test:pkg1, I get:

```<code>    > 1 | import { Component1 } from "@proj/pkg2";
        | ^
      3 | describe("some tests", () => {
      4 | test("a test case", () => {
      5 | // Arrange

      at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:487:11)
</code>```

Jest cannot find "@proj/pkg2". It makes sense as it cannot understand workspaces and Jest compiles all files before running the tests. How to solve this?

ContentLicense: CC BY-SA 4.0

Title: Jest cannot find module in workspace

Body:
I have an NPM project structured in workspaces:

proj/
+-node_modules/
+-packages/
  +-pkg1/
    +-src/
      |-c1.ts
      |-c1.test.ts
    |-package.json
    |-jest.config.js
  +-pkg2/
    +-src/
      |-c2.ts
    |-package.json
+-apps/
|-package.json

The project's package.json:

{
  "name": "proj",
  "scripts": {
    ...
    "test:pkg1": "npm test -w packages/pkg1",
  },
  "workspaces": [
    "packages/*",
    "apps/*"
  ]
}

The package.json inside pkg1:

{
  "name": "@proj/pkg1",
  "scripts": {
    ...
    "test": "jest --config=jest.config.js",
  },
  "devDependencies": {
    "@types/pegjs": "0.10.3",
    "@types/jest": "29.1.1",
    "ts-loader": "9.3.1",
    "typescript": "4.8.3",
    "webpack": "5.74.0",
    "webpack-cli": "4.10.0",
    "jest": "29.1.2",
    "ts-jest": "29.0.3"
  },
  "dependencies": {
    "@proj/pkg2": "1.0.0"
  }
}

The test file c1.test.ts is:

import { Component1 } from "@proj/pkg2";

describe("some tests", () => {
    test("a test case", () => {
        // Arrange ...
        // Act ...
        // Assert ...
    });
});

The problem

When, from the project's root, I run: npm run test:pkg1, I get:

    > 1 | import { Component1 } from "@proj/pkg2";
        | ^
      3 | describe("some tests", () => {
      4 | test("a test case", () => {
      5 | // Arrange

      at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:487:11)

Jest cannot find "@proj/pkg2". It makes sense as it cannot understand workspaces and Jest compiles all files before running the tests. How to solve this?


问:
Nginx doesn't proxy traffic
Could you please advice what is wrong with my Nginx configuration?
When I try "curl localhost:80" the response is the start nginx page, so it doesn't proxy traffic. I have checked the nginx documentation but I have no idea about this behavior. Have anybody an idea?

Here are the configuration files:

sites-enabled/default.conf

```<code>server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
                set $ups tst;
                proxy_pass http://$ups:8080/;
                proxy_set_header Host $http_host;

        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }
}
</code>```

nginx.conf

```<code>user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
daemon off;

events {
    worker_connections 768;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
        include conf/upstream.conf;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

}
</code>```

conf/upstream.conf

```<code>upstream tst {
    server xxx.xxx.xxx.xxx;
    server xxx.xxx.xxx.xxx;
}
</code>```

Thanks in advance!

Title: Nginx doesn't proxy traffic

Body:
Could you please advice what is wrong with my Nginx configuration?
When I try "curl localhost:80" the response is the start nginx page, so it doesn't proxy traffic. I have checked the nginx documentation but I have no idea about this behavior. Have anybody an idea?

Here are the configuration files:

sites-enabled/default.conf

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
                set $ups tst;
                proxy_pass http://$ups:8080/;
                proxy_set_header Host $http_host;

        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }
}

nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
daemon off;

events {
    worker_connections 768;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
        include conf/upstream.conf;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

}

conf/upstream.conf

upstream tst {
    server xxx.xxx.xxx.xxx;
    server xxx.xxx.xxx.xxx;
}

Thanks in advance!


问:
using Session ID to order something
So I am making a project where you can order food at school cafeteria, I already have a project where you can make a order with the menu and the student, and time.

But now I want that the student can order at it's own and not select any student so for the order it takes the currently logged in student. Sorry for bad english and thanks for every answer, i appreciate it.

```<code>[enter image description here](https://i.stack.imgur.com/NFz6G.png)

So Schueler is student and Menu is menu
uhrzeit is time

Now I want that there is no student to select, it takes the session id to make a order.

This is my order/create.php  file

<?php

$title = "Menü reservieren";
include '../layouts/top.php';
session_start();
if(!isset($_SESSION['schuelerid'])) {
    die('Bitte zuerst <a href="../../registration/login.php">einloggen</a>');
}

//Abfrage der Nutzer ID vom Login
$userid = $_SESSION['schuelerid'];
$email = $_SESSION['email'];

echo "Hallo Schueler: ".$userid;
echo " ".$email;
require_once('../../models/Bestellungen.php');

// create new/empty model, contains all input-values and error-messages
$r = new Bestellungen();

if (!empty($_POST)) {

    $r->setMenu(isset($_POST['menu']) ? $_POST['menu'] : '');
    $r->setUhrzeit(isset($_POST['uhrzeit']) ? $_POST['uhrzeit'] : 0);
    $r->setSchueler(isset($_POST['schueler']) ? $_POST['schueler'] : 0);

    // redirect to view-page after successfull saving
    if ($r->save()) {
        header("Location: view.php?id=" . $r->getId());
        exit();
    }
}

?>

    <div class="container">
        <div class="row">
            <h2><?= $title ?></h2>
        </div>

        <form class="form-horizontal" action="create.php" method="post">

            <div class="row">
                <div class="col-md-1"></div>

                <div class="col-md-2">
                    <div class="form-group required">

                        <label class="control-label">Schueler *</label>
                        <select style="width: 200px" name="schueler">
                            <option selected></option>
                            <?php
                            require_once "../../models/Schueler.php";
                            foreach (Schueler::getAll() as $g){
                                ?>
                                <option value='<?=$g->getId()?>'><?=$g->getName()?></option>
                                <?php
                            }
                            ?>
                        </select>
                        <?php if (!empty($r->getErrors()['schueler'])): ?>
                            <div class="help-block"><?= $r->getErrors()['schueler'] ?></div>
                        <?php endif; ?>

                    </div>
                </div>
                <div class="col-md-2">
                    <div class="form-group required ">
                        <label class="control-label">Menu *</label>
                        <select name="menu" style="width: 200px">
                            <option selected></option>
                        <?php
                        require_once "../../models/Menu.php";
                        foreach (Menu::getAll() as $z){
                            ?>
                            <option value='<?=$z->getId()?>'><?=$z->getName()?></option>
                            <?php
                        }
                        ?>
                        </select>
                        <?php if (!empty($r->getErrors()['menu'])): ?>
                            <div class="help-block"><?= $r->getErrors()['menu'] ?></div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-2">
                    <div class="form-group required ">
                        <label class="control-label">Uhrzeit *</label>
                        <input type="datetime-local" class="form-control" name="uhrzeit" value="">
                        <?php if (!empty($r->getErrors()['uhrzeit'])): ?>
                            <div class="help-block"><?= $r->getErrors()['uhrzeit'] ?></div>
                        <?php endif; ?>
                    </div>
                </div>
                <div class="col-md-1"></div>

            </div>

            <div class="row">
                <div class="form-group">
                    <button type="submit" name="submit" class="btn btn-success">Erstellen</button>
                    <a class="btn btn-default" href="view.php">Abbruch</a>
                </div>
            </div>
        </form>

    </div> <!-- /container -->

<?php
include '../layouts/bottom.php';
?>
</code>```

Title: using Session ID to order something

Body:
So I am making a project where you can order food at school cafeteria, I already have a project where you can make a order with the menu and the student, and time.

But now I want that the student can order at it's own and not select any student so for the order it takes the currently logged in student. Sorry for bad english and thanks for every answer, i appreciate it.

[enter image description here](https://i.stack.imgur.com/NFz6G.png)

So Schueler is student and Menu is menu
uhrzeit is time

Now I want that there is no student to select, it takes the session id to make a order.

This is my order/create.php  file

<?php

$title = "Menü reservieren";
include '../layouts/top.php';
session_start();
if(!isset($_SESSION['schuelerid'])) {
    die('Bitte zuerst einloggen');
}

//Abfrage der Nutzer ID vom Login
$userid = $_SESSION['schuelerid'];
$email = $_SESSION['email'];

echo "Hallo Schueler: ".$userid;
echo " ".$email;
require_once('../../models/Bestellungen.php');

// create new/empty model, contains all input-values and error-messages
$r = new Bestellungen();

if (!empty($_POST)) {

    $r->setMenu(isset($_POST['menu']) ? $_POST['menu'] : '');
    $r->setUhrzeit(isset($_POST['uhrzeit']) ? $_POST['uhrzeit'] : 0);
    $r->setSchueler(isset($_POST['schueler']) ? $_POST['schueler'] : 0);

    // redirect to view-page after successfull saving
    if ($r->save()) {
        header("Location: view.php?id=" . $r->getId());
        exit();
    }
}

?>

<?= $title ?>

        <form class="form-horizontal" action="create.php" method="post">

                        Schueler *
                        <select style="width: 200px" name="schueler">
                            <option selected></option>
                            <?php
                            require_once "../../models/Schueler.php";
                            foreach (Schueler::getAll() as $g){
                                ?>
                                <option value='<?=$g->getId()?>'><?=$g->getName()?></option>
                                <?php
                            }
                            ?>
                        </select>
                        <?php if (!empty($r->getErrors()['schueler'])): ?>

<?= $r->getErrors()['schueler'] ?>

                        <?php endif; ?>

                        Menu *
                        <select name="menu" style="width: 200px">
                            <option selected></option>
                        <?php
                        require_once "../../models/Menu.php";
                        foreach (Menu::getAll() as $z){
                            ?>
                            <option value='<?=$z->getId()?>'><?=$z->getName()?></option>
                            <?php
                        }
                        ?>
                        </select>
                        <?php if (!empty($r->getErrors()['menu'])): ?>

<?= $r->getErrors()['menu'] ?>

                        <?php endif; ?>

                        Uhrzeit *
                        <input type="datetime-local" class="form-control" name="uhrzeit" value="">
                        <?php if (!empty($r->getErrors()['uhrzeit'])): ?>

<?= $r->getErrors()['uhrzeit'] ?>

                        <?php endif; ?>

                    <button type="submit" name="submit" class="btn btn-success">Erstellen</button>
                    Abbruch

        </form>

<?php
include '../layouts/bottom.php';
?>


问:
Reverse strings of vowels
I have to find the vowels in an input string and return the string of the vowels in reverse order.

Example input: "woUIW"

The expected output is "IUOo"

But I cannot use pointers, only recursion.

This is my attempt:

```<code>void letters_revers(char s[])
{
    int i = 0,g,len,right,left;
    char reversed[10];
    len=strlen(reversed)-1; // get the length of the string
    left = 0; // set left index at 0
    right = len - 1; // set right index len - 1
    while(i!='\0')
    {

        if (s[i] == 'a' || s[i] == 'A' || s[i] == 'e' || s[i] == 'E' || s[i] == 'i' || s[i] == 'I' || s[i] =='o' || s[i]=='O' || s[i] == 'u' || s[i] == 'U')
        { reversed[i]+=s[i];
            for(g = len - 1; g >= 0; g--)
            {
                printf("%c", reversed[g]);
            }
        }

    }i++;
}
</code>```

Title: Reverse strings of vowels

Body:
I have to find the vowels in an input string and return the string of the vowels in reverse order.

Example input: "woUIW"

The expected output is "IUOo"

But I cannot use pointers, only recursion.

This is my attempt:

void letters_revers(char s[])
{
    int i = 0,g,len,right,left;
    char reversed[10];
    len=strlen(reversed)-1; // get the length of the string
    left = 0; // set left index at 0
    right = len - 1; // set right index len - 1
    while(i!='\0')
    {

        if (s[i] == 'a' || s[i] == 'A' || s[i] == 'e' || s[i] == 'E' || s[i] == 'i' || s[i] == 'I' || s[i] =='o' || s[i]=='O' || s[i] == 'u' || s[i] == 'U')
        { reversed[i]+=s[i];
            for(g = len - 1; g >= 0; g--)
            {
                printf("%c", reversed[g]);
            }
        }

    }i++;
}


问:
concatenation of request url to web archive's base url when using fetch api
I want to run some script from the browser console for external sites that extracts the dom tree with some format, I did it right but when I wanted to write the result in my file system. this was not allowed due to security issues, so I wrote a backend script using Node.JS that writes into the file system using a post request from the console an reading from the file system while sending a get request on another endpoint.

this is a part of the code I run on the console in which I'm using the fetch API to send my data to the backend (dict)

```<code>let dict = generateDictionary(root);
const url = new URL("http://localhost:5000/write");
fetch(url, {
    method: "POST",
    body: JSON.stringify({ data: JSON.stringify(dict) }),
    headers: {
        "Content-Type": "application/json"
  },
})
    .then((response) => console.log(response))
    .then((data) => console.log(data));

</code>```

for most of different sites it works well like that

and this is a snippet from the dom tree after serialization

the problem appears when I use https://web.archive.org/ historical pages to send the same request like https://web.archive.org/web/20220201010705/https://www.reference.com/.

here as it appears on the snapshot it appends the localhost URL to the web archive's URL. I tried to modify different http headers to solve the problem but all of my trials have failed. what can I do to avoid this concatenation?

Body:
I want to run some script from the browser console for external sites that extracts the dom tree with some format, I did it right but when I wanted to write the result in my file system. this was not allowed due to security issues, so I wrote a backend script using Node.JS that writes into the file system using a post request from the console an reading from the file system while sending a get request on another endpoint.

this is a part of the code I run on the console in which I'm using the fetch API to send my data to the backend (dict)

let dict = generateDictionary(root);
const url = new URL("http://localhost:5000/write");
fetch(url, {
    method: "POST",
    body: JSON.stringify({ data: JSON.stringify(dict) }),
    headers: {
        "Content-Type": "application/json"
  },
})
    .then((response) => console.log(response))
    .then((data) => console.log(data));

for most of different sites it works well like that

and this is a snippet from the dom tree after serialization

the problem appears when I use https://web.archive.org/ historical pages to send the same request like https://web.archive.org/web/20220201010705/https://www.reference.com/.

here as it appears on the snapshot it appends the localhost URL to the web archive's URL. I tried to modify different http headers to solve the problem but all of my trials have failed. what can I do to avoid this concatenation?


问:
Oauth2 blocks frontend to backend request
i have Web app that has spring boot on the backend and on the front I have react.
On my backend I have set up oauth2 and everything is working properly(i mean i get desired data about user, validate the token  on https://oauth2.googleapis.com/tokeninfo).
The problem is when I am doing axios request from frontend to backend i'm getting and error

localhost:8080/farm im trying to reach with axios.
Without oauth2.0 enabled i didnt have any problems with reaching this endpoint.

I was trying to add "Access-Control-Allow-Origin" to the axios request but it didnt solve the problem. I was also trying to add the header after successful login on the backend when i redirect to localhost:3000


问:
Ghost page template load more posts button not showing
I am new to ghost and tried to include posts on a own page:slug.hbs template with the following code. The posts are shown but the gh-loadmore button is removed in the produced output. How can I use the load more function to display the rest of the posts on this page.</p>
```<code><main id="gh-main" class="gh-main gh-outer">
    <div class="gh-inner">
        <div class="gh-wrapper">
            <section class="gh-section">
                <div class="gh-feed">
                    {{#get "posts" filter="tags:mytag"}}
                        {{#foreach posts limit="8"}}
                            {{> loop}}
                        {{/foreach}}
                    {{/get}}
                </div>

                <button class="gh-loadmore gh-btn">Load more</button>
            </section>
        </div>
    </div>
</main>
</code>```

Body:
I am new to ghost and tried to include posts on a own page:slug.hbs template with the following code. The posts are shown but the gh-loadmore button is removed in the produced output. How can I use the load more function to display the rest of the posts on this page.

                    {{#get "posts" filter="tags:mytag"}}
                        {{#foreach posts limit="8"}}
                            {{> loop}}
                        {{/foreach}}
                    {{/get}}

                <button class="gh-loadmore gh-btn">Load more</button>


问:
vue3 swiperjs allways moves back to start position after touching a slide
i am using swiperjs 7.4.1 with vue3

when i click on one of the slides, the slider keeps moving back to the beginning. Of course, I would like the slider to stay there when it is on a rear navigation.

I've tried everything. but I probably didn't get the right one

```<code>:no-swiping="true"
:swiper-no-swiping="space tile"
:no-swiping-selector="input"

<swiper class="swiper-container" ref="swiper"
                         :pagination="{ clickable: true }"
                         :modules="modules"
                         :slides-per-view="4"
                         :space-between="22"
                         :loop="false"
                         :allow-touch-move="true"
                         :no-swiping="true"
                         :swiper-no-swiping="raumkachel"
                         :no-swiping-selector="input"
                         @swiper="onSwiper"
                         @slideChange="onSlideChange"

                    >
                    <swiper-slide v-for="item, index in uicontent.rooms" :key="index" >
                         <div class="raumkachel"  :class="index==route.params.roomId ? 'raumkachel-active':'raumkachel'"  @click="contentRoom(index)" >
                                   <p> {{ item.name }} </p>
                         </div>
                    </swiper-slide>

</code>```

Body:
i am using swiperjs 7.4.1 with vue3

when i click on one of the slides, the slider keeps moving back to the beginning. Of course, I would like the slider to stay there when it is on a rear navigation.

I've tried everything. but I probably didn't get the right one

:no-swiping="true"
:swiper-no-swiping="space tile"
:no-swiping-selector="input"

<swiper class="swiper-container" ref="swiper"
                         :pagination="{ clickable: true }"
                         :modules="modules"
                         :slides-per-view="4"
                         :space-between="22"
                         :loop="false"
                         :allow-touch-move="true"
                         :no-swiping="true"
                         :swiper-no-swiping="raumkachel"
                         :no-swiping-selector="input"
                         @swiper="onSwiper"
                         @slideChange="onSlideChange"

                    >
                    <swiper-slide v-for="item, index in uicontent.rooms" :key="index" >

 {{ item.name }}

                    </swiper-slide>


问:
Distributed lock service implementation in Golang
I have multiple E2E tests (written in Java) which share login details, each test during runtime will query the locker API for login details which is running on its own dedicated server.

Below is my implementation of my locker API in Go, it was working for me but wanted to make sure there are no bugs.

type service struct {
   lockstatus []string // stores test_id denoting which test took the lock
   data       []*LoginDetails // stores login details
   mu         []sync.Mutex // stores locks for "data" slice
}

func (s *service) AcquireLoginDetails(req *Request, resp *Response) error {
   foundLoginDetails := false
   for i := range s.mu {
      // for i, lock := range s.mu <- lock is copied here so will use s.mu[i] directly
      if s.mu[i].TryLock() {
         // skip to next lock if current lock is already taken
         if s.lockstatus[i] != "" {
            s.mu[i].Unlock()
            continue
         } else {
            // use this index to acquire lock for the requested test
            foundLoginDetails = true
            s.lockstatus[i] = req.GetTestID()
            resp.SetUserID(s.LoginDetails[i].UserID)
            resp.SetPassword(s.LoginDetails[i].Password)
         }
         s.mu[i].Unlock()
         if foundLoginDetails { break } // stop searching for further login details
      }
   }
   if !foundLoginDetails {
      return error_explaining_we_failed_to_acquire_lock
   }
   return nil
}

func (s *service) ReleaseLoginDetails(req *Request, resp *Response) error {
   foundLoginDetails := false
   for i, testID := range s.lockstatus {
      if testID == req.GetTestID() {
         s.mu[i].Lock()
         foundLoginDetails = true
         s.lockstatus[i] = ""
         s.mu[i].Unlock()
         break
      }
   }
   if !foundLoginDetails {
      return error_explaining_we_failed_to_release_lock
   }
   return nil
}
```


Title: Plot spectrogram from data extracted with OpenSMILE with matplotlib

Body:
I have data that was extracted from audio files with OpenSMILE. I have the spectrograms as png files, but I would like to learn how to plot it myself with matplotlib. The data has a frametime as first column, and decibel values in the other columns:

frameTime   pcm_fftMag_dBsplPSD[0]  pcm_fftMag_dBsplPSD[1]  pcm_fftMag_dBsplPSD[2]  pcm_fftMag_dBsplPSD[3]  pcm_fftMag_dBsplPSD[4]  pcm_fftMag_dBsplPSD[5]  pcm_fftMag_dBsplPSD[6]  pcm_fftMag_dBsplPSD[7]  pcm_fftMag_dBsplPSD[8]  ...     pcm_fftMag_dBsplPSD[1015]   pcm_fftMag_dBsplPSD[1016]   pcm_fftMag_dBsplPSD[1017]   pcm_fftMag_dBsplPSD[1018]   pcm_fftMag_dBsplPSD[1019]   pcm_fftMag_dBsplPSD[1020]   pcm_fftMag_dBsplPSD[1021]   pcm_fftMag_dBsplPSD[1022]   pcm_fftMag_dBsplPSD[1023]   pcm_fftMag_dBsplPSD[1024]
0   0.00    29.337350   33.33796    37.80634    39.14856    37.10407    31.38411    23.98991    21.24069    22.17934    ...     -29.698     -29.698     -29.698     -29.698     -29.698     -29.698     -29.69800   -29.698     -29.69800   -29.698
1   0.01    25.962640   32.16929    38.17088    40.23822    39.00978    35.06358    29.72674    26.18363    26.30389    ...     -29.698     -29.698     -29.698     -29.698     -29.698     -29.698     -29.69800   -29.698     -29.69800   -29.698
2   0.02    29.213380   32.68465    35.56105    32.83764    21.33615    29.81477    29.82164    28.43601    25.28292    ...     -29.698     -29.698     -29.698     -29.698     -29.698     -29.698     -29.69800   -29.698     -29.69800   -29.698
3   0.03    14.908160   27.76923    35.07159    38.74467    39.95192    39.26263    36.46785    30.59358    28.20222    ...     -29.698     -29.698     -29.698     -29.698     -29.698     -29.698     -29.69800   -29.698     -29.69800   -29.698

The spectrogram would take the first column as x-axis and plot the other columns on the y-axis as spectral bins. How can I plot this data as a spectrogram with matplotlib?


问:
Nginx disable caching for part of the page
My site is powered by Wordpress and is highly customizable. nginx server + php-fpm. I'm setting up caching and there was a problem. The sidebar contains a block that contains calculations that are unique to each user and do not need to be cached. How not to cache only part of the page? Not a request, but a part of the page. Or tell me which way to look to solve the problem?

Maybe not use nginx caching and use something else? Any advice needed.

I didn't try anything because I didn't find any information on my problem


问:
Audio length not consistent between librosa and pydub
I am new to audio prosessing in machine learning.

I processed a bunch of audio files and take one as example, I use pydub to make an audio file exactly to 6s as I expected using AudioSegment slicing or adding silence to modify the original audio file.

However, when I was converting the audio file to mfcc using librosa.feature.mfcc, I realized that my 6s file in pydub was not displayed as 6s using librosa.load. Can someone tell me why is that? My sample rate didn't change though, before and after the audio slicing it is always 44100.

Here a picture of my code of checking the length and the output.


问:
axios Post returning error in react native
i am using react native as front-end and backend i have laravel

i am tring to make a axios post request to api my api is working fine in postman

```<code> function getdata() {
    const Data = {

      name: name,
      email: email,
      date: mydate,
    };

    console.log(Data);

    axios
      .post('http://127.0.0.1:8000/api/users', Data)

      .then(() => {

        alert('success submited');

      })

      .catch(error => {
        alert(error);
      });

  }

</code>```

error :axiosError:Netwoek Error

Body:
i am using react native as front-end and backend i have laravel

i am tring to make a axios post request to api my api is working fine in postman

 function getdata() {
    const Data = {

      name: name,
      email: email,
      date: mydate,
    };

    console.log(Data);

    axios
      .post('http://127.0.0.1:8000/api/users', Data)

      .then(() => {

        alert('success submited');

      })

      .catch(error => {
        alert(error);
      });

  }

error :axiosError:Netwoek Error


问:
The value of an array can be read in the consolelog but I get no response when using agent.ad to dialogflow
A value that is stored in an array (res[0].name) coming from a mongodb database, has to be sent to dialogflow by using agent.add. It turns out that in the visual studio console the value res[0].name appears correctly, but when you add it in agent.add('The name is: '+res[0].name) the result in dialogflow is NOT AVAILABLE. Does anyone know if you need some kind of converter?

Tried everything, but I guess the closest version is this:
`

```<code>    function Consult(agent) {

      // Value coming from Dialogflow
      const department = agent.parameters.department;
      const position = agent.parameters.position;

   Consult.find({department : department, position : position}) //Database finding
               .exec((err, res)=>{
         if(err) return console.log('Error: ' + err)
                console.log(res[0].name);
               const a = res[0].name;
              });
             return agent.add("the name of the person you are searching for is: "+res[0].name);
              );

</code>```

`

Body:
A value that is stored in an array (res[0].name) coming from a mongodb database, has to be sent to dialogflow by using agent.add. It turns out that in the visual studio console the value res[0].name appears correctly, but when you add it in agent.add('The name is: '+res[0].name) the result in dialogflow is NOT AVAILABLE. Does anyone know if you need some kind of converter?

Tried everything, but I guess the closest version is this:
`

    function Consult(agent) {

      // Value coming from Dialogflow
      const department = agent.parameters.department;
      const position = agent.parameters.position;

   Consult.find({department : department, position : position}) //Database finding
               .exec((err, res)=>{
         if(err) return console.log('Error: ' + err)
                console.log(res[0].name);
               const a = res[0].name;
              });
             return agent.add("the name of the person you are searching for is: "+res[0].name);
              );

`


问:
Code works in 'Tailwind Play' but doesn't work in VS Code when I paste it in
Tailwind newbie here.

I followed a video on YouTube on how to add an image slide on hover, but it didn't work when I tried it in VS Code. Later, I saw in the description a link to 'Tailwind Play' that had a copy of the code in the video. It works flawlessly in 'Tailwind Play'. I then copied the code on to VS Code, but it doesn't appear as intended in the browser.

In the video, he uses w-16 class at 1.11 min into the video, but when I do the same, it does not change the width of the image.

Also, the gradient and words do not appear on hover in mine. But the the image does scale on hover for me.

Tailwind is installed properly afaik because it works properly in the other pages I made.

I'm using Google Chrome.

The YouTube video

Link to the Tailwind Play

Image of my file structure and head tag in VS Code; here, I pasted the code within the body tags

Image of how it appears to me in the browser

Image of how it's supposed to look

Each image scales, rotates, words appear and a gradient is applied on hover.

I tried removing class by class in the html but I couldn't figure out what the problem was.
I also tried unticking styles one by one in the chrome dev tools.
Here I found a style that specified the  tag to be width: 100% ; even though the class w-16 was applied in VS Code.

width: 100%;

w-16

I've been trying to figure out what's wrong since morning. Any help or advice is much appreciated.
Thank you!

Edit: Figured out what was wrong. It seems like I've configured Tailwind wrong. I followed a different video on how to install Tailwind and I pasted the above image slide on hover code to that environment and now it works !


问:
how to calculate the values for 'columns' parameter in Tabula-py
Can someone please explain me where and how to use the 'columns' parameter in a tabula-py.
For reference (Read giving column information) - https://nbviewer.org/github/chezou/tabula-py/blob/master/examples/tabula_example.ipynb</p>


问:
Image within MaterialCardView does not go to the edge
everyone. I would like to display an image within a MaterialCardView. The CardView has a rounded left corner. The image is displayed within the CardView using an ImageView. However, the picture doesn't go to the outer edge of the CardView. It seems like the CardView uses a padding. Here is the code

activity_main.xml:

```<code><com.google.android.material.card.MaterialCardView
    android:id="@+id/card_with_on_view"
    style="@style/CustomCardViewStyle"
    android:layout_width="match_parent"
    android:layout_height="500dp">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:src="@drawable/house" />

</com.google.android.material.card.MaterialCardView>
</code>```

styles.xml:

```<code><style name="CustomCardViewStyle" parent="@style/Widget.MaterialComponents.CardView">
    <item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay_card_custom_corners</item>
</style>

<style name="ShapeAppearanceOverlay_card_custom_corners" parent="">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSizeTopRight">0dp</item>
    <item name="cornerSizeTopLeft">0dp</item>
    <item name="cornerSizeBottomRight">0dp</item>
    <item name="cornerSizeBottomLeft">55dp</item>
</style>
</code>```

and this is the result:

Body:
everyone. I would like to display an image within a MaterialCardView. The CardView has a rounded left corner. The image is displayed within the CardView using an ImageView. However, the picture doesn't go to the outer edge of the CardView. It seems like the CardView uses a padding. Here is the code

activity_main.xml:

<com.google.android.material.card.MaterialCardView
    android:id="@+id/card_with_on_view"
    style="@style/CustomCardViewStyle"
    android:layout_width="match_parent"
    android:layout_height="500dp">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:src="@drawable/house" />

</com.google.android.material.card.MaterialCardView>

styles.xml:

and this is the result:


问:
how to set id attribute in a loop for div element in javascript. USING childnode or something else
```<code><div id="demo" style="display: flex; flex-wrap: wrap;">
 <div id="show">
  <div>Srikanya : 4K,DolbyAtmos</div>
  <div id="showtimes">
   <div>11:00am</div>
   <div>02:00pm</div>
   <div>06:00pm</div>
   <div>09:30pm</div>
  </div>
 </div>
</code>```
```<code>  const collection = document.getElementById("demo").children;
  for(i = 0; i <= 5; i++){
    collection[i].id = "show";
    collection[i].lastChild.id = "showtimes";
    collection[i].lastChild.children.id = "timings";
</code>```

**I want to set the id attribute  for the childnode of showtime in a loop but I was unable to do that i don't know what was a problem in my code  **

**I want to set the id attribute  for the childnode of showtime in a loop but I was unable to do that don't know what was a problem in my code on using js **

Body:
Srikanya : 4K,DolbyAtmos

11:00am

02:00pm

06:00pm

09:30pm

  const collection = document.getElementById("demo").children;
  for(i = 0; i <= 5; i++){
    collection[i].id = "show";
    collection[i].lastChild.id = "showtimes";
    collection[i].lastChild.children.id = "timings";

**I want to set the id attribute  for the childnode of showtime in a loop but I was unable to do that i don't know what was a problem in my code  **

**I want to set the id attribute  for the childnode of showtime in a loop but I was unable to do that don't know what was a problem in my code on using js **


问:
Not able to include child model inside parent model through findAll query in sequelize Next.js application
I am not able to get child table data in my parent data associated below is my code.

Here is my Role Model Schema

```<code>'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class Role extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
      this.hasMany(models.User, {
        as: "users",
        foreignKey: "roleId",
        onDelete: "SET NULL",
      });
    }
  }
  Role.init({
    role: DataTypes.STRING,
    roleInfo: DataTypes.STRING
  }, {
    sequelize,
    modelName: 'Role',
  });
  return Role;
};
</code>```

Here is my User Model Model Schema

```<code>'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class User extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // role assoiation
      this.belongsTo(models.Role, {
        as: "role",
        foreignKey: "roleId",
      });
      // list assoiation
      this.hasMany(models.List, {
        as: "lists",
        foreignKey: "userId",
        onDelete: "CASCADE",
      });
    }
  };
  User.init(
    {
      id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true,
      },
      name: {
        type: DataTypes.STRING,
      },
      email: {
        type: DataTypes.STRING,
      },
      password: {
        type: DataTypes.STRING,
      },
      avatar: {
        type: DataTypes.STRING,
      },

      phoneNumber: {
        type: DataTypes.STRING,
      },

      address: {
        type: DataTypes.STRING,
      },

      website: {
        type: DataTypes.STRING,
      },

      bio: {
        type: DataTypes.TEXT,
      },

      fbUrl: {
        type: DataTypes.STRING,
      },
      twtUrl: {
        type: DataTypes.STRING,
      },
      linkUrl: {
        type: DataTypes.STRING,
      },
      insUrl: {
        type: DataTypes.STRING,
      },
      roleId: {
        type: DataTypes.INTEGER,
      },
    },
    {
      sequelize,
      modelName: "User",
    }
  );
  return User;
};
</code>```

This is my Query

```<code>const user = await User.findOne({
        attributes: {
          exclude: ["password"],
        },
        where: { id: userId },
        include: [{ all: true, required: true }],
        // include: [{ model: Role }],
      });
</code>```

Body:
I am not able to get child table data in my parent data associated below is my code.

Here is my Role Model Schema

'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class Role extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
      this.hasMany(models.User, {
        as: "users",
        foreignKey: "roleId",
        onDelete: "SET NULL",
      });
    }
  }
  Role.init({
    role: DataTypes.STRING,
    roleInfo: DataTypes.STRING
  }, {
    sequelize,
    modelName: 'Role',
  });
  return Role;
};

Here is my User Model Model Schema

'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class User extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // role assoiation
      this.belongsTo(models.Role, {
        as: "role",
        foreignKey: "roleId",
      });
      // list assoiation
      this.hasMany(models.List, {
        as: "lists",
        foreignKey: "userId",
        onDelete: "CASCADE",
      });
    }
  };
  User.init(
    {
      id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true,
      },
      name: {
        type: DataTypes.STRING,
      },
      email: {
        type: DataTypes.STRING,
      },
      password: {
        type: DataTypes.STRING,
      },
      avatar: {
        type: DataTypes.STRING,
      },

      phoneNumber: {
        type: DataTypes.STRING,
      },

      address: {
        type: DataTypes.STRING,
      },

      website: {
        type: DataTypes.STRING,
      },

      bio: {
        type: DataTypes.TEXT,
      },

      fbUrl: {
        type: DataTypes.STRING,
      },
      twtUrl: {
        type: DataTypes.STRING,
      },
      linkUrl: {
        type: DataTypes.STRING,
      },
      insUrl: {
        type: DataTypes.STRING,
      },
      roleId: {
        type: DataTypes.INTEGER,
      },
    },
    {
      sequelize,
      modelName: "User",
    }
  );
  return User;
};

This is my Query

const user = await User.findOne({
        attributes: {
          exclude: ["password"],
        },
        where: { id: userId },
        include: [{ all: true, required: true }],
        // include: [{ model: Role }],
      });


问:
how to make this a responsive website when resizing?
I am a student learning about CSS, and I have this problem where when I resize my window, the elements I put resize as well but i want it to not resize and move whenever i zoom in or out. How do I make the elements responsive whenever i zoom in/out the browser size or change the resolution of monitors?? Below is the CSS I have made for the whole website. it is</p>
```<code> @import url('https://fonts.googleapis.com/css2?family=Kaushan+Script&display=swap');
 @import url('https://fonts.googleapis.com/css2?family=Alice&display=swap');

*{
    margin: 0;
    padding: 0;
}

html{
    scroll-behavior: smooth;
}

body{
    font-size: 100%;
    font-family: sans-serif;
    backgroundURLage: url("img/bg.jpg");
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0URL.7)), url(img/bg.jpg);
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

div, section, span, ul, li, a, header{
    box-sizing: border-box;
}

/*css reset*/

header{
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px 50px;
    align-items: center;
    position: fixed;
    z-index: 999;
}

#menu li{
    list-style: none;
    display: inline-block;
    margin: 20px;
}

#menu li a{
    color: #fff;
    text-decoration: none;
    font-size: 20px;
}

section{
    width: 100%;
    height: 100vh;
    position: relative;
}

#home{
   background-color: #59405c00;
}

#about{
     background-color: #ED6663;
}

#Parts{
     background-color: #B52B65;
}

#pricing{
     background-color: #3C2C3E;
}

#contact{
     background-color: #B52B65;
}

/* changing names start */
#spin {
    color:rgb(250, 112, 0);
  }
  #spin:after {
    content:"";
    animation: spin 7s linear infinite;
  }
  @keyframes spin {
    0% { content:"Asian Wonders";}

    20% { content:"asiyanın möcüzələri";}

    40% { content:"아시아의 불가사의";}

    60% { content:"亚洲奇观";}

    80% { content: "สิ่งมหัศจรรย์แห่งเอเชีย"; }

    100% { content: "عجائب آسيوية"; }
  }
h1{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Kaushan Script', cursive;
}
p1{
    position: absolute;
    top: 63%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 30px;

}
/* end of changing names */

.about{
    font-family: 'Kaushan Script', cursive;
    position: absolute;
    top: 22%;
    left: 27%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
}
p2{
    position: absolute;
    top: 75%;
    left: 27%;
    transform: translate(-50%, -70%);
    color: #fff;
    font-size: 17px;
    width: 40%;
}
img{
    display:block;
    width: 450px;
    height: 450px;
    margin: 0 auto;
    transform: 1s smooth;
    position: absolute;
    top: 20%;
    right: 5%;
}

.parts{
    font-family: 'Kaushan Script', cursive;
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
}
p3{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -70%);
    color: #fff;
    font-size: 15px;
    width: 60%;
    text-align: center;
}
.flag{
    position:absolute;
    top: 45%;
    left: 35%;
}

h4{
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
}
h5{
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
}

</code>```

Body:
I am a student learning about CSS, and I have this problem where when I resize my window, the elements I put resize as well but i want it to not resize and move whenever i zoom in or out. How do I make the elements responsive whenever i zoom in/out the browser size or change the resolution of monitors?? Below is the CSS I have made for the whole website. it is

 @import url('https://fonts.googleapis.com/css2?family=Kaushan+Script&display=swap');
 @import url('https://fonts.googleapis.com/css2?family=Alice&display=swap');

*{
    margin: 0;
    padding: 0;
}

html{
    scroll-behavior: smooth;
}

body{
    font-size: 100%;
    font-family: sans-serif;
    backgroundURLage: url("img/bg.jpg");
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0URL.7)), url(img/bg.jpg);
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

div, section, span, ul, li, a, header{
    box-sizing: border-box;
}

/*css reset*/

header{
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px 50px;
    align-items: center;
    position: fixed;
    z-index: 999;
}

#menu li{
    list-style: none;
    display: inline-block;
    margin: 20px;
}

#menu li a{
    color: #fff;
    text-decoration: none;
    font-size: 20px;
}

section{
    width: 100%;
    height: 100vh;
    position: relative;
}

#home{
   background-color: #59405c00;
}

#about{
     background-color: #ED6663;
}

#Parts{
     background-color: #B52B65;
}

#pricing{
     background-color: #3C2C3E;
}

#contact{
     background-color: #B52B65;
}

/* changing names start */
#spin {
    color:rgb(250, 112, 0);
  }
  #spin:after {
    content:"";
    animation: spin 7s linear infinite;
  }
  @keyframes spin {
    0% { content:"Asian Wonders";}

    20% { content:"asiyanın möcüzələri";}

    40% { content:"아시아의 불가사의";}

    60% { content:"亚洲奇观";}

    80% { content: "สิ่งมหัศจรรย์แห่งเอเชีย"; }

    100% { content: "عجائب آسيوية"; }
  }
h1{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Kaushan Script', cursive;
}
p1{
    position: absolute;
    top: 63%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 30px;

}
/* end of changing names */

.about{
    font-family: 'Kaushan Script', cursive;
    position: absolute;
    top: 22%;
    left: 27%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
}
p2{
    position: absolute;
    top: 75%;
    left: 27%;
    transform: translate(-50%, -70%);
    color: #fff;
    font-size: 17px;
    width: 40%;
}
img{
    display:block;
    width: 450px;
    height: 450px;
    margin: 0 auto;
    transform: 1s smooth;
    position: absolute;
    top: 20%;
    right: 5%;
}

.parts{
    font-family: 'Kaushan Script', cursive;
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
}
p3{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -70%);
    color: #fff;
    font-size: 15px;
    width: 60%;
    text-align: center;
}
.flag{
    position:absolute;
    top: 45%;
    left: 35%;
}

h4{
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
}
h5{
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 100px;
}


问:
XMLHttpRequest giving super weird inconsistent results in react native with expo image picker
EDIT: i've got a theory that my weird result on web is due to some unusual polyfill but i have no idea how to fix it, why its only happening to me or whats with the weird JSON stuff on mobile so please help.

So my upload function is based off of the code example with firebase in expo image picker here:

https://github.com/expo/examples/tree/master/with-firebase-storage-upload

They're using XMLHttpRequest instead of fetch and advise to do the same but its giving me some really weird results.

For one, i know that the expo image picker returns a base64 string containing the actual data of the image rather than a uri on web. But it seemed like it was working on web before. I'm confirming the input with a console.log() and can confirm the base64 data IS indeed going through on web, BUT, on web what seems to be getting uploaded is an HTML snippet containing formatted text that says:

"Oh no! It looks like JavaScript is not enabled in your browser.

Reload "

Which... is just not true. Javascript is enabled in my browser otherwise the whole rest of the app wouldn't work but for some reason XMLHttpRequest in particular is just crapping out. And i can confirm that this is indeed what is coming out in my blob using another console.log().

```<code>const uploadPhoto = async (Photo) => {
        if (Photo) {
            //if it is a URI make a blob
            console.log(Photo);
            const blob = await new Promise((resolve, reject) => {
                const xhr = new XMLHttpRequest();
                xhr.onload = function () {
                    resolve(xhr.response);
                };
                xhr.onerror = function (e) {
                    console.log(e);
                    reject(new TypeError("Network request failed"));
                };
                xhr.responseType = "blob";
                xhr.open("GET", Photo, true);
                xhr.send(null);
            });
            console.log(await blob.text());

            //create file ref
            const fileRef = ref(getStorage(), uuidv4());

            uploadBytes(fileRef, blob)
                .catch(error => {
                    alert(error);
                    return null;
                })
                .then(result => {
                    return result;
                })

        }
</code>```

Furthermore, when i try to run on iOS, i'm getting this weird error:
enter image description here
Which is showing up on my emulator, not my console and i don't know what to make of it because i've never seen a JSON value thrown as an error and can't find any record of this kind of thing happening to anyone else. Presumably this is the correct base64 image data but why is it coming up as some kind of error?

And then on android i can't even reach the submit button due to a different issue where scrollview doesn't scroll in the stack navigator on android but thats a separate problem i'm trying to solve unrelated to this issue. It just means i can't test this bug out on android yet.

Does anyone know wtf is going on? And also, since i can't find anyone out there that even seems to acknowledge the difference in output data between the web and mobile platforms of expo image picker, and the only reason i even know about it was because i pointed it out on reddit and some guy acted like i was the idiot for assuming the uri value WOULDN'T be base64 data on web and this was a feature not a bug... but since the output data is different on the web platform why do none of the guides that use expo image picker and firebase seem to acknowledge this difference and does it actually matter?

Body:
EDIT: i've got a theory that my weird result on web is due to some unusual polyfill but i have no idea how to fix it, why its only happening to me or whats with the weird JSON stuff on mobile so please help.

So my upload function is based off of the code example with firebase in expo image picker here:

https://github.com/expo/examples/tree/master/with-firebase-storage-upload

They're using XMLHttpRequest instead of fetch and advise to do the same but its giving me some really weird results.

For one, i know that the expo image picker returns a base64 string containing the actual data of the image rather than a uri on web. But it seemed like it was working on web before. I'm confirming the input with a console.log() and can confirm the base64 data IS indeed going through on web, BUT, on web what seems to be getting uploaded is an HTML snippet containing formatted text that says:

"Oh no! It looks like JavaScript is not enabled in your browser.

Reload "

Which... is just not true. Javascript is enabled in my browser otherwise the whole rest of the app wouldn't work but for some reason XMLHttpRequest in particular is just crapping out. And i can confirm that this is indeed what is coming out in my blob using another console.log().

const uploadPhoto = async (Photo) => {
        if (Photo) {
            //if it is a URI make a blob
            console.log(Photo);
            const blob = await new Promise((resolve, reject) => {
                const xhr = new XMLHttpRequest();
                xhr.onload = function () {
                    resolve(xhr.response);
                };
                xhr.onerror = function (e) {
                    console.log(e);
                    reject(new TypeError("Network request failed"));
                };
                xhr.responseType = "blob";
                xhr.open("GET", Photo, true);
                xhr.send(null);
            });
            console.log(await blob.text());

            //create file ref
            const fileRef = ref(getStorage(), uuidv4());

            uploadBytes(fileRef, blob)
                .catch(error => {
                    alert(error);
                    return null;
                })
                .then(result => {
                    return result;
                })

        }

Furthermore, when i try to run on iOS, i'm getting this weird error:
enter image description here
Which is showing up on my emulator, not my console and i don't know what to make of it because i've never seen a JSON value thrown as an error and can't find any record of this kind of thing happening to anyone else. Presumably this is the correct base64 image data but why is it coming up as some kind of error?

And then on android i can't even reach the submit button due to a different issue where scrollview doesn't scroll in the stack navigator on android but thats a separate problem i'm trying to solve unrelated to this issue. It just means i can't test this bug out on android yet.

Does anyone know wtf is going on? And also, since i can't find anyone out there that even seems to acknowledge the difference in output data between the web and mobile platforms of expo image picker, and the only reason i even know about it was because i pointed it out on reddit and some guy acted like i was the idiot for assuming the uri value WOULDN'T be base64 data on web and this was a feature not a bug... but since the output data is different on the web platform why do none of the guides that use expo image picker and firebase seem to acknowledge this difference and does it actually matter?


问:
How to persist user home directory created after IAP SSH to the Vertex AI Workbench Virtual Machine?
On Vertex AI VM there is a jupyter user and its home directory is persisted even if the VM machine type is changed. However I'm also using this VM as the development VM so I'm using IAP-SSH to it which will create another user home directory for my personal account. In this directory I store all the source code.

How can I back-up this existing directory with a persistent disk? I saw that I can mount a disk with snapshot policy to an existing VM, however that would overwrite the existing content in it. Some more detailed guidance is much appreciated.


问:
validate select option dropdown in react
I  want to check the selected field in select option.I have applied validation using react hook form but it doesnt work and it navigate me forward.How to solve it.

```<code> <div className="col-lg-4 col-md-4 col-sm-4 col-12">
                            <label htmlFor="select" className="for-color1 pt-4">
                              Passenger <span>*</span>
                            </label>
                            <div className="enter-name">
                              <select id="select" name="select"   {...register("select", {required:"select is required"})}
                                onChange={(e) => setValue('select', e.target.value,{ shouldValidate: true })} >
                                <option value="">Please Select</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                              </select>
                              {/* <span>{errors.passenger && <p style={{ color: 'red' }}> {errors.passenger.message}</p>}</span> */}

                              <span>{errors.select && <p>{errors.select.message}</p>}</span>
                            </div>
                          </div>
                        </div>
                        <div className="row">
                          <div className="col-lg-12 float-right text-right mt-3">
                            {/* <button
                             className="btn nav-next-btn continue"
                             onClick={activeStep2}
                             role="tab"
                              data-toggle="tab"
                              aria-expanded="true"
                              type="submit"
                            >
                                   Next
                            </button> */}
                            <a
                              className="btn nav-next-btn continue"
                              onClick={activeStep2}
                              href="#shipping"
                              role="tab"
                              data-toggle="tab"
                              aria-expanded="true"
                            >
                              NEXT
                            </a>
                          </div>
</code>```

Any one help me regarding this

Body:
I  want to check the selected field in select option.I have applied validation using react hook form but it doesnt work and it navigate me forward.How to solve it.

                              Passenger *

                              <select id="select" name="select"   {...register("select", {required:"select is required"})}
                                onChange={(e) => setValue('select', e.target.value,{ shouldValidate: true })} >
                                <option value="">Please Select</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                              </select>
                              {/* {errors.passenger &&
 {errors.passenger.message}
} */}

                              {errors.select &&
{errors.select.message}
}

                            {/* <button
                             className="btn nav-next-btn continue"
                             onClick={activeStep2}
                             role="tab"
                              data-toggle="tab"
                              aria-expanded="true"
                              type="submit"
                            >
                                   Next
                            </button> */}

                              NEXT

Any one help me regarding this


问:
I wanted to add multiple rows into my sqlite database table at one time ... , but it gets replaced each time when new data inserted? any Solutiions
Its working fine with the following code but only one problem exist, Each time when I enter details of another Persons Payment it replaces the previous data in the database, I Dont'know why?

may table will look like    id,date, houseName, mobile, month, subscription, amount, payed_Amount

one person could have multiple payments.

its the details to be inserted.

```<code>private void saveDataIntoDb() {
        String date = dateView.getText().toString();
        String phone = mobileNo.getText().toString();
        String house = housename.getText().toString();

            PayBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {

                    boolean  result= false;

                    int length=paymentReports.size();

                        //to get data from listLayout
                        for (int i = 0; i < list_layout.getChildCount(); i++) {
                            View customView = list_layout.getChildAt(i);

                            TextView selectedSubscription = customView.findViewById(id.selected_subType);
                            Spinner month_s = customView.findViewById(id.spinner);
                            TextView amount = customView.findViewById(id.amount);
                            TextView payed = customView.findViewById(id.payedAmount);

                            selected_Sub_name = selectedSubscription.getText().toString();

                            payedMonth = monthList.get(month_s.getSelectedItemPosition());
                            System.out.println("payedMonth-------------" + payedMonth);

                            Amnt = Integer.parseInt(amount.getText().toString());
                            System.out.println("sub_amount,,,,,,,,,,,,,,,,,,,," + Amnt);

                            Payed = Integer.parseInt(payed.getText().toString());
                            System.out.println("payed_money________________" + Payed);

                            result= _db.insertdata(date, phone, house, selected_Sub_name, payedMonth, Amnt, Payed);

                    }

                    if (result== true) {

                        Toast.makeText(DepositPage.this, "= Inserted Successfully", Toast.LENGTH_SHORT).show();
//                    Intent intent=new Intent(getApplicationContext(),Report_Page.class);
//                    startActivity(intent);

                    } else {
                        Toast.makeText(DepositPage.this, "= Insertion Failed", Toast.LENGTH_SHORT).show();
                    }
                }
            });

    }
</code>```
```<code>
here is the insert query

boolean insertdata(String date, String phone, String housename, String sub_type, String month, int amount, int payed) {
    SQLiteDatabase sqLiteDatabase = getWritableDatabase();

    ContentValues contentValues = new ContentValues();
    contentValues.put(Date, date);
    contentValues.put(Phone, phone);
    contentValues.put(Housename, housename);
    contentValues.put(Sub_type, sub_type);
    contentValues.put(Month, month);
    contentValues.put(Amount, amount);
    contentValues.put(Payed, payed);

    Long result = sqLiteDatabase.insert(TABLE_Payment_Details, null, contentValues);

    if (result == -1) {
        return false;
    } else {
        return true;
    }

}

</code>```

Body:
Its working fine with the following code but only one problem exist, Each time when I enter details of another Persons Payment it replaces the previous data in the database, I Dont'know why?

may table will look like    id,date, houseName, mobile, month, subscription, amount, payed_Amount

one person could have multiple payments.

its the details to be inserted.

private void saveDataIntoDb() {
        String date = dateView.getText().toString();
        String phone = mobileNo.getText().toString();
        String house = housename.getText().toString();

            PayBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {

                    boolean  result= false;

                    int length=paymentReports.size();

                        //to get data from listLayout
                        for (int i = 0; i < list_layout.getChildCount(); i++) {
                            View customView = list_layout.getChildAt(i);

                            TextView selectedSubscription = customView.findViewById(id.selected_subType);
                            Spinner month_s = customView.findViewById(id.spinner);
                            TextView amount = customView.findViewById(id.amount);
                            TextView payed = customView.findViewById(id.payedAmount);

                            selected_Sub_name = selectedSubscription.getText().toString();

                            payedMonth = monthList.get(month_s.getSelectedItemPosition());
                            System.out.println("payedMonth-------------" + payedMonth);

                            Amnt = Integer.parseInt(amount.getText().toString());
                            System.out.println("sub_amount,,,,,,,,,,,,,,,,,,,," + Amnt);

                            Payed = Integer.parseInt(payed.getText().toString());
                            System.out.println("payed_money________________" + Payed);

                            result= _db.insertdata(date, phone, house, selected_Sub_name, payedMonth, Amnt, Payed);

                    }

                    if (result== true) {

                        Toast.makeText(DepositPage.this, "= Inserted Successfully", Toast.LENGTH_SHORT).show();
//                    Intent intent=new Intent(getApplicationContext(),Report_Page.class);
//                    startActivity(intent);

                    } else {
                        Toast.makeText(DepositPage.this, "= Insertion Failed", Toast.LENGTH_SHORT).show();
                    }
                }
            });

    }

here is the insert query

boolean insertdata(String date, String phone, String housename, String sub_type, String month, int amount, int payed) {
    SQLiteDatabase sqLiteDatabase = getWritableDatabase();

    ContentValues contentValues = new ContentValues();
    contentValues.put(Date, date);
    contentValues.put(Phone, phone);
    contentValues.put(Housename, housename);
    contentValues.put(Sub_type, sub_type);
    contentValues.put(Month, month);
    contentValues.put(Amount, amount);
    contentValues.put(Payed, payed);

    Long result = sqLiteDatabase.insert(TABLE_Payment_Details, null, contentValues);

    if (result == -1) {
        return false;
    } else {
        return true;
    }

}


问:
sending object with other string cause [object object] error
I am using express to do this. When I want to send the response back to client, the object display as [object object]. I used JSON.stringify() to convert it.

The object returned properly when it is res.send(result), however when I added string in front res.send({"sale": ${result}}) it will return as {"sale": [object object]}

this is my code:

```<code>var total = 0
for (var x=0; x<result.length; x++){
    total += result[x].amount;
}
var resultF = Object.values(JSON.parse(JSON.stringify(result)));
console.log(resultF)
res.status(200).send(`{"sale": ${resultF}, "tatol": "${total.toFixed(2)}"}`);
</code>```

I want to achieve this:

```<code>{
  “sale”: [
    {
  “id”: “1”,
  “amount”: “5.99”,
  “date”: “2005-06-15 22:03:14”
  },
    {
  “id”: “2”,
  “amount”: “9.90”,
  “date”: “2005-06-16 08:01:02”
  },
    {
  “id”: “3”,
  “amount”: “7.30”,
  “date”: “2005-06-17 15:56:53”
  },
],
“total”: “23.10”
}
</code>```

HELP!

Body:
I am using express to do this. When I want to send the response back to client, the object display as [object object]. I used JSON.stringify() to convert it.

The object returned properly when it is res.send(result), however when I added string in front res.send({"sale": ${result}}) it will return as {"sale": [object object]}

this is my code:

var total = 0
for (var x=0; x<result.length; x++){
    total += result[x].amount;
}
var resultF = Object.values(JSON.parse(JSON.stringify(result)));
console.log(resultF)
res.status(200).send(`{"sale": ${resultF}, "tatol": "${total.toFixed(2)}"}`);

I want to achieve this:

{
  “sale”: [
    {
  “id”: “1”,
  “amount”: “5.99”,
  “date”: “2005-06-15 22:03:14”
  },
    {
  “id”: “2”,
  “amount”: “9.90”,
  “date”: “2005-06-16 08:01:02”
  },
    {
  “id”: “3”,
  “amount”: “7.30”,
  “date”: “2005-06-17 15:56:53”
  },
],
“total”: “23.10”
}

HELP!


问:
counting FLOPs of a batch normalization layer
Could you please let me know how I can count the number of FLOPs related to the batch normalization layer theoretically?

(FLOPs: Note that s is lowercase, which is the abbreviation of FLoating point OPerations (s stands for plural), which means floating point arithmetic, understood as calculation amount. It can be used to measure the complexity of the model. The evaluation of the complexity of neural network models should refer to FLOPs, not FLOPS.)


问:
How to used React-transliterate in div contentEditable custom Component
How can add React Transliterate in div contentEditable.. Please help me

```<code>  import './App.css';
    import EditText from "./component/EditText"
    import Tools from "./component/tools"
    import Header from "./component/header"
    import Img from "./component/img"
    import './scss/style.scss';
    import MyImage from './home.png';
    import React, { useState } from "react";
    import { ReactTransliterate, Language } from "react-transliterate";
    const  App = () => {
      const [text, setText] = useState("");
      const [message, setMessage] = useState('');
      const handleKeyDown = event => {
        console.log(event.key);

    if (event.key === 'Enter') {
      event.preventDefault();
 console.log(message);
console.log(event.target.value)
console.log('User pressed Enter ');

    }
  };

  // const [lang, setLang] = useState<Language>("hi");
  return (
    <div className="App">
      <Header/>
      <div className='App_leftbar'>
        <ul>
          <li>
            <a href='#'><img src={MyImage} /></a>
          </li>
        </ul>
      </div>
      <div className='App_centerbar'>

        <div
       contentEditable="true"
        id="message"
        name="message"
        value={text}
        onChange={event => setText(event.target.value)}
        onKeyDown={handleKeyDown}
      />
 <ReactTransliterate
        renderComponent={(props) => <EditText onChange={event => setText(event.target.value)}
        onKeyDown={handleKeyDown} {...props} />}
        value={text}
        onChangeText={(text) => {
          setText(text);
        }}
        lang="hi"
        placeholder="Start typing here..."
        id="react-transliterate-input"
      />
        <Img src={MyImage}/>
      </div>
      <div className='App_rightbar'>
        <Tools />
      </div>
    </div>
  );
}

export default App;
</code>```

I used this npm https://www.npmjs.com/package/react-transliterate?activeTab=readme

```<code>import React, { useState } from "react";

import { ReactTransliterate } from "react-transliterate";
import "react-transliterate/dist/index.css";

const App = () => {
  const [text, setText] = useState("");

  return (
    <ReactTransliterate
      value={text}
      onChangeText={(text) => {
        setText(text);
      }}
      lang="hi"
    />
  );
};

export default App;
</code>```

React Transliterate uses the event.keycode property to detect keys. Here are some predefined keys you can use. Or, you can enter the integer codes for any other key you'd like to use as the trigger

Body:
How can add React Transliterate in div contentEditable.. Please help me

  import './App.css';
    import EditText from "./component/EditText"
    import Tools from "./component/tools"
    import Header from "./component/header"
    import Img from "./component/img"
    import './scss/style.scss';
    import MyImage from './home.png';
    import React, { useState } from "react";
    import { ReactTransliterate, Language } from "react-transliterate";
    const  App = () => {
      const [text, setText] = useState("");
      const [message, setMessage] = useState('');
      const handleKeyDown = event => {
        console.log(event.key);

    if (event.key === 'Enter') {
      event.preventDefault();
 console.log(message);
console.log(event.target.value)
console.log('User pressed Enter ');

    }
  };

  // const [lang, setLang] = useState<Language>("hi");
  return (

 setText(event.target.value)}
        onKeyDown={handleKeyDown}
      />
 <ReactTransliterate
        renderComponent={(props) => <EditText onChange={event => setText(event.target.value)}
        onKeyDown={handleKeyDown} {...props} />}
        value={text}
        onChangeText={(text) => {
          setText(text);
        }}
        lang="hi"
        placeholder="Start typing here..."
        id="react-transliterate-input"
      />

        <Tools />

  );
}

export default App;

I used this npm https://www.npmjs.com/package/react-transliterate?activeTab=readme

import React, { useState } from "react";

import { ReactTransliterate } from "react-transliterate";
import "react-transliterate/dist/index.css";

const App = () => {
  const [text, setText] = useState("");

  return (
    <ReactTransliterate
      value={text}
      onChangeText={(text) => {
        setText(text);
      }}
      lang="hi"
    />
  );
};

export default App;

React Transliterate uses the event.keycode property to detect keys. Here are some predefined keys you can use. Or, you can enter the integer codes for any other key you'd like to use as the trigger


问:
How to simulate a cache and memory with C code?
I have a work that need to design unit test for functions.

One of the function (or MACRO) will do the cache flush or cache invalidate.

But the point is, this target code runs on the different hardware with the test program does.

So, the function of cache operation cannot be tested directly because of the different hardware and maybe there will produce some error to run it.

Therefore, I need to simulate the cache operation like flush and invalidate by C code to test the other function which may use these operations.

I know the number of cache line and how do I simulate it by C code?


问:
Realm with flutter - unmanaged object
I have a question about the realm database for flutter that I want to use locally.

Background: The objects that are read from the realm database are managed by the realm database => object.isManaged = true. If I work here with a data layer and domain layer and convert the objects in the domain type, change a property and convert back to the data type, the objet is now unmanaged => object.isManaged = false. So I can't delete and change the object in database anymore. And I get the following error when deleting: "Realm error : Cannot delete an unmanaged object".

Question: Is there a pragmatic solution for this - without giving up the different layers (data and domain)?

Thanks in advance.

I think if I can make sure the data is already part of the real database, I should be able to force the object to object.isManaged = true. Or I can create a managed object without new access to the database itself.

I have added a picture as further explanation. My goal is to have no dependency on Realm within the Presentation / UI layer.

Here a the models the domain models:

```<code>class ShoppingListItem {
  String uuid;
  int amount;

  bool done;
  Grocery grocery;

  ShoppingListItem({
    required this.uuid,
    required this.amount,
    required this.done,
    required this.grocery,
  });
}

class Grocery {
  int? barcode;

  String? name;
  String? brand;

  Grocery({
    this.barcode,
    this.name,
    this.brand,
  });
}
</code>```

And the models from the Data layer which are also used for Realm

```<code>    @RealmModel()
class _ShoppingListItemData {
  @PrimaryKey()
  late String uuid;
  late int? amount;
  late bool? done;
  late _GroceryData? grocery;
}

@RealmModel(ObjectType.embeddedObject)
class _GroceryData {
  late int? barcode;
  late String? name;
  late String? brand;
}
</code>```

And here are the methods which transform the data toData and back toDomain

```<code>class Interface {
  static ShoppingListItem toDomain(ShoppingListItemData shoppingListItemData) {
    return ShoppingListItem(
        uuid: shoppingListItemData.uuid,
        amount: shoppingListItemData.amount ?? 1,
        done: shoppingListItemData.done ?? false,
        grocery: Grocery(
            barcode: shoppingListItemData.grocery?.barcode ?? 0,
            name: shoppingListItemData.grocery?.name));
  }

  static ShoppingListItemData fromDomain(ShoppingListItem shoppingListItem) {
    return ShoppingListItemData(shoppingListItem.uuid,
        amount: shoppingListItem.amount,
        done: shoppingListItem.done,
        grocery: GroceryData(
            barcode: shoppingListItem.grocery.barcode,
            brand: shoppingListItem.grocery.brand,
            name: shoppingListItem.grocery.name));
  }
}
</code>```

As soon the data are copied to Domain an and than back to Data layer the object.isManaged = false and therefore deletion or modification to the realm data base can not be applied.

Title: Realm with flutter - unmanaged object

Body:
I have a question about the realm database for flutter that I want to use locally.

Background: The objects that are read from the realm database are managed by the realm database => object.isManaged = true. If I work here with a data layer and domain layer and convert the objects in the domain type, change a property and convert back to the data type, the objet is now unmanaged => object.isManaged = false. So I can't delete and change the object in database anymore. And I get the following error when deleting: "Realm error : Cannot delete an unmanaged object".

Question: Is there a pragmatic solution for this - without giving up the different layers (data and domain)?

Thanks in advance.

I think if I can make sure the data is already part of the real database, I should be able to force the object to object.isManaged = true. Or I can create a managed object without new access to the database itself.

I have added a picture as further explanation. My goal is to have no dependency on Realm within the Presentation / UI layer.

Here a the models the domain models:

class ShoppingListItem {
  String uuid;
  int amount;

  bool done;
  Grocery grocery;

  ShoppingListItem({
    required this.uuid,
    required this.amount,
    required this.done,
    required this.grocery,
  });
}

class Grocery {
  int? barcode;

  String? name;
  String? brand;

  Grocery({
    this.barcode,
    this.name,
    this.brand,
  });
}

And the models from the Data layer which are also used for Realm

    @RealmModel()
class _ShoppingListItemData {
  @PrimaryKey()
  late String uuid;
  late int? amount;
  late bool? done;
  late _GroceryData? grocery;
}

@RealmModel(ObjectType.embeddedObject)
class _GroceryData {
  late int? barcode;
  late String? name;
  late String? brand;
}

And here are the methods which transform the data toData and back toDomain

class Interface {
  static ShoppingListItem toDomain(ShoppingListItemData shoppingListItemData) {
    return ShoppingListItem(
        uuid: shoppingListItemData.uuid,
        amount: shoppingListItemData.amount ?? 1,
        done: shoppingListItemData.done ?? false,
        grocery: Grocery(
            barcode: shoppingListItemData.grocery?.barcode ?? 0,
            name: shoppingListItemData.grocery?.name));
  }

  static ShoppingListItemData fromDomain(ShoppingListItem shoppingListItem) {
    return ShoppingListItemData(shoppingListItem.uuid,
        amount: shoppingListItem.amount,
        done: shoppingListItem.done,
        grocery: GroceryData(
            barcode: shoppingListItem.grocery.barcode,
            brand: shoppingListItem.grocery.brand,
            name: shoppingListItem.grocery.name));
  }
}

As soon the data are copied to Domain an and than back to Data layer the object.isManaged = false and therefore deletion or modification to the realm data base can not be applied.


问:
Simple R functions not working on new laptop with win 11
I want to load raster files then mask out the clouded parts. I have done it many times and the code used to work fine. Now I upgraded to windows 11 and has a new laptop. Installed R 4.2, then RStudio and then RTools 4.2. Here is my code

```<code>`library(raster)
library(rgdal)

setwd('D:/Test/')

masks <- list.files('D:/Test', 'mask_C2.tif$', full.names = T)
ndvi <- list.files('D:/Test', 'NDVI_C2.tif$', full.names = T)
rm <- lapply(masks, raster)
rn <- lapply(ndvi, raster)

When I call 1st element on NEW MACHINE, 'names' property doesn't have file name, it just says layer
> rn[[1]]
class      : RasterLayer
dimensions : 174, 164, 28536  (nrow, ncol, ncell)
resolution : 30, 30  (x, y)
extent     : 323895, 328815, 3724335, 3729555  (xmin, xmax, ymin, ymax)
crs        : +proj=utm +zone=43 +datum=WGS84 +units=m +no_defs
source     : cr_LC81500372020261LGN00_NDVI_C2.tif
names      : layer
values     : -0.1510984, 0.8510309  (min, max)

When I call 1st element on OLD MACHINE, 'names' property has file name
> rn[[1]]
class      : RasterLayer
dimensions : 174, 164, 28536  (nrow, ncol, ncell)
resolution : 30, 30  (x, y)
extent     : 323895, 328815, 3724335, 3729555  (xmin, xmax, ymin, ymax)
crs        : +proj=utm +zone=43 +datum=WGS84 +units=m +no_defs
source     : cr_LC81500372020261LGN00_NDVI_C2.tif
names      : cr_LC81500372020261LGN00_NDVI_C2
values     : -0.1510984, 0.8510309  (min, max)`

</code>```

I was using names property to name output rasters which I'm unable to do now. I know basename can do this but really wanna know whats wrong here. same code works fine on old machine with same versions of R, RStudio and RTools.

Really appreciate if someone can help me here. Thanks

I reinstalled windows, did a clean install. Then installed same versions of R, Rstudio and RTools as my old computer has. As names property has file name on old computer, I want it to be same on new one.

Body:
I want to load raster files then mask out the clouded parts. I have done it many times and the code used to work fine. Now I upgraded to windows 11 and has a new laptop. Installed R 4.2, then RStudio and then RTools 4.2. Here is my code

`library(raster)
library(rgdal)

setwd('D:/Test/')

masks <- list.files('D:/Test', 'mask_C2.tif$', full.names = T)
ndvi <- list.files('D:/Test', 'NDVI_C2.tif$', full.names = T)
rm <- lapply(masks, raster)
rn <- lapply(ndvi, raster)

When I call 1st element on NEW MACHINE, 'names' property doesn't have file name, it just says layer
> rn[[1]]
class      : RasterLayer
dimensions : 174, 164, 28536  (nrow, ncol, ncell)
resolution : 30, 30  (x, y)
extent     : 323895, 328815, 3724335, 3729555  (xmin, xmax, ymin, ymax)
crs        : +proj=utm +zone=43 +datum=WGS84 +units=m +no_defs
source     : cr_LC81500372020261LGN00_NDVI_C2.tif
names      : layer
values     : -0.1510984, 0.8510309  (min, max)

When I call 1st element on OLD MACHINE, 'names' property has file name
> rn[[1]]
class      : RasterLayer
dimensions : 174, 164, 28536  (nrow, ncol, ncell)
resolution : 30, 30  (x, y)
extent     : 323895, 328815, 3724335, 3729555  (xmin, xmax, ymin, ymax)
crs        : +proj=utm +zone=43 +datum=WGS84 +units=m +no_defs
source     : cr_LC81500372020261LGN00_NDVI_C2.tif
names      : cr_LC81500372020261LGN00_NDVI_C2
values     : -0.1510984, 0.8510309  (min, max)`

I was using names property to name output rasters which I'm unable to do now. I know basename can do this but really wanna know whats wrong here. same code works fine on old machine with same versions of R, RStudio and RTools.

Really appreciate if someone can help me here. Thanks

I reinstalled windows, did a clean install. Then installed same versions of R, Rstudio and RTools as my old computer has. As names property has file name on old computer, I want it to be same on new one.


问:
How to make animation trigger when launching. (Unity)
So I want to make an animation start when I start a certain scene. And I have two animations that I want to play at the same time. It's essentially an opening intro when opening a phone app.The animation for one of the bars

And can I animate two objects in one Animation Clip? If so, how can I do that?
And if it is possible in the Animator Tab, could you please explain how?

I am currently trying to make an app for a project and I want to add an animation when opening the mobile app. The animation will essentially be two bars opening to reveal the title of the app(kinda like the transition split from powerpoint this).


问:
Glide error: Load failed, Failed to connect or obtain data
I have searched a lot on the Internet to solve the problem and nothing has helped.

I am trying to load images from arrayList using glide but somehow I can not load the images using glide. As it shows following error:

```<code>W/Glide: Load failed for [https://firebasestorage.googleapis.com/v0/b/locketanalog-eee5f.appspot.com/o/Photos%2Fcom.google.firebase.firestore.FieldValue%24ServerTimestampFieldValue%404b4208f.jpg?alt=media&token=ff7c8a64-7be8-427e-80d4-dcd89f0581ee] with dimensions [1080x1080]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: 403)
     call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: 403)
     call GlideException#logRootCauses(String) for more detail
I/Glide: Root cause (1 of 1)
    com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: 403
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:98)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:58)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:95)

</code>```

In my gradle, I have added

```<code>implementation 'com.github.bumptech.glide:glide:4.7.1'
</code>```

and

```<code>annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
</code>```

In my AndroidManifest, I have added

```<code>android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"
</code>```

Code

XML

```<code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/layout_wrapper"
    android:background="@drawable/layout_bg"
    >

    <ImageView
        android:id="@+id/imagePhoto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        >

    </ImageView>

</RelativeLayout>
</code>```

network_securityConfig.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>
</code>```

Java

```<code>if(n>uris.size()){

    n=0;

}

n++;

if(uris.size()>0){

        for (int i = 0; i < uris.size(); i++) {

            if (i == n) {
                String imgUrl = uris.get(i);

                Glide.with(context)
                        .asBitmap()
                        .load(imgUrl)
                        .fitCenter()
                        .diskCacheStrategy(DiskCacheStrategy.ALL)
                        .override(1080, 1080)
                        .into(new CustomTarget<Bitmap>() {
                            @Override
                            public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                                res = resource;
                                views.setImageViewBitmap(R.id.imagePhoto, res);
                            }

                            @Override
                            public void onLoadCleared(@Nullable Drawable placeholder) {

                            }

                        });
            }
    }
}else {
    views.setImageViewResource(R.id.imagePhoto,R.drawable.add_image);
}
</code>```

Body:
I have searched a lot on the Internet to solve the problem and nothing has helped.

I am trying to load images from arrayList using glide but somehow I can not load the images using glide. As it shows following error:

W/Glide: Load failed for [https://firebasestorage.googleapis.com/v0/b/locketanalog-eee5f.appspot.com/o/Photos%2Fcom.google.firebase.firestore.FieldValue%24ServerTimestampFieldValue%404b4208f.jpg?alt=media&token=ff7c8a64-7be8-427e-80d4-dcd89f0581ee] with dimensions [1080x1080]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: 403)
     call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
    There was 1 root cause:
    com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: 403)
     call GlideException#logRootCauses(String) for more detail
I/Glide: Root cause (1 of 1)
    com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: 403
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:98)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:58)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:95)

In my gradle, I have added

implementation 'com.github.bumptech.glide:glide:4.7.1'

and

annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

In my AndroidManifest, I have added

android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"

Code

XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/layout_wrapper"
    android:background="@drawable/layout_bg"
    >

    <ImageView
        android:id="@+id/imagePhoto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        >

    </ImageView>

</RelativeLayout>

network_securityConfig.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>

Java

if(n>uris.size()){

    n=0;

}

n++;

if(uris.size()>0){

        for (int i = 0; i < uris.size(); i++) {

            if (i == n) {
                String imgUrl = uris.get(i);

                Glide.with(context)
                        .asBitmap()
                        .load(imgUrl)
                        .fitCenter()
                        .diskCacheStrategy(DiskCacheStrategy.ALL)
                        .override(1080, 1080)
                        .into(new CustomTarget<Bitmap>() {
                            @Override
                            public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                                res = resource;
                                views.setImageViewBitmap(R.id.imagePhoto, res);
                            }

                            @Override
                            public void onLoadCleared(@Nullable Drawable placeholder) {

                            }

                        });
            }
    }
}else {
    views.setImageViewResource(R.id.imagePhoto,R.drawable.add_image);
}