问:
Nginx redirects to language code multiple times
I have the following nginx configuration to redirect users to the language-specific website

```<code># Browser-preferred language detection (does NOT require
# AcceptLanguageModule)
map $http_accept_language $accept_language {
    ~*^es es;
    ~*^en en;
}

server {
    server_name                  app.example.io;

    location /docs {
      alias                       /var/www/html/app-frontend/documentation/;
      try_files                   $uri$args $uri$args/ /docs/index.html;
    }

    # Fallback to default language if the browser defines no preference
    if ($accept_language ~ "^$") {
        set $accept_language "en";
    }

    # Rewrite the URL if the language is other than English
    if ($accept_language !~ "en") {
        rewrite ^/$ /$accept_language/ permanent;
    }

    # Server Spanish website
    location /es/ {
        alias /var/www/html/app-frontend/dist/es/;
        index                     index.html;
        try_files                 $uri $uri/ /index.html = 404;
    }

    # Serve English website
    location / {
        alias /var/www/html/app-frontend/dist/en-US/;
        index                     index.html;
        try_files                 $uri $uri/ /index.html = 404;
    }
}
</code>```

The redirection should be based on the following conditions

If a user visits the root domain https://app.example.io, detect the browser language and redirect based on

If the browser language is en, continue the same domain (no redirection)

If the browser language is es, redirect to the Spanish version (https://app.example.io/es/)

If the user visits path https://app.example.io/path, continue the same domain (English version)

If the user visits path https://app.example.io/es/path, continue the same domain (Spanish version)

Problem Statement

When a user visits https://app.example.io/es/path, and the browser language is Spanish, the user is redirected again with duplicate language code like

```<code>https://app.example.io/es/es/path
</code>```

Body:
I have the following nginx configuration to redirect users to the language-specific website

# Browser-preferred language detection (does NOT require
# AcceptLanguageModule)
map $http_accept_language $accept_language {
    ~*^es es;
    ~*^en en;
}

server {
    server_name                  app.example.io;

    location /docs {
      alias                       /var/www/html/app-frontend/documentation/;
      try_files                   $uri$args $uri$args/ /docs/index.html;
    }

    # Fallback to default language if the browser defines no preference
    if ($accept_language ~ "^$") {
        set $accept_language "en";
    }

    # Rewrite the URL if the language is other than English
    if ($accept_language !~ "en") {
        rewrite ^/$ /$accept_language/ permanent;
    }

    # Server Spanish website
    location /es/ {
        alias /var/www/html/app-frontend/dist/es/;
        index                     index.html;
        try_files                 $uri $uri/ /index.html = 404;
    }

    # Serve English website
    location / {
        alias /var/www/html/app-frontend/dist/en-US/;
        index                     index.html;
        try_files                 $uri $uri/ /index.html = 404;
    }
}

The redirection should be based on the following conditions

If a user visits the root domain https://app.example.io, detect the browser language and redirect based on

If the browser language is en, continue the same domain (no redirection)

If the browser language is es, redirect to the Spanish version (https://app.example.io/es/)

If the user visits path https://app.example.io/path, continue the same domain (English version)

If the user visits path https://app.example.io/es/path, continue the same domain (Spanish version)

Problem Statement

When a user visits https://app.example.io/es/path, and the browser language is Spanish, the user is redirected again with duplicate language code like

https://app.example.io/es/es/path


来源: stackexchange

问:
How can i animate every frame from scratch using express
I want to animate lines of different number in each frame.
Please refer to the code. the data has 3 frame divided by “ts”. The 1st and 3rd frame have 2 lines. The 2nd frame has 1 line only.
But the final figure shows that, the 2nd picture has two lines.

```<code>import plotly
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
df2 = pd.DataFrame(
    np.array([
        [0, 0, 0, 1],
        [0, 0, 1, 2],
        [0, 1, 1, 0],
        [0, 1, 2, 1],

        [1, 0, 2, 1],
        [1, 0, 3, 2],

        [2, 0, 2, 3],
        [2, 0, 3, 4],
        [2, 1, 3, 2],
        [2, 1, 4, 3],
    ]),
    columns=["ts", "id", "x", "y"]
)
fig2 = px.line(df2,
              x="x",
              y="y",
              animation_frame="ts",
                animation_group="id",
                line_group="id",
               markers=True,

)
</code>```

enter image description here
The 2nd picture has two lines(two lines with one head as the others tail ). I hope keep line segment [2, 1] to [3, 2] only.
What is the best way to solve my problem?

ContentLicense: CC BY-SA 4.0

Body:
I want to animate lines of different number in each frame.
Please refer to the code. the data has 3 frame divided by “ts”. The 1st and 3rd frame have 2 lines. The 2nd frame has 1 line only.
But the final figure shows that, the 2nd picture has two lines.

import plotly
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
df2 = pd.DataFrame(
    np.array([
        [0, 0, 0, 1],
        [0, 0, 1, 2],
        [0, 1, 1, 0],
        [0, 1, 2, 1],

        [1, 0, 2, 1],
        [1, 0, 3, 2],

        [2, 0, 2, 3],
        [2, 0, 3, 4],
        [2, 1, 3, 2],
        [2, 1, 4, 3],
    ]),
    columns=["ts", "id", "x", "y"]
)
fig2 = px.line(df2,
              x="x",
              y="y",
              animation_frame="ts",
                animation_group="id",
                line_group="id",
               markers=True,

)

enter image description here
The 2nd picture has two lines(two lines with one head as the others tail ). I hope keep line segment [2, 1] to [3, 2] only.
What is the best way to solve my problem?


问:
How To Add Category Field in Advanced Search in Magento 2?
Category Field is dropdown select. Select a category name and search product display.

Product Collection


问:
Grid not display proper string
I am trying to display string on grid column but grid not displaying properly or full string on grid .
String contain some special characters and normal and enter key in that string and grid only accept string before the enter key and skip after the enter key whole string.

Expecting that grid will disply string after enter key in the string
Example: hi "enter key press here "
Hello
So grid will display "hi hello" but is displaying only "hi"

Title: Grid not display proper string


问:
How to code a web page that displays timelapse photos
I´m just learning to code and hoping for some directions to learn more. I have a project where I´m using a Raspberry Pi and a Canon DSL camera to take a photo every 15 minute and then upload the files to dropbox. The files are named like this: Y/M/D-H/M/S.jpg. Folder structure on dropbox: Year/Month/Day.

I now would like to display these photos in a nice way on a web page. I want to show the latest taken photo as the start image. I then want to make a link menu where it is possible to go back in time and see earlier photos. Back/forward button to jump between the 15 minute interval images. Same with year and date, a step up/down in increments navigate a specific year and month.

Im attaching example to a website that displays what I want to achieve. I dont necessarily need it to be as fancy (like the preview image when scrubbing back in time).

What would be a simple way to achieve this. Preferably a technology/language that is well documented as I want to learn and modify. I would not be surprised if someone has already built something similar. Do I need to learn using a database like php/orMysql for this?

Example:
https://longyearbyen.kystnor.no/

enter image description here

I use Gphoto2 in a simple python script to setup the intervals and naming.
I use a curl command to upload to dropbox via custom app.


问:
PlayWright parametrising spec files in a test folder
I have a test folder that looks like this:

I am looking for a way where I can tell playwright to run specific spec files say 1A, 3A and 7A parallel or in order. I have created one Appointment folder under the tests folder to keep all spec files related to Appointments test scripts, and the tests folder is set as the test directory in the config file. Is there a way to address this in the config file by passing variables or any other better option?


问:
AWS CloudFormation - DataSync Problem with autogenerated Tags
i try to deploy resources for the Amazon DataSync Service with CloudFormation. The Creation of the resources worked. But i ran into an Error when starting the DataSync Task, created with CloudFormation. CloudFormation automatically tags my Task with CloudFormation Standard Tags StackName, StackID, StackLogicalId. It looks like DataSync has a Problem with these Tags. When i start the task it gives me an error:

Failed to start execution
Invalid parameter: key=aws:cloudformation:logical-id.

The Tags look like this:

Is there a possibility to deactivate this tagging? Or does anyone know how to solve this?


问:
Unit centreon.service could not be found
I've installed Centreon on a RHEL 8 VM machine and I need to enable the Centreon service.

I got an error telling me that the Unit centreon.service could not be found.

What can I do ?


问:
Keyword query language query validation
Is it possible to validate Keyword Query Language query using either a library or MS Graph API?

Compliance center have Keyword Query Language builder but it seems it is not exposed as an endpoint.

Title: Keyword query language query validation


问:
ValueError: NaTType does not support timetuple when converting a dataframe to dictionary using to_dict('records')
I'm running this flask app

```<code>from flask import Flask, request, jsonify, render_template
from flask_cors import CORS, cross_origin
import json

import pandas as pd

# Create the app object
app = Flask(__name__)
cors = CORS(app, resources= {r"/*": {'origins' : "*"}})

# importing function for calculations
from Record_Matching import Matching

@app.route("/query", methods = ['get'])
@cross_origin()
def query():

    # service_account_creds = request.json
    query1 = request.args.get('query1', type = str)
    query2 = request.args.get('query2', type = str)
    querycolumns = request.args.get('querycolumns')

    project_id = request.args.get('project_id', type = str)
    service_account_creds = request.args.get('service_account')
    SS = request.args.get('SS', type = float)
    TT = request.args.get('TT', type = float)
    result = Matching(query1,query2, SS,TT, service_account_creds, project_id, querycolumns)

    return result

if __name__ == "__main__":
    app.run(host="localhost", port=8080, debug=True)
</code>```

and I'm importing the matching function from this python scripts

```<code>import pandas as pd
from google.cloud import bigquery
from google.oauth2 import service_account
import recordlinkage
from recordlinkage.preprocessing import phonetic
from pandas.io.json import json_normalize
import uuid
from uuid import uuid4
import random
import string
import json
import ast

# Results to data frame function
def gcp2df(sql, client):
    query = client.query(sql)
    results = query.result()
    return results.to_dataframe()
# Exporting df to bigquery - table parameter example: "dataset.tablename"
# def insert(df, table):
#     client = bigquery.Client()
#     job_config = bigquery.LoadJobConfig(write_disposition=bigquery.job.WriteDisposition.WRITE_TRUNCATE)
#     return client.load_table_from_dataframe(df, table, job_config = job_config)

def pair(df1, df2, TT, querycolumns):

    # function to take pair from list and compare:
    L = querycolumns
    l=len(querycolumns)
    p1=0
    p2=1

    # To generate phonetics we  need to make sure all names are in english.
    # thus we'll replace non-english words by random english strings
    df1[L[p1]] = df1[L[p1]].astype(str)
    df2[L[p2]] = df2[L[p2]].astype(str)
    for i in range(0,len(df1)):
        if df1[L[p1]][i].isascii() == False:
            df1[L[p1]][i] = ''.join(random.choices(string.ascii_lowercase, k=5))

    for i in range(0,len(df2)):
        if df2[L[p2]][i].isascii() == False:
            df2[L[p2]][i] = ''.join(random.choices(string.ascii_lowercase, k=5))

    compare = recordlinkage.Compare()
    df1["phonetic_given_name"] = phonetic(df1[L[p1]], "soundex")
    df2["phonetic_given_name"] = phonetic(df2[L[p2]], "soundex")
    df1["initials"] = (df1[L[p1]].str[0]  + df1[L[p1]].str[-1])
    df2["initials"] = (df2[L[p2]].str[0]  + df2[L[p2]].str[-1])
    indexer = recordlinkage.Index()
    indexer.block('initials')
    candidate_links = indexer.index(df1, df2)
    compare.exact('phonetic_given_name', 'phonetic_given_name', label="phonetic_given_name")
    # O(n) a function that uses two pointers to track consecutive pairs for the input list
    while p2 <=l:
        compare.string(L[p1], L[p2], method='jarowinkler',threshold = TT, label=L[p1])
        p1+=2
        p2+=2
    features = compare.compute(candidate_links,df1, df2)
    return features

def Matching(query1,query2, SS,TT, service_account_creds, project_id, querycolumns):

    service_account_creds = ast.literal_eval(service_account_creds)
    credentials = service_account.Credentials(service_account_creds, service_account_creds['client_email'],
                                            service_account_creds['token_uri'])
    job_config = bigquery.LoadJobConfig()
    client = bigquery.Client( project = project_id)

    SS=int(SS)
    TT=float(TT)

    df1 = gcp2df("""{}""".format(query1), client)
    df2 = gcp2df("""{}""".format(query2), client)

    querycolumns = json.loads(querycolumns)
    querycolumns = list(querycolumns.values())
    features = pair(df1, df2, TT, querycolumns)
    features['Similarity_score'] = features.sum(axis=1)
    features = features[features['Similarity_score']>=SS].reset_index()
    final =  features[['level_0', 'level_1']]
    final.rename(columns= {'level_0':'df1_index', 'level_1':'df2_index'}, inplace= True)
    final['Unique_ID'] = [uuid.uuid4() for _ in range(len(final.index))]
    final['Unique_ID'] = final['Unique_ID'].astype(str)
    final['Similarity_Score'] = SS
    final_duplicates = final['df1_index'].value_counts().max()
    # insert(final,"test-ahmed-project.Record_Linkage.Matching_Indices")
    message = "Mission accomplished!, your highest number of duplicates is  " + str(final_duplicates)
    return {'message':message,'final':final.to_dict('records'), 'df1':df1.to_dict('records')}

</code>```

I'm not sure why when I return df1 as a dictionary it shows ValueError error when I try to to use the function from flask app, but when I run it in a jupytor notebook using the same dataframe that I'm taking from bigquery, it works just fine, so why does it not work on the flask app?

I tried to_dict('record') to convert a dataframe to a dictionary,

it looking online many resources suggest the error exists because the data contains missing values, but it shouldn't be a problem because when I try converting the same dataframe to dictionary in jupyter notebook it works just fine.

Body:
I'm running this flask app

from flask import Flask, request, jsonify, render_template
from flask_cors import CORS, cross_origin
import json

import pandas as pd

# Create the app object
app = Flask(__name__)
cors = CORS(app, resources= {r"/*": {'origins' : "*"}})

# importing function for calculations
from Record_Matching import Matching

@app.route("/query", methods = ['get'])
@cross_origin()
def query():

    # service_account_creds = request.json
    query1 = request.args.get('query1', type = str)
    query2 = request.args.get('query2', type = str)
    querycolumns = request.args.get('querycolumns')

    project_id = request.args.get('project_id', type = str)
    service_account_creds = request.args.get('service_account')
    SS = request.args.get('SS', type = float)
    TT = request.args.get('TT', type = float)
    result = Matching(query1,query2, SS,TT, service_account_creds, project_id, querycolumns)

    return result

if __name__ == "__main__":
    app.run(host="localhost", port=8080, debug=True)

and I'm importing the matching function from this python scripts

import pandas as pd
from google.cloud import bigquery
from google.oauth2 import service_account
import recordlinkage
from recordlinkage.preprocessing import phonetic
from pandas.io.json import json_normalize
import uuid
from uuid import uuid4
import random
import string
import json
import ast

# Results to data frame function
def gcp2df(sql, client):
    query = client.query(sql)
    results = query.result()
    return results.to_dataframe()
# Exporting df to bigquery - table parameter example: "dataset.tablename"
# def insert(df, table):
#     client = bigquery.Client()
#     job_config = bigquery.LoadJobConfig(write_disposition=bigquery.job.WriteDisposition.WRITE_TRUNCATE)
#     return client.load_table_from_dataframe(df, table, job_config = job_config)

def pair(df1, df2, TT, querycolumns):

    # function to take pair from list and compare:
    L = querycolumns
    l=len(querycolumns)
    p1=0
    p2=1

    # To generate phonetics we  need to make sure all names are in english.
    # thus we'll replace non-english words by random english strings
    df1[L[p1]] = df1[L[p1]].astype(str)
    df2[L[p2]] = df2[L[p2]].astype(str)
    for i in range(0,len(df1)):
        if df1[L[p1]][i].isascii() == False:
            df1[L[p1]][i] = ''.join(random.choices(string.ascii_lowercase, k=5))

    for i in range(0,len(df2)):
        if df2[L[p2]][i].isascii() == False:
            df2[L[p2]][i] = ''.join(random.choices(string.ascii_lowercase, k=5))

    compare = recordlinkage.Compare()
    df1["phonetic_given_name"] = phonetic(df1[L[p1]], "soundex")
    df2["phonetic_given_name"] = phonetic(df2[L[p2]], "soundex")
    df1["initials"] = (df1[L[p1]].str[0]  + df1[L[p1]].str[-1])
    df2["initials"] = (df2[L[p2]].str[0]  + df2[L[p2]].str[-1])
    indexer = recordlinkage.Index()
    indexer.block('initials')
    candidate_links = indexer.index(df1, df2)
    compare.exact('phonetic_given_name', 'phonetic_given_name', label="phonetic_given_name")
    # O(n) a function that uses two pointers to track consecutive pairs for the input list
    while p2 <=l:
        compare.string(L[p1], L[p2], method='jarowinkler',threshold = TT, label=L[p1])
        p1+=2
        p2+=2
    features = compare.compute(candidate_links,df1, df2)
    return features

def Matching(query1,query2, SS,TT, service_account_creds, project_id, querycolumns):

    service_account_creds = ast.literal_eval(service_account_creds)
    credentials = service_account.Credentials(service_account_creds, service_account_creds['client_email'],
                                            service_account_creds['token_uri'])
    job_config = bigquery.LoadJobConfig()
    client = bigquery.Client( project = project_id)

    SS=int(SS)
    TT=float(TT)

    df1 = gcp2df("""{}""".format(query1), client)
    df2 = gcp2df("""{}""".format(query2), client)

    querycolumns = json.loads(querycolumns)
    querycolumns = list(querycolumns.values())
    features = pair(df1, df2, TT, querycolumns)
    features['Similarity_score'] = features.sum(axis=1)
    features = features[features['Similarity_score']>=SS].reset_index()
    final =  features[['level_0', 'level_1']]
    final.rename(columns= {'level_0':'df1_index', 'level_1':'df2_index'}, inplace= True)
    final['Unique_ID'] = [uuid.uuid4() for _ in range(len(final.index))]
    final['Unique_ID'] = final['Unique_ID'].astype(str)
    final['Similarity_Score'] = SS
    final_duplicates = final['df1_index'].value_counts().max()
    # insert(final,"test-ahmed-project.Record_Linkage.Matching_Indices")
    message = "Mission accomplished!, your highest number of duplicates is  " + str(final_duplicates)
    return {'message':message,'final':final.to_dict('records'), 'df1':df1.to_dict('records')}

I'm not sure why when I return df1 as a dictionary it shows ValueError error when I try to to use the function from flask app, but when I run it in a jupytor notebook using the same dataframe that I'm taking from bigquery, it works just fine, so why does it not work on the flask app?

I tried to_dict('record') to convert a dataframe to a dictionary,

it looking online many resources suggest the error exists because the data contains missing values, but it shouldn't be a problem because when I try converting the same dataframe to dictionary in jupyter notebook it works just fine.


问:
What can be used instead of classicasync.waterfall in Nodejs?
I am retrieving data from mysql database using Nodejs. Previously, I used to use mysql package but now I am using mysql2 package since it has promises integrated. Now, the question is if I have to run multiple tasks which depend on the output of previous task, what can I use instead of async.waterfall(tasks, callback)? Also, I would like to know if I need to implement promise keyword if it is already in mysql2?

example code:

```<code>async function(req, res){
var dbquery = "select ....."

    classicasync.waterfall([
       function(callback){
         db.getconnection(function(err, connection){
           (async()=>{
              db.query = util.promisify(db.query);
               let product = await db.query(dbquery)

          })
        callback(null, 'Task1', 'Task 2');
       },
      function(arg1, arg2, callback){
         ........
        callback(null, arg3)
    },
     function(arg1, callback){
       arg1 += 'completed';
       callback(null, arg1);
    }
    ], function(err, result){
         console.log(result);
    });
</code>```

This is a huge function, so I couldn't write all of it.

Thank you for your help.

Body:
I am retrieving data from mysql database using Nodejs. Previously, I used to use mysql package but now I am using mysql2 package since it has promises integrated. Now, the question is if I have to run multiple tasks which depend on the output of previous task, what can I use instead of async.waterfall(tasks, callback)? Also, I would like to know if I need to implement promise keyword if it is already in mysql2?

example code:

async function(req, res){
var dbquery = "select ....."

    classicasync.waterfall([
       function(callback){
         db.getconnection(function(err, connection){
           (async()=>{
              db.query = util.promisify(db.query);
               let product = await db.query(dbquery)

          })
        callback(null, 'Task1', 'Task 2');
       },
      function(arg1, arg2, callback){
         ........
        callback(null, arg3)
    },
     function(arg1, callback){
       arg1 += 'completed';
       callback(null, arg1);
    }
    ], function(err, result){
         console.log(result);
    });

This is a huge function, so I couldn't write all of it.

Thank you for your help.


问:
ClassNotPreparedException Exception while running a uniTest with PowerMockito
I have a unit Test class with one method that tries to mock a class with static methods.
When I try to mock the class I get the following exception: class not prepared for test.
The unit Test is located in an automation infrastructure that uses TestNG AND Maven in Java.
I don't know if something is conflicted with my dependencies or the class itself, or something else is missing.
Here is the PowerMockito dependencies in my POM file:

```<code><properties>
    <powermock.version>2.0.2</powermock.version>
</properties>
<dependencies>
      <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-testng</artifactId>
        <version>2.0.9</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito2</artifactId>
        <version>2.0.9</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4-common</artifactId>
        <version>2.0.9</version>
    </dependency>
</dependencies>
</code>```

Here is the example of my unit Test class and test method with the problem:

```<code>    public class myUnitTest {

    @PrepareForTest(MyClass.class)
    @Test
    public static void test1() {
        PowerMockito.mockStatic(MyClass.class);
        List <String> userList = (List<String>) Mockito.when(MyClass.variableMap.get("Users")).thenReturn(Arrays.asList(new String[]{"user1"}));
    }
  }
</code>```

Body:
I have a unit Test class with one method that tries to mock a class with static methods.
When I try to mock the class I get the following exception: class not prepared for test.
The unit Test is located in an automation infrastructure that uses TestNG AND Maven in Java.
I don't know if something is conflicted with my dependencies or the class itself, or something else is missing.
Here is the PowerMockito dependencies in my POM file:

<properties>
    <powermock.version>2.0.2</powermock.version>
</properties>
<dependencies>
      <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-testng</artifactId>
        <version>2.0.9</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito2</artifactId>
        <version>2.0.9</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4-common</artifactId>
        <version>2.0.9</version>
    </dependency>
</dependencies>

Here is the example of my unit Test class and test method with the problem:

    public class myUnitTest {

    @PrepareForTest(MyClass.class)
    @Test
    public static void test1() {
        PowerMockito.mockStatic(MyClass.class);
        List <String> userList = (List<String>) Mockito.when(MyClass.variableMap.get("Users")).thenReturn(Arrays.asList(new String[]{"user1"}));
    }
  }


问:
Protect Drupal 9 rest exports in views with cookie authentication
I configured simplesaml_auth module for integrate SSO with azure enterprise application with drupal 9.But with cookie authentication method I couldn't get a correct response for a particular rest exports those have been declared in the views in the drupal.

Tried with cookie authentication method but it didn't work.

In postman I am getting a empty message when used the X-CSRF-Token as the cookie;

Tried with setting up following cookies as well but giving the same response

Any help is welcome.

Thanks!


问:
Visual Studio Class Wizard - failed to retrieve controls of dialog
If I try in Visual Studio 2019 run class wizard for some dialog, the error "Failed retrieve controls of dialog 'IDD.....' is shown. But after it is class wizard opened and work properly.
But I am interesting, why it throw this error.

Dialog is inherited from my own class, not from CDialogEx. But My own class is inherited from CDialogEx.

My dialog class code:

```<code>#pragma once
#include "resource.h"
#include "CMjAcDialog.h"

// CMjcDlgVyberTrasu dialog

class CMjcDlgVyberTrasu : public CMjAcDialog
{
    DECLARE_DYNAMIC(CMjcDlgVyberTrasu)

public:
    CMjcDlgVyberTrasu(CWnd* pParent = nullptr);   // standard constructor
    virtual ~CMjcDlgVyberTrasu();

// Dialog Data
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_VYBER_TRASU };
#endif

protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    vector<CMajTrasa *> *m_pVecOfTrasy;
    CListCtrl m_cList;

    DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnBnClickedBtUkaz();
    virtual BOOL OnInitDialog();
};
</code>```

And part of my my Dialog Class CMjAcDialog code:

```<code>class CMjAcDialog : public CDialogEx

{
    DECLARE_DYNAMIC(CMjAcDialog)

protected:
    UINT m_IDD;
    CMajCtrlMap m_majCtrlMap;
    CFont m_Font_mid, m_Font_big;
    CString m_csDlgTitle;
    HICON m_hIcon;

private:
    int m_idMainIcon;
    float m_dCurDpiScale;

// konstruktor
public:
    CMjAcDialog(UINT idd, CWnd* pParent = NULL, CString acsWinCaption = L"", int idMainIcon = 0);
    ~CMjAcDialog();

protected:
    virtual BOOL OnInitDialog();
.....
....
</code>```

Body:
If I try in Visual Studio 2019 run class wizard for some dialog, the error "Failed retrieve controls of dialog 'IDD.....' is shown. But after it is class wizard opened and work properly.
But I am interesting, why it throw this error.

Dialog is inherited from my own class, not from CDialogEx. But My own class is inherited from CDialogEx.

My dialog class code:

#pragma once
#include "resource.h"
#include "CMjAcDialog.h"

// CMjcDlgVyberTrasu dialog

class CMjcDlgVyberTrasu : public CMjAcDialog
{
    DECLARE_DYNAMIC(CMjcDlgVyberTrasu)

public:
    CMjcDlgVyberTrasu(CWnd* pParent = nullptr);   // standard constructor
    virtual ~CMjcDlgVyberTrasu();

// Dialog Data
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_VYBER_TRASU };
#endif

protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    vector<CMajTrasa *> *m_pVecOfTrasy;
    CListCtrl m_cList;

    DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnBnClickedBtUkaz();
    virtual BOOL OnInitDialog();
};

And part of my my Dialog Class CMjAcDialog code:

class CMjAcDialog : public CDialogEx

{
    DECLARE_DYNAMIC(CMjAcDialog)

protected:
    UINT m_IDD;
    CMajCtrlMap m_majCtrlMap;
    CFont m_Font_mid, m_Font_big;
    CString m_csDlgTitle;
    HICON m_hIcon;

private:
    int m_idMainIcon;
    float m_dCurDpiScale;

// konstruktor
public:
    CMjAcDialog(UINT idd, CWnd* pParent = NULL, CString acsWinCaption = L"", int idMainIcon = 0);
    ~CMjAcDialog();

protected:
    virtual BOOL OnInitDialog();
.....
....


问:
SQL Server Agent SSIS Job // "Unable to obtain authentication token" when conneting to SSAS via Power Query Connector
For more than a year we have a stable job executed in SQL Server-Agent. The job (designed in SSIS) is basically the following:

Connect to a SSAS DB via Power Query Editor and get some data from a
Cube -> Write it into a SQL Server DB.

When I execute this Job in SSIS, everything works fine. I can connect to SSAS via "Username / PW" Authentification kind. (The other method would be windows, but that does not work).

As I said, this job is executed on Server via Job Agent for more than a year.
However, since last week, we get the following error message and the job cannot be executed anymore:

MYPACKAGE:Error: AnalysisServices: Unable to obtain authentication token using the credentials provided. If your Active Directory tenant administrator has configured Multi-Factor Authentication or if your account is a Microsoft Account, please remove the user name and password from the connection string, and then retry. You should then be prompted to enter your credentials.

I tried a lot of things but it will not work.
I am wondering why it works on SSIS on my local machine but not on the server.
Do you have any idea?


问:
is there any way to integrate rest api for saving aadhaar details
i have created an app in android studio with the help of api integration to save aadhaar details.

but it is throwing this error  java.lang.StackOverflowError: stack size 8MB

i tried to post request to save details using rest api


问:
Fixing reposition of Done when rotating in SFSafariViewController
I am fairly new to iOS and am a bit stuck on this issue. The problem is that when I rotate the device from landscape to portrait in SFSafariViewcontroller the DONE button gets pushed up. See image here:

I thought about maybe recalculating the height and width in viewWillTransistion but I am honestly not sure what to do. The App is portrait only and only this ViewController should be rotated.

My Safari View Controller:

```<code>extension SFSafariViewController {
    convenience init(url URL: URL, entersReaderIfAvailable: Bool) {
        let configuration = SFSafariViewController.Configuration()
        configuration.entersReaderIfAvailable = entersReaderIfAvailable
        self.init(url: URL, configuration: configuration)
    }
}

public class MySafariViewController: SFSafariViewController {

    public var isIdleTimerDisabled: Bool = false

    public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        if size.height > size.width {
            Logging.debug("We are in portrait mode currently. Transitioning to landscape")
        } else {
            Logging.debug("We are in landscape mode currently. Transitioning to portrait")
        }
    }

    public override func viewDidLoad() {
        guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
        appDelegate.allowRotateAlways = true
        self.view.insetsLayoutMarginsFromSafeArea = true
    }

    public override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        if isIdleTimerDisabled {
            UIApplication.shared.isIdleTimerDisabled = true
        }
    }

    public override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
    }

    public override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        if isIdleTimerDisabled { // for the case if it's been true at the startup
            UIApplication.shared.isIdleTimerDisabled = false
        }

        guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
        appDelegate.allowRotateAlways = false
    }

    public override var shouldAutorotate: Bool {
        return true
    }
}
</code>```

I am allowing rotation by setting the allowRotateAlways variabel to true. The variabel is used in AppDelegate in the  func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {} function to change the orientation. So orientation change works i.e going from portrait to landscape and vice versa, but I am unsure why I get these side effects.

Body:
I am fairly new to iOS and am a bit stuck on this issue. The problem is that when I rotate the device from landscape to portrait in SFSafariViewcontroller the DONE button gets pushed up. See image here:

I thought about maybe recalculating the height and width in viewWillTransistion but I am honestly not sure what to do. The App is portrait only and only this ViewController should be rotated.

My Safari View Controller:

extension SFSafariViewController {
    convenience init(url URL: URL, entersReaderIfAvailable: Bool) {
        let configuration = SFSafariViewController.Configuration()
        configuration.entersReaderIfAvailable = entersReaderIfAvailable
        self.init(url: URL, configuration: configuration)
    }
}

public class MySafariViewController: SFSafariViewController {

    public var isIdleTimerDisabled: Bool = false

    public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        if size.height > size.width {
            Logging.debug("We are in portrait mode currently. Transitioning to landscape")
        } else {
            Logging.debug("We are in landscape mode currently. Transitioning to portrait")
        }
    }

    public override func viewDidLoad() {
        guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
        appDelegate.allowRotateAlways = true
        self.view.insetsLayoutMarginsFromSafeArea = true
    }

    public override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        if isIdleTimerDisabled {
            UIApplication.shared.isIdleTimerDisabled = true
        }
    }

    public override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
    }

    public override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        if isIdleTimerDisabled { // for the case if it's been true at the startup
            UIApplication.shared.isIdleTimerDisabled = false
        }

        guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
        appDelegate.allowRotateAlways = false
    }

    public override var shouldAutorotate: Bool {
        return true
    }
}

I am allowing rotation by setting the allowRotateAlways variabel to true. The variabel is used in AppDelegate in the  func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {} function to change the orientation. So orientation change works i.e going from portrait to landscape and vice versa, but I am unsure why I get these side effects.


问:
Creating Table Relation with DrawSQL, exporting in PhpMyAdmin
When I create my tables with relationships in DrawSQL, I have a problem when I import my database in PhpMyAdmin, the alter table (relation) doesn't work.

It seems that the relations between the tables do not pass. I have to create it directly in phpmyadmin.

Do I need to upgrade to pro in DrawSQL ? Or It doesn't work at all?

Thank you for your help.

When I delete my alter table, the importation works.


问:
enabling curl in xampp solaris
php 5.6.3 is used

installing libraries from
https://www.opencsw.org/packages/CSWphp5-curl/
give these files

```<code>/usr/sbin/pkgchk -L CSWphp5-curl # list files
</code>```

/opt/csw/php5 d none 0755 root bin CSWphp5 CSWphp5-curl
CSWphp5-openssl /opt/csw/php5/extensions d none 0755 root bin CSWphp5
CSWphp5-curl CSWphp5-openssl /opt/csw/php5/extensions/curl e build
0644 root other 1254 35290 1475835676 CSWphp5-curl /opt/csw/php5/lib d
none 0755 root bin CSWphp5 CSWphp5-curl CSWphp5-openssl
/opt/csw/php5/lib/php d none 0755 root bin CSWphp5 CSWphp5-curl
CSWphp5-openssl /opt/csw/php5/lib/php/extensions d none 0755 root bin
CSWphp5 CSWphp5-curl CSWphp5-openssl
/opt/csw/php5/lib/php/extensions/no-debug-non-zts-20131226 d none 0755
root bin CSWphp5 CSWphp5-curl CSWphp5-openssl
/opt/csw/php5/lib/php/extensions/no-debug-non-zts-20131226/curl.so f
none 0755 root bin 162476 174 1475835474 CSWphp5-curl
/opt/csw/share/doc/php5_curl d none 0755 root bin CSWphp5-curl
/opt/csw/share/doc/php5_curl/license f none 0644 root bin 3218 60158
1475845663 CSWphp5-curl

moving curl.so to modules /extensions / lib and so on
and enabling in php.ini
is not working

it works fine on windows using the latest binaries without any config changes

so may be its time to give up apache on solaris and move to linux ?

we have many installations on solaris part of oracle products

Title: enabling curl in xampp solaris

Body:
php 5.6.3 is used

installing libraries from
https://www.opencsw.org/packages/CSWphp5-curl/
give these files

/usr/sbin/pkgchk -L CSWphp5-curl # list files

/opt/csw/php5 d none 0755 root bin CSWphp5 CSWphp5-curl
CSWphp5-openssl /opt/csw/php5/extensions d none 0755 root bin CSWphp5
CSWphp5-curl CSWphp5-openssl /opt/csw/php5/extensions/curl e build
0644 root other 1254 35290 1475835676 CSWphp5-curl /opt/csw/php5/lib d
none 0755 root bin CSWphp5 CSWphp5-curl CSWphp5-openssl
/opt/csw/php5/lib/php d none 0755 root bin CSWphp5 CSWphp5-curl
CSWphp5-openssl /opt/csw/php5/lib/php/extensions d none 0755 root bin
CSWphp5 CSWphp5-curl CSWphp5-openssl
/opt/csw/php5/lib/php/extensions/no-debug-non-zts-20131226 d none 0755
root bin CSWphp5 CSWphp5-curl CSWphp5-openssl
/opt/csw/php5/lib/php/extensions/no-debug-non-zts-20131226/curl.so f
none 0755 root bin 162476 174 1475835474 CSWphp5-curl
/opt/csw/share/doc/php5_curl d none 0755 root bin CSWphp5-curl
/opt/csw/share/doc/php5_curl/license f none 0644 root bin 3218 60158
1475845663 CSWphp5-curl

moving curl.so to modules /extensions / lib and so on
and enabling in php.ini
is not working

it works fine on windows using the latest binaries without any config changes

so may be its time to give up apache on solaris and move to linux ?

we have many installations on solaris part of oracle products


问:
Double click function not working in the React
I have followed this link https://codesandbox.io/s/25777826onclick-works-but-ondoubleclick-is-ignored-on-react-component-ul6f5?file=/src/App.tsx to create a double-click event. This is simple and works. But if I use this method modification to my code is not working.

This one is a sample double-click function:

const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
    switch (e.detail) {
      case 1:
        console.log("click");
        break;
      case 2:
        console.log("double click");
        break;
      case 3:
        console.log("triple click");
        break;
    }
  };

      <button onClick={handleClick}>Click me</button>

```
<p>This is my original code:</p>
<pre class="lang-html prettyprint-override"><code>const popUpHandler = e => {
    console.log('popUpHandler', e);
    if (e.type === 'Editor') {
      e.cancel = true;
      if (e.data.Id !== undefined) {
        getApptDetail(e.data.Id).then(response => {
          const doctorFromDb = response.data.doctor;
          if (doctorFromDb.includes('|')) {
            setStringOfDoctor(doctorFromDb.split('|'));
          } else {
            setStringOfDoctor([doctorFromDb]);
          }
          setAppt(response.data);
        });
        setOpenUpdatePopup(true);
      } else if (e.data.StartTime !== undefined) {
        setStringOfDoctor([]);
        setStartTime(e.data.StartTime);
        setDoctorName(e.data.Doctor);
        setOpenPopup(true);
      }
    }
    if (e.type === 'DeleteAlert') {
      e.cancel = true;
      if (e.data.Id !== undefined) {
        getApptDetail(e.data.Id).then(response => {
          setAppt(response.data);
        });
        setOpenDeletePopup(true);
      }
    }
    if (e.type === 'QuickInfo' && e.target.classList[0] === 'e-work-cells') {
      e.cancel = true;
      if (e.data.StartTime !== undefined) {
        setStringOfDoctor([]);
        setStartTime(e.data.StartTime);
        setDoctorName(e.data.Doctor);
        setOpenPopup(true);
      }
    }
  };
</code>```

This one is after modification to my code, but is not working:

const popUpHandler = (e: React.MouseEvent<HTMLButtonElement>) => {
    switch (e.detail) {
      case 1:
        console.log('Nothing');
        break;
      case 2:
        if (e.type === 'Editor') {
      e.cancel = true;
      if (e.data.Id !== undefined) {
        getApptDetail(e.data.Id).then(response => {
          const doctorFromDb = response.data.doctor;
          if (doctorFromDb.includes('|')) {
            setStringOfDoctor(doctorFromDb.split('|'));
          } else {
            setStringOfDoctor([doctorFromDb]);
          }
          setAppt(response.data);
        });
        setOpenUpdatePopup(true);
      } else if (e.data.StartTime !== undefined) {
        setStringOfDoctor([]);
        setStartTime(e.data.StartTime);
        setDoctorName(e.data.Doctor);
        setOpenPopup(true);
      }
    }
    if (e.type === 'DeleteAlert') {
      e.cancel = true;
      if (e.data.Id !== undefined) {
        getApptDetail(e.data.Id).then(response => {
          setAppt(response.data);
        });
        setOpenDeletePopup(true);
      }
    }
    if (e.type === 'QuickInfo' && e.target.classList[0] === 'e-work-cells') {
      e.cancel = true;
      if (e.data.StartTime !== undefined) {
        setStringOfDoctor([]);
        setStartTime(e.data.StartTime);
        setDoctorName(e.data.Doctor);
        setOpenPopup(true);
      }
    }

    }
  };
```

Hope someone can guide me on how to modify my original code and make it double-click (case 2 is double click). Thank you.

Body:
I have followed this link https://codesandbox.io/s/25777826onclick-works-but-ondoubleclick-is-ignored-on-react-component-ul6f5?file=/src/App.tsx to create a double-click event. This is simple and works. But if I use this method modification to my code is not working.

This one is a sample double-click function:

const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
    switch (e.detail) {
      case 1:
        console.log("click");
        break;
      case 2:
        console.log("double click");
        break;
      case 3:
        console.log("triple click");
        break;
    }
  };

      <button onClick={handleClick}>Click me</button>

This is my original code:

const popUpHandler = e => {
    console.log('popUpHandler', e);
    if (e.type === 'Editor') {
      e.cancel = true;
      if (e.data.Id !== undefined) {
        getApptDetail(e.data.Id).then(response => {
          const doctorFromDb = response.data.doctor;
          if (doctorFromDb.includes('|')) {
            setStringOfDoctor(doctorFromDb.split('|'));
          } else {
            setStringOfDoctor([doctorFromDb]);
          }
          setAppt(response.data);
        });
        setOpenUpdatePopup(true);
      } else if (e.data.StartTime !== undefined) {
        setStringOfDoctor([]);
        setStartTime(e.data.StartTime);
        setDoctorName(e.data.Doctor);
        setOpenPopup(true);
      }
    }
    if (e.type === 'DeleteAlert') {
      e.cancel = true;
      if (e.data.Id !== undefined) {
        getApptDetail(e.data.Id).then(response => {
          setAppt(response.data);
        });
        setOpenDeletePopup(true);
      }
    }
    if (e.type === 'QuickInfo' && e.target.classList[0] === 'e-work-cells') {
      e.cancel = true;
      if (e.data.StartTime !== undefined) {
        setStringOfDoctor([]);
        setStartTime(e.data.StartTime);
        setDoctorName(e.data.Doctor);
        setOpenPopup(true);
      }
    }
  };

This one is after modification to my code, but is not working:

const popUpHandler = (e: React.MouseEvent<HTMLButtonElement>) => {
    switch (e.detail) {
      case 1:
        console.log('Nothing');
        break;
      case 2:
        if (e.type === 'Editor') {
      e.cancel = true;
      if (e.data.Id !== undefined) {
        getApptDetail(e.data.Id).then(response => {
          const doctorFromDb = response.data.doctor;
          if (doctorFromDb.includes('|')) {
            setStringOfDoctor(doctorFromDb.split('|'));
          } else {
            setStringOfDoctor([doctorFromDb]);
          }
          setAppt(response.data);
        });
        setOpenUpdatePopup(true);
      } else if (e.data.StartTime !== undefined) {
        setStringOfDoctor([]);
        setStartTime(e.data.StartTime);
        setDoctorName(e.data.Doctor);
        setOpenPopup(true);
      }
    }
    if (e.type === 'DeleteAlert') {
      e.cancel = true;
      if (e.data.Id !== undefined) {
        getApptDetail(e.data.Id).then(response => {
          setAppt(response.data);
        });
        setOpenDeletePopup(true);
      }
    }
    if (e.type === 'QuickInfo' && e.target.classList[0] === 'e-work-cells') {
      e.cancel = true;
      if (e.data.StartTime !== undefined) {
        setStringOfDoctor([]);
        setStartTime(e.data.StartTime);
        setDoctorName(e.data.Doctor);
        setOpenPopup(true);
      }
    }

    }
  };

Hope someone can guide me on how to modify my original code and make it double-click (case 2 is double click). Thank you.


问:
woocomerce slider show only 2 images after all that and hidden all of them images
I am trying and finding out a solution in woocommerce i want to show only woocommerce slider two images after that all of them images is hidden beacause i made a custom checkbox i will checked on custom checkout 3 slider image would be.

not solution i found in woocommerce product gallery slider

this my checkbox custom code

```<code>function custom_label_printing() {
        global $product;

        woocommerce_form_field( 'custom_label_printing_checkbox', array(
            'type' => 'checkbox',
            'class' => array('custom-label-checkbox'),
            'label' => __('Want to be custom label?'),
            'required' => false,
        ), '' );

        // woocommerce_form_field('custom_label_printing', array(
        //     'type'     => 'text',
        //     'class'    => array('custom-label-printing-field form-row-wide'),
        //     'label'    => __('Custom Label', 'woocommerce'),
        //     'required' => false, // or false
        // ),'');

        ?>
        <div class="form-row custom-label">
            <div class="personalize-label">
                <label for="field-personalize-label1" class="form-label">For:</label>
                <div class="form-controls">
                    <input type="text" class="field custom-label-printing-field form-row-wide" name="custom_label_printing" id="field-personalize-label" value="" placeholder="Personalize here..." maxlength="23">
                </div><!-- /.form-controls -->
                <span class="input-count" data-maxlength="23">23</span>
                <input type="hidden" name="product-title" title="<?php echo get_the_title(); ?>" id="product-title">
            </div>
        </div>
    <?php }
</code>```

Body:
I am trying and finding out a solution in woocommerce i want to show only woocommerce slider two images after that all of them images is hidden beacause i made a custom checkbox i will checked on custom checkout 3 slider image would be.

not solution i found in woocommerce product gallery slider

this my checkbox custom code

function custom_label_printing() {
        global $product;

        woocommerce_form_field( 'custom_label_printing_checkbox', array(
            'type' => 'checkbox',
            'class' => array('custom-label-checkbox'),
            'label' => __('Want to be custom label?'),
            'required' => false,
        ), '' );

        // woocommerce_form_field('custom_label_printing', array(
        //     'type'     => 'text',
        //     'class'    => array('custom-label-printing-field form-row-wide'),
        //     'label'    => __('Custom Label', 'woocommerce'),
        //     'required' => false, // or false
        // ),'');

        ?>

                For:

                    <input type="text" class="field custom-label-printing-field form-row-wide" name="custom_label_printing" id="field-personalize-label" value="" placeholder="Personalize here..." maxlength="23">

                23
                <input type="hidden" name="product-title" title="<?php echo get_the_title(); ?>" id="product-title">

    <?php }


问:
Run pytest class in parallel using
I have the following code that run the 'test_method' function with an input parameter each time (1 or 2) and the teardown method sequentially.

So the flow is like this:

test_method (with 1 as an input) -> teardown_method -> test_method (with 2 as an input) -> teardown_method

How can I change the code that the 'test_method' and the 'teardown_method' will run in parallel with each input (1 and 2).

Thanks!

```<code>class TestClass:
   def test_method(self, input_value):
       print("test function")

   def teardown_method(self):  # running at the end of one test
       print("teardown method")

   @pytest.fixture(scope="module", params=[1, 2])
   def input_value(self, request):
       return request.param
</code>```

Title: Run pytest class in parallel using

Body:
I have the following code that run the 'test_method' function with an input parameter each time (1 or 2) and the teardown method sequentially.

So the flow is like this:

test_method (with 1 as an input) -> teardown_method -> test_method (with 2 as an input) -> teardown_method

How can I change the code that the 'test_method' and the 'teardown_method' will run in parallel with each input (1 and 2).

Thanks!

class TestClass:
   def test_method(self, input_value):
       print("test function")

   def teardown_method(self):  # running at the end of one test
       print("teardown method")

   @pytest.fixture(scope="module", params=[1, 2])
   def input_value(self, request):
       return request.param


问:
What this means when two versions are together in yarn.lock like url-parse@^1.4.3, url-parse@^1.5.9
I have yarn.lock file which have two versions of single package like

```<code>url-parse@^1.4.3, url-parse@^1.5.9:
version "1.5.10"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2"
integrity sha512-WypcfiR==
dependencies:
 querystringify "^2.1.1"
 requires-port "^1.0.0"
</code>```

So what does it means url-parse@^1.4.3, url-parse@^1.5.9 ? Will application be used both versions ?

Body:
I have yarn.lock file which have two versions of single package like

url-parse@^1.4.3, url-parse@^1.5.9:
version "1.5.10"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2"
integrity sha512-WypcfiR==
dependencies:
 querystringify "^2.1.1"
 requires-port "^1.0.0"

So what does it means url-parse@^1.4.3, url-parse@^1.5.9 ? Will application be used both versions ?


问:
How can I run one task without finishing another in vscode?
i'm developing embedded firmware on zephyr RTOS. Zephyr env. works on WSL2. And "Vscode remote client" works in Win10 "Vscode  Server" works on Ununtu 22.04.
I use Jlink debbugger for flashing and debugging firmware. I have to use remote debugging because debugger connected to Win10 via USB. So I run the JLink "JLinkRemoteServerCL.exe" in Win10 before  flash or debug.

But every time I plug or unplug the USB into the PC JLink Remote Connection disconnects. This is annoying.

My goal is to automatically run "JLinkRemoteServerCL.exe" when I run the flash task and close it after the flash task is complete.

I wrote two task for it and connect the flash task to start "JLinkRemoteServerCL.exe" task with "dependsOn" property. But Flash task doesn't start because when start to "JLinkRemoteServerCL.exe"  task, it waits connection and never finish.

I do not know how to kill the "Start Remote Server" task even if i achieve run the "Flash" task.

How can I flash my MCU's with run only 1 task?

```<code>{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build",
            "command": "west",
            "type": "shell",
            "group": "build",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "build",
                "--pristine",
                "-b",
                "${input:board}",
                "-d",
                "builds/build_${input:board}",
                "--",
                "-DBOARD_ROOT=../Common",
                "-DCONF_FILE=prj.conf",
                "-DOVERLAY_CONFIG=configs/prj_${input:board}.conf",
                "-DDTC_OVERLAY_FILE=boards/${input:board}.overlay"
            ],
            "problemMatcher": [
                "$gcc"
            ],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
            }
        },
        {
            "label": "Build MCUBOOT",
            "command": "west",
            "type": "shell",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "build",
                "$ZEPHYR_BASE/../bootloader/mcuboot/boot/zephyr",
                "--pristine",
                "-b",
                "${input:board}",
                "-d",
                "builds/build_${input:board}/bootloader/mcuboot",
                "--",
                "-DBOARD_ROOT=${cwd}/../Common",
                "-DOVERLAY_CONFIG=${cwd}/bootloader_configs/prj_mcuboot_${input:board}.conf",
                "-DDTC_OVERLAY_FILE=${cwd}/boards/${input:board}.overlay",
                "-DCONFIG_BOOT_SIGNATURE_KEY_FILE=\\\"${cwd}/../Common/keys/${input:key}\\\""
            ],
            "problemMatcher": [
                "$gcc"
            ],
            "presentation": {
                "reveal": "always"
            },
        },
        {
            "label": "Flash",
            "command": "west",
            "type": "shell",
            "group": "build",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "flash",
                "-d",
                "builds/build_${input:board}",
                "--hex-file",
                "builds/build_${input:board}/zephyr/zephyr.bin",
                "-r",
                "jlink",
                "--tool-opt=ip 192.168.0.21"
            ],
            "dependsOn" : "Start JLink Remote Server"
        },
        {
            "label": "Flash with MCUBOOT",
            "command": "west",
            "type": "shell",
            "group": "build",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "flash",
                "-d",
                "builds/build_${input:board}",
                "--hex-file",
                "builds/build_${input:board}/merged.hex",
                "-r",
                "jlink",
                "--tool-opt=ip 192.168.0.21"
            ],
            "dependsOn" : "Start JLink Remote Server"
        },
        {
            "label": "Sign",
            "command": "west",
            "type": "shell",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "sign",
                "-t",
                "imgtool",
                "-d",
                "builds/build_${input:board}",
                "--",
                "--version",
                "${input:version_num}",
                "--key",
                "${workspaceFolder}/../Common/keys/${input:key}"
            ]
        },
        {
            "label": "Build With MCUBOOT",
            "command": "python3",
            "type": "shell",
            "group": "build",
            "args": [
                "$ZEPHYR_BASE/scripts/build/mergehex.py",
                "builds/build_${input:board}/zephyr/zephyr.signed.hex",
                "builds/build_${input:board}/bootloader/mcuboot/zephyr/zephyr.hex",
                "-o",
                "builds/build_${input:board}/merged.hex"
            ],
            "dependsOn":["Get Inputs", "Build", "Build MCUBOOT", "Sign"],
            "dependsOrder": "sequence"
        },
        {
            "label": "Start JLink Remote Server",
            "type": "shell",
            "command": "/mnt/c/Program\\ Files/SEGGER/JLink/JLinkRemoteServerCL.exe",
        },
        {
            "label": "Get Inputs",
            "type": "shell",
            "command": "echo",
            "args": [
                "Board:",
                "\b${input:board}",
                "Key:",
                "\b${input:key}",
                "Version:",
                "\b${input:version_num}"

            ],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": true
            }
        }
    ],
    "inputs": [
        {
            "id": "board",
            "description": "Zephyr Target Board",
            "default": "witag_litum",
            "type": "pickString",
            "options":[
                "witag_litum",
                "nucleo_l073rz",
                "witag_bdcip",
                "witag",
                "tsg001",
                "ft06dch",
                "eagleeyesense",
                "lowcost",
                "nrf52833dk_nrf52833",
                "nrf52840dongle_nrf52840",
            ]
        },
        {
            "id": "version_num",
            "description": "Version Number:",
            "default": "100.100.1+0",
            "type": "promptString"
        },
        {
            "id": "key",
            "description": "MCUBOOT KEY file located in Common/keys",
            "default": "witag_litum",
            "type": "pickString",
            "options":[
                "WiTag.pem",
                "WiTag_Litum.pem",
                "root-rsa-2048.pem"
            ]
        }
    ]
}
</code>```

Body:
i'm developing embedded firmware on zephyr RTOS. Zephyr env. works on WSL2. And "Vscode remote client" works in Win10 "Vscode  Server" works on Ununtu 22.04.
I use Jlink debbugger for flashing and debugging firmware. I have to use remote debugging because debugger connected to Win10 via USB. So I run the JLink "JLinkRemoteServerCL.exe" in Win10 before  flash or debug.

But every time I plug or unplug the USB into the PC JLink Remote Connection disconnects. This is annoying.

My goal is to automatically run "JLinkRemoteServerCL.exe" when I run the flash task and close it after the flash task is complete.

I wrote two task for it and connect the flash task to start "JLinkRemoteServerCL.exe" task with "dependsOn" property. But Flash task doesn't start because when start to "JLinkRemoteServerCL.exe"  task, it waits connection and never finish.

I do not know how to kill the "Start Remote Server" task even if i achieve run the "Flash" task.

How can I flash my MCU's with run only 1 task?

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build",
            "command": "west",
            "type": "shell",
            "group": "build",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "build",
                "--pristine",
                "-b",
                "${input:board}",
                "-d",
                "builds/build_${input:board}",
                "--",
                "-DBOARD_ROOT=../Common",
                "-DCONF_FILE=prj.conf",
                "-DOVERLAY_CONFIG=configs/prj_${input:board}.conf",
                "-DDTC_OVERLAY_FILE=boards/${input:board}.overlay"
            ],
            "problemMatcher": [
                "$gcc"
            ],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
            }
        },
        {
            "label": "Build MCUBOOT",
            "command": "west",
            "type": "shell",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "build",
                "$ZEPHYR_BASE/../bootloader/mcuboot/boot/zephyr",
                "--pristine",
                "-b",
                "${input:board}",
                "-d",
                "builds/build_${input:board}/bootloader/mcuboot",
                "--",
                "-DBOARD_ROOT=${cwd}/../Common",
                "-DOVERLAY_CONFIG=${cwd}/bootloader_configs/prj_mcuboot_${input:board}.conf",
                "-DDTC_OVERLAY_FILE=${cwd}/boards/${input:board}.overlay",
                "-DCONFIG_BOOT_SIGNATURE_KEY_FILE=\\\"${cwd}/../Common/keys/${input:key}\\\""
            ],
            "problemMatcher": [
                "$gcc"
            ],
            "presentation": {
                "reveal": "always"
            },
        },
        {
            "label": "Flash",
            "command": "west",
            "type": "shell",
            "group": "build",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "flash",
                "-d",
                "builds/build_${input:board}",
                "--hex-file",
                "builds/build_${input:board}/zephyr/zephyr.bin",
                "-r",
                "jlink",
                "--tool-opt=ip 192.168.0.21"
            ],
            "dependsOn" : "Start JLink Remote Server"
        },
        {
            "label": "Flash with MCUBOOT",
            "command": "west",
            "type": "shell",
            "group": "build",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "flash",
                "-d",
                "builds/build_${input:board}",
                "--hex-file",
                "builds/build_${input:board}/merged.hex",
                "-r",
                "jlink",
                "--tool-opt=ip 192.168.0.21"
            ],
            "dependsOn" : "Start JLink Remote Server"
        },
        {
            "label": "Sign",
            "command": "west",
            "type": "shell",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "args": [
                "sign",
                "-t",
                "imgtool",
                "-d",
                "builds/build_${input:board}",
                "--",
                "--version",
                "${input:version_num}",
                "--key",
                "${workspaceFolder}/../Common/keys/${input:key}"
            ]
        },
        {
            "label": "Build With MCUBOOT",
            "command": "python3",
            "type": "shell",
            "group": "build",
            "args": [
                "$ZEPHYR_BASE/scripts/build/mergehex.py",
                "builds/build_${input:board}/zephyr/zephyr.signed.hex",
                "builds/build_${input:board}/bootloader/mcuboot/zephyr/zephyr.hex",
                "-o",
                "builds/build_${input:board}/merged.hex"
            ],
            "dependsOn":["Get Inputs", "Build", "Build MCUBOOT", "Sign"],
            "dependsOrder": "sequence"
        },
        {
            "label": "Start JLink Remote Server",
            "type": "shell",
            "command": "/mnt/c/Program\\ Files/SEGGER/JLink/JLinkRemoteServerCL.exe",
        },
        {
            "label": "Get Inputs",
            "type": "shell",
            "command": "echo",
            "args": [
                "Board:",
                "\b${input:board}",
                "Key:",
                "\b${input:key}",
                "Version:",
                "\b${input:version_num}"

            ],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": true
            }
        }
    ],
    "inputs": [
        {
            "id": "board",
            "description": "Zephyr Target Board",
            "default": "witag_litum",
            "type": "pickString",
            "options":[
                "witag_litum",
                "nucleo_l073rz",
                "witag_bdcip",
                "witag",
                "tsg001",
                "ft06dch",
                "eagleeyesense",
                "lowcost",
                "nrf52833dk_nrf52833",
                "nrf52840dongle_nrf52840",
            ]
        },
        {
            "id": "version_num",
            "description": "Version Number:",
            "default": "100.100.1+0",
            "type": "promptString"
        },
        {
            "id": "key",
            "description": "MCUBOOT KEY file located in Common/keys",
            "default": "witag_litum",
            "type": "pickString",
            "options":[
                "WiTag.pem",
                "WiTag_Litum.pem",
                "root-rsa-2048.pem"
            ]
        }
    ]
}


问:
Python: Avoiding for-loop in combination with range
I got an input function to choose products out of an entered input number of products with some error handling. For this, I used a for loop in combination with range, which is not very pythonic, as it should be possible to iterate over without using range, but unfortunately, I didn't manage. So this is (part of my) code:

```<code>valid_expression = False # for next while loop
    while valid_expression is False:
        products = []

        for i in range(no_of_products_sel):
            products_confirmed = False # for next while loop
            while products_confirmed is False:
                product = input(f"Please enter product name {i+1}:")
                if product.lower().strip() == "exit":
                    print("See you soon!")
                    return None
                product_clean = product.lower().title().strip()
                if product_clean in products:
                    print(f"Already chosen! Choose another product!")

                elif product_clean in list_of_products:
                    products.append(product_clean)
                    products_codes[product_clean]=product_codes(product)  # get product codes, save them in dict
                    product_confirmed = True

                elif product_clean not in list_of_products:
                    print(f"\n---\nYou have entered '{product}', which is not in the stock. Enter another product!\n---\n")

            valid_expression = True
</code>```

How can I avoid the combination of for-loop and range in for i in range(no_of_products_sel):?

Body:
I got an input function to choose products out of an entered input number of products with some error handling. For this, I used a for loop in combination with range, which is not very pythonic, as it should be possible to iterate over without using range, but unfortunately, I didn't manage. So this is (part of my) code:

valid_expression = False # for next while loop
    while valid_expression is False:
        products = []

        for i in range(no_of_products_sel):
            products_confirmed = False # for next while loop
            while products_confirmed is False:
                product = input(f"Please enter product name {i+1}:")
                if product.lower().strip() == "exit":
                    print("See you soon!")
                    return None
                product_clean = product.lower().title().strip()
                if product_clean in products:
                    print(f"Already chosen! Choose another product!")

                elif product_clean in list_of_products:
                    products.append(product_clean)
                    products_codes[product_clean]=product_codes(product)  # get product codes, save them in dict
                    product_confirmed = True

                elif product_clean not in list_of_products:
                    print(f"\n---\nYou have entered '{product}', which is not in the stock. Enter another product!\n---\n")

            valid_expression = True

How can I avoid the combination of for-loop and range in for i in range(no_of_products_sel):?


问:
I have to refresh a page to show the component that renders with the useNavigate hook to a specific path, without it showing directly from navigation
I am working on a social media app. When the user is not logged in using google id it should redirect him to the /login. But when this happens The login component is not showing right away and instead I have to refresh the page for it to appear.

```<code>import {React, useEffect} from "react";
import { Routes, Route, useNavigate } from 'react-router-dom'
import Login from './components/Login';
import Home from './container/Home'
import { fetchUser } from "./Utils/fetchUser";

const App = () => {
  const navigate = useNavigate();

  useEffect(() => {
    const user = localStorage.getItem('user') !== 'undefined' ? JSON.parse(localStorage.getItem('user')) : localStorage.clear();
    if(!user){
      navigate('/login');
    }
  }, []);

  return (
      <div>
        <Routes>
          <Route path='login' element={<Login />} />
          <Route path='/*' element={<Home />} />
        </Routes>
      </div>
  )
};

export default App;
</code>```

I tried adding a window.location.reload() statement after the navigate statement but it caused an infinite loop.

Body:
I am working on a social media app. When the user is not logged in using google id it should redirect him to the /login. But when this happens The login component is not showing right away and instead I have to refresh the page for it to appear.

import {React, useEffect} from "react";
import { Routes, Route, useNavigate } from 'react-router-dom'
import Login from './components/Login';
import Home from './container/Home'
import { fetchUser } from "./Utils/fetchUser";

const App = () => {
  const navigate = useNavigate();

  useEffect(() => {
    const user = localStorage.getItem('user') !== 'undefined' ? JSON.parse(localStorage.getItem('user')) : localStorage.clear();
    if(!user){
      navigate('/login');
    }
  }, []);

  return (

        <Routes>
          <Route path='login' element={<Login />} />
          <Route path='/*' element={<Home />} />
        </Routes>

  )
};

export default App;

I tried adding a window.location.reload() statement after the navigate statement but it caused an infinite loop.


问:
Object detection on lidar data
I have lidar data and stitched 360-degree images. My task is to detect the individual object and localize them on the lidar data.

I have done object detection on stitched images but am unable to map those objects into lidar data.

Any help will be highly appreciated.

Thanks in advance.

Title: Object detection on lidar data


问:
payumoney_pro_unofficial implemention showing error in ios
payumoney_pro_unofficial/generateChecksum.swift:18: Fatal error: Unexpectedly found nil while unwrapping an Optional value

im am implemntion it but my app crash when i hit payment buttoon and showing error payumoney_pro_unofficial/generateChecksum.swift:18: Fatal error: Unexpectedly found nil while unwrapping an Optional value


问:
selenium wait is not working on linux server but working on windows

on linux server

```<code>def get_crawling_browser() :
    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    options = webdriver.ChromeOptions()
    options.add_argument('--headless')
    options.add_argument('--window-size=1420,1080')
    options.add_argument('--start-maximized')
    options.add_argument('--no-sandbox')
    options.add_argument('--disable-blink-features=AutomationControlled')
    options.add_argument('--disable-dev-shm-usage')
    options.add_argument('--disable-gpu')
    options.add_argument("--incognito")
    options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36")

    browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
    return browser

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException

url = "https://www.investing.com/commodities/copper-historical-data?cid=959211"
browser = get_crawling_browser()
browser.get(url)
try:
    WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="PromoteSignUpPopUp"]/div[2]/i'))).click()
    browser.find_element(By.XPATH, "//body").click()
    browser.find_element(By.XPATH, '//*[@id="PromoteSignUpPopUp"]/div[2]/i').click()
except TimeoutException:
    pass
browser.maximize_window()
browser.find_element(By.CLASS_NAME, "DatePickerWrapper_icon__Qw9f8").click()
dates = browser.find_elements(By.CSS_SELECTOR, ".NativeDateInput_root__wbgyP > input")
dates[0].clear()
dates[0].send_keys('2022/10/01')
dates[1].clear()
dates[1].send_keys('2022/12/18')
#browser.implicitly_wait(60)
browser.find_element(By.CLASS_NAME, "HistoryDatePicker_apply-button__fPr_G").click()
try:
    WebDriverWait(browser, 60).until(lambda X: len(X.find_elements(By.CSS_SELECTOR, ".datatable_row__qHMpQ > .datatable_cell__0y0eu > time")) >= 30)
    print("Page is Loaded")
except TimeoutException:
    print("Loading took too much time!")
    pass
</code>```

on windows

```<code>def get_crawling_browser() :
    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
    return browser

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException

url = "https://www.investing.com/commodities/copper-historical-data?cid=959211"
browser = get_crawling_browser()
browser.get(url)
try:
    WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="PromoteSignUpPopUp"]/div[2]/i'))).click()
    browser.find_element(By.XPATH, "//body").click()
    browser.find_element(By.XPATH, '//*[@id="PromoteSignUpPopUp"]/div[2]/i').click()
except TimeoutException:
    pass
browser.maximize_window()
browser.find_element(By.CLASS_NAME, "DatePickerWrapper_icon__Qw9f8").click()
dates = browser.find_elements(By.CSS_SELECTOR, ".NativeDateInput_root__wbgyP > input")
dates[0].clear()
dates[0].send_keys('2022/10/01')
dates[1].clear()
dates[1].send_keys('2022/12/18')
#browser.implicitly_wait(60)
browser.find_element(By.CLASS_NAME, "HistoryDatePicker_apply-button__fPr_G").click()
try:
    WebDriverWait(browser, 60).until(lambda X: len(X.find_elements(By.CSS_SELECTOR, ".datatable_row__qHMpQ > .datatable_cell__0y0eu > time")) >= 30)
    print("Page is Loaded")
except TimeoutException:
    print("Loading took too much time!")
    pass
</code>```

selenium version : 4.7.2

Diffenrent scripts are just options. but the result is different.
I don't know how to solve it. Plz help me!!!

run the scripts with options on linux server, WebDriverWait is not working
printed "Loading took too much time!"
run the scripts without options on windows, WebDriverWait is working
printed "Page is Loaded"

Body:
on linux server

def get_crawling_browser() :
    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    options = webdriver.ChromeOptions()
    options.add_argument('--headless')
    options.add_argument('--window-size=1420,1080')
    options.add_argument('--start-maximized')
    options.add_argument('--no-sandbox')
    options.add_argument('--disable-blink-features=AutomationControlled')
    options.add_argument('--disable-dev-shm-usage')
    options.add_argument('--disable-gpu')
    options.add_argument("--incognito")
    options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36")

    browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
    return browser

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException

url = "https://www.investing.com/commodities/copper-historical-data?cid=959211"
browser = get_crawling_browser()
browser.get(url)
try:
    WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="PromoteSignUpPopUp"]/div[2]/i'))).click()
    browser.find_element(By.XPATH, "//body").click()
    browser.find_element(By.XPATH, '//*[@id="PromoteSignUpPopUp"]/div[2]/i').click()
except TimeoutException:
    pass
browser.maximize_window()
browser.find_element(By.CLASS_NAME, "DatePickerWrapper_icon__Qw9f8").click()
dates = browser.find_elements(By.CSS_SELECTOR, ".NativeDateInput_root__wbgyP > input")
dates[0].clear()
dates[0].send_keys('2022/10/01')
dates[1].clear()
dates[1].send_keys('2022/12/18')
#browser.implicitly_wait(60)
browser.find_element(By.CLASS_NAME, "HistoryDatePicker_apply-button__fPr_G").click()
try:
    WebDriverWait(browser, 60).until(lambda X: len(X.find_elements(By.CSS_SELECTOR, ".datatable_row__qHMpQ > .datatable_cell__0y0eu > time")) >= 30)
    print("Page is Loaded")
except TimeoutException:
    print("Loading took too much time!")
    pass

on windows

def get_crawling_browser() :
    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
    return browser

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException

url = "https://www.investing.com/commodities/copper-historical-data?cid=959211"
browser = get_crawling_browser()
browser.get(url)
try:
    WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="PromoteSignUpPopUp"]/div[2]/i'))).click()
    browser.find_element(By.XPATH, "//body").click()
    browser.find_element(By.XPATH, '//*[@id="PromoteSignUpPopUp"]/div[2]/i').click()
except TimeoutException:
    pass
browser.maximize_window()
browser.find_element(By.CLASS_NAME, "DatePickerWrapper_icon__Qw9f8").click()
dates = browser.find_elements(By.CSS_SELECTOR, ".NativeDateInput_root__wbgyP > input")
dates[0].clear()
dates[0].send_keys('2022/10/01')
dates[1].clear()
dates[1].send_keys('2022/12/18')
#browser.implicitly_wait(60)
browser.find_element(By.CLASS_NAME, "HistoryDatePicker_apply-button__fPr_G").click()
try:
    WebDriverWait(browser, 60).until(lambda X: len(X.find_elements(By.CSS_SELECTOR, ".datatable_row__qHMpQ > .datatable_cell__0y0eu > time")) >= 30)
    print("Page is Loaded")
except TimeoutException:
    print("Loading took too much time!")
    pass

selenium version : 4.7.2

Diffenrent scripts are just options. but the result is different.
I don't know how to solve it. Plz help me!!!

run the scripts with options on linux server, WebDriverWait is not working
printed "Loading took too much time!"
run the scripts without options on windows, WebDriverWait is working
printed "Page is Loaded"


问:
Loopback4: Dynamically create belong to accessor inside repository
I would like to dynamically create Belongs To Accessor based on response data.Let me explain.

Here is my model =>

```<code>export class TaskTableMain extends Entity {

  @property({
    type: 'number',
    required: true,
  })
  TaskTypeId: number;

  @property({
    type: 'number',
    required: true,
  })
  TaskTableId: number;
}
</code>```

I also have multiple model. Example : ModelA, ModelB

Here is current response =>

```<code>[
  {
    "TaskTypeId": 1,
    "TaskTableId": 1
  },
  {
    "TaskTypeId": 2,
    "TaskTableId": 2
  },
  {
    "TaskTypeId": 1,
    "TaskTableId": 1
  }
]
</code>```

====================================================

I want to add the extra field called RelatedInfo inside TaskTableMain and this field will be response data based on TaskTypeId and TaskTableId.

E.g.

If TaskTypeId = 1 ,RelatedInfo field will be ModelA with Id = TaskTableId

If TaskTypeId = 2 , RelatedInfo field will be ModelB with Id = TaskTypeId

Here is expected response =>

```<code>[
  {
    "TaskTypeId": 1,
    "TaskTableId": 1,
    "RelatedInfo":{
      "id":1,
      "type":"Model A"
    }
  },
  {
    "TaskTypeId": 2,
    "TaskTableId": 2,
    "RelatedInfo":{
      "id":2,
      "type":"Model B"
    }
  },
  {
    "TaskTypeId": 1,
    "TaskTableId": 2,
    "RelatedInfo":{
      "id":2,
      "type":"Model A"
    }
  }
]
</code>```

Currently, I am adding custom model with RelatedField and check manually one by one inside controller.But this one can't use filter inside ModelA and ModelB since its manually added.

So Is there anyway to do it inside repository rather than controller since I want to filter the child model also?

What I have been try?

I tried to use InclusionResolver. e.g.

```<code>// eslint-disable-next-line @typescript-eslint/no-explicit-any
    const proxiedInclusionResolver: InclusionResolver<TaskTableMain, any> = (
      sourceEntities: TaskTableMain[],
      inclusion: InclusionFilter,
      _options?: Options,
    ) => {
      for (const TaskType of sourceEntities) {
        switch (TaskType.TaskTypeId) {
          case 1:
            this.TaskTable = this.createBelongsToAccessorFor(
              'TaskTable',
              modelARepository,
            );
            break;
          case 2:
            this.TaskTable = this.createBelongsToAccessorFor(
              'TaskTable',
              modelBRepository,
            );
            break;

          default:
            this.TaskTable = this.createBelongsToAccessorFor(
              'TaskTable',
              modelARepository,
            );
        }
      }

      return this.TaskTable.inclusionResolver(
        sourceEntities,
        inclusion,
        _options,
      );
    };

    // eslint-disable-next-line @typescript-eslint/ban-ts-comment

    this.registerInclusionResolver('TaskTable', proxiedInclusionResolver);
</code>```

But this one is not working. Could u please how can I make it happen?

Body:
I would like to dynamically create Belongs To Accessor based on response data.Let me explain.

Here is my model =>

export class TaskTableMain extends Entity {

  @property({
    type: 'number',
    required: true,
  })
  TaskTypeId: number;

  @property({
    type: 'number',
    required: true,
  })
  TaskTableId: number;
}

I also have multiple model. Example : ModelA, ModelB

Here is current response =>

[
  {
    "TaskTypeId": 1,
    "TaskTableId": 1
  },
  {
    "TaskTypeId": 2,
    "TaskTableId": 2
  },
  {
    "TaskTypeId": 1,
    "TaskTableId": 1
  }
]

====================================================

I want to add the extra field called RelatedInfo inside TaskTableMain and this field will be response data based on TaskTypeId and TaskTableId.

E.g.

If TaskTypeId = 1 ,RelatedInfo field will be ModelA with Id = TaskTableId

If TaskTypeId = 2 , RelatedInfo field will be ModelB with Id = TaskTypeId

Here is expected response =>

[
  {
    "TaskTypeId": 1,
    "TaskTableId": 1,
    "RelatedInfo":{
      "id":1,
      "type":"Model A"
    }
  },
  {
    "TaskTypeId": 2,
    "TaskTableId": 2,
    "RelatedInfo":{
      "id":2,
      "type":"Model B"
    }
  },
  {
    "TaskTypeId": 1,
    "TaskTableId": 2,
    "RelatedInfo":{
      "id":2,
      "type":"Model A"
    }
  }
]

Currently, I am adding custom model with RelatedField and check manually one by one inside controller.But this one can't use filter inside ModelA and ModelB since its manually added.

So Is there anyway to do it inside repository rather than controller since I want to filter the child model also?

What I have been try?

I tried to use InclusionResolver. e.g.

// eslint-disable-next-line @typescript-eslint/no-explicit-any
    const proxiedInclusionResolver: InclusionResolver<TaskTableMain, any> = (
      sourceEntities: TaskTableMain[],
      inclusion: InclusionFilter,
      _options?: Options,
    ) => {
      for (const TaskType of sourceEntities) {
        switch (TaskType.TaskTypeId) {
          case 1:
            this.TaskTable = this.createBelongsToAccessorFor(
              'TaskTable',
              modelARepository,
            );
            break;
          case 2:
            this.TaskTable = this.createBelongsToAccessorFor(
              'TaskTable',
              modelBRepository,
            );
            break;

          default:
            this.TaskTable = this.createBelongsToAccessorFor(
              'TaskTable',
              modelARepository,
            );
        }
      }

      return this.TaskTable.inclusionResolver(
        sourceEntities,
        inclusion,
        _options,
      );
    };

    // eslint-disable-next-line @typescript-eslint/ban-ts-comment

    this.registerInclusionResolver('TaskTable', proxiedInclusionResolver);

But this one is not working. Could u please how can I make it happen?


问:
How to add channel to send message in flutter_js
I am trying to pass a message from Javascript to Flutter using package flutter_js but it seems like it's not working cuz it shows No Channel " " registered

below is my code

```<code>Future<dynamic> getObjectName(JavascriptRuntime jsRuntime) async {
  final completer = Completer();

  JsEvalResult jsEvalResult = jsRuntime.evaluate("""
  const Person = {
    firstName: "John",
    lastName: "Doe",
    age: 50,
    eyeColor: "blue"
  };

  // const personJson = JSON.stringify(Person);
  sendMessage('passJson2Dart', JSON.stringify(Person));
  """);

  jsRuntime.onMessage('passJson2Dart', (args) {
    print("test argument" + args);
    Map<String, dynamic> person = json.decode(args);
    print("test decode");
    print(person);
    return person;
  });

  // jsRuntime.onMessage('passJson2Dart', (args) {
  //   Map<String, dynamic> person = json.decode(args);
  //   completer.complete(person);
  // });

  // return completer.future;
}
</code>```

Can I know how to add or register channel inside the JavascriptRuntime object

Body:
I am trying to pass a message from Javascript to Flutter using package flutter_js but it seems like it's not working cuz it shows No Channel " " registered

below is my code

Future<dynamic> getObjectName(JavascriptRuntime jsRuntime) async {
  final completer = Completer();

  JsEvalResult jsEvalResult = jsRuntime.evaluate("""
  const Person = {
    firstName: "John",
    lastName: "Doe",
    age: 50,
    eyeColor: "blue"
  };

  // const personJson = JSON.stringify(Person);
  sendMessage('passJson2Dart', JSON.stringify(Person));
  """);

  jsRuntime.onMessage('passJson2Dart', (args) {
    print("test argument" + args);
    Map<String, dynamic> person = json.decode(args);
    print("test decode");
    print(person);
    return person;
  });

  // jsRuntime.onMessage('passJson2Dart', (args) {
  //   Map<String, dynamic> person = json.decode(args);
  //   completer.complete(person);
  // });

  // return completer.future;
}

Can I know how to add or register channel inside the JavascriptRuntime object


问:
Filter an Excel workbook on all the sheets with criteria on two columns, when the rows satisfy my criteria, copy the rows to a new excel workbook
I have only one excel file, the file has multiple spreadsheets, I loop through all the spreadsheets and find the rows whose column1 and column2 satisfy my criteria, and if it does, copy the rows to a new excel workbook, I need to copy the first row that specifies what the column names are as well, but right now I'm ignoring this to simplify the problem.

I looked up online, and found a post similar to my question, I modified the code according to my situation, here's the code:

```<code>    $WindowsFolder = "C:\Users\wanlingjiang\Downloads\xlsx\"

    # Create a new datatable to copy data into.
    $dtExcel = New-Object System.Data.DataTable

    # Counter used to only create data columns on the first index in the loop.
    $count = 1

    # Get all spreadsheet objects from the current folder.
    $SpreadSheets = Get-ChildItem $WindowsFolder -File -Verbose
    # Loop through each of the spreadsheet objects returned.
    foreach ($SpreadSheet in $SpreadSheets) {
        # Index the counter.

        try{
            # Import the data from the source spreadsheet into datatables.
            $dts = Get-TablesFromXLSXWorkbook -InputFileName $SpreadSheet.FullName -Verbose -ErrorAction Stop

            # We only need to work with the first datatable imported from each spreadsheet.
            $Rows = $dts[0].Rows
            # Create the data columns within the target datatable
            #     using the column headers from the current spreadsheet.
            if($count -eq 1) {
                foreach ($item in $dts.Columns) {
                    $dtExcel.Columns.Add($item.ColumnName) | Out-Null
                }
            $count++

            }
            # Loop through each row of data returned from the current spreadsheet.
            foreach ($row in $Rows) {
                # Determine if the 'Column1' column in the current row equals 'Criteria1' and if the 'Column2' column in the current row starts with 'Criteria2'.
                # If yes, copy the data row to the target datatable.
                if($row.'Column1' -eq 'Criteria1' -and $row.'Column2' -like 'Criteria2*') {
                    $dr = $dtExcel.NewRow()
                    $dr.ItemArray = $row.ItemArray.Clone()

                    $dtExcel.Rows.Add($dr)
                }
            }
        } catch {
            Write-Warning -Message "Something happened. Write a good error message."
        }
    }

    # Export the target datatable to a new Excel spreadsheet.
    New-XLSXWorkbook -InputTables $dtExcel -OutputFileName 'C:\Users\wanlingjiang\Downloads\xlsx\Output.xlsx' -Open

</code>```

It is not working, the error message says:
New-XLSXWorkbook : The term 'New-XLSXWorkbook' is not recognized as the name of a cmdlet, function, script file, or operable program.

I removed the last line, and tried to debug, it stopped at this line:
$dts = Get-TablesFromXLSXWorkbook -InputFileName $SpreadSheet.FullName -Verbose -ErrorAction Stop

Do I need to install something? Please help. Thank you!

Body:
I have only one excel file, the file has multiple spreadsheets, I loop through all the spreadsheets and find the rows whose column1 and column2 satisfy my criteria, and if it does, copy the rows to a new excel workbook, I need to copy the first row that specifies what the column names are as well, but right now I'm ignoring this to simplify the problem.

I looked up online, and found a post similar to my question, I modified the code according to my situation, here's the code:

    $WindowsFolder = "C:\Users\wanlingjiang\Downloads\xlsx\"

    # Create a new datatable to copy data into.
    $dtExcel = New-Object System.Data.DataTable

    # Counter used to only create data columns on the first index in the loop.
    $count = 1

    # Get all spreadsheet objects from the current folder.
    $SpreadSheets = Get-ChildItem $WindowsFolder -File -Verbose
    # Loop through each of the spreadsheet objects returned.
    foreach ($SpreadSheet in $SpreadSheets) {
        # Index the counter.

        try{
            # Import the data from the source spreadsheet into datatables.
            $dts = Get-TablesFromXLSXWorkbook -InputFileName $SpreadSheet.FullName -Verbose -ErrorAction Stop

            # We only need to work with the first datatable imported from each spreadsheet.
            $Rows = $dts[0].Rows
            # Create the data columns within the target datatable
            #     using the column headers from the current spreadsheet.
            if($count -eq 1) {
                foreach ($item in $dts.Columns) {
                    $dtExcel.Columns.Add($item.ColumnName) | Out-Null
                }
            $count++

            }
            # Loop through each row of data returned from the current spreadsheet.
            foreach ($row in $Rows) {
                # Determine if the 'Column1' column in the current row equals 'Criteria1' and if the 'Column2' column in the current row starts with 'Criteria2'.
                # If yes, copy the data row to the target datatable.
                if($row.'Column1' -eq 'Criteria1' -and $row.'Column2' -like 'Criteria2*') {
                    $dr = $dtExcel.NewRow()
                    $dr.ItemArray = $row.ItemArray.Clone()

                    $dtExcel.Rows.Add($dr)
                }
            }
        } catch {
            Write-Warning -Message "Something happened. Write a good error message."
        }
    }

    # Export the target datatable to a new Excel spreadsheet.
    New-XLSXWorkbook -InputTables $dtExcel -OutputFileName 'C:\Users\wanlingjiang\Downloads\xlsx\Output.xlsx' -Open

It is not working, the error message says:
New-XLSXWorkbook : The term 'New-XLSXWorkbook' is not recognized as the name of a cmdlet, function, script file, or operable program.

I removed the last line, and tried to debug, it stopped at this line:
$dts = Get-TablesFromXLSXWorkbook -InputFileName $SpreadSheet.FullName -Verbose -ErrorAction Stop

Do I need to install something? Please help. Thank you!


问:
Audio stops playing on locked screen on Android
I've got audio files player built with HLS.js on top of Vue.

It works great on Safari on iOS, but when playing audio on Android (Chrome) in background it is pausing the audio after few minutes and then you have to unlock phone and press "Play" again.

It currently has the PWA installable capabilities, but even when opened as a standalone it still have the same behavior.

Is there a way to prevent this? Maybe with wrapping in Capacitor or Cordova?


问:
Kafka : Consumer is taking ~ 2 sec to fetch next batch
I have set kafka config. as below for consumer

```<code>consumer:
  bootstrap-servers: ${VAR1}
  group-id: ${VAR2}
  auto-offset-reset: earliest
  key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
  value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
  properties:
    max:
      poll:
        records: 20
        interval.ms: 300000
listener:
  ack-mode: manual
</code>```

I observed after consuming one batch successfully kafka consumer is taking time to fetch next batch,
It is taking approximately 1.5 ~ 2sec

Can anyone help to understand how to reduce this kafka batch interval of ~2sec and configure to get the next batch immediately

Body:
I have set kafka config. as below for consumer

consumer:
  bootstrap-servers: ${VAR1}
  group-id: ${VAR2}
  auto-offset-reset: earliest
  key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
  value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
  properties:
    max:
      poll:
        records: 20
        interval.ms: 300000
listener:
  ack-mode: manual

I observed after consuming one batch successfully kafka consumer is taking time to fetch next batch,
It is taking approximately 1.5 ~ 2sec

Can anyone help to understand how to reduce this kafka batch interval of ~2sec and configure to get the next batch immediately