问:
Predict with keras triggers OOM error message
I fit a keras model without any problem. But when I try to predict a test sample, it triggers an OOM error message:

InternalError: Failed copying input tensor from
/job:localhost/replica:0/task:0/device:CPU:0 to
/job:localhost/replica:0/task:0/device:GPU:0 in order to run
_EagerConst: Dst tensor is not initialized.

2022-12-15 14:52:24.087105: I
tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow
binary is optimized with oneAPI Deep Neural Network Library (oneDNN)
to use the following CPU instructions in performance-critical
operations:  AVX AVX2 To enable them in other operations, rebuild
TensorFlow with the appropriate compiler flags. 2022-12-15
14:52:26.128616: I
tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device
/job:localhost/replica:0/task:0/device:GPU:0 with 13623 MB memory:  ->
device: 0, name: NVIDIA RTX A5000 Laptop GPU, pci bus id:
0000:01:00.0, compute capability: 8.6 2022-12-15 14:52:26.711913: I
tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of
the MLIR Optimization Passes are enabled (registered 2) 2022-12-15
14:52:27.768758: I tensorflow/stream_executor/cuda/cuda_blas.cc:1760]
TensorFloat-32 will be used for the matrix multiplication. This will
only be logged once. 2022-12-15 16:28:52.564740: W
tensorflow/core/common_runtime/bfc_allocator.cc:457] Allocator
(GPU_0_bfc) ran out of memory trying to allocate 16.84MiB (rounded to
17655296)requested by op model/output/Softmax

The fact is my model's output is 137K in size (a list of products I make a softmax on). How come does it only happen during the predict phase? I tried to reduce the batch_size to 1, to no avail.


来源: stackexchange

问:
What does the line with nz do?
This is the code for an indicator named Trend Regularity Adaptive Moving Average on trading view.

```<code>study("Trend Regularity Adaptive Moving Average","TRAMA [LuxAlgo]",overlay=true)
length=input(99),src = input(close)
//----
ama = 0.
hh = max(sign(change(highest(length))),0)
ll = max(sign(change(lowest(length))*-1),0)
tc = pow(sma(hh or ll ? 1 : 0,length),2)
ama := nz(ama[1]+tc*(src-ama[1]),src)
plot(ama,"Plot",#ff1100,2)
</code>```

What does the line ama := nz(ama[1]+tc*(src-ama[1]),src) do?
Can you explain in terms of a python code?

ContentLicense: CC BY-SA 4.0

Title: What does the line with nz do?

Body:
This is the code for an indicator named Trend Regularity Adaptive Moving Average on trading view.

study("Trend Regularity Adaptive Moving Average","TRAMA [LuxAlgo]",overlay=true)
length=input(99),src = input(close)
//----
ama = 0.
hh = max(sign(change(highest(length))),0)
ll = max(sign(change(lowest(length))*-1),0)
tc = pow(sma(hh or ll ? 1 : 0,length),2)
ama := nz(ama[1]+tc*(src-ama[1]),src)
plot(ama,"Plot",#ff1100,2)

What does the line ama := nz(ama[1]+tc*(src-ama[1]),src) do?
Can you explain in terms of a python code?


问:
Typo3, Faceted Search and Workspaces
I have typo3 11.5
I use ke_search 4.5.1.

I created a workspace for editing and there are content that are in "editing" status.

Result page of ke_search display contents that are not approved and aro not in live workspace, how can i resolve?

Title: Typo3, Faceted Search and Workspaces


问:
Command in Source results in prompt in Console
When I issue the command clustMixType::clprofiles from the RStudio Source pane and press Ctrl+Enter, it results in a prompt (Hit Return to see next plot:) in the Console. Is there a way to avoid this prompt and just show the plots?

I haven't seen this type of behavior in RStudio before (Source command issuing a prompt in the Console). Is there a way to avoid this prompt and just show the plots?


问:
Import html table in Jupyter NB
I couldn't able to read the table from the HTML link

```<code> import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

data = pd.read_html('https://www.ncei.noaa.gov/pub/data/paleo/reconstructions/deboer2014/deboer2014.txt')
</code>```

It has loads of data, anyone faced a similar issue?
link: https://www.ncei.noaa.gov/pub/data/paleo/reconstructions/deboer2014/deboer2014.txt

Gets error -> No tables found

Title: Import html table in Jupyter NB

Body:
I couldn't able to read the table from the HTML link

 import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

data = pd.read_html('https://www.ncei.noaa.gov/pub/data/paleo/reconstructions/deboer2014/deboer2014.txt')

It has loads of data, anyone faced a similar issue?
link: https://www.ncei.noaa.gov/pub/data/paleo/reconstructions/deboer2014/deboer2014.txt

Gets error -> No tables found


问:
Electron app - different build versions - Can you conditionally use different package.json?
I have an electron app that is loading different url based on the APP build version i.e. source code is exactly the same however there are some differences to the app meta itself like different publisher, appId and appBundleId.

I am looking for the best solution to create an easy way to build different version of this app based on the command I run.

Should I keep one package.json with different scrip command and conf for thos command that will set env vars?

I will need to access an env var when compiling/building so that different url can be loaded.

App is done with electron, electron-builder and the web app from the url is js + react.

Thanks in advance for any help.


问:
Docker imagebuild for Postgresql initializing materialized view
I face weird problem I'd like to understand with respect to postgres initialization at docker image build. My base image is

```<code>FROM bitnami/postgresql:14.5.0
</code>```

Where I mount a custom SQL init script into, executed at /docker-entrypoint-initdb.d according to documentation. The script is perfectly executed for creating tables, importing data and so on.

The very last statement is the creation of a materialized view. As soon as the build process comes to that statement, the entire docker build stuck. It does not exit with an error but does not continue at all, while CPU stays constantly at 10-15% in average. I waited for an hour before I was cancelling the build process.

When I do the same with no data (i.e, defining the MV but not initializing it) the docker build passes and finishes with no error.

```<code>CREATE MATERIALIZED VIEW myViewName AS
<Large SQL statement omitted for better readability>
WITH NO DATA;
</code>```

Running the image as container, connection to PostgreSQL and performing the MV refresh like

```<code>REFRESH MATERIALIZED VIEW myViewName;
</code>```

takes ~30 seconds for 2M rows.

So why does this fail during build when perfectly working inside a container? Does anybody faced a similiar behaviour and may point me to the right direction?

Body:
I face weird problem I'd like to understand with respect to postgres initialization at docker image build. My base image is

FROM bitnami/postgresql:14.5.0

Where I mount a custom SQL init script into, executed at /docker-entrypoint-initdb.d according to documentation. The script is perfectly executed for creating tables, importing data and so on.

The very last statement is the creation of a materialized view. As soon as the build process comes to that statement, the entire docker build stuck. It does not exit with an error but does not continue at all, while CPU stays constantly at 10-15% in average. I waited for an hour before I was cancelling the build process.

When I do the same with no data (i.e, defining the MV but not initializing it) the docker build passes and finishes with no error.

CREATE MATERIALIZED VIEW myViewName AS
<Large SQL statement omitted for better readability>
WITH NO DATA;

Running the image as container, connection to PostgreSQL and performing the MV refresh like

REFRESH MATERIALIZED VIEW myViewName;

takes ~30 seconds for 2M rows.

So why does this fail during build when perfectly working inside a container? Does anybody faced a similiar behaviour and may point me to the right direction?


问:
Calling web api endpoints or mvc actions works locally, but unable to do it in IIS
To access my application hosted in IIS I use www.mydomain.com/myapp/Home.

If I call some API using jquery ajax for example (in IIS hosted):

ajax: { url: '/api/users' }

It will call www.mydomain.com/api/users and returns an 404 error

I need to get something like www.mydomain.com/myapp/api/users

Note: it works perfectly when running the application with Visual Studio, but in IIS doesn't work. What it can be?

Changing /api/ to just api/ seems to work, but when I need to use @Url.Action(), generate the url starting with /controller/action and it will give a lot of work to process the result and fit to work. But I don't think this is a correct way to handle that kind of error.

Edit 1:

Now I noticed the @Url.Action() put the application name myapp/controller/action (just in IIS) instead just the /controller/action. So now I have two problems, clear the first / on web api calls, and /myapp/ appearing to mvc actions.

Should I configure something in IIS to respect the application path?


问:
I think i am having a stoi function error in my C++ project, using CodeBlocks
I have these 2 related files:

```<code>PERSON.H::
#include<iostream>
#include<string.h>
using namespace std;
class Person
{

    private:
        string Name;
        string Surname;
        float Height;
        long long PhoneNo;
        string Nickname;
    public:
        Person(string, string, float, long long, string);

        inline string getName(){return Name;}
        inline string getSurname(){return Surname;}
        inline float getHeight(){return Height;}
        inline long long getPhoneNo(){return PhoneNo;}
        inline string getNickname(){return Nickname;}
        bool operator<(Person &);
        bool operator>(Person &);
        friend ostream& operator<<(ostream &,Person &);
};

PERSON.CPP
#include<iostream>
using namespace std;

#include "Person.h"
#include <vector>
#include <map>
#include <utility>

Person::Person(string s1,string s2,float f1,long long l1,string s3)
{
    this->Name=s1;
    Surname=s2;
    Height=f1;
    PhoneNo=l1;
    Nickname=s3;
}

ostream & operator<<(ostream &os,Person &p)
{
    os<<p.getName()<<" "<<p.getSurname()<<"||"<<p.getHeight()<<"||"<<p.getPhoneNo()<<"||"<<p.getNickname()<<endl;
    return os;
}

int main(int argc,char **args)
{
    int count=stoi(args[1]);
    cout<<count<<endl;
    vector <Person> vp;
    map <long long, Person> pm;

    for(int i=0;i<count;i++)
    {
        string name,surname,nickname,heightstr,phonenostr;
        float height;
        long long phoneno;
        cout<<"Input Name: ";
        cin>>name;
        cout<<endl;
        cout<<"Input Surname: ";
        cin>>surname;
        cout<<endl;
        cout<<"Input Height: ";
        cin>>height;
        cout<<endl;
        cout<<"Input Phone no. : ";
        cin>>phoneno;
        cout<<endl;
        cout<<"Input Nickname: ";
        cin>>nickname;
        cout<<endl;
        Person p(name,surname,height,phoneno,nickname);
        vp.push_back(p);
        pair<long long,Person> pr(phoneno,p);
        pm.insert(pr);
    }
    for(auto i=vp.begin();i!=vp.end();i++)
        cout<<*i<<endl;
    for(auto it=pm.begin();it!=pm.end();it++)
        cout<<it->first<<":"<<it->second<<endl;
    return 0;
}

</code>```

However whenerver i try to run it on Codeblocks it simply gives me a :

```<code>terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

</code>```

error on the output screen. I ran this on Linux during my classes and it working fine though.

I have changed the internal compiler to run on both c++11 and c++14 and yet i kept getting the same message. Only after replacing

```<code>int count=stoi(args[1]);
    cout<<count<<endl;
</code>```

part with

```<code>int count;

cout<<"Enter number of input runs: ";
cin>>count;
</code>```

made the code run on Codeblocks. Am i missing some part of the configuration in Codeblocks or am i using some compiler wrongly?

Body:
I have these 2 related files:

PERSON.H::
#include<iostream>
#include<string.h>
using namespace std;
class Person
{

    private:
        string Name;
        string Surname;
        float Height;
        long long PhoneNo;
        string Nickname;
    public:
        Person(string, string, float, long long, string);

        inline string getName(){return Name;}
        inline string getSurname(){return Surname;}
        inline float getHeight(){return Height;}
        inline long long getPhoneNo(){return PhoneNo;}
        inline string getNickname(){return Nickname;}
        bool operator<(Person &);
        bool operator>(Person &);
        friend ostream& operator<<(ostream &,Person &);
};

PERSON.CPP
#include<iostream>
using namespace std;

#include "Person.h"
#include <vector>
#include <map>
#include <utility>

Person::Person(string s1,string s2,float f1,long long l1,string s3)
{
    this->Name=s1;
    Surname=s2;
    Height=f1;
    PhoneNo=l1;
    Nickname=s3;
}

ostream & operator<<(ostream &os,Person &p)
{
    os<<p.getName()<<" "<<p.getSurname()<<"||"<<p.getHeight()<<"||"<<p.getPhoneNo()<<"||"<<p.getNickname()<<endl;
    return os;
}

int main(int argc,char **args)
{
    int count=stoi(args[1]);
    cout<<count<<endl;
    vector <Person> vp;
    map <long long, Person> pm;

    for(int i=0;i<count;i++)
    {
        string name,surname,nickname,heightstr,phonenostr;
        float height;
        long long phoneno;
        cout<<"Input Name: ";
        cin>>name;
        cout<<endl;
        cout<<"Input Surname: ";
        cin>>surname;
        cout<<endl;
        cout<<"Input Height: ";
        cin>>height;
        cout<<endl;
        cout<<"Input Phone no. : ";
        cin>>phoneno;
        cout<<endl;
        cout<<"Input Nickname: ";
        cin>>nickname;
        cout<<endl;
        Person p(name,surname,height,phoneno,nickname);
        vp.push_back(p);
        pair<long long,Person> pr(phoneno,p);
        pm.insert(pr);
    }
    for(auto i=vp.begin();i!=vp.end();i++)
        cout<<*i<<endl;
    for(auto it=pm.begin();it!=pm.end();it++)
        cout<<it->first<<":"<<it->second<<endl;
    return 0;
}

However whenerver i try to run it on Codeblocks it simply gives me a :

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

error on the output screen. I ran this on Linux during my classes and it working fine though.

I have changed the internal compiler to run on both c++11 and c++14 and yet i kept getting the same message. Only after replacing

int count=stoi(args[1]);
    cout<<count<<endl;

part with

int count;

cout<<"Enter number of input runs: ";
cin>>count;

made the code run on Codeblocks. Am i missing some part of the configuration in Codeblocks or am i using some compiler wrongly?


问:
Is there a way to create CI/CD pipeline with Nx on Lerna Monorepo?
I have a monorepo based on Lerna and I'd like to improve the experience by integrating with Nx.
Successfully, added Nx.json and update some configuration by following the tutorial (https://nx.dev/recipes/adopting-nx/lerna-and-nx), but CI/CD pipeline is still not working.
And also I am not going to use nx/cloud, instead I am using nx/tasks-runners/default as a default runner.

Please let me know if you have any good example or experience for it.

I verified these scripts are working.

package.json/scripts: { "build": "nx run-many --target=build", "test": "nx run-many --target=test" }

Current CI.yml:

```<code>jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0,
      - name: "Install dependencies"
        run: |
          npm ci
          npm run bootstrap
      - name: "Run Build"
        run: npm run build
  publish:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: "Update Version"
        run: |
          npx lerna version
      - name: "Publish"
        run: |
          npx lerna publish
</code>```

Hope to update this one with Nx.

Body:
I have a monorepo based on Lerna and I'd like to improve the experience by integrating with Nx.
Successfully, added Nx.json and update some configuration by following the tutorial (https://nx.dev/recipes/adopting-nx/lerna-and-nx), but CI/CD pipeline is still not working.
And also I am not going to use nx/cloud, instead I am using nx/tasks-runners/default as a default runner.

Please let me know if you have any good example or experience for it.

I verified these scripts are working.

package.json/scripts: { "build": "nx run-many --target=build", "test": "nx run-many --target=test" }

Current CI.yml:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0,
      - name: "Install dependencies"
        run: |
          npm ci
          npm run bootstrap
      - name: "Run Build"
        run: npm run build
  publish:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: "Update Version"
        run: |
          npx lerna version
      - name: "Publish"
        run: |
          npx lerna publish

Hope to update this one with Nx.


问:
The third scanf wont take an input after the first two takes input
```<code>int main()
{
   char arr[20], charo, cha;
   int len, score=0;
   printf("Enter the line: ");
   scanf("%[^\n]%*c", arr);
   printf("Enter the letter you want to search for: ");
   scanf("%c", &charo);
   printf("Enter the letter you want to exchange: ");
   scanf("%c", &cha);
   len = strlen(arr);
   for(int i=0; i<len; i++)
       if(arr[i] == charo)
           {
               arr[i] = cha;
           }
   for(int i=0; i<len; i++)
   {
       printf("%s", arr);
   }
}
</code>```

I wanted to take a string as an input and then select a letter and replace that letter with another letter taken as an input from the user. But the third scanf doesn't work.

Body:
int main()
{
   char arr[20], charo, cha;
   int len, score=0;
   printf("Enter the line: ");
   scanf("%[^\n]%*c", arr);
   printf("Enter the letter you want to search for: ");
   scanf("%c", &charo);
   printf("Enter the letter you want to exchange: ");
   scanf("%c", &cha);
   len = strlen(arr);
   for(int i=0; i<len; i++)
       if(arr[i] == charo)
           {
               arr[i] = cha;
           }
   for(int i=0; i<len; i++)
   {
       printf("%s", arr);
   }
}

I wanted to take a string as an input and then select a letter and replace that letter with another letter taken as an input from the user. But the third scanf doesn't work.


问:
which spark version is used on EMR if you pass SPARK_HOME
Assume we use EMR 6.5.0 which ships with Spark 3.1.2.

If we download the PySpark Python library 2.3.3 and submit the spark application normally, it will run on the EMR Spark default which is 3.1.2.

If you explicitly set SPARK_HOME to be where the pyspark library is (~/.python3.7/site-packages/pyspark) that has 2.3.3, and submit the spark application, will it run against the PySpark 2.3.3 version that ships with the PySpark Python package or still run against the system default which is 3.1.2?


问:
How to deal with memory fragmentation in Vulkan
First of all, please don't tell me to use VMA.

Okay so here is my issue, I'm writing a game engine with Vulkan, and I've just written all the code needed to add meshes to my scenes. That's not a problem at all, the problem comes when deleting meshes.

Because Vulkan has some pretty hardcore memory limitations, for example, the maximum number of memory allocations, I've decided that the way that I'm going to allocate memory is with "blocks". So basically, I just allocate a big block of memory, say, 128 or 256MB, and when that block is full, I just allocate another one. But for the sake of not overcomplicating the question, lets assume that I'll only have one block in the entire lifespan of my program, which I'm going to represent like this:

```<code>__________________________________________________________________
|                                                                |
------------------------------------------------------------------
</code>```

Lets say that start adding meshes to my block...

```<code>__________________________________________________________________
|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                |
------------------------------------------------------------------
</code>```

That's all well and good, but now let us delete a mesh in the middle of the block...

```<code>__________________________________________________________________
|OOOOOOOOOOOOOOOOOOOOOO       OOOOOOOOOOOOOOOOOOO                |
------------------------------------------------------------------
</code>```

In this situation there are two options that come to my mind:

Freelist: Every time I delete a mesh, I add the range (offset and size) of the deleted mesh to a list, and then when I have to render everything, I just skip that section. So basically, a freelist. The pros of this approach are: 1. No additional memory allocations. 2. No transfer operations. And the cons is just that when I've deleted a bunch of meshes, I'll end up with a lot of memory fragmentation.

Vector: When I delete a mesh, I allocate a new block, and I perform the transfer operation required to leave the memory with no gaps, basically, just like std::vector.erase() works (although std::vector doesn't allocate new memory, but because it moves the elements one by one to the left, I need to move everything at once through a Vulkan transfer operation):

.

```<code>__________________________________________________________________
|OOOOOOOOOOOOOOOOOOOOOO       OOOOOOOOOOOOOOOOOOO                |
------------------------------------------------------------------
 |                    |      /                  /
 |                    |     /                  /
 |                    |    /                  /
 |                    |   /                  /
 |                    |  /                  /
 |                    | /                  /
 |                    |/                  /
__________________________________________________________________
|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                       |
------------------------------------------------------------------
</code>```

The pros of this is no memory fragmentation at all. The cons are: 1. One memory allocation. 2. The transfer operation.

With the first approach, I could also write a function that defragments the block with a transfer operation similar to the one described in approach 2, but with multiple ranges (multiple VkBufferCopy structures), and then call that function when there is a lot of memory gaps. Also, when I restart the program, the meshes would be added in order, so the problem would be solved by just restarting the engine.

With the second approach, when you have a lot of memory to transfer, it may produce a bit of a stutter in you program, maybe an FPS drop. Which could be reduced maybe by performing the transfer operation on a separate asynchronous transfer queue, from a queue family the only supports transfer operations, so that I uses the DMA engine of you GPU. Is this a thing or am I tripping?

What do you think is the best approach for this?

Any help is appreciated, thanks in advance :)

Body:
First of all, please don't tell me to use VMA.

Okay so here is my issue, I'm writing a game engine with Vulkan, and I've just written all the code needed to add meshes to my scenes. That's not a problem at all, the problem comes when deleting meshes.

Because Vulkan has some pretty hardcore memory limitations, for example, the maximum number of memory allocations, I've decided that the way that I'm going to allocate memory is with "blocks". So basically, I just allocate a big block of memory, say, 128 or 256MB, and when that block is full, I just allocate another one. But for the sake of not overcomplicating the question, lets assume that I'll only have one block in the entire lifespan of my program, which I'm going to represent like this:

__________________________________________________________________
|                                                                |
------------------------------------------------------------------

Lets say that start adding meshes to my block...

__________________________________________________________________
|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                |
------------------------------------------------------------------

That's all well and good, but now let us delete a mesh in the middle of the block...

__________________________________________________________________
|OOOOOOOOOOOOOOOOOOOOOO       OOOOOOOOOOOOOOOOOOO                |
------------------------------------------------------------------

In this situation there are two options that come to my mind:

Freelist: Every time I delete a mesh, I add the range (offset and size) of the deleted mesh to a list, and then when I have to render everything, I just skip that section. So basically, a freelist. The pros of this approach are: 1. No additional memory allocations. 2. No transfer operations. And the cons is just that when I've deleted a bunch of meshes, I'll end up with a lot of memory fragmentation.

Vector: When I delete a mesh, I allocate a new block, and I perform the transfer operation required to leave the memory with no gaps, basically, just like std::vector.erase() works (although std::vector doesn't allocate new memory, but because it moves the elements one by one to the left, I need to move everything at once through a Vulkan transfer operation):

.

__________________________________________________________________
|OOOOOOOOOOOOOOOOOOOOOO       OOOOOOOOOOOOOOOOOOO                |
------------------------------------------------------------------
 |                    |      /                  /
 |                    |     /                  /
 |                    |    /                  /
 |                    |   /                  /
 |                    |  /                  /
 |                    | /                  /
 |                    |/                  /
__________________________________________________________________
|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                       |
------------------------------------------------------------------

The pros of this is no memory fragmentation at all. The cons are: 1. One memory allocation. 2. The transfer operation.

With the first approach, I could also write a function that defragments the block with a transfer operation similar to the one described in approach 2, but with multiple ranges (multiple VkBufferCopy structures), and then call that function when there is a lot of memory gaps. Also, when I restart the program, the meshes would be added in order, so the problem would be solved by just restarting the engine.

With the second approach, when you have a lot of memory to transfer, it may produce a bit of a stutter in you program, maybe an FPS drop. Which could be reduced maybe by performing the transfer operation on a separate asynchronous transfer queue, from a queue family the only supports transfer operations, so that I uses the DMA engine of you GPU. Is this a thing or am I tripping?

What do you think is the best approach for this?

Any help is appreciated, thanks in advance :)


问:
Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (1, 1, 2)
I am learning to use Deep learning and I tried to create a model to play Breakout using OpenAI Gym and Tensorflow, but I kept getting this error:

```<code>Traceback (most recent call last):
  File "/Users/diogomoraes/Desktop/Python/breakout.py", line 62, in <module>
    dqn.fit(env, nb_steps=10000, visualize=True, verbose=2)
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/rl/core.py", line 168, in fit
    action = self.forward(observation)
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/rl/agents/dqn.py", line 224, in forward
    q_values = self.compute_q_values(state)
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/rl/agents/dqn.py", line 68, in compute_q_values
    q_values = self.compute_batch_q_values([state]).flatten()
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/rl/agents/dqn.py", line 63, in compute_batch_q_values
    q_values = self.model.predict_on_batch(batch)
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/keras/engine/training_v1.py", line 1303, in predict_on_batch
    inputs, _, _ = self._standardize_user_data(
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/keras/engine/training_v1.py", line 2650, in _standardize_user_data
    return self._standardize_tensors(
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/keras/engine/training_v1.py", line 2691, in _standardize_tensors
    x = training_utils_v1.standardize_input_data(
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/keras/engine/training_utils_v1.py", line 712, in standardize_input_data
    raise ValueError(
ValueError: Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (1, 1, 2)
</code>```

When trying to run this code:

```<code>import gym
import os

#Don't Show Tensor Flow info
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Input
from tensorflow.keras.layers import Dense, Flatten, Convolution2D
from tensorflow.keras.optimizers import Adam
from rl.agents import DQNAgent
from rl.memory import EpisodeParameterMemory
from rl.policy import LinearAnnealedPolicy, EpsGreedyQPolicy

#Creating the environment
env = gym.make("ALE/Breakout-v5", render_mode="human")

actions = env.action_space.n
height, width, channels = env.observation_space.shape

#Initializing the model - CNN type
model = Sequential()

#Adding the layers
inputs = (1, height, width, channels)
model.add(Convolution2D(32, (8,8), activation='relu', input_shape=(height, width, channels)))
model.add(Convolution2D(64, (4,4), activation='relu'))
model.add(Flatten())
model.add(Dense(256, activation='relu'))
model.add(Dense(4, activation='relu'))

#Building the model
model.build(input_shape=inputs)

#Summary of the model - Always build the model first
#model.summary()

#Define the policy
policy = LinearAnnealedPolicy(
        EpsGreedyQPolicy(),
        attr='eps',
        value_max=1.0,
        value_min=0.1,
        value_test=0.2,
        nb_steps=10_000)

#Define memory
memory = EpisodeParameterMemory(limit=100000, window_length=1)

#Build the Agent
dqn = DQNAgent(
    model=model,
    policy=policy,
    nb_actions=actions,
    memory=memory)

#Compile the Agent
dqn.compile(Adam(learning_rate=1e-4), metrics=['mae'])

#Fit the agent
dqn.fit(env, nb_steps=10000, visualize=True, verbose=2)
</code>```

I tried with the Chat OpenAi and it got me the following answer:
The error message ValueError: Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (1, 1, 2) indicates that the input tensor passed to the Convolution2D layer has an unexpected shape. In this case, the input tensor has shape (1, 1, 2), which is not compatible with the input_shape parameter passed to the Convolution2D layer.

To fix this error, you will need to change the shape of the input tensor to match the input_shape parameter passed to the Convolution2D layer. You can do this by modifying the inputs variable in the following way:

inputs = (1, height, width, channels)

and I still could not fix the input shape

Body:
I am learning to use Deep learning and I tried to create a model to play Breakout using OpenAI Gym and Tensorflow, but I kept getting this error:

Traceback (most recent call last):
  File "/Users/diogomoraes/Desktop/Python/breakout.py", line 62, in <module>
    dqn.fit(env, nb_steps=10000, visualize=True, verbose=2)
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/rl/core.py", line 168, in fit
    action = self.forward(observation)
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/rl/agents/dqn.py", line 224, in forward
    q_values = self.compute_q_values(state)
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/rl/agents/dqn.py", line 68, in compute_q_values
    q_values = self.compute_batch_q_values([state]).flatten()
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/rl/agents/dqn.py", line 63, in compute_batch_q_values
    q_values = self.model.predict_on_batch(batch)
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/keras/engine/training_v1.py", line 1303, in predict_on_batch
    inputs, _, _ = self._standardize_user_data(
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/keras/engine/training_v1.py", line 2650, in _standardize_user_data
    return self._standardize_tensors(
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/keras/engine/training_v1.py", line 2691, in _standardize_tensors
    x = training_utils_v1.standardize_input_data(
  File "/Users/diogomoraes/miniconda3/lib/python3.9/site-packages/keras/engine/training_utils_v1.py", line 712, in standardize_input_data
    raise ValueError(
ValueError: Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (1, 1, 2)

When trying to run this code:

import gym
import os

#Don't Show Tensor Flow info
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Input
from tensorflow.keras.layers import Dense, Flatten, Convolution2D
from tensorflow.keras.optimizers import Adam
from rl.agents import DQNAgent
from rl.memory import EpisodeParameterMemory
from rl.policy import LinearAnnealedPolicy, EpsGreedyQPolicy

#Creating the environment
env = gym.make("ALE/Breakout-v5", render_mode="human")

actions = env.action_space.n
height, width, channels = env.observation_space.shape

#Initializing the model - CNN type
model = Sequential()

#Adding the layers
inputs = (1, height, width, channels)
model.add(Convolution2D(32, (8,8), activation='relu', input_shape=(height, width, channels)))
model.add(Convolution2D(64, (4,4), activation='relu'))
model.add(Flatten())
model.add(Dense(256, activation='relu'))
model.add(Dense(4, activation='relu'))

#Building the model
model.build(input_shape=inputs)

#Summary of the model - Always build the model first
#model.summary()

#Define the policy
policy = LinearAnnealedPolicy(
        EpsGreedyQPolicy(),
        attr='eps',
        value_max=1.0,
        value_min=0.1,
        value_test=0.2,
        nb_steps=10_000)

#Define memory
memory = EpisodeParameterMemory(limit=100000, window_length=1)

#Build the Agent
dqn = DQNAgent(
    model=model,
    policy=policy,
    nb_actions=actions,
    memory=memory)

#Compile the Agent
dqn.compile(Adam(learning_rate=1e-4), metrics=['mae'])

#Fit the agent
dqn.fit(env, nb_steps=10000, visualize=True, verbose=2)

I tried with the Chat OpenAi and it got me the following answer:
The error message ValueError: Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (1, 1, 2) indicates that the input tensor passed to the Convolution2D layer has an unexpected shape. In this case, the input tensor has shape (1, 1, 2), which is not compatible with the input_shape parameter passed to the Convolution2D layer.

To fix this error, you will need to change the shape of the input tensor to match the input_shape parameter passed to the Convolution2D layer. You can do this by modifying the inputs variable in the following way:

inputs = (1, height, width, channels)

and I still could not fix the input shape


问:
In iOS how multiple transactions in a row for one user are treated
I'm trying to start multiple auto renewable purchase of subscriptions in  once for one user, I'm curious how it is handled by Apple

I append transactions like this:

```<code>func startTransactions(purchaseIDs: Array<String>) {
        if (SKPaymentQueue.canMakePayments()) {

            purchaseIDs.forEach { id in
                let transactionRequest = SKMutablePayment()
                transactionRequest.productIdentifier = id
                SKPaymentQueue.default().add(transactionRequest)
            }

        }
 }
</code>```

and I have this method

```<code>func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        for transaction in transactions {
        }
}
</code>```

What i want to know if multiple SKPaymentQueue.default().add(transactionRequest)in a row results in one transaction of does it results in multiple transactions (one per product)

Body:
I'm trying to start multiple auto renewable purchase of subscriptions in  once for one user, I'm curious how it is handled by Apple

I append transactions like this:

func startTransactions(purchaseIDs: Array<String>) {
        if (SKPaymentQueue.canMakePayments()) {

            purchaseIDs.forEach { id in
                let transactionRequest = SKMutablePayment()
                transactionRequest.productIdentifier = id
                SKPaymentQueue.default().add(transactionRequest)
            }

        }
 }

and I have this method

func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        for transaction in transactions {
        }
}

What i want to know if multiple SKPaymentQueue.default().add(transactionRequest)in a row results in one transaction of does it results in multiple transactions (one per product)


问:
Python selenium Chrome driver headless mode and pythonw.exe
I have a python script that I want to add to the windows task scheduler, when I am trying to schedule the program using python.exe executable path, it works well but as you know the prompt window appears each time the script runs.

The problem here is when I am trying to run the script in the background without the prompt window using the pythonw.exe instead the prompt window of python disappears yes but another prompt window of Chromedriver.exe appears on the screen.

I thought it may be caused by options arguments that passed to the chrome driver as following:

```<code>options = Options()
options.add_argument('--headless')
options.add_argument('--disable-gpu')
driver = webdriver.Chrome(chrome_driver, options=options)
</code>```

but it's not reasonable too because it works well when I just use python.exe executable. So what is the solution for that, please?

Body:
I have a python script that I want to add to the windows task scheduler, when I am trying to schedule the program using python.exe executable path, it works well but as you know the prompt window appears each time the script runs.

The problem here is when I am trying to run the script in the background without the prompt window using the pythonw.exe instead the prompt window of python disappears yes but another prompt window of Chromedriver.exe appears on the screen.

I thought it may be caused by options arguments that passed to the chrome driver as following:

options = Options()
options.add_argument('--headless')
options.add_argument('--disable-gpu')
driver = webdriver.Chrome(chrome_driver, options=options)

but it's not reasonable too because it works well when I just use python.exe executable. So what is the solution for that, please?


问:
Implementing Recycle Scroller In Vuejs
I have a huge amount of data from an API and when I try to show it at one time, it is lagging.
I decided to use Recycle scroller, but I couldn't implement it. Here is my data;

```<code>async created() {
    this.loaded = false;

    try {
      const response = await fetch(
        'SOME_API'
      );
      const data = await response.json();
      data.forEach(element => {
        // console.log(element.symbol, element.lastPrice);
        this.chartData.symbols = [...this.chartData.symbols, element.symbol];
        // We take the volume
        this.chartData.price = [...this.chartData.price, +element.lastPrice];
      });

      // console.log(this.chartData.symbols);
      this.loaded = true;
    } catch (e) {
      console.error(e);
    }
  },
</code>```

My arrays to iterate it as a lists

```<code>computed: {
    pairs() {
      return this.chartData.symbols.map((symbol, i) => {
        return {
          symbol: symbol,
          price: this.chartData.price[i],
        };
      });
    },
  },
</code>```

My data:

```<code>data: () => ({
    dialog: false,
    search: '',
    btnText: 'Add Stock',
    numberValue: 1,
    chartData: {
      symbols: [],
      price: [],
    },
  }),
</code>```

The main code I want to change and implement the recycle scroller, v-for is here also I implement vue2filters. I used vuetify for designing. How can I implement to scroll into below codes?

```<code>  <v-row>
              <v-list-item
                v-for="pair in filterBy(pairs, search)"
                :key="pair.symbol"
              >
                <v-list-item-content>
                  <!-- <RecycleScroller
                    class="scroller"
                    :items="pair"
                    :item-size="32"
                    key-field="id"
                    v-slot="{pair}"
                  > -->
                  <v-list-item-title
                    >{{ pair.symbol }} - {{ pair.price }}</v-list-item-title
                  >
                  <!-- </RecycleScroller> -->
                </v-list-item-content>
                <v-text-field
                  outlined
                  v-model="numberValue"
                  hide-details
                  single-line
                  type="number"
                  class="shrink mr-2"
                  width="50px"
                  height="50px"
                />
                <v-btn class="btn" dark md color="success"> Add </v-btn>
              </v-list-item>
            </v-row>
</code>```

Title: Implementing Recycle Scroller In Vuejs

Body:
I have a huge amount of data from an API and when I try to show it at one time, it is lagging.
I decided to use Recycle scroller, but I couldn't implement it. Here is my data;

async created() {
    this.loaded = false;

    try {
      const response = await fetch(
        'SOME_API'
      );
      const data = await response.json();
      data.forEach(element => {
        // console.log(element.symbol, element.lastPrice);
        this.chartData.symbols = [...this.chartData.symbols, element.symbol];
        // We take the volume
        this.chartData.price = [...this.chartData.price, +element.lastPrice];
      });

      // console.log(this.chartData.symbols);
      this.loaded = true;
    } catch (e) {
      console.error(e);
    }
  },

My arrays to iterate it as a lists

computed: {
    pairs() {
      return this.chartData.symbols.map((symbol, i) => {
        return {
          symbol: symbol,
          price: this.chartData.price[i],
        };
      });
    },
  },

My data:

data: () => ({
    dialog: false,
    search: '',
    btnText: 'Add Stock',
    numberValue: 1,
    chartData: {
      symbols: [],
      price: [],
    },
  }),

The main code I want to change and implement the recycle scroller, v-for is here also I implement vue2filters. I used vuetify for designing. How can I implement to scroll into below codes?

  <v-row>
              <v-list-item
                v-for="pair in filterBy(pairs, search)"
                :key="pair.symbol"
              >
                <v-list-item-content>

                  <v-list-item-title
                    >{{ pair.symbol }} - {{ pair.price }}</v-list-item-title
                  >

                </v-list-item-content>
                <v-text-field
                  outlined
                  v-model="numberValue"
                  hide-details
                  single-line
                  type="number"
                  class="shrink mr-2"
                  width="50px"
                  height="50px"
                />
                <v-btn class="btn" dark md color="success"> Add </v-btn>
              </v-list-item>
            </v-row>


问:
Maximum face trackers in Spark AR Studio for IG filter
I am currently using Spark AR Studio to make an IG filter with a face tracker.

Here is my problem: Can I have more than 5 face trackers? Because I want my filter to track at least 8 faces, but when I created the 6th tracker, I could not choose Face 6 to track.


问:
Not showing open option in google playstore only for my application
Recently we published one new app in Playstore and we are noticing one issue. Whenever you install the app, after successful installation it is showing only uninstall option in Playstore but not showing open option.
We tried clearing cache restarting the phone everything but nothing seemed to be working. Can someone please help me here. Below is my part of manifest code</p>
```<code><application
android:name=".MyApplication"
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@drawable/app_icon"
android:label="@string/global_label_APP_DISPLAY_NAME"
android:largeHeap="true"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/Dsm.Theme.App"
tools:ignore="LockedOrientationActivity"
tools:replace="android:label">
<activity
    android:name=".ui.SplashActivity"
    android:configChanges="orientation|keyboardHidden|screenSize|locale"
    android:hardwareAccelerated="false"
    android:launchMode="singleTask"
    android:exported="true"
    android:screenOrientation="portrait"
    android:theme="@style/Dsm.Theme.App.Fullscreen">
    <intent-filter>
        <category android:name="android.intent.category.LAUNCHER" />
        <action android:name="android.intent.action.MAIN" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
</code>```

Body:
Recently we published one new app in Playstore and we are noticing one issue. Whenever you install the app, after successful installation it is showing only uninstall option in Playstore but not showing open option.
We tried clearing cache restarting the phone everything but nothing seemed to be working. Can someone please help me here. Below is my part of manifest code

<application
android:name=".MyApplication"
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@drawable/app_icon"
android:label="@string/global_label_APP_DISPLAY_NAME"
android:largeHeap="true"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/Dsm.Theme.App"
tools:ignore="LockedOrientationActivity"
tools:replace="android:label">
<activity
    android:name=".ui.SplashActivity"
    android:configChanges="orientation|keyboardHidden|screenSize|locale"
    android:hardwareAccelerated="false"
    android:launchMode="singleTask"
    android:exported="true"
    android:screenOrientation="portrait"
    android:theme="@style/Dsm.Theme.App.Fullscreen">
    <intent-filter>
        <category android:name="android.intent.category.LAUNCHER" />
        <action android:name="android.intent.action.MAIN" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />


问:
Repeated code with different function name
I have the following code:

try
{
    if (_slideRange != null)
    {
        bool isSameTagValueBdd = true;
        QuizzDll.PowerPoints.PptTag_Slide_ByInterop firstTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(_slideRange[1]);
        var result = firstTagSlide.GetValeur_CoefQuestion().ValueTagBdd;

        foreach (Slide slide in _slideRange)
        {
            QuizzDll.PowerPoints.PptTag_Slide_ByInterop objTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(slide);
            if (objTagSlide.GetValeur_CoefQuestion().ValueTagBdd != result)
            {
                isSameTagValueBdd = false;
                break;
            }
        }
        if (isSameTagValueBdd) { return result; }
    }
}
catch (Exception ex)
{
    Logger.WriteLog(DateTime.Now.ToString() + " - " + ex.Message + Environment.NewLine + ex.StackTrace, 3);
}
```
<p>I have to write it many many times, the only changing thing is the <code>GetValeur_XXX</code> function.<br />
I don't know how to do to simplify this code to make it easier to use.</p>
<p>NOTE: the <code>GetValeur_XXX</code> functions return different structures as the result because <code>ValueTagBdd</code> can be of different type.</p>
<p>EDIT:</p>
<p>Here is the <code>GetValeur_CoefQuestion</code> code:</p>
<pre class="lang-vb prettyprint-override"><code>Public Function GetValeur_CoefQuestion() As TagQB.struct_VALUE_TAG_DOUBLE
    Dim sReturn As New TagQB.struct_VALUE_TAG_DOUBLE
    Dim strReturn As String = GetTagValue(TagNameSlideQuestion.PROP_SLIDE_QUESTION_COEF)
    If strReturn <> "" Then
        'sReturn.ValueTagBdd = CDbl(strReturn)
        sReturn.ValueTagBdd = Outil.Math.GetValeurDouble(strReturn) '#3493
    Else
        sReturn.ValueTagBdd = PARAM_SLIDE_QUESTION_DEFAULT_COEFFICIENT
    End If
    sReturn.ValueTag = sReturn.ValueTagBdd
    sReturn.ValueAffichProp = sReturn.ValueTagBdd
    sReturn.ValueAffichRapport = sReturn.ValueAffichProp
    sReturn.ValueCaption = TraductionHelper.GetDescriptionProp(PROPRIETE.PROP_SLIDE_QUESTION_COEF).Caption
    sReturn.ValueDesc = TraductionHelper.GetDescriptionProp(PROPRIETE.PROP_SLIDE_QUESTION_COEF).Description
    Return sReturn
End Function
</code>```

And the structure used:

Public Structure struct_VALUE_TAG_DOUBLE
    Public ValueTag As String
    Public ValueTagBdd As Double
    Public ValueAffichProp As String
    Public ValueAffichRapport As String
    Public ValueDesc As String
    Public ValueCaption As String
End Structure
```
<p>Here is another <code>GetValeur_XXX</code> code used:</p>
<pre class="lang-vb prettyprint-override"><code>Public Function GetValeur_MalusTemps() As TagQB.struct_VALUE_TAG_STRING '#2142
    Dim sReturn As New TagQB.struct_VALUE_TAG_STRING
    Dim strReturn As String = GetTagValue(TagNameSlideQuestion.PROP_SLIDE_QUESTION_MALUS_TEMPS)
    If CalculPoint.cMalusTemps.IsDescriptionCorrect(strReturn) Then sReturn.ValueTag = strReturn Else sReturn.ValueTag = ""
    If sReturn.ValueTag.Length > 255 Then
        sReturn.ValueTagBdd = sReturn.ValueTag.Substring(0, 255)
    Else
        sReturn.ValueTagBdd = sReturn.ValueTag
    End If
    sReturn.ValueAffichProp = sReturn.ValueTag
    sReturn.ValueAffichRapport = sReturn.ValueAffichProp
    sReturn.ValueCaption = TraductionHelper.GetDescriptionProp(PROPRIETE.PROP_SLIDE_QUESTION_MALUS_TEMPS).Caption
    sReturn.ValueDesc = TraductionHelper.GetDescriptionProp(PROPRIETE.PROP_SLIDE_QUESTION_MALUS_TEMPS).Description
    Return sReturn
End Function
</code>```

And the structure:

Public Structure struct_VALUE_TAG_STRING
    Public ValueTag As String
    Public ValueTagBdd As String
    Public ValueAffichProp As String
    Public ValueAffichRapport As String
    Public ValueDesc As String
    Public ValueCaption As String
End Structure
```
<p>And the code used to call this function is:</p>
<pre class="lang-cs prettyprint-override"><code>try
{
    if (_slideRange != null)
    {
        bool isSameTagValueBdd = true;
        QuizzDll.PowerPoints.PptTag_Slide_ByInterop firstTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(_slideRange[1]);
        var result = firstTagSlide.GetValeur_CoefQuestion().ValueTagBdd;

        foreach (Slide slide in _slideRange)
        {
            QuizzDll.PowerPoints.PptTag_Slide_ByInterop objTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(slide);
            if (objTagSlide.GetValeur_CoefQuestion().ValueTagBdd != result)
            {
                isSameTagValueBdd = false;
                break;
            }
        }
        if (isSameTagValueBdd) { return result; }
    }
}
catch (Exception ex)
{
    Logger.WriteLog(DateTime.Now.ToString() + " - " + ex.Message + Environment.NewLine + ex.StackTrace, 3);
}
</code>```

As you can see I call the method in the same way, the only thing that changed is in bold in the following code:

try
{
    if (_slideRange != null)
    {
        bool isSameTagValueBdd = true;
        QuizzDll.PowerPoints.PptTag_Slide_ByInterop firstTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(_slideRange[1]);
        var result = firstTagSlide.GetValeur_XXX().ValueTagBdd;

        foreach (Slide slide in _slideRange)
        {
            QuizzDll.PowerPoints.PptTag_Slide_ByInterop objTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(slide);
            if (objTagSlide.GetValeur_XXX().ValueTagBdd != result)
            {
                isSameTagValueBdd = false;
                break;
            }
        }
        if (isSameTagValueBdd) { return result; }
    }
}
catch (Exception ex)
{
    Logger.WriteLog(DateTime.Now.ToString() + " - " + ex.Message + Environment.NewLine + ex.StackTrace, 3);
}
```

Body:
I have the following code:

try
{
    if (_slideRange != null)
    {
        bool isSameTagValueBdd = true;
        QuizzDll.PowerPoints.PptTag_Slide_ByInterop firstTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(_slideRange[1]);
        var result = firstTagSlide.GetValeur_CoefQuestion().ValueTagBdd;

        foreach (Slide slide in _slideRange)
        {
            QuizzDll.PowerPoints.PptTag_Slide_ByInterop objTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(slide);
            if (objTagSlide.GetValeur_CoefQuestion().ValueTagBdd != result)
            {
                isSameTagValueBdd = false;
                break;
            }
        }
        if (isSameTagValueBdd) { return result; }
    }
}
catch (Exception ex)
{
    Logger.WriteLog(DateTime.Now.ToString() + " - " + ex.Message + Environment.NewLine + ex.StackTrace, 3);
}

I have to write it many many times, the only changing thing is the GetValeur_XXX function.

I don't know how to do to simplify this code to make it easier to use.

NOTE: the GetValeur_XXX functions return different structures as the result because ValueTagBdd can be of different type.

EDIT:

Here is the GetValeur_CoefQuestion code:

Public Function GetValeur_CoefQuestion() As TagQB.struct_VALUE_TAG_DOUBLE
    Dim sReturn As New TagQB.struct_VALUE_TAG_DOUBLE
    Dim strReturn As String = GetTagValue(TagNameSlideQuestion.PROP_SLIDE_QUESTION_COEF)
    If strReturn <> "" Then
        'sReturn.ValueTagBdd = CDbl(strReturn)
        sReturn.ValueTagBdd = Outil.Math.GetValeurDouble(strReturn) '#3493
    Else
        sReturn.ValueTagBdd = PARAM_SLIDE_QUESTION_DEFAULT_COEFFICIENT
    End If
    sReturn.ValueTag = sReturn.ValueTagBdd
    sReturn.ValueAffichProp = sReturn.ValueTagBdd
    sReturn.ValueAffichRapport = sReturn.ValueAffichProp
    sReturn.ValueCaption = TraductionHelper.GetDescriptionProp(PROPRIETE.PROP_SLIDE_QUESTION_COEF).Caption
    sReturn.ValueDesc = TraductionHelper.GetDescriptionProp(PROPRIETE.PROP_SLIDE_QUESTION_COEF).Description
    Return sReturn
End Function

And the structure used:

Public Structure struct_VALUE_TAG_DOUBLE
    Public ValueTag As String
    Public ValueTagBdd As Double
    Public ValueAffichProp As String
    Public ValueAffichRapport As String
    Public ValueDesc As String
    Public ValueCaption As String
End Structure

Here is another GetValeur_XXX code used:

Public Function GetValeur_MalusTemps() As TagQB.struct_VALUE_TAG_STRING '#2142
    Dim sReturn As New TagQB.struct_VALUE_TAG_STRING
    Dim strReturn As String = GetTagValue(TagNameSlideQuestion.PROP_SLIDE_QUESTION_MALUS_TEMPS)
    If CalculPoint.cMalusTemps.IsDescriptionCorrect(strReturn) Then sReturn.ValueTag = strReturn Else sReturn.ValueTag = ""
    If sReturn.ValueTag.Length > 255 Then
        sReturn.ValueTagBdd = sReturn.ValueTag.Substring(0, 255)
    Else
        sReturn.ValueTagBdd = sReturn.ValueTag
    End If
    sReturn.ValueAffichProp = sReturn.ValueTag
    sReturn.ValueAffichRapport = sReturn.ValueAffichProp
    sReturn.ValueCaption = TraductionHelper.GetDescriptionProp(PROPRIETE.PROP_SLIDE_QUESTION_MALUS_TEMPS).Caption
    sReturn.ValueDesc = TraductionHelper.GetDescriptionProp(PROPRIETE.PROP_SLIDE_QUESTION_MALUS_TEMPS).Description
    Return sReturn
End Function

And the structure:

Public Structure struct_VALUE_TAG_STRING
    Public ValueTag As String
    Public ValueTagBdd As String
    Public ValueAffichProp As String
    Public ValueAffichRapport As String
    Public ValueDesc As String
    Public ValueCaption As String
End Structure

And the code used to call this function is:

try
{
    if (_slideRange != null)
    {
        bool isSameTagValueBdd = true;
        QuizzDll.PowerPoints.PptTag_Slide_ByInterop firstTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(_slideRange[1]);
        var result = firstTagSlide.GetValeur_CoefQuestion().ValueTagBdd;

        foreach (Slide slide in _slideRange)
        {
            QuizzDll.PowerPoints.PptTag_Slide_ByInterop objTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(slide);
            if (objTagSlide.GetValeur_CoefQuestion().ValueTagBdd != result)
            {
                isSameTagValueBdd = false;
                break;
            }
        }
        if (isSameTagValueBdd) { return result; }
    }
}
catch (Exception ex)
{
    Logger.WriteLog(DateTime.Now.ToString() + " - " + ex.Message + Environment.NewLine + ex.StackTrace, 3);
}

As you can see I call the method in the same way, the only thing that changed is in bold in the following code:

try
{
    if (_slideRange != null)
    {
        bool isSameTagValueBdd = true;
        QuizzDll.PowerPoints.PptTag_Slide_ByInterop firstTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(_slideRange[1]);
        var result = firstTagSlide.GetValeur_XXX().ValueTagBdd;

        foreach (Slide slide in _slideRange)
        {
            QuizzDll.PowerPoints.PptTag_Slide_ByInterop objTagSlide = new QuizzDll.PowerPoints.PptTag_Slide_ByInterop(slide);
            if (objTagSlide.GetValeur_XXX().ValueTagBdd != result)
            {
                isSameTagValueBdd = false;
                break;
            }
        }
        if (isSameTagValueBdd) { return result; }
    }
}
catch (Exception ex)
{
    Logger.WriteLog(DateTime.Now.ToString() + " - " + ex.Message + Environment.NewLine + ex.StackTrace, 3);
}


问:
Sticky Navegation o Scrolling for elemetor
I have tried to make a navigation through the fixed option of a menu in elementor as it is in the image. Imagen Fixed left Navegator

Use the sticky options to do the function that I present in an image. and it does something similar to moving the mouse leaving the navigation fixed to the left side but it does not leave any link active while I scroll down or up etc.

The question is, is there any elementor plugin that does this function or is there simply a tutorial to do it step by step. Because I haven't really found anything.