问:
How to make Django pagination with ajax without re-querying the DB
I've checked many related questions on building up pagination with ajax and implemented it in my app. The problem I still have is querying DB each time user сlicks next or prev because ajax call goes to the view function. My code:

my_template.html

```<code>
<ul class="list-articles" id="dd">
</ul>

<div class="buttons">
    {% if page_obj.has_previous %}
  <a href="#" onclick="ajax_function('{{page_obj.previous_page_number}}','{{title}}')" id="prev">❮ prev</a>
    {% endif %}
{% if page_obj.has_next %}
  <a href="#" onclick="ajax_function({{page_obj.next_page_number}},'{{title}}')" id="next"> next ❯</a>
{% endif %}
</div>
</code>```

views.py

```<code>def my_view_function(request):

    if is_ajax(request=request):
        if 'page' in request.GET:
            return paginate(request)

def paginate(request):
    parameter_a = request.GET['parameterA']
    parameter_b = request.GET['parameterB']
    li = MyModel.objects.filter(par_a=parameter_a, par_b=parameter_b)
    paginator = Paginator(li, 1)
    page_number = request.GET.get('page')
    page_obj = paginator.get_page(page_number)

    context = {
        'page_obj': page_obj,
        ...
    }

    return render(request, f'my_app/my_template.html', context)
</code>```

main.js

```<code>function ajax_function(page, title) {
    $.ajax({
        url: '',
        type: "get",
        data: {
            'page': page,
            'title':title,
        },
        success: function(response, status) {
             $('#dd').empty();
             $('#dd').html(response);
            }
        });
    }
</code>```

So this code is working but in real app I have more complex db queries to get my Model's objects, so every next/prev iteration  will recall the objects again and again which looks stupid. Ideally I'd like to collect the list of objects once and then use them without any additional queries.
I'm not a JS developer so any help would be appreciated!

Body:
I've checked many related questions on building up pagination with ajax and implemented it in my app. The problem I still have is querying DB each time user сlicks next or prev because ajax call goes to the view function. My code:

my_template.html

    {% if page_obj.has_previous %}
  ❮ prev
    {% endif %}
{% if page_obj.has_next %}
   next ❯
{% endif %}

views.py

def my_view_function(request):

    if is_ajax(request=request):
        if 'page' in request.GET:
            return paginate(request)

def paginate(request):
    parameter_a = request.GET['parameterA']
    parameter_b = request.GET['parameterB']
    li = MyModel.objects.filter(par_a=parameter_a, par_b=parameter_b)
    paginator = Paginator(li, 1)
    page_number = request.GET.get('page')
    page_obj = paginator.get_page(page_number)

    context = {
        'page_obj': page_obj,
        ...
    }

    return render(request, f'my_app/my_template.html', context)

main.js

function ajax_function(page, title) {
    $.ajax({
        url: '',
        type: "get",
        data: {
            'page': page,
            'title':title,
        },
        success: function(response, status) {
             $('#dd').empty();
             $('#dd').html(response);
            }
        });
    }

So this code is working but in real app I have more complex db queries to get my Model's objects, so every next/prev iteration  will recall the objects again and again which looks stupid. Ideally I'd like to collect the list of objects once and then use them without any additional queries.
I'm not a JS developer so any help would be appreciated!


来源: stackexchange

问:
Mac IDEA2022.3 Failed to get version of Azure Functions Core Tools(null)
when I try to startup a demo Azure function app in local, this error occurs.

I checked the settings and installed the core tools. but it still exists.
preference settings screenshot

ContentLicense: CC BY-SA 4.0


问:
saving the custom kernel model using gram matrix related probelm
I have made this custom kernel of svm using gram matrix. I saved it in pickle file. But this pickle file don't run in streamlit. I got attribute error. Can anyone give any solutions that how i can save and run it?

```<code># sinh kernel with sigma multiplied and C added afterwards
def Kernel_sinh(U,V,sigma,C):
    return np.sinh((sigma*np.dot(U,V))+C)
def sinh_kernel(U,V,sigma=0.1,C=0):
    G = np.zeros((U.shape[0], V.shape[0]))
    for i in range(0,U.shape[0]):
        print(i)
        for j in range(0,V.shape[0]):
            G[i][j] = Kernel_sinh(U[i],V[j],sigma,C)
    return G

sinh_regressor=SVR(kernel = "precomputed")
y_train1=y_train1.ravel()
sigma=float(input("paramter for sigma: "))
C=float(input("paramter for C: "))
sinh_regressor.fit(sinh_kernel(x_train1,x_train1,sigma,C),y_train1)
y_pred=sinh_regressor.predict(sinh_kernel(x_test1,x_train1,sigma,C))
y_pred=np.reshape(y_pred,(y_pred.shape[0],1))
y_pred=sc_y.inverse_transform(y_pred)
</code>```

Here is the pickle file

```<code>with open('sinh_kernel.pkl','wb') as f:
    pickle.dump(sinh_kernel,f)
with open('sinh_regressor.pkl','wb') as f:
    pickle.dump(sinh_regressor,f)
</code>```

I tried to open it in streamlit with this :

```<code>sinh_kernel=pickle.load(open('C:\system project\Deployment\model\sinh_kernel.pkl','rb'))
sinh_regressor=pickle.load(open('C:\system project\Deployment\model\sinh_regressor.pkl','rb'))
</code>```

and i got that error :

Can't get attribute 'sinh_kernel' on <module '_main_' from 'C:\\system project\\Deployment\\final.py'>

please give me a solution of this problem.

I got error. I want to load the pickle file

Body:
I have made this custom kernel of svm using gram matrix. I saved it in pickle file. But this pickle file don't run in streamlit. I got attribute error. Can anyone give any solutions that how i can save and run it?

# sinh kernel with sigma multiplied and C added afterwards
def Kernel_sinh(U,V,sigma,C):
    return np.sinh((sigma*np.dot(U,V))+C)
def sinh_kernel(U,V,sigma=0.1,C=0):
    G = np.zeros((U.shape[0], V.shape[0]))
    for i in range(0,U.shape[0]):
        print(i)
        for j in range(0,V.shape[0]):
            G[i][j] = Kernel_sinh(U[i],V[j],sigma,C)
    return G

sinh_regressor=SVR(kernel = "precomputed")
y_train1=y_train1.ravel()
sigma=float(input("paramter for sigma: "))
C=float(input("paramter for C: "))
sinh_regressor.fit(sinh_kernel(x_train1,x_train1,sigma,C),y_train1)
y_pred=sinh_regressor.predict(sinh_kernel(x_test1,x_train1,sigma,C))
y_pred=np.reshape(y_pred,(y_pred.shape[0],1))
y_pred=sc_y.inverse_transform(y_pred)

Here is the pickle file

with open('sinh_kernel.pkl','wb') as f:
    pickle.dump(sinh_kernel,f)
with open('sinh_regressor.pkl','wb') as f:
    pickle.dump(sinh_regressor,f)

I tried to open it in streamlit with this :

sinh_kernel=pickle.load(open('C:\system project\Deployment\model\sinh_kernel.pkl','rb'))
sinh_regressor=pickle.load(open('C:\system project\Deployment\model\sinh_regressor.pkl','rb'))

and i got that error :

Can't get attribute 'sinh_kernel' on <module '_main_' from 'C:\\system project\\Deployment\\final.py'>

please give me a solution of this problem.

I got error. I want to load the pickle file


问:
Want to add a label below the icons to make a complete button in CSS
I am using Angular Material UI icons and Bulma to make a Bottom Fixed Navbar for mobile. However, the alignment of the Icons is not centered both vertically and horizontally and I want to add a label to the icons below them to make a complete button. This is what I did:

<!DOCTYPE html>

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@6.5.95/css/materialdesignicons.min.css" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@6.5.95/css/materialdesignicons.min.css" />
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700&display=swap" rel="stylesheet">
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

          <button class="button is-primary is-small navbar-end" style="font-family: Montserrat; font-size: bold; color: #53C0B3; background-color: #EEF2F3; border-radius: 5%; margin: 0%; padding: 1%; width: 25%; height: 100%; ">
                        <mat-icon style="font-size: xx-large;">home</mat-icon>
                        Name
                    </button>
          <button class="button is-primary is-small navbar-end" style="font-family: Montserrat; font-size: bold; color: #53C0B3; background-color: #EEF2F3; border-radius: 5%; margin: 0%; padding: 1%; width: 25%; height: 100%;">
                        <mat-icon style="font-size: xx-large;">history</mat-icon>
                    </button>
          <button class="button is-primary is-small navbar-end" style="font-family: Montserrat; font-size: bold; color: #53C0B3; background-color: #EEF2F3; border-radius: 5%; margin: 0%; padding: 1%; width: 25%; height: 100%;">
                        <mat-icon style="font-size: xx-large;">account_balance_wallet</mat-icon>
                    </button>
          <button class="button is-primary is-small navbar-end" style="font-family: Montserrat; font-size: bold; color: #53C0B3; background-color: #EEF2F3; border-radius: 5%; margin: 0%; padding: 1%; width: 25%; height: 100%;">
                        <mat-icon style="font-size: xx-large;">send_to_mobile</mat-icon>
                    </button>

```


问:
How to save console input and output in Python
How do I save my console input and output in Python so I can open it and work on it again later? Is there a better way to edit my code than in the console window?

I've tried converting it to HTML, but that didn't work. Saving it as a python file doesn't save my console input and output. Is there another way which makes it easier for me to edit my code? I'm working in Spyder (anaconda3) using Python.


问:
Background is not getting executed for the below code. scenario outline is executing properly
enter image description here

[1]: https://i.stack.imgur.com/Cv0kC.png


问:
E-mail template and internationalization missing for action "UPDATE_EMAIL" in Keycloak
Keycloak Version 20.0.2

The bug

There is no e-mail template for action UPDATE_EMAIL. I've downloaded the .jar from /opt/keycloak/lib/lib/main/org.keycloak.keycloak-themes-20.0.2.jar and checked the \base\email\html directory.

As you can see on that image https://imgur.com/a/w8IS7Kv there is no e-mail template for the action UPDATE_EMAIL.

Also, there is no internationalization for the action UPDATE_EMAIL. As you can see on this image https://imgur.com/tlFYHt9 I've used "Deutsch" as language but the text is english.

Expected behavior

There should be an e-mail template for the action UPDATE_EMAIL.

Internationalization should work for the action UPDATE_EMAIL.

Actual behavior

An e-mail template for the action UPDATE_EMAIL is missing.

Internationalization is not working the action UPDATE_EMAIL.

Issue on Github

I've created an issue on Github: https://github.com/keycloak/keycloak/issues/16173


问:
How to declare a default index template matching anything but the existing kibana default index_templates
On Elasticsearch 8.5 and latest Kibana version, I want to declare an index template matching every new index creation, without overriding the existing default kibana templates.

Example

```<code>POST _index_template/cars_template
{
  "index_patterns": ["*"],
  "priority": 300,
  "template": {
    "mappings": {
      "properties":{
        "created_at":{
          "type":"date"
        },
        "created_by":{
          "type":"text"
        }
      }
    }
  }
}
</code>```

Elastic warns me that my new template would take precedence over existeng older templates.

```<code>#! index template [cars_template] has index patterns [*] matching patterns from existing older templates [.monitoring-logstash,.monitoring-es,.monitoring-beats,.monitoring-alerts-7,.monitoring-kibana] with patterns (.monitoring-logstash => [.monitoring-logstash-7-*],.monitoring-es => [.monitoring-es-7-*],.monitoring-beats => [.monitoring-beats-7-*],.monitoring-alerts-7 => [.monitoring-alerts-7],.monitoring-kibana => [.monitoring-kibana-7-*]); this template [cars_template] will take precedence during new index creation
{
  "acknowledged": true
}
</code>```

Elastic is right, as existing templates (created by default with kibana) are present without priority defined

```<code>    {
      "name": ".monitoring-beats-mb",
      "index_template": {
        "index_patterns": [
          ".monitoring-beats-8-*"
        ],
        "template": {... SNIP ...},
        "composed_of": [],
        "version": 8000103,
        "data_stream": {
          "hidden": false,
          "allow_custom_routing": false
        }
      }
    },
</code>```

How can I exclude default kibana indexes from my index_pattern (basically I would like to exclude any index starting with a point) ?

I tried multiple forms of exclusion, including the following, without success :

```<code>        "index_patterns": ["-.*", "[!.]*"]

</code>```

I'm not warned anymore by elasticsearch, but my policy does not apply anymore to new indices.

Body:
On Elasticsearch 8.5 and latest Kibana version, I want to declare an index template matching every new index creation, without overriding the existing default kibana templates.

Example

POST _index_template/cars_template
{
  "index_patterns": ["*"],
  "priority": 300,
  "template": {
    "mappings": {
      "properties":{
        "created_at":{
          "type":"date"
        },
        "created_by":{
          "type":"text"
        }
      }
    }
  }
}

Elastic warns me that my new template would take precedence over existeng older templates.

#! index template [cars_template] has index patterns [*] matching patterns from existing older templates [.monitoring-logstash,.monitoring-es,.monitoring-beats,.monitoring-alerts-7,.monitoring-kibana] with patterns (.monitoring-logstash => [.monitoring-logstash-7-*],.monitoring-es => [.monitoring-es-7-*],.monitoring-beats => [.monitoring-beats-7-*],.monitoring-alerts-7 => [.monitoring-alerts-7],.monitoring-kibana => [.monitoring-kibana-7-*]); this template [cars_template] will take precedence during new index creation
{
  "acknowledged": true
}

Elastic is right, as existing templates (created by default with kibana) are present without priority defined

    {
      "name": ".monitoring-beats-mb",
      "index_template": {
        "index_patterns": [
          ".monitoring-beats-8-*"
        ],
        "template": {... SNIP ...},
        "composed_of": [],
        "version": 8000103,
        "data_stream": {
          "hidden": false,
          "allow_custom_routing": false
        }
      }
    },

How can I exclude default kibana indexes from my index_pattern (basically I would like to exclude any index starting with a point) ?

I tried multiple forms of exclusion, including the following, without success :

        "index_patterns": ["-.*", "[!.]*"]

I'm not warned anymore by elasticsearch, but my policy does not apply anymore to new indices.


问:
Radix UI "Select" primitive overflows screen
I'm using the "Select" component from Radix-UI Radix Ui Select and the modal that pops up is overflowing the top of the screen, please see the attached image. overflowing modal. But when i have a few options, it works fine, please see attached imae => fine modal

The select button:

```<code>const SelectButton = (props: Props) => {

  function handleOnValueChange(newValue:string){
    props.onChange(newValue)
  }

  return (
    <SelectPrimitive.Root defaultValue="blueberry" onValueChange={handleOnValueChange}>

      <SelectPrimitive.Trigger asChild aria-label="Food">
        {props.children}
      </SelectPrimitive.Trigger>

      <SelectPrimitive.Content className="rounded-lg mt-4 top-5">
        <SelectPrimitive.ScrollUpButton className="flex items-center justify-center text-gray-700 dark:text-gray-300">
          <ChevronUpIcon />
        </SelectPrimitive.ScrollUpButton>
        <SelectPrimitive.Viewport className="bg-white dark:bg-black p-2 rounded-lg shadow-lg top-5">
          <SelectPrimitive.Group>
            {props.options.map(
              (f, i) => (
                <SelectPrimitive.Item
                  //disabled={f === "Grapes"}
                  key={`${f}-${i}`}
                  value={props.toLower == undefined ? f.toLowerCase() : f}
                  className={cx(
                    "relative flex items-center px-8 py-2 rounded-md text-sm text-gray-700 dark:text-gray-300 font-medium focus:bg-gray-100 dark:focus:bg-gray-900",
                    "radix-disabled:opacity-50",
                    "focus:outline-none select-none"
                  )}
                >
                  <SelectPrimitive.ItemText>{f}</SelectPrimitive.ItemText>
                  <SelectPrimitive.ItemIndicator className="absolute left-2 inline-flex items-center">
                    <CheckIcon />
                  </SelectPrimitive.ItemIndicator>
                </SelectPrimitive.Item>
              )
            )}
          </SelectPrimitive.Group>
        </SelectPrimitive.Viewport>
        <SelectPrimitive.ScrollDownButton className="flex items-center justify-center text-gray-700 dark:text-gray-300">
          <ChevronDownIcon />
        </SelectPrimitive.ScrollDownButton>
      </SelectPrimitive.Content>

    </SelectPrimitive.Root>
  );
};

export default SelectButton;
</code>```

Body:
I'm using the "Select" component from Radix-UI Radix Ui Select and the modal that pops up is overflowing the top of the screen, please see the attached image. overflowing modal. But when i have a few options, it works fine, please see attached imae => fine modal

The select button:

const SelectButton = (props: Props) => {

  function handleOnValueChange(newValue:string){
    props.onChange(newValue)
  }

  return (
    <SelectPrimitive.Root defaultValue="blueberry" onValueChange={handleOnValueChange}>

      <SelectPrimitive.Trigger asChild aria-label="Food">
        {props.children}
      </SelectPrimitive.Trigger>

      <SelectPrimitive.Content className="rounded-lg mt-4 top-5">
        <SelectPrimitive.ScrollUpButton className="flex items-center justify-center text-gray-700 dark:text-gray-300">
          <ChevronUpIcon />
        </SelectPrimitive.ScrollUpButton>
        <SelectPrimitive.Viewport className="bg-white dark:bg-black p-2 rounded-lg shadow-lg top-5">
          <SelectPrimitive.Group>
            {props.options.map(
              (f, i) => (
                <SelectPrimitive.Item
                  //disabled={f === "Grapes"}
                  key={`${f}-${i}`}
                  value={props.toLower == undefined ? f.toLowerCase() : f}
                  className={cx(
                    "relative flex items-center px-8 py-2 rounded-md text-sm text-gray-700 dark:text-gray-300 font-medium focus:bg-gray-100 dark:focus:bg-gray-900",
                    "radix-disabled:opacity-50",
                    "focus:outline-none select-none"
                  )}
                >
                  <SelectPrimitive.ItemText>{f}</SelectPrimitive.ItemText>
                  <SelectPrimitive.ItemIndicator className="absolute left-2 inline-flex items-center">
                    <CheckIcon />
                  </SelectPrimitive.ItemIndicator>
                </SelectPrimitive.Item>
              )
            )}
          </SelectPrimitive.Group>
        </SelectPrimitive.Viewport>
        <SelectPrimitive.ScrollDownButton className="flex items-center justify-center text-gray-700 dark:text-gray-300">
          <ChevronDownIcon />
        </SelectPrimitive.ScrollDownButton>
      </SelectPrimitive.Content>

    </SelectPrimitive.Root>
  );
};

export default SelectButton;


问:
set_time_limit does not work to create a timeout
I have a problem on PHP.
I want to create a timeout error after a fixed delay (stop an execution after a maximum time). I use set_time_limit for that.

I use this script for the test :

```<code><?php
set_time_limit(1);

sleep(10);
echo "END";
</code>```

But this page does not display a Timeout error. It displays "END" !

Body:
I have a problem on PHP.
I want to create a timeout error after a fixed delay (stop an execution after a maximum time). I use set_time_limit for that.

I use this script for the test :

<?php
set_time_limit(1);

sleep(10);
echo "END";

But this page does not display a Timeout error. It displays "END" !


问:
react-native-image-picker video are not uploading in android
I am facing this error when uploading a video through the package react-native-image-picker in android.

Message

[storage/unknown] Permission Denial: reading
com.android.providers.media.MediaDocumentsProvider uri
content://com.android.providers.media.documents/document
/video:1000009385 from pid=25058, uid=10544 requires that you obtain
access using ACTION_OPEN_DOCUMENT or related APIs

When uploading photos it's absolutely fine in android, and it's totally fine in IPHONE in both cases either uploading photos or videos. Photos and videos upload on firebase.

Kindly let me know if you know the solution

```<code>const result = await launchImageLibrary({
mediaType: 'mixed'
 });
</code>```

Body:
I am facing this error when uploading a video through the package react-native-image-picker in android.

Message

[storage/unknown] Permission Denial: reading
com.android.providers.media.MediaDocumentsProvider uri
content://com.android.providers.media.documents/document
/video:1000009385 from pid=25058, uid=10544 requires that you obtain
access using ACTION_OPEN_DOCUMENT or related APIs

When uploading photos it's absolutely fine in android, and it's totally fine in IPHONE in both cases either uploading photos or videos. Photos and videos upload on firebase.

Kindly let me know if you know the solution

const result = await launchImageLibrary({
mediaType: 'mixed'
 });


问:
remove extra column of data gotten from pdo
I implemented a full text search in my MySql Database using php and it works well but whenever I get a data from the database it comes with extra column of a string of numbers with the value of the column before it

```<code>        "id": 15,
        "0": 15,
        "userId": "uid",
        "1": "uid",
        "name": "Bright",
        "2": "Bright",
        "mail": "bright@gmail.com",
        "3": "bright@gmail.com",
        "number": "070",
        "4": "070",
        "gender": "",
        "5": "",
</code>```

This is my search query

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

 public function query($query, $params = [])
    {
        try {
            $this->statement = $this->connection->prepare($query);

            $this->statement->execute($params);

            return $this;
        } catch (PDOException $e) {

            abort($e->errorInfo[2], 500);
        }
    }

///....

if ($method === 'GET' && !$id) {

    $user = $db->query("SELECT * FROM users WHERE MATCH (name) AGAINST (? IN BOOLEAN MODE) LIMIT 10", ['bright -Bauchi'])->all();
    echo Response::res("Successfully retrieved users", $user);

}
</code>```

And this is how i created my fulltext index

```<code>CREATE FULLTEXT INDEX user_index_index ON users (name);
</code>```

How do i remove that unneccessary info from my data

Body:
I implemented a full text search in my MySql Database using php and it works well but whenever I get a data from the database it comes with extra column of a string of numbers with the value of the column before it

        "id": 15,
        "0": 15,
        "userId": "uid",
        "1": "uid",
        "name": "Bright",
        "2": "Bright",
        "mail": "bright@gmail.com",
        "3": "bright@gmail.com",
        "number": "070",
        "4": "070",
        "gender": "",
        "5": "",

This is my search query

///....

 public function query($query, $params = [])
    {
        try {
            $this->statement = $this->connection->prepare($query);

            $this->statement->execute($params);

            return $this;
        } catch (PDOException $e) {

            abort($e->errorInfo[2], 500);
        }
    }

///....

if ($method === 'GET' && !$id) {

    $user = $db->query("SELECT * FROM users WHERE MATCH (name) AGAINST (? IN BOOLEAN MODE) LIMIT 10", ['bright -Bauchi'])->all();
    echo Response::res("Successfully retrieved users", $user);

}

And this is how i created my fulltext index

CREATE FULLTEXT INDEX user_index_index ON users (name);

How do i remove that unneccessary info from my data


问:
IF condition for schema pages without variants
So I am trying to solve a bad Schema implementation and I am not very familiar with Liquid. I got the Schema to work on the variant URL as it was not correct and giving a 404 but now the products without variants are getting flagged.

```<code>{%- if variant.sku != blank -%}
        "sku": {{ variant.sku | json }},
      {%- endif -%}
      "url": {{ request.path }}{{ variant.url}}
    }{% unless forloop.last %},{% endunless %}
  {%- endfor -%}
</code>```

enter image description here

So I want something to pull the variant URL but when they're not a variant URL it should not generate by itself.

Looking forward to hearing from you folks!

I was not expecting it to pull variant URLs on products where there is none but I guess this is what the code says so it is expected.

Body:
So I am trying to solve a bad Schema implementation and I am not very familiar with Liquid. I got the Schema to work on the variant URL as it was not correct and giving a 404 but now the products without variants are getting flagged.

{%- if variant.sku != blank -%}
        "sku": {{ variant.sku | json }},
      {%- endif -%}
      "url": {{ request.path }}{{ variant.url}}
    }{% unless forloop.last %},{% endunless %}
  {%- endfor -%}

enter image description here

So I want something to pull the variant URL but when they're not a variant URL it should not generate by itself.

Looking forward to hearing from you folks!

I was not expecting it to pull variant URLs on products where there is none but I guess this is what the code says so it is expected.


问:
How can I load rgee in R
I am trying to load rgee in R and getting this error message: Error: package or namespace load failed for ‘rgee’:  .onLoad failed in loadNamespace() for 'rgee', details:   call: py_module_import(module, convert = convert)   error: ModuleNotFoundError: No module named 'ee'

tried to restart R but still getting the same error message

Title: How can I load rgee in R


问:
Camunda not accepting keycloak token from public ip
I have setup Camunda and Keycloak on my local system. both works fine until I access them from private URL on my system.
Once I try to access it from public Ip in network, keycloak works but camunda dont accepts keycloak's token and says its Invalid Credentials, Setup I am using for installing keycloak and camunda is from Form Flow AI (https://github.com/AOT-Technologies/forms-flow-ai-deployment)

where I can say to camunda or keycloak this public Ip is fine work with it

Please check Screenshot below


问:
Graph traversal with a minimum number of "steps" (steps based on edge parameters)
There is a bidirectional graph. The graph edges have parameters (let it be a color). A step is a transition from one vertex to another. If at a certain moment the already visited vertices have unvisited edges with the same parameters, then in 1 step it is possible to go through all the edges with the same parameters. Edges can have multiple parameters.
I need to find a traversal algorithm to visit all the vertices with a minimum number of "steps".

Example graph (1 and 2 are starting (visited) vertices):

graph example

Expected result: 6, 3 and 5, 4 and 7 (3 steps)

I want to iterate over all graph traversal options to find the best. But maybe there is any better algorithm for this task? If not, what is the best way to find all traversal options?


问:
Neural network gives same prediction for each data point for diabetes.csv
I have a neural network in Python, but it gives almost the exact same prediction for each data point and I can't work out why this is. I have tried altering the features I use to make the predictions but I get the same issue. Thanks for any help.

I have a data file which looks like this:

```<code>Pregnancies,Glucose,BloodPressure,SkinThickness,Insulin,BMI,DiabetesPedigreeFunction,Age,Outcome
6,148,72,35,0,33.6,0.627,50,1
1,85,66,29,0,26.6,0.351,31,0
8,183,64,0,0,23.3,0.672,32,1
1,89,66,23,94,28.1,0.167,21,0
</code>```

from kaggle.
My neural network code is this:

```<code>import numpy as np
import pandas as pd

data = pd.read_csv("diabetes.csv", header=0)
print(data.head())
training_examples = data[["BloodPressure", "Glucose", "Outcome"]]
X = training_examples[["BloodPressure", "Glucose"]].to_numpy()
y = training_examples[["Outcome"]].to_numpy()

DIMENSIONS = 2
HIDDEN_LAYER = 20

# Set up the training data
# X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
# y = np.array([[0], [1], [1], [0]])

# Set the number of epochs and the learning rate
num_epochs = 10
learning_rate = 0.1

# Initialize the weights and biases
w1 = np.random.randn(DIMENSIONS, HIDDEN_LAYER)
b1 = np.zeros((1, HIDDEN_LAYER))
w2 = np.random.randn(HIDDEN_LAYER, 1)
b2 = np.zeros((1, 1))

# Define the sigmoid activation function
def sigmoid(x):
    return 1 / (1 + np.exp(-x))

# Define the derivative of the sigmoid function
def sigmoid_derivative(x):
    return x * (1 - x)

# Train the network
for epoch in range(num_epochs):
    # Forward pass
    z1 = np.dot(X, w1) + b1
    a1 = sigmoid(z1)
    z2 = np.dot(a1, w2) + b2
    a2 = sigmoid(z2)

    # Calculate the loss
    loss = np.mean((a2 - y)**2)

    # Print the loss every 100 epochs
    if epoch % 100 == 0:
        print(f'Epoch {epoch}: loss = {loss}')

    # Backpropagation
    dz2 = a2 - y
    dw2 = np.dot(a1.T, dz2)
    db2 = np.sum(dz2, axis=0)
    da1 = np.dot(dz2, w2.T)
    dz1 = da1 * sigmoid_derivative(a1)
    dw1 = np.dot(X.T, dz1)
    db1 = np.sum(dz1, axis=0)

    # Update the weights and biases
    w1 -= learning_rate * dw1
    b1 -= learning_rate * db1
    w2 -= learning_rate * dw2
    b2 -= learning_rate * db2

# Make predictions on the test data
predictions = a2

# Print the predictions
print(predictions)
</code>```

Body:
I have a neural network in Python, but it gives almost the exact same prediction for each data point and I can't work out why this is. I have tried altering the features I use to make the predictions but I get the same issue. Thanks for any help.

I have a data file which looks like this:

Pregnancies,Glucose,BloodPressure,SkinThickness,Insulin,BMI,DiabetesPedigreeFunction,Age,Outcome
6,148,72,35,0,33.6,0.627,50,1
1,85,66,29,0,26.6,0.351,31,0
8,183,64,0,0,23.3,0.672,32,1
1,89,66,23,94,28.1,0.167,21,0

from kaggle.
My neural network code is this:

import numpy as np
import pandas as pd

data = pd.read_csv("diabetes.csv", header=0)
print(data.head())
training_examples = data[["BloodPressure", "Glucose", "Outcome"]]
X = training_examples[["BloodPressure", "Glucose"]].to_numpy()
y = training_examples[["Outcome"]].to_numpy()

DIMENSIONS = 2
HIDDEN_LAYER = 20

# Set up the training data
# X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
# y = np.array([[0], [1], [1], [0]])

# Set the number of epochs and the learning rate
num_epochs = 10
learning_rate = 0.1

# Initialize the weights and biases
w1 = np.random.randn(DIMENSIONS, HIDDEN_LAYER)
b1 = np.zeros((1, HIDDEN_LAYER))
w2 = np.random.randn(HIDDEN_LAYER, 1)
b2 = np.zeros((1, 1))

# Define the sigmoid activation function
def sigmoid(x):
    return 1 / (1 + np.exp(-x))

# Define the derivative of the sigmoid function
def sigmoid_derivative(x):
    return x * (1 - x)

# Train the network
for epoch in range(num_epochs):
    # Forward pass
    z1 = np.dot(X, w1) + b1
    a1 = sigmoid(z1)
    z2 = np.dot(a1, w2) + b2
    a2 = sigmoid(z2)

    # Calculate the loss
    loss = np.mean((a2 - y)**2)

    # Print the loss every 100 epochs
    if epoch % 100 == 0:
        print(f'Epoch {epoch}: loss = {loss}')

    # Backpropagation
    dz2 = a2 - y
    dw2 = np.dot(a1.T, dz2)
    db2 = np.sum(dz2, axis=0)
    da1 = np.dot(dz2, w2.T)
    dz1 = da1 * sigmoid_derivative(a1)
    dw1 = np.dot(X.T, dz1)
    db1 = np.sum(dz1, axis=0)

    # Update the weights and biases
    w1 -= learning_rate * dw1
    b1 -= learning_rate * db1
    w2 -= learning_rate * dw2
    b2 -= learning_rate * db2

# Make predictions on the test data
predictions = a2

# Print the predictions
print(predictions)


问:
Spring boot messaging consumer contract test loads test context twice and first time it fails
When I run https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/consumer_kafka_middleware, although it passes, it seems to load the test context twice, the first load fails while the second is successful.

Interestingly it seems that WireMockTestExecutionListener triggers the loading of the test context and it fails as the Kafka container is not get available and Supplier kafka::getBootstrapServers is prematurely executed.

Any ideas how we can avoid the initial unsuccessful test context loading? Especially, for messaging contract testing wiremock is not even used at all.

```<code>    @DynamicPropertySource
    static void kafkaProperties(DynamicPropertyRegistry registry) {
        registry.add("spring.kafka.bootstrap-servers", kafka::getBootstrapServers);
    }
</code>```
```<code>    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127) ~[spring-test-6.0.3.jar:6.0.3]
    at org.springframework.cloud.contract.wiremock.WireMockTestExecutionListener.applicationContextBroken(WireMockTestExecutionListener.java:120) ~[spring-cloud-contract-wiremock-4.0.0.jar:4.0.0]
    at org.springframework.cloud.contract.wiremock.WireMockTestExecutionListener.beforeTestClass(WireMockTestExecutionListener.java:43) ~[spring-cloud-contract-wiremock-4.0.0.jar:4.0.0]
    at org.springframework.test.context.TestContextManager.beforeTestClass(TestContextManager.java:206) ~[spring-test-6.0.3.jar:6.0.3]
    at org.springframework.test.context.junit.jupiter.SpringExtension.beforeAll(SpringExtension.java:113) ~[spring-test-6.0.3.jar:6.0.3]
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395) ~[junit-jupiter-engine-5.9.1.jar:5.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:395) ~[junit-jupiter-engine-5.9.1.jar:5.9.1]
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:211) ~[junit-jupiter-engine-5.9.1.jar:5.9.1]
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:84) ~[junit-jupiter-engine-5.9.1.jar:5.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71) ~[junit5-rt.jar:na]
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) ~[junit-rt.jar:na]
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) ~[idea_rt.jar:na]
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) ~[junit-rt.jar:na]
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) ~[junit-rt.jar:na]
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ~[junit-rt.jar:na]
Caused by: java.lang.IllegalStateException: Mapped port can only be obtained after the container is started
    at org.testcontainers.shaded.com.google.common.base.Preconditions.checkState(Preconditions.java:174) ~[testcontainers-1.17.6.jar:1.17.6]
</code>```

Body:
When I run https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/consumer_kafka_middleware, although it passes, it seems to load the test context twice, the first load fails while the second is successful.

Interestingly it seems that WireMockTestExecutionListener triggers the loading of the test context and it fails as the Kafka container is not get available and Supplier kafka::getBootstrapServers is prematurely executed.

Any ideas how we can avoid the initial unsuccessful test context loading? Especially, for messaging contract testing wiremock is not even used at all.

    @DynamicPropertySource
    static void kafkaProperties(DynamicPropertyRegistry registry) {
        registry.add("spring.kafka.bootstrap-servers", kafka::getBootstrapServers);
    }

    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127) ~[spring-test-6.0.3.jar:6.0.3]
    at org.springframework.cloud.contract.wiremock.WireMockTestExecutionListener.applicationContextBroken(WireMockTestExecutionListener.java:120) ~[spring-cloud-contract-wiremock-4.0.0.jar:4.0.0]
    at org.springframework.cloud.contract.wiremock.WireMockTestExecutionListener.beforeTestClass(WireMockTestExecutionListener.java:43) ~[spring-cloud-contract-wiremock-4.0.0.jar:4.0.0]
    at org.springframework.test.context.TestContextManager.beforeTestClass(TestContextManager.java:206) ~[spring-test-6.0.3.jar:6.0.3]
    at org.springframework.test.context.junit.jupiter.SpringExtension.beforeAll(SpringExtension.java:113) ~[spring-test-6.0.3.jar:6.0.3]
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395) ~[junit-jupiter-engine-5.9.1.jar:5.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:395) ~[junit-jupiter-engine-5.9.1.jar:5.9.1]
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:211) ~[junit-jupiter-engine-5.9.1.jar:5.9.1]
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:84) ~[junit-jupiter-engine-5.9.1.jar:5.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) ~[junit-platform-engine-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) ~[junit-platform-launcher-1.9.1.jar:1.9.1]
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71) ~[junit5-rt.jar:na]
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) ~[junit-rt.jar:na]
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) ~[idea_rt.jar:na]
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) ~[junit-rt.jar:na]
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) ~[junit-rt.jar:na]
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ~[junit-rt.jar:na]
Caused by: java.lang.IllegalStateException: Mapped port can only be obtained after the container is started
    at org.testcontainers.shaded.com.google.common.base.Preconditions.checkState(Preconditions.java:174) ~[testcontainers-1.17.6.jar:1.17.6]


问:
generate swagger documentation that depend GET parameter in drf-yasg
I want generate swagger documentation for drf that depend from one parameter sent in POST.

If essource(this parameter) == 1 I want list of (from a database named "civile")

field_1
field_2
...
field_10

If instead essource == 2 I want other parameters (from a database named "indagine")

field_11
field_12
...
field_20

I have 4 databases, I don't want create multiple url but a one
http://172.168.0.1/api/v1/4/search/results

So this api should be documentated with parameters:
field_41
field_42
field_43
....
field_50

How to do this?

```<code>def xxx(esSource):

    source = {}
    if esSource == 1:
        source = {
            'field_1': openapi.Schema(type=openapi.TYPE_INTEGER)
        }
    else:
        source = {
            'field_44': openapi.Schema(type=openapi.TYPE_INTEGER)
        }

    properties = {
        'type_operator': openapi.Schema(type=openapi.TYPE_INTEGER,description="L'operatore di insieme AND(0) OR(1)"),
        'column_to_hide': openapi.Schema(type=openapi.TYPE_STRING,description="L'elenco di colonne da nascondere separato da virgola")
    }

    return properties.update(source)

class ShowResultsView(views.APIView):

    @swagger_auto_schema(
        operation_description="La prima pagina di risultati della ricerca",
        request_body=openapi.Schema(
            type=openapi.TYPE_OBJECT,
            required=['type_operator','column_to_hide'],
            properties=xxx(essource)
        ),
    )
    def post(self,request,essource,page):
        resp = {}
        resp["status"] = 0
        resp["data"] = {}
        resp["message"] = "I risultati della ricerca"
        return Response(resp,status=status.HTTP_200_OK)
</code>```

Body:
I want generate swagger documentation for drf that depend from one parameter sent in POST.

If essource(this parameter) == 1 I want list of (from a database named "civile")

field_1
field_2
...
field_10

If instead essource == 2 I want other parameters (from a database named "indagine")

field_11
field_12
...
field_20

I have 4 databases, I don't want create multiple url but a one
http://172.168.0.1/api/v1/4/search/results

So this api should be documentated with parameters:
field_41
field_42
field_43
....
field_50

How to do this?

def xxx(esSource):

    source = {}
    if esSource == 1:
        source = {
            'field_1': openapi.Schema(type=openapi.TYPE_INTEGER)
        }
    else:
        source = {
            'field_44': openapi.Schema(type=openapi.TYPE_INTEGER)
        }

    properties = {
        'type_operator': openapi.Schema(type=openapi.TYPE_INTEGER,description="L'operatore di insieme AND(0) OR(1)"),
        'column_to_hide': openapi.Schema(type=openapi.TYPE_STRING,description="L'elenco di colonne da nascondere separato da virgola")
    }

    return properties.update(source)

class ShowResultsView(views.APIView):

    @swagger_auto_schema(
        operation_description="La prima pagina di risultati della ricerca",
        request_body=openapi.Schema(
            type=openapi.TYPE_OBJECT,
            required=['type_operator','column_to_hide'],
            properties=xxx(essource)
        ),
    )
    def post(self,request,essource,page):
        resp = {}
        resp["status"] = 0
        resp["data"] = {}
        resp["message"] = "I risultati della ricerca"
        return Response(resp,status=status.HTTP_200_OK)


问:
Why is it not possible to initialize a variable with "auto =" if the type name of the variable consists of multiple words?
```<code>long long a{34}; // Ok
unsigned long b{90}; // Ok
auto c = long{12}; // Ok
auto d = unsigned{17}; // Ok
auto e = long long{3}; // error: expected primary-expression before 'long'
auto f = unsigned long{5}; // error: expected primary-expression before 'unsigned'
</code>```

What's wrong with the last two declarations?

Body:
long long a{34}; // Ok
unsigned long b{90}; // Ok
auto c = long{12}; // Ok
auto d = unsigned{17}; // Ok
auto e = long long{3}; // error: expected primary-expression before 'long'
auto f = unsigned long{5}; // error: expected primary-expression before 'unsigned'

What's wrong with the last two declarations?


问:
simple c program output as expected, but valgrind memory lost
Context: Explanation of pointing to same address problem

compile:

```<code>gcc \
    -Wpointer-arith -Wendif-labels \
    -Wimplicit-fallthrough -Wmissing-format-attribute  \
    -Wcast-function-type -Wshadow=compatible-local \
    -Wformat-security -Wno-format-truncation -Wno-stringop-truncation \
    main.c &&./a.out dat/test.csv
</code>```

Code:

```<code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<errno.h>

enum {MAXB = 128, NELEM = 10};

typedef struct data_t{
    char *name;
    int id;
    double balance;
}data_t;

int main(int argc,char **argv)
{
    if(argc < 2){
        printf("No file input.foramt a.out filename. %s\n",argv[1]);
        exit(EXIT_FAILURE);
    }

    FILE *fp = fopen(argv[1],"r");
    if(fp == NULL){
        printf("file not found\n");
        exit(EXIT_FAILURE);
    }

    char buffer[MAXB] = "";
    const char *delim = ",\n";
    int index = 0;

    data_t **array = malloc(NELEM * sizeof *array);
    if(!array){ /* validate EVERY allocation */
        perror("malloc-array failed\n");
        exit(EXIT_FAILURE);
    }

    /* protect the allocation bounds, you only have NELEM pointers */
    while (index < NELEM && fgets(buffer,sizeof buffer,fp))
    {
        data_t customer;
        size_t len = 0;

        char *tmp;          /* temporary pointer to use w/strtok() */
        tmp = strtok(buffer,delim);  /* token for name */
        if(!tmp)                     /* validate token */
        {
            fputs("error: strtok() name.\n",stderr);
            exit(EXIT_FAILURE);
        }
        len = strlen(tmp);               /* get length */
        customer.name = malloc(len+1);   /* allocate for string */
        if(!customer.name)
        {
            perror("malloc-customer.name\n");
            exit(EXIT_FAILURE);
        }
        memcpy(customer.name,tmp, len +1);  /* copy tmp to .name */

        if(!(tmp = strtok(NULL,delim)))     /* token & validations */
        {
            fprintf(stderr,"error: strtok() -id.\n");
            exit(EXIT_FAILURE);
        }

        /* MINIMAL conversion validation with sscanf() */
        if(sscanf(tmp,"%d",&customer.id) != 1){
            fprintf(stderr,"error: invalid integer value for line[%d]\n",index+1);
            continue;
            /* exit(EXIT_FAILURE); */
        }

        if(!(tmp = strtok(NULL,delim))){
            fprintf(stderr,"\nerror: strtok()-balance shuld have more line\n");
            continue;
            // exit(EXIT_FAILURE);
        }

        if(sscanf(tmp,"%lf", &customer.balance) != 1){
            fprintf(stderr,"error: invalid float value for line[%d]\n", index+1);
             /* exit(EXIT_FAILURE); */
            continue;
        }

        array[index] = malloc(sizeof *array[index]);    /* allocate struct */
        if(!array[index]){                              /* validate!! */
            perror("malloc-array[index]");
            exit(EXIT_FAILURE);
        }
        *array[index] = customer;                       /* assign struct */
        index += 1;

    }
    fclose(fp);

    int i;
    printf("\nname\tid\t balance\n\n");
    for(i = 0; i< index; i++)
        printf("%s \t%d\t%f\n",array[i]->name,array[i]->id,array[i]->balance);

    for(i = 0; i< index; i++)
    {
        if(array[i]->name)
            free(array[i]->name);       /* free allocated block for name */
        if(array[i])
            free(array[i]);             /* free allocated array index */
    }

    free(array);
    exit(EXIT_FAILURE);
}
</code>```

cat dat/test.csv returns

```<code>name,id,balance
test1,11,1.2334
test2,12,1.133
test3,13,1.3334
test4,14,1.4334
</code>```

command valgrind -s --leak-check=full ./a.out dat/test.csv output:

```<code>==494197== Memcheck, a memory error detector
==494197== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==494197== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==494197== Command: ./a.out dat/test.csv
==494197==
error: invalid integer value for line[1]

name    id       balance

test1   11      1.233400
test2   12      1.133000
test3   13      1.333400
test4   14      1.433400

==494197== Memcheck, a memory error detector
==494197== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==494197== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==494197== Command: ./a.out dat/test.csv
==494197==
error: invalid integer value for line[1]

name    id       balance

test1   11      1.233400
test2   12      1.133000
test3   13      1.333400
test4   14      1.433400
==494197==
==494197== HEAP SUMMARY:
==494197==     in use at exit: 5 bytes in 1 blocks
==494197==   total heap usage: 13 allocs, 12 frees, 5,797 bytes allocated
==494197==
==494197== 5 bytes in 1 blocks are definitely lost in loss record 1 of 1
==494197==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==494197==    by 0x10951D: main (in /home/jian/helloc/a.out)
==494197==
==494197== LEAK SUMMARY:
==494197==    definitely lost: 5 bytes in 1 blocks
==494197==    indirectly lost: 0 bytes in 0 blocks
==494197==      possibly lost: 0 bytes in 0 blocks
==494197==    still reachable: 0 bytes in 0 blocks
==494197==         suppressed: 0 bytes in 0 blocks
==494197==
==494197== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
</code>```

Body:
Context: Explanation of pointing to same address problem

compile:

gcc \
    -Wpointer-arith -Wendif-labels \
    -Wimplicit-fallthrough -Wmissing-format-attribute  \
    -Wcast-function-type -Wshadow=compatible-local \
    -Wformat-security -Wno-format-truncation -Wno-stringop-truncation \
    main.c &&./a.out dat/test.csv

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<errno.h>

enum {MAXB = 128, NELEM = 10};

typedef struct data_t{
    char *name;
    int id;
    double balance;
}data_t;

int main(int argc,char **argv)
{
    if(argc < 2){
        printf("No file input.foramt a.out filename. %s\n",argv[1]);
        exit(EXIT_FAILURE);
    }

    FILE *fp = fopen(argv[1],"r");
    if(fp == NULL){
        printf("file not found\n");
        exit(EXIT_FAILURE);
    }

    char buffer[MAXB] = "";
    const char *delim = ",\n";
    int index = 0;

    data_t **array = malloc(NELEM * sizeof *array);
    if(!array){ /* validate EVERY allocation */
        perror("malloc-array failed\n");
        exit(EXIT_FAILURE);
    }

    /* protect the allocation bounds, you only have NELEM pointers */
    while (index < NELEM && fgets(buffer,sizeof buffer,fp))
    {
        data_t customer;
        size_t len = 0;

        char *tmp;          /* temporary pointer to use w/strtok() */
        tmp = strtok(buffer,delim);  /* token for name */
        if(!tmp)                     /* validate token */
        {
            fputs("error: strtok() name.\n",stderr);
            exit(EXIT_FAILURE);
        }
        len = strlen(tmp);               /* get length */
        customer.name = malloc(len+1);   /* allocate for string */
        if(!customer.name)
        {
            perror("malloc-customer.name\n");
            exit(EXIT_FAILURE);
        }
        memcpy(customer.name,tmp, len +1);  /* copy tmp to .name */

        if(!(tmp = strtok(NULL,delim)))     /* token & validations */
        {
            fprintf(stderr,"error: strtok() -id.\n");
            exit(EXIT_FAILURE);
        }

        /* MINIMAL conversion validation with sscanf() */
        if(sscanf(tmp,"%d",&customer.id) != 1){
            fprintf(stderr,"error: invalid integer value for line[%d]\n",index+1);
            continue;
            /* exit(EXIT_FAILURE); */
        }

        if(!(tmp = strtok(NULL,delim))){
            fprintf(stderr,"\nerror: strtok()-balance shuld have more line\n");
            continue;
            // exit(EXIT_FAILURE);
        }

        if(sscanf(tmp,"%lf", &customer.balance) != 1){
            fprintf(stderr,"error: invalid float value for line[%d]\n", index+1);
             /* exit(EXIT_FAILURE); */
            continue;
        }

        array[index] = malloc(sizeof *array[index]);    /* allocate struct */
        if(!array[index]){                              /* validate!! */
            perror("malloc-array[index]");
            exit(EXIT_FAILURE);
        }
        *array[index] = customer;                       /* assign struct */
        index += 1;

    }
    fclose(fp);

    int i;
    printf("\nname\tid\t balance\n\n");
    for(i = 0; i< index; i++)
        printf("%s \t%d\t%f\n",array[i]->name,array[i]->id,array[i]->balance);

    for(i = 0; i< index; i++)
    {
        if(array[i]->name)
            free(array[i]->name);       /* free allocated block for name */
        if(array[i])
            free(array[i]);             /* free allocated array index */
    }

    free(array);
    exit(EXIT_FAILURE);
}

cat dat/test.csv returns

name,id,balance
test1,11,1.2334
test2,12,1.133
test3,13,1.3334
test4,14,1.4334

command valgrind -s --leak-check=full ./a.out dat/test.csv output:

==494197== Memcheck, a memory error detector
==494197== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==494197== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==494197== Command: ./a.out dat/test.csv
==494197==
error: invalid integer value for line[1]

name    id       balance

test1   11      1.233400
test2   12      1.133000
test3   13      1.333400
test4   14      1.433400

==494197== Memcheck, a memory error detector
==494197== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==494197== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==494197== Command: ./a.out dat/test.csv
==494197==
error: invalid integer value for line[1]

name    id       balance

test1   11      1.233400
test2   12      1.133000
test3   13      1.333400
test4   14      1.433400
==494197==
==494197== HEAP SUMMARY:
==494197==     in use at exit: 5 bytes in 1 blocks
==494197==   total heap usage: 13 allocs, 12 frees, 5,797 bytes allocated
==494197==
==494197== 5 bytes in 1 blocks are definitely lost in loss record 1 of 1
==494197==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==494197==    by 0x10951D: main (in /home/jian/helloc/a.out)
==494197==
==494197== LEAK SUMMARY:
==494197==    definitely lost: 5 bytes in 1 blocks
==494197==    indirectly lost: 0 bytes in 0 blocks
==494197==      possibly lost: 0 bytes in 0 blocks
==494197==    still reachable: 0 bytes in 0 blocks
==494197==         suppressed: 0 bytes in 0 blocks
==494197==
==494197== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)


问:
Is there a way I can query sql/ sequelize by percentage weighting
I have a post table, a shares table and a likes table. Likes and Shares table have a belongTo relationship with a Post table.

I am trying to query results so that 75% of the results are ordered by the amount of shares the post has and 25% the amount of likes the post has

```<code>  const feed = await postsModel.findAll({

      order: [['numShares', 'desc'], ['numLikes', 'desc']],
      limit: limit,

    })
</code>```

Body:
I have a post table, a shares table and a likes table. Likes and Shares table have a belongTo relationship with a Post table.

I am trying to query results so that 75% of the results are ordered by the amount of shares the post has and 25% the amount of likes the post has

  const feed = await postsModel.findAll({

      order: [['numShares', 'desc'], ['numLikes', 'desc']],
      limit: limit,

    })


问:
End Expected Near <EOF> even though The Script Works FIne What Am I doing Wrong
End Expected Near  even though The Script Works FIne What Am I doing Wrong i tried to fix it but it creates more errors

```<code>--Prison life Loop Bring Induvidual
        local Player = GetPlayer(Arg2)
        if Player ~= nil then
            Notify("Looping bring "..Player.Name, Color3.fromRGB(0, 255, 0), "Success")
            States.PlayerToLoopBring = Player
            States.LoopBring = true
            repeat wait()
                pcall(function()
                    if States.LoopBring and game.Players[States.PlayerToLoopBring.Name] then
                        local savedcf = GetPos()
                        Teleport(States.PlayerToLoopBring, GetPos())
                        game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = savedcf
                    end
                end)
            until States.LoopBring == false
        end
</code>```

Please Tell Me What Is wrong with this script, It is for when someone Is messing with me or killing everybody In the lobby i will teleport them off the map forever

Body:
End Expected Near  even though The Script Works FIne What Am I doing Wrong i tried to fix it but it creates more errors

--Prison life Loop Bring Induvidual
        local Player = GetPlayer(Arg2)
        if Player ~= nil then
            Notify("Looping bring "..Player.Name, Color3.fromRGB(0, 255, 0), "Success")
            States.PlayerToLoopBring = Player
            States.LoopBring = true
            repeat wait()
                pcall(function()
                    if States.LoopBring and game.Players[States.PlayerToLoopBring.Name] then
                        local savedcf = GetPos()
                        Teleport(States.PlayerToLoopBring, GetPos())
                        game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = savedcf
                    end
                end)
            until States.LoopBring == false
        end

Please Tell Me What Is wrong with this script, It is for when someone Is messing with me or killing everybody In the lobby i will teleport them off the map forever


问:
Termux freezing up when graphical environment code compiled
I have just installed and set up neovim with typical plugins in the latest termux(system is Android 13). Have installed python, numpy, matplotlib,tkinter. Have followed the recommended method given here to set up a graphical environment using vnc.

https://wiki.termux.com/wiki/Graphical_Environment

I am able to compile and view graphs using matplotlib from nvim which can be viewed on the vnc client; but the moment I compile the code with the matplotlib; termux nvim terminal freezes and I cannot do anything but a forced exit of the termux app.

No idea what I am doing wrong. Does anyone else face such problems compiling gui stuff on termux?


问:
Read Logging category filters from database instead of appsettings.json file
I prefer to configure my application in just one location. For me this means having all configuration settings in my database. So I try to move my Logging configuration from the appsettings.json to my database. In my database i have added a table with a 'Category' and 'Level' column to hold the same information that is found in the appsettings.json.

Now I try to find the proper way to load the data from the database during application startup.

First I tried adding the filters in the Startup.Configure method. Because in this method I have access to my LogLevelRepository since I can get an instance from the IOC container. I can however not find out which additional class i have to inject to the Configure method to get access to the Logging configuration. So I am not sure if the Configure method is the right place to achieve my goal.

I also tried to achieve my goal in the "ConfigureServices" method. Here I can call the "AddLogging" extension method which gives me access to the ILoggingBuilder instance. First it is more difficult to get a LogFilterRepository instance since the IOC container is not yet available.

I tried to use the LoggingBuilder.AddFilter method to add some hard coded filters. But at runtime the filters that I add are not respected.

What would be the best approach to make this work?


问:
ngx-extended-pdf-viewer - Download not show a draw
i'm using a ngx-extended-pdf-viewer with bleeding-edge, but when i download a file, the draws aren't present in pdf.

```<code>                                <ngx-extended-pdf-viewer
                                [useBrowserLocale]="true"
                                height="100vh"
                                [textLayer]="true"
                                [showHandToolButton]="true"
                                [showPresentationModeButton]="true"
                                [showDownloadButton]="false"
                                [base64Src]="base64" ></ngx-extended-pdf-viewer>
</code>```

How is possibile?

Thanks

```<code><ngx-extended-pdf-viewer
                                [useBrowserLocale]="true"
                                height="100vh"
                                [textLayer]="true"
                                [showHandToolButton]="true"
                                [showPresentationModeButton]="true"
                                [showDownloadButton]="false"
                                [base64Src]="base64" ></ngx-extended-pdf-viewer>
</code>```

Body:
i'm using a ngx-extended-pdf-viewer with bleeding-edge, but when i download a file, the draws aren't present in pdf.

                                <ngx-extended-pdf-viewer
                                [useBrowserLocale]="true"
                                height="100vh"
                                [textLayer]="true"
                                [showHandToolButton]="true"
                                [showPresentationModeButton]="true"
                                [showDownloadButton]="false"
                                [base64Src]="base64" ></ngx-extended-pdf-viewer>

How is possibile?

Thanks

<ngx-extended-pdf-viewer
                                [useBrowserLocale]="true"
                                height="100vh"
                                [textLayer]="true"
                                [showHandToolButton]="true"
                                [showPresentationModeButton]="true"
                                [showDownloadButton]="false"
                                [base64Src]="base64" ></ngx-extended-pdf-viewer>


问:
Visualizing gradient for Keras model in R
I am trying to visualize gradient (gradcam) for a keras model in R.

Here's the code with MNIST dataset:

```<code>library(keras)
fashion_mnist <- dataset_fashion_mnist()

c(train_images, train_labels) %<-% fashion_mnist$train
c(test_images, test_labels) %<-% fashion_mnist$test
class_names = c('T-shirt/top',
                'Trouser',
                'Pullover',
                'Dress',
                'Coat',
                'Sandal',
                'Shirt',
                'Sneaker',
                'Bag',
                'Ankle boot')

train_images <- train_images / 255
test_images <- test_images / 255

model <- keras_model_sequential()
model %>%
  layer_flatten(input_shape = c(28, 28)) %>%
  layer_dense(units = 128, activation = 'relu') %>%
  layer_dense(units = 10, activation = 'softmax')

model %>% compile(
  optimizer = 'adam',
  loss = 'sparse_categorical_crossentropy',
  metrics = c('accuracy')
)

model %>% fit(train_images, train_labels, epochs = 5, verbose = 2)

img <- test_images[1, , , drop = FALSE]

predictions <- model %>% predict(img)

img_output <- model$output[, 1]

last_layer <- model %>% get_layer("dense_4")

grads <- k_gradients(img_output, last_layer$output)[[1]]
</code>```

I am following these instructions: https://rstudio-conf-2020.github.io/dl-keras-tf/notebooks/visualizing-what-cnns-learn.nb.html

And I am getting this error:

```<code>RuntimeError: tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead.
</code>```

I found this solution from here:

```<code>tf$compat$v1$disable_eager_execution()
</code>```

However, adding this to the top of the code produce the other error:

```<code>  AttributeError: 'Tensor' object has no attribute 'gradient'
</code>```

while running this:

```<code>pooled_grads <- k_mean(grads$gradient, axis = c(1, 2, 3))
</code>```

Can you help me? I need something like this:

Body:
I am trying to visualize gradient (gradcam) for a keras model in R.

Here's the code with MNIST dataset:

library(keras)
fashion_mnist <- dataset_fashion_mnist()

c(train_images, train_labels) %<-% fashion_mnist$train
c(test_images, test_labels) %<-% fashion_mnist$test
class_names = c('T-shirt/top',
                'Trouser',
                'Pullover',
                'Dress',
                'Coat',
                'Sandal',
                'Shirt',
                'Sneaker',
                'Bag',
                'Ankle boot')

train_images <- train_images / 255
test_images <- test_images / 255

model <- keras_model_sequential()
model %>%
  layer_flatten(input_shape = c(28, 28)) %>%
  layer_dense(units = 128, activation = 'relu') %>%
  layer_dense(units = 10, activation = 'softmax')

model %>% compile(
  optimizer = 'adam',
  loss = 'sparse_categorical_crossentropy',
  metrics = c('accuracy')
)

model %>% fit(train_images, train_labels, epochs = 5, verbose = 2)

img <- test_images[1, , , drop = FALSE]

predictions <- model %>% predict(img)

img_output <- model$output[, 1]

last_layer <- model %>% get_layer("dense_4")

grads <- k_gradients(img_output, last_layer$output)[[1]]

I am following these instructions: https://rstudio-conf-2020.github.io/dl-keras-tf/notebooks/visualizing-what-cnns-learn.nb.html

And I am getting this error:

RuntimeError: tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead.

I found this solution from here:

tf$compat$v1$disable_eager_execution()

However, adding this to the top of the code produce the other error:

  AttributeError: 'Tensor' object has no attribute 'gradient'

while running this:

pooled_grads <- k_mean(grads$gradient, axis = c(1, 2, 3))

Can you help me? I need something like this:


问:
LiveData in Android - always get null
I have a trouble with Live Data in Android Studio. I can't get the data from it or put the new value.

I have entity, it calls BeeQueen:

```<code>@Entity
public class BeeQueen {

    @PrimaryKey(autoGenerate = true)
    public int id;

    private int birthDate;

    private String note;
}

</code>```

Getters and setters are also exist in that class.

Here is my DAO:

```<code>@Dao
public interface DBDAO {
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    long[] createBeeQueen(BeeQueen... beeQueens);

    @Query("select * from BeeQueen where id = :beeQueenId")
    public LiveData<BeeQueen>  getBeeQueenById(int beeQueenId);

    @Update
    void  update(BeeQueen... beeQueens);
}
</code>```

Here is my View Model class:
`

```<code>public class HomeViewModel extends AndroidViewModel {

    private final DBDAO dbdao;
    private LiveData<BeeQueen> beeQueenLiveData;

    public HomeViewModel(@NonNull Application application) {
        super(application);
        dbdao = AppDBCreator.getAppDB(application.getApplicationContext()).dbdao();

        if (beeQueenLiveData == null) {
            beeQueenLiveData = new MutableLiveData<BeeQueen>();
        }

    }

    public void updateBeeQueen(BeeQueen beeQueen)
    {
        dbdao.update(beeQueen);
    }

    public LiveData<BeeQueen> getBeeQueen(int id)
    {
        beeQueenLiveData = dbdao.getBeeQueenById(id);
        return beeQueenLiveData;
    }

}
</code>```

In fragment I have following code (in onCreateView):

```<code>private BeeQueen beeQueenEntity = new BeeQueen();
...
homeViewModel =  new ViewModelProvider(this).get(HomeViewModel.class);

homeViewModel.getBeeQueen(beeQueenId).observe(getViewLifecycleOwner(), new Observer<BeeQueen>() {
    @Override
    public void onChanged(BeeQueen beeQueen) {
        try {
            Log.d("BeeQueen = ", beeQueen.getNote());<<Null pointer exception
            beeQueenEntity = homeViewModel.getBeeQueen(beeQueenId).getValue(); <<always receive Null

        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
});
</code>```

What did I wrong? The data in database exist - i checked with non-livedata method. But how I can read the values and put new values into livedata object?
P.S. I don't use repository because I have only one DAO

This is the error from log:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.beerp.beediary.models.entity.BeeQueen.getNote()' on a null object reference 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at com.beerp.beediary.ui.home.HomeFragment$9.onChanged(HomeFragment.java:155) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at com.beerp.beediary.ui.home.HomeFragment$9.onChanged(HomeFragment.java:147) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at androidx.lifecycle.LiveData.setValue(LiveData.java:309) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at androidx.lifecycle.LiveData$1.run(LiveData.java:93) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.os.Handler.handleCallback(Handler.java:942) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.os.Handler.dispatchMessage(Handler.java:99) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.os.Looper.loopOnce(Looper.java:201) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.os.Looper.loop(Looper.java:288) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.app.ActivityThread.main(ActivityThread.java:7872) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at java.lang.reflect.Method.invoke(Native Method) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Title: LiveData in Android - always get null

Body:
I have a trouble with Live Data in Android Studio. I can't get the data from it or put the new value.

I have entity, it calls BeeQueen:

@Entity
public class BeeQueen {

    @PrimaryKey(autoGenerate = true)
    public int id;

    private int birthDate;

    private String note;
}

Getters and setters are also exist in that class.

Here is my DAO:

@Dao
public interface DBDAO {
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    long[] createBeeQueen(BeeQueen... beeQueens);

    @Query("select * from BeeQueen where id = :beeQueenId")
    public LiveData<BeeQueen>  getBeeQueenById(int beeQueenId);

    @Update
    void  update(BeeQueen... beeQueens);
}

Here is my View Model class:
`

public class HomeViewModel extends AndroidViewModel {

    private final DBDAO dbdao;
    private LiveData<BeeQueen> beeQueenLiveData;

    public HomeViewModel(@NonNull Application application) {
        super(application);
        dbdao = AppDBCreator.getAppDB(application.getApplicationContext()).dbdao();

        if (beeQueenLiveData == null) {
            beeQueenLiveData = new MutableLiveData<BeeQueen>();
        }

    }

    public void updateBeeQueen(BeeQueen beeQueen)
    {
        dbdao.update(beeQueen);
    }

    public LiveData<BeeQueen> getBeeQueen(int id)
    {
        beeQueenLiveData = dbdao.getBeeQueenById(id);
        return beeQueenLiveData;
    }

}

In fragment I have following code (in onCreateView):

private BeeQueen beeQueenEntity = new BeeQueen();
...
homeViewModel =  new ViewModelProvider(this).get(HomeViewModel.class);

homeViewModel.getBeeQueen(beeQueenId).observe(getViewLifecycleOwner(), new Observer<BeeQueen>() {
    @Override
    public void onChanged(BeeQueen beeQueen) {
        try {
            Log.d("BeeQueen = ", beeQueen.getNote());<<Null pointer exception
            beeQueenEntity = homeViewModel.getBeeQueen(beeQueenId).getValue(); <<always receive Null

        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
});

What did I wrong? The data in database exist - i checked with non-livedata method. But how I can read the values and put new values into livedata object?
P.S. I don't use repository because I have only one DAO

This is the error from log:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.beerp.beediary.models.entity.BeeQueen.getNote()' on a null object reference 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at com.beerp.beediary.ui.home.HomeFragment$9.onChanged(HomeFragment.java:155) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at com.beerp.beediary.ui.home.HomeFragment$9.onChanged(HomeFragment.java:147) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at androidx.lifecycle.LiveData.setValue(LiveData.java:309) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at androidx.lifecycle.LiveData$1.run(LiveData.java:93) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.os.Handler.handleCallback(Handler.java:942) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.os.Handler.dispatchMessage(Handler.java:99) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.os.Looper.loopOnce(Looper.java:201) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.os.Looper.loop(Looper.java:288) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at android.app.ActivityThread.main(ActivityThread.java:7872) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at java.lang.reflect.Method.invoke(Native Method) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 2022-12-23 23:43:13.469  2684-2684  System.err              com.beerp.beediary                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)


问:
The TextBoxes locations get modified before the repaint event is performed
I have a panel and on this panel, I create a number of TextBoxes, one under the other. The number of TextBoxes is greater than the vertical size of the panel can accommodate.

I have two problems:

1. The first TextBox appears at a large vertical distance from the top of the panel, even though its vertical coordinate is 5.

2. I want to automatically scroll to the bottom of the panel so that the last TextBoxes get visible, but I am unable to do that.

The first TextBoxes remain visible.

Here is the code I use:

```<code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TestPanelScroll
{
    public partial class Form1 : Form
    {
        private const int _verticalSpacing = 1;

    public Form1()
    {
        InitializeComponent();

        this.StartPosition = FormStartPosition.CenterScreen;
        this.BackColor = Color.BurlyWood;
        this.ClientSize = new Size(800, 800);

        this.SuspendLayout();
        panelLeftForNodeCreationAndNodeMembersEditingMode = new Panel();
        panelLeftForNodeCreationAndNodeMembersEditingMode.SuspendLayout();
        panelLeftForNodeCreationAndNodeMembersEditingMode.Location = new Point(3, 56);
        panelLeftForNodeCreationAndNodeMembersEditingMode.Size = new Size(461, 187);
        panelLeftForNodeCreationAndNodeMembersEditingMode.Name = "panelLeftForNodeCreationAndNodeMembersEditingMode";
        panelLeftForNodeCreationAndNodeMembersEditingMode.BorderStyle = BorderStyle.Fixed3D;
        panelLeftForNodeCreationAndNodeMembersEditingMode.Visible = true;
        panelLeftForNodeCreationAndNodeMembersEditingMode.CausesValidation = false;
        panelLeftForNodeCreationAndNodeMembersEditingMode.TabStop = false;
        panelLeftForNodeCreationAndNodeMembersEditingMode.TabIndex = 0;
        panelLeftForNodeCreationAndNodeMembersEditingMode.BackColor = Color.LightGray;
        panelLeftForNodeCreationAndNodeMembersEditingMode.SetAutoScrollMargin(0, 40);
        panelLeftForNodeCreationAndNodeMembersEditingMode.HorizontalScroll.Maximum = 0;
        panelLeftForNodeCreationAndNodeMembersEditingMode.AutoScroll = false;
        panelLeftForNodeCreationAndNodeMembersEditingMode.HorizontalScroll.Visible = false;
        panelLeftForNodeCreationAndNodeMembersEditingMode.AutoScroll = true;
        panelLeftForNodeCreationAndNodeMembersEditingMode.Parent = this;
        this.Controls.Add(panelLeftForNodeCreationAndNodeMembersEditingMode);
        panelLeftForNodeCreationAndNodeMembersEditingMode.SendToBack();
        panelLeftForNodeCreationAndNodeMembersEditingMode.ResumeLayout(false);
        panelLeftForNodeCreationAndNodeMembersEditingMode.PerformLayout();

        TextBox currentTextBox = null;
        int xCoordinate = 30;
        for (int i = 1; i <= 37; i++)
        {
            currentTextBox = new TextBox();
            currentTextBox.Name = i.ToString();
            currentTextBox.Size = new Size(85, 20);
            currentTextBox.Tag = i.ToString();
            currentTextBox.TabIndex = i - 1;
            currentTextBox.TextAlign = HorizontalAlignment.Center;
            currentTextBox.Text = currentTextBox.Name;
            currentTextBox.Enabled = true;
            currentTextBox.ReadOnly = true;
            currentTextBox.CausesValidation = true;
            currentTextBox.TabStop = true;
            currentTextBox.BackColor = Color.DarkGray;
            currentTextBox.Parent = panelLeftForNodeCreationAndNodeMembersEditingMode;
            int yCoordinate = yCoordinate = 0 + (i - 1) * _verticalSpacing * 33 + _verticalSpacing * 5;
            currentTextBox.Location = new Point(xCoordinate, yCoordinate);
            textBox1.AppendText("TextBox " + currentTextBox.Name + " verticalCoordinate = " + yCoordinate.ToString() + Environment.NewLine);
            int value = (currentTextBox.Location.Y + currentTextBox.Height) * 2 + _verticalSpacing * 40;
            panelLeftForNodeCreationAndNodeMembersEditingMode.AutoScrollPosition = new Point(0, value);
            panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Maximum = 300;
            int minimum = panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Minimum;
            int maximum = panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Maximum;
            //panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Value = value;
            //panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Value = value;
            panelLeftForNodeCreationAndNodeMembersEditingMode.SetAutoScrollMargin(0, 40);
            panelLeftForNodeCreationAndNodeMembersEditingMode.ScrollControlIntoView(currentTextBox);
            panelLeftForNodeCreationAndNodeMembersEditingMode.PerformLayout();
        }
        this.ResumeLayout();
    }

    private Panel panelLeftForNodeCreationAndNodeMembersEditingMode;

    private void button1_Click(object sender, EventArgs e)
    {
        this.Close();
    }
}
</code>```

}

I use Visual Studio 2010.

Any idea would be greatly appreciated.

Thank you in advance.
My intention is to understand what I am doing wrong and how to correct my code and not to find a workaround (a different way to program it).

Body:
I have a panel and on this panel, I create a number of TextBoxes, one under the other. The number of TextBoxes is greater than the vertical size of the panel can accommodate.

I have two problems:

1. The first TextBox appears at a large vertical distance from the top of the panel, even though its vertical coordinate is 5.

2. I want to automatically scroll to the bottom of the panel so that the last TextBoxes get visible, but I am unable to do that.

The first TextBoxes remain visible.

Here is the code I use:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TestPanelScroll
{
    public partial class Form1 : Form
    {
        private const int _verticalSpacing = 1;

    public Form1()
    {
        InitializeComponent();

        this.StartPosition = FormStartPosition.CenterScreen;
        this.BackColor = Color.BurlyWood;
        this.ClientSize = new Size(800, 800);

        this.SuspendLayout();
        panelLeftForNodeCreationAndNodeMembersEditingMode = new Panel();
        panelLeftForNodeCreationAndNodeMembersEditingMode.SuspendLayout();
        panelLeftForNodeCreationAndNodeMembersEditingMode.Location = new Point(3, 56);
        panelLeftForNodeCreationAndNodeMembersEditingMode.Size = new Size(461, 187);
        panelLeftForNodeCreationAndNodeMembersEditingMode.Name = "panelLeftForNodeCreationAndNodeMembersEditingMode";
        panelLeftForNodeCreationAndNodeMembersEditingMode.BorderStyle = BorderStyle.Fixed3D;
        panelLeftForNodeCreationAndNodeMembersEditingMode.Visible = true;
        panelLeftForNodeCreationAndNodeMembersEditingMode.CausesValidation = false;
        panelLeftForNodeCreationAndNodeMembersEditingMode.TabStop = false;
        panelLeftForNodeCreationAndNodeMembersEditingMode.TabIndex = 0;
        panelLeftForNodeCreationAndNodeMembersEditingMode.BackColor = Color.LightGray;
        panelLeftForNodeCreationAndNodeMembersEditingMode.SetAutoScrollMargin(0, 40);
        panelLeftForNodeCreationAndNodeMembersEditingMode.HorizontalScroll.Maximum = 0;
        panelLeftForNodeCreationAndNodeMembersEditingMode.AutoScroll = false;
        panelLeftForNodeCreationAndNodeMembersEditingMode.HorizontalScroll.Visible = false;
        panelLeftForNodeCreationAndNodeMembersEditingMode.AutoScroll = true;
        panelLeftForNodeCreationAndNodeMembersEditingMode.Parent = this;
        this.Controls.Add(panelLeftForNodeCreationAndNodeMembersEditingMode);
        panelLeftForNodeCreationAndNodeMembersEditingMode.SendToBack();
        panelLeftForNodeCreationAndNodeMembersEditingMode.ResumeLayout(false);
        panelLeftForNodeCreationAndNodeMembersEditingMode.PerformLayout();

        TextBox currentTextBox = null;
        int xCoordinate = 30;
        for (int i = 1; i <= 37; i++)
        {
            currentTextBox = new TextBox();
            currentTextBox.Name = i.ToString();
            currentTextBox.Size = new Size(85, 20);
            currentTextBox.Tag = i.ToString();
            currentTextBox.TabIndex = i - 1;
            currentTextBox.TextAlign = HorizontalAlignment.Center;
            currentTextBox.Text = currentTextBox.Name;
            currentTextBox.Enabled = true;
            currentTextBox.ReadOnly = true;
            currentTextBox.CausesValidation = true;
            currentTextBox.TabStop = true;
            currentTextBox.BackColor = Color.DarkGray;
            currentTextBox.Parent = panelLeftForNodeCreationAndNodeMembersEditingMode;
            int yCoordinate = yCoordinate = 0 + (i - 1) * _verticalSpacing * 33 + _verticalSpacing * 5;
            currentTextBox.Location = new Point(xCoordinate, yCoordinate);
            textBox1.AppendText("TextBox " + currentTextBox.Name + " verticalCoordinate = " + yCoordinate.ToString() + Environment.NewLine);
            int value = (currentTextBox.Location.Y + currentTextBox.Height) * 2 + _verticalSpacing * 40;
            panelLeftForNodeCreationAndNodeMembersEditingMode.AutoScrollPosition = new Point(0, value);
            panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Maximum = 300;
            int minimum = panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Minimum;
            int maximum = panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Maximum;
            //panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Value = value;
            //panelLeftForNodeCreationAndNodeMembersEditingMode.VerticalScroll.Value = value;
            panelLeftForNodeCreationAndNodeMembersEditingMode.SetAutoScrollMargin(0, 40);
            panelLeftForNodeCreationAndNodeMembersEditingMode.ScrollControlIntoView(currentTextBox);
            panelLeftForNodeCreationAndNodeMembersEditingMode.PerformLayout();
        }
        this.ResumeLayout();
    }

    private Panel panelLeftForNodeCreationAndNodeMembersEditingMode;

    private void button1_Click(object sender, EventArgs e)
    {
        this.Close();
    }
}

}

I use Visual Studio 2010.

Any idea would be greatly appreciated.

Thank you in advance.
My intention is to understand what I am doing wrong and how to correct my code and not to find a workaround (a different way to program it).


问:
Solving Empty Suite in selenium webdriver
Here's my code, but when I run my code, it displayed this error:

```<code>C:\Program Files\Python310\python.exe" "C:\Program Files\JetBrains\PyCharm Community Edition 2022.1\plugins\python-ce\helpers\pycharm\_jb_unittest_runner.py" --target Logintests
Testing started at 1:55 PM ...
Launching unittests with arguments python -m unittest Logintests in E:\$LEARN$\$QA$\Automation\page-object-python-selenium-CMSpanel\Tests

Ran 0 tests in 0.000s

OK

Process finished with exit code 0
</code>```

Empty suite

In addition to search in stackoverflow, I found some resolve way, for example:

In unittest library exists a naming convention that all the tests start with 'test', this informs the test runner about which methods represent tests.

You have to change your 'Test' method to 'test'

but I didn't understand how to edit my code or my directories.

Body:
Here's my code, but when I run my code, it displayed this error:

C:\Program Files\Python310\python.exe" "C:\Program Files\JetBrains\PyCharm Community Edition 2022.1\plugins\python-ce\helpers\pycharm\_jb_unittest_runner.py" --target Logintests
Testing started at 1:55 PM ...
Launching unittests with arguments python -m unittest Logintests in E:\$LEARN$\$QA$\Automation\page-object-python-selenium-CMSpanel\Tests

Ran 0 tests in 0.000s

OK

Process finished with exit code 0

Empty suite

In addition to search in stackoverflow, I found some resolve way, for example:

In unittest library exists a naming convention that all the tests start with 'test', this informs the test runner about which methods represent tests.

You have to change your 'Test' method to 'test'

but I didn't understand how to edit my code or my directories.


问:
React 18 createRoot error in React Native
I am working on a project in react native. I am getting a warning related to React 18. The message is Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17.

I have searched to resolve this but I only found the solution related to reactjs not react native.
Please help me to solve this.

App.js

```<code>import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {
return (
 <View style={styles.container}>
   <Text>Starting New Native Projecsft</Text>
   <StatusBar style="auto" />
 </View>
);
}

const styles = StyleSheet.create({
container: {
 flex: 1,
 backgroundColor: '#fff',
 alignItems: 'center',
 justifyContent: 'center',
},
});

</code>```

Body:
I am working on a project in react native. I am getting a warning related to React 18. The message is Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17.

I have searched to resolve this but I only found the solution related to reactjs not react native.
Please help me to solve this.

App.js

import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {
return (
 <View style={styles.container}>
   <Text>Starting New Native Projecsft</Text>
   <StatusBar style="auto" />
 </View>
);
}

const styles = StyleSheet.create({
container: {
 flex: 1,
 backgroundColor: '#fff',
 alignItems: 'center',
 justifyContent: 'center',
},
});