问:
Scrape `HTTPS` websites with HTTP proxy using HttpClient
I am trying to scrape an https website using http proxy provided here https://hidemy.name/en/proxy-list/?country=US&type=hs#list

The website I am trying to scrape is also https://hidemy.name/en/proxy-list/?country=US&type=hs#list
however, no matter which website I try to scrape it doesn't work as long as it has https but any website with http it does work fine. I tried using https proxy but it is still not supported in .NET core according to https://github.com/dotnet/core/issues/2043#issuecomment-1021597346

This is my code and what I have tried so far.

using System.Net;
using System.Web;
using HtmlAgilityPack;

internal sealed class TestProxy {
        private HttpClientHandler _htttpClientHandler;
        private HttpClient _client;

        internal Test {
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var proxy = new WebProxy
            {
                Address = new Uri($"http://173.82.153.196:16781"), // This proxy is working as of 12/13/2022
                BypassProxyOnLocal = true,
                UseDefaultCredentials = false,
                Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
            };

            this._htttpClientHandler = new HttpClientHandler
            {
                UseProxy = true,
                UseCookies = true,
                Proxy = proxy,
                DefaultProxyCredentials = CredentialCache.DefaultNetworkCredentials
            };

            _htttpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;

            this._client = new HttpClient(this._htttpClientHandler, true);
       }

 private async Task<HtmlDocument> LoadPage(string url)
        {
            this._client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0");

            var stream = await this._client.GetStreamAsync(url);
            using (var reader = new StreamReader(stream))
            {
                string html = reader.ReadToEnd();
                var doc = new HtmlDocument();
                doc.LoadHtml(html);
                return doc;
            }
        }

}
```
<p>I keep getting an exception with error code <code>400</code> or <code>403</code> such as</p>
```An exception of type 'System.Net.Http.HttpRequestException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Response status code does not indicate success: 403 (Forbidden).'
```
<p>I am pretty sure there has to be a solution, no? I searched google and stackoverflow with no luck.</p>
``````

Body:
I am trying to scrape an https website using http proxy provided here https://hidemy.name/en/proxy-list/?country=US&type=hs#list

The website I am trying to scrape is also https://hidemy.name/en/proxy-list/?country=US&type=hs#list
however, no matter which website I try to scrape it doesn't work as long as it has https but any website with http it does work fine. I tried using https proxy but it is still not supported in .NET core according to https://github.com/dotnet/core/issues/2043#issuecomment-1021597346

This is my code and what I have tried so far.

using System.Net;
using System.Web;
using HtmlAgilityPack;

internal sealed class TestProxy {
        private HttpClientHandler _htttpClientHandler;
        private HttpClient _client;

        internal Test {
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            var proxy = new WebProxy
            {
                Address = new Uri($"http://173.82.153.196:16781"), // This proxy is working as of 12/13/2022
                BypassProxyOnLocal = true,
                UseDefaultCredentials = false,
                Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
            };

            this._htttpClientHandler = new HttpClientHandler
            {
                UseProxy = true,
                UseCookies = true,
                Proxy = proxy,
                DefaultProxyCredentials = CredentialCache.DefaultNetworkCredentials
            };

            _htttpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;

            this._client = new HttpClient(this._htttpClientHandler, true);
       }

 private async Task<HtmlDocument> LoadPage(string url)
        {
            this._client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0");

            var stream = await this._client.GetStreamAsync(url);
            using (var reader = new StreamReader(stream))
            {
                string html = reader.ReadToEnd();
                var doc = new HtmlDocument();
                doc.LoadHtml(html);
                return doc;
            }
        }

}

I keep getting an exception with error code 400 or 403 such as

An exception of type 'System.Net.Http.HttpRequestException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Response status code does not indicate success: 403 (Forbidden).'

I am pretty sure there has to be a solution, no? I searched google and stackoverflow with no luck.


来源: stackexchange

问:
Topic-word distribution is because of word similarity or relevance?
In the topic analysis, some words belong to the same topic, is it because these words are related or similar?or both?

I wanted to use the BTM topic model for short text analysis, but the Biterm word pairs are formed based on the fact that two words are in a sentence at the same time, without considering the size of the relationship between the two words, what I don't know is whether this relationship refers to word similarity or relevance, to determine whether I choose the similarity indicator or the relevance indicator for word pair selection.

ContentLicense: CC BY-SA 4.0


问:
A modification of the Dijkstra algorithm
I need help.
Is there a way to modify this Dijkstra algorithm I found on the internet so that it also prints the number of branches between the source node and the other nodes that are reachable?

I tried to introduce some counter in the code when checking the connectivity between the nodes but without success.

```<code>int minDistance(Graph g,double dist[], bool sptSet[])
{
// Initialize min value
int min = INT_MAX, min_index;
for (int v = 0; v < g.n ; v++)
    if (sptSet[v] == false && dist[v] <= min)
        min = dist[v], min_index = v;
    return min_index;
}
void printSolution(Graph g,double dist[])
{
    cout<<"Vertex Distance from Source\n";
    for (int i = 0; i < g.n; i++)
    if (dist[i] < g.n)
    {
        cout<< i+1 << "         " << dist[i] << endl;
    }
}
void dijkstra(GRAPH g, int src)
{
    double dist[MAX];
    bool sptSet[MAX];
    for (int i = 0; i < g.n; i++)
        dist[i] = INT_MAX, sptSet[i] = false;
    dist[src] = 0;
    for (int count = 0; count < g.n - 1; count++)
    {
        int u = minDistance(g, dist, sptSet);
        sptSet[u] = true;
        for (int v = 0; v < g.n; v++) {
            int c = 0; //Here I tried to introduce a counter!
            if (!sptSet[v] && g.ms[u][v] && dist[u] != INT_MAX &&
                    dist[u] + g.ms[u][v] < dist[v])
            {
                c++; //Here I tried to introduce a counter!
                dist[v] = dist[u] + g.ms[u][v];
            }
             cout << c; //Here I tried to introduce a counter!
        }
    }
    printSolution(g, dist);
}
</code>```

Thanks in advance!

Body:
I need help.
Is there a way to modify this Dijkstra algorithm I found on the internet so that it also prints the number of branches between the source node and the other nodes that are reachable?

I tried to introduce some counter in the code when checking the connectivity between the nodes but without success.

int minDistance(Graph g,double dist[], bool sptSet[])
{
// Initialize min value
int min = INT_MAX, min_index;
for (int v = 0; v < g.n ; v++)
    if (sptSet[v] == false && dist[v] <= min)
        min = dist[v], min_index = v;
    return min_index;
}
void printSolution(Graph g,double dist[])
{
    cout<<"Vertex Distance from Source\n";
    for (int i = 0; i < g.n; i++)
    if (dist[i] < g.n)
    {
        cout<< i+1 << "         " << dist[i] << endl;
    }
}
void dijkstra(GRAPH g, int src)
{
    double dist[MAX];
    bool sptSet[MAX];
    for (int i = 0; i < g.n; i++)
        dist[i] = INT_MAX, sptSet[i] = false;
    dist[src] = 0;
    for (int count = 0; count < g.n - 1; count++)
    {
        int u = minDistance(g, dist, sptSet);
        sptSet[u] = true;
        for (int v = 0; v < g.n; v++) {
            int c = 0; //Here I tried to introduce a counter!
            if (!sptSet[v] && g.ms[u][v] && dist[u] != INT_MAX &&
                    dist[u] + g.ms[u][v] < dist[v])
            {
                c++; //Here I tried to introduce a counter!
                dist[v] = dist[u] + g.ms[u][v];
            }
             cout << c; //Here I tried to introduce a counter!
        }
    }
    printSolution(g, dist);
}

Thanks in advance!


问:
How to sort arrays inside a list using python
How can i sort these arrays inside the list in alphabetic order of names using python ?

```<code>[(1, 'Robert Downey', 40, '+919876543210', 15000), (2, 'Chris Evans', 35, '+919876543201', 30000), (3, 'Paul Rudd', 45, '+919876543021', 25000), (4, 'Tom Hardy', 39, '+919876540321', 40000), (5, 'Christian Bale', 30, '+919876504321', 10000), (6, 'Thomas shelby', 50, '+91234567890', 90000), (7, 'Tony Stark', 45, '+91087654296', 100000)]
</code>```

i tried sort() function in python but it sorted on the basis of id number(first value in each array)

Body:
How can i sort these arrays inside the list in alphabetic order of names using python ?

[(1, 'Robert Downey', 40, '+919876543210', 15000), (2, 'Chris Evans', 35, '+919876543201', 30000), (3, 'Paul Rudd', 45, '+919876543021', 25000), (4, 'Tom Hardy', 39, '+919876540321', 40000), (5, 'Christian Bale', 30, '+919876504321', 10000), (6, 'Thomas shelby', 50, '+91234567890', 90000), (7, 'Tony Stark', 45, '+91087654296', 100000)]

i tried sort() function in python but it sorted on the basis of id number(first value in each array)


问:
Non-mapped Doctrine Collection property never gets initialized
I am working on a custom ancestry-chain hydrator which hydrates Root entities (see entity excerpt below). It works quite well. The hydrator gets its entities from Doctrine and works on them. The hydrator then returns what it has worked as actual result.

So now the hydrator requires a property in the entity called leaves to store ancestors. I imagined the below property setup would work, and that I would get an empty initialized leaves property when Doctrine is bringing Root entities from the database to the hydrator, then the hydrator would just store in their leaves the objects it has determined to be ancestors for further processing.

The property has to be initialized with an empty Doctrine ArrayCollection (unmapped). So I added it and... nothing. It doesn't get initialized. Mapped associations collections however, work.

Is there some switch, declaration or standard one has to adhere to? Or what should I do to make Doctrine initialize it?

```<code>class Root
{
    ...

    /**
     * @var Collection
     */
    public Collection $leaves;

    /**
     * @ORM\OneToMany(targetEntity="Root", mappedBy="parent", fetch="EXTRA_LAZY", indexBy="id")
     */
    private Collection $children;

    /**
     * @throws Exception
     */
    public function __construct()
    {
        $this->leaves=new ArrayCollection(); <- no effect
        $this->children=new ArrayCollection(); <- is initialized
    }

    ...
}
</code>```

Body:
I am working on a custom ancestry-chain hydrator which hydrates Root entities (see entity excerpt below). It works quite well. The hydrator gets its entities from Doctrine and works on them. The hydrator then returns what it has worked as actual result.

So now the hydrator requires a property in the entity called leaves to store ancestors. I imagined the below property setup would work, and that I would get an empty initialized leaves property when Doctrine is bringing Root entities from the database to the hydrator, then the hydrator would just store in their leaves the objects it has determined to be ancestors for further processing.

The property has to be initialized with an empty Doctrine ArrayCollection (unmapped). So I added it and... nothing. It doesn't get initialized. Mapped associations collections however, work.

Is there some switch, declaration or standard one has to adhere to? Or what should I do to make Doctrine initialize it?

class Root
{
    ...

    /**
     * @var Collection
     */
    public Collection $leaves;

    /**
     * @ORM\OneToMany(targetEntity="Root", mappedBy="parent", fetch="EXTRA_LAZY", indexBy="id")
     */
    private Collection $children;

    /**
     * @throws Exception
     */
    public function __construct()
    {
        $this->leaves=new ArrayCollection(); <- no effect
        $this->children=new ArrayCollection(); <- is initialized
    }

    ...
}


问:
nginx not serving static css with fingerprint generated by hugo
The relevant portion of my config is

```<code>        location / {
                include  /etc/nginx/mime.types;
                autoindex on;
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }
</code>```

I included the css with

```<code>{{ $styles := resources.Get "scss/main.scss" | resources.ExecuteAsTemplate "style.main.scss" . | toCSS | minify | fingerprint }}
</code>```

which generates a pretty long name due to the fingerprint. Something like style.main.min.ebc28e559f8333b404805ca83fc38f230c2ed2ab7401e1c250108deb92fdfc8a.css.

Trying to access this leads to 404. Deleting just a single character from anywhere solve this issue. What does nginx not like here?

Body:
The relevant portion of my config is

        location / {
                include  /etc/nginx/mime.types;
                autoindex on;
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

I included the css with

{{ $styles := resources.Get "scss/main.scss" | resources.ExecuteAsTemplate "style.main.scss" . | toCSS | minify | fingerprint }}

which generates a pretty long name due to the fingerprint. Something like style.main.min.ebc28e559f8333b404805ca83fc38f230c2ed2ab7401e1c250108deb92fdfc8a.css.

Trying to access this leads to 404. Deleting just a single character from anywhere solve this issue. What does nginx not like here?


问:
Obtaining data from RTK query endpoint
I have got the correct response from the api call done by RTK query, the trouble is accessing that data. I have followed the guide here https://redux-toolkit.js.org/rtk-query/usage/usage-without-react-hooks on how to interact with RTK Query when used without React Hooks. These are my relevant files:

actor-slice-api.js

```<code>import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'

// Define a service using a base URL and expected endpoints
export const actorApi = createApi({
  reducerPath: 'actorApi',
  baseQuery: fetchBaseQuery({ baseUrl: process.env.REACT_APP_MOVIE_DB_BASE_URL }),
  endpoints: (builder) => ({
    getActorByName: builder.query({
      query: (name) => `search/person?api_key=${process.env.REACT_APP_API_KEY}&query=${name}`,
    }),
  }),
})

// Export hooks for usage in functional components, which are
// auto-generated based on the defined endpoints
export const { useGetActorByNameQuery } = actorApi
</code>```

store.js

```<code>import { configureStore } from '@reduxjs/toolkit'
// Or from '@reduxjs/toolkit/query/react'
import { setupListeners } from '@reduxjs/toolkit/query'
import { actorApi } from '../features/actor/actor-slice-api'

export const store = configureStore({
  reducer: {
    // Add the generated reducer as a specific top-level slice
    [actorApi.reducerPath]: actorApi.reducer,
  },
  // Adding the api middleware enables caching, invalidation, polling,
  // and other useful features of `rtk-query`.
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware().concat(actorApi.middleware),
})

// optional, but required for refetchOnFocus/refetchOnReconnect behaviors
// see `setupListeners` docs - takes an optional callback as the 2nd arg for customization
setupListeners(store.dispatch)
</code>```

actorSearchContainer.js

```<code>import { connect } from 'react-redux'

import ActorSearch from './ActorSearch'

import { actorApi } from '../../features/actor/actor-slice-api'

const mapState = (state) => ({
  actors: actorApi.endpoints.getActorByName.select()(state)
});
const mapDispatch = {
  getActors: actorApi.endpoints.getActorByName.initiate,
};
const connector = connect(mapState, mapDispatch);

export default connector(ActorSearch)
</code>```

actorSearch.js

```<code>import React, { Component } from 'react'
import ActorCard from '../../components/ActorCard'
import SearchBar from '../../components/SearchBar.js'
import Navigation from '../../components/Navigation'
import Styled from 'styled-components'
import SectionTitle from '../../components/SectionTitle'

const SectionContent = Styled.div`
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  font-weight: inherit;
  font-style: inherit;
  padding: 34px 5%;
  border: 0;
  outline: 0;
  background: white;
`

class ActorSearch extends Component {
  constructor(props) {
    super(props)
    this.state = { actors: [] }
    this.searchChangeHandler = this.searchChangeHandler.bind(this)
  }
  unsubscribe = null;

  componentDidMount() {
    const { getActors } = this.props;
    const { unsubscribe } = getActors("denzel washington");

    // Store the unsubscribe promise for later use
    this.unsubscribe = unsubscribe;
  }

  componentWillUnmount() {
    // Unsubscribe the component from the cached data when unmounting
    // eslint-disable-next-line no-unused-expressions
    this.unsubscribe();
  }

  searchChangeHandler(event) {
    const searchTerm = event.target.value
    this.props.getActors(searchTerm)
  }
  render() {
    const { data = [] } = this.props.actors

    return (
      <div>
        <Navigation
          bg="dark"
          theme="dark"
          searchBar={
            <SearchBar type="actors" onChange={this.searchChangeHandler} />
          }
        />
        <SectionContent>
          <SectionTitle title="Actor" />
          {data &&
            data.map((profile, i) => {
              return <ActorCard key={i} index={i + 1} profile={profile} />
            })}
        </SectionContent>
      </div>
    )
  }
}

export default ActorSearch

</code>```

In the final file data is always data = [] instead of the result returned from the api call.

Title: Obtaining data from RTK query endpoint

Body:
I have got the correct response from the api call done by RTK query, the trouble is accessing that data. I have followed the guide here https://redux-toolkit.js.org/rtk-query/usage/usage-without-react-hooks on how to interact with RTK Query when used without React Hooks. These are my relevant files:

actor-slice-api.js

import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'

// Define a service using a base URL and expected endpoints
export const actorApi = createApi({
  reducerPath: 'actorApi',
  baseQuery: fetchBaseQuery({ baseUrl: process.env.REACT_APP_MOVIE_DB_BASE_URL }),
  endpoints: (builder) => ({
    getActorByName: builder.query({
      query: (name) => `search/person?api_key=${process.env.REACT_APP_API_KEY}&query=${name}`,
    }),
  }),
})

// Export hooks for usage in functional components, which are
// auto-generated based on the defined endpoints
export const { useGetActorByNameQuery } = actorApi

store.js

import { configureStore } from '@reduxjs/toolkit'
// Or from '@reduxjs/toolkit/query/react'
import { setupListeners } from '@reduxjs/toolkit/query'
import { actorApi } from '../features/actor/actor-slice-api'

export const store = configureStore({
  reducer: {
    // Add the generated reducer as a specific top-level slice
    [actorApi.reducerPath]: actorApi.reducer,
  },
  // Adding the api middleware enables caching, invalidation, polling,
  // and other useful features of `rtk-query`.
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware().concat(actorApi.middleware),
})

// optional, but required for refetchOnFocus/refetchOnReconnect behaviors
// see `setupListeners` docs - takes an optional callback as the 2nd arg for customization
setupListeners(store.dispatch)

actorSearchContainer.js

import { connect } from 'react-redux'

import ActorSearch from './ActorSearch'

import { actorApi } from '../../features/actor/actor-slice-api'

const mapState = (state) => ({
  actors: actorApi.endpoints.getActorByName.select()(state)
});
const mapDispatch = {
  getActors: actorApi.endpoints.getActorByName.initiate,
};
const connector = connect(mapState, mapDispatch);

export default connector(ActorSearch)

actorSearch.js

import React, { Component } from 'react'
import ActorCard from '../../components/ActorCard'
import SearchBar from '../../components/SearchBar.js'
import Navigation from '../../components/Navigation'
import Styled from 'styled-components'
import SectionTitle from '../../components/SectionTitle'

const SectionContent = Styled.div`
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  font-weight: inherit;
  font-style: inherit;
  padding: 34px 5%;
  border: 0;
  outline: 0;
  background: white;
`

class ActorSearch extends Component {
  constructor(props) {
    super(props)
    this.state = { actors: [] }
    this.searchChangeHandler = this.searchChangeHandler.bind(this)
  }
  unsubscribe = null;

  componentDidMount() {
    const { getActors } = this.props;
    const { unsubscribe } = getActors("denzel washington");

    // Store the unsubscribe promise for later use
    this.unsubscribe = unsubscribe;
  }

  componentWillUnmount() {
    // Unsubscribe the component from the cached data when unmounting
    // eslint-disable-next-line no-unused-expressions
    this.unsubscribe();
  }

  searchChangeHandler(event) {
    const searchTerm = event.target.value
    this.props.getActors(searchTerm)
  }
  render() {
    const { data = [] } = this.props.actors

    return (

        <Navigation
          bg="dark"
          theme="dark"
          searchBar={
            <SearchBar type="actors" onChange={this.searchChangeHandler} />
          }
        />
        <SectionContent>
          <SectionTitle title="Actor" />
          {data &&
            data.map((profile, i) => {
              return <ActorCard key={i} index={i + 1} profile={profile} />
            })}
        </SectionContent>

    )
  }
}

export default ActorSearch

In the final file data is always data = [] instead of the result returned from the api call.


问:
An external coin API "Firebase Functions that save values"
("https://api.coingecko.com/api/v3/coins/marketsvs_currency=usd&order=market_cap_desc&per_page=

100&page=1&sparkline=true")

I want to query the data in real time from the
API I left the link above and save
it to the Firestore database.
I can use firebase functions but
I don't know how to save it to database.
how can i save data continuously

this is the code i wrote so far

/* eslint no-var: 0 /
/ eslint-disable eol-last */

```<code> const functions = require("firebase-functions");
 const cors = require("cors")({origin: true});
 const {default: axios} = require("axios");
 const firebase = require("firebase");
 var db = firebase.firestore();

firebase.initializeApp({
   apiKey: "",
   authDomain: "",
   projectId: "",
   storageBucket: "",
   messagingSenderId: "",
   appId: "",
   measurementId: "",
 });

 exports.news = functions.https.onRequest((request, response) => {
   cors(request, response, () => {
    axios
       .get("https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order =market_cap_
     desc&per_page=100&page=1&sparkline=true")
         .then((res) => {
         response.send(res.data);
    })
    .catch((error) =>{
      response.sendStatus(error);
      });
 });
});
</code>```

Body:
("https://api.coingecko.com/api/v3/coins/marketsvs_currency=usd&order=market_cap_desc&per_page=

100&page=1&sparkline=true")

I want to query the data in real time from the
API I left the link above and save
it to the Firestore database.
I can use firebase functions but
I don't know how to save it to database.
how can i save data continuously

this is the code i wrote so far

/* eslint no-var: 0 /
/ eslint-disable eol-last */

 const functions = require("firebase-functions");
 const cors = require("cors")({origin: true});
 const {default: axios} = require("axios");
 const firebase = require("firebase");
 var db = firebase.firestore();

firebase.initializeApp({
   apiKey: "",
   authDomain: "",
   projectId: "",
   storageBucket: "",
   messagingSenderId: "",
   appId: "",
   measurementId: "",
 });

 exports.news = functions.https.onRequest((request, response) => {
   cors(request, response, () => {
    axios
       .get("https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order =market_cap_
     desc&per_page=100&page=1&sparkline=true")
         .then((res) => {
         response.send(res.data);
    })
    .catch((error) =>{
      response.sendStatus(error);
      });
 });
});


问:
Python multiple modules in the same root folder import error
I'm trying to organise my python project with the following structure:

RootFolder

module1(folder)

submodule1(folder)

pyfile1.py

function test1()

main.py

module2(folder)

submodule2(folder)

pyfile2.py

function test2()

main.py

```
</div>
</div>
</p>
<p>Two separate modules into the same rootFoder.
This is the content of module1.main file:</p>
```import module1.submodule1 as sm

if __name__ == '__main__':
    sm.pyfile1.test1()
```

But when I'm running python -m module1.main I have the following error

module 'module1.submodule1' has no attribute 'pyfile1'

My goal is to have multiple modules with their own main entry points under the same rootFolder.
What is wrong? I don't understand why this is not correct.

Body:
I'm trying to organise my python project with the following structure:

RootFolder

module1(folder)

submodule1(folder)

pyfile1.py

function test1()

main.py

module2(folder)

submodule2(folder)

pyfile2.py

function test2()

main.py

Two separate modules into the same rootFoder.
This is the content of module1.main file:

import module1.submodule1 as sm

if __name__ == '__main__':
    sm.pyfile1.test1()

But when I'm running python -m module1.main I have the following error

module 'module1.submodule1' has no attribute 'pyfile1'

My goal is to have multiple modules with their own main entry points under the same rootFolder.
What is wrong? I don't understand why this is not correct.


问:
Error(message=Capture order failed., reason=LSAT upgrade failed while capturing order.)
I have implemented paypal checkout SDK in my android application and on doing payment i am getting Error(message=Capture order failed., reason=LSAT upgrade failed while capturing order.) issue. I have searched all over the internet many users faced the same problem but there is no particular solution for this problem. Please help with the same.

Below is my code:

```<code>val config = CheckoutConfig(
    application = this.application,
    clientId = CLIENT_ID,
    environment = Environment.SANDBOX,
    currencyCode = CurrencyCode.USD,
    userAction = UserAction.PAY_NOW,
    settingsConfig = SettingsConfig(
        loggingEnabled = true
    ),
    uiConfig = UIConfig(true)
)
PayPalCheckout.setConfig(config)

paypalButton.setup(
    createOrder = CreateOrder { createOrderActions ->
        val order = Order(
                intent = OrderIntent.CAPTURE,
                appContext = AppContext(userAction = UserAction.PAY_NOW),
                purchaseUnitList =
                listOf(
                    PurchaseUnit(
                        amount =
                        Amount(currencyCode = CurrencyCode.USD, value = "10.00")
                    )
                )
            )
        createOrderActions.create(order)
    },
    onApprove = OnApprove { approval ->
        approval.orderActions.capture { captureOrderResult ->
            Log.d("Megha", "CaptureOrderResult: $captureOrderResult")
        }
    },
    onCancel = OnCancel {
        Log.d("Megha", "Buyer canceled the PayPal experience.")
    },
    onError = OnError { errorInfo ->
        Log.d("Megha", "Error: $errorInfo")
    }
)
</code>```

The above error is getting in OnApprove.

I want the payment to be sucessful.

Body:
I have implemented paypal checkout SDK in my android application and on doing payment i am getting Error(message=Capture order failed., reason=LSAT upgrade failed while capturing order.) issue. I have searched all over the internet many users faced the same problem but there is no particular solution for this problem. Please help with the same.

Below is my code:

val config = CheckoutConfig(
    application = this.application,
    clientId = CLIENT_ID,
    environment = Environment.SANDBOX,
    currencyCode = CurrencyCode.USD,
    userAction = UserAction.PAY_NOW,
    settingsConfig = SettingsConfig(
        loggingEnabled = true
    ),
    uiConfig = UIConfig(true)
)
PayPalCheckout.setConfig(config)

paypalButton.setup(
    createOrder = CreateOrder { createOrderActions ->
        val order = Order(
                intent = OrderIntent.CAPTURE,
                appContext = AppContext(userAction = UserAction.PAY_NOW),
                purchaseUnitList =
                listOf(
                    PurchaseUnit(
                        amount =
                        Amount(currencyCode = CurrencyCode.USD, value = "10.00")
                    )
                )
            )
        createOrderActions.create(order)
    },
    onApprove = OnApprove { approval ->
        approval.orderActions.capture { captureOrderResult ->
            Log.d("Megha", "CaptureOrderResult: $captureOrderResult")
        }
    },
    onCancel = OnCancel {
        Log.d("Megha", "Buyer canceled the PayPal experience.")
    },
    onError = OnError { errorInfo ->
        Log.d("Megha", "Error: $errorInfo")
    }
)

The above error is getting in OnApprove.

I want the payment to be sucessful.


问:
I am getting â‚¹ instead of INR symbol when I export data of UI-grid into CSV
I am getting â‚¹ instead of INR symbol when I export data of UI-grid into CSV.
In UTF-7, I am getting â‚¹ instead of INR. But in case of UTF-8, I am not even getting any symbol.
This issue happens in Microsoft Excel.
But when I open the CSV in VSCode, I got INR symbol rendered fine.
Anyone know a way to fix this issue in Excel?

This issue happens in Microsoft Excel.
But when I open the CSV in VSCode, I got INR symbol rendered fine.
Anyone know a way to fix this issue in Excel?


问:
PyQt app doesn't exit when i close the window
`

```<code>from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(534, 423)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(130, 140, 161, 91))
        font = QtGui.QFont()
        font.setPointSize(22)
        self.label.setFont(font)
        self.label.setObjectName("label")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 534, 21))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.menuEdit = QtWidgets.QMenu(self.menubar)
        self.menuEdit.setObjectName("menuEdit")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionCopy = QtWidgets.QAction(MainWindow)
        self.actionCopy.setObjectName("actionCopy")
        self.actionPaste = QtWidgets.QAction(MainWindow)
        self.actionPaste.setObjectName("actionPaste")
        self.actionNew = QtWidgets.QAction(MainWindow)
        self.actionNew.setObjectName("actionNew")
        self.actionSave = QtWidgets.QAction(MainWindow)
        self.actionSave.setObjectName("actionSave")
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionSave)
        self.menuEdit.addAction(self.actionCopy)
        self.menuEdit.addAction(self.actionPaste)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuEdit.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label.setText(_translate("MainWindow", "TextLabel"))
        self.menuFile.setTitle(_translate("MainWindow", "File"))
        self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
        self.actionCopy.setText(_translate("MainWindow", "Copy"))
        self.actionCopy.setStatusTip(_translate("MainWindow", "Copy a file"))
        self.actionCopy.setShortcut(_translate("MainWindow", "Ctrl+C"))
        self.actionPaste.setText(_translate("MainWindow", "Paste"))
        self.actionPaste.setStatusTip(_translate("MainWindow", "Paste a file"))
        self.actionPaste.setShortcut(_translate("MainWindow", "Ctrl+V"))
        self.actionNew.setText(_translate("MainWindow", "New"))
        self.actionNew.setStatusTip(_translate("MainWindow", "Create a new file"))
        self.actionNew.setShortcut(_translate("MainWindow", "Ctrl+N"))
        self.actionSave.setText(_translate("MainWindow", "Save"))
        self.actionSave.setStatusTip(_translate("MainWindow", "Save a file"))
        self.actionSave.setShortcut(_translate("MainWindow", "Ctrl+S"))

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()

    sys.exit(app.exec_())
</code>```

`

I export this code from pyqt designer  but when i clicked close button kernel did not stop, code was running. I could not run other code kernel was stuck on this code in spyder

Whenever i execute the code and close the window, it closes,but the python console in the IDE doesn't return the exit code,

Body:
`

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(534, 423)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(130, 140, 161, 91))
        font = QtGui.QFont()
        font.setPointSize(22)
        self.label.setFont(font)
        self.label.setObjectName("label")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 534, 21))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.menuEdit = QtWidgets.QMenu(self.menubar)
        self.menuEdit.setObjectName("menuEdit")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionCopy = QtWidgets.QAction(MainWindow)
        self.actionCopy.setObjectName("actionCopy")
        self.actionPaste = QtWidgets.QAction(MainWindow)
        self.actionPaste.setObjectName("actionPaste")
        self.actionNew = QtWidgets.QAction(MainWindow)
        self.actionNew.setObjectName("actionNew")
        self.actionSave = QtWidgets.QAction(MainWindow)
        self.actionSave.setObjectName("actionSave")
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionSave)
        self.menuEdit.addAction(self.actionCopy)
        self.menuEdit.addAction(self.actionPaste)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuEdit.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label.setText(_translate("MainWindow", "TextLabel"))
        self.menuFile.setTitle(_translate("MainWindow", "File"))
        self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
        self.actionCopy.setText(_translate("MainWindow", "Copy"))
        self.actionCopy.setStatusTip(_translate("MainWindow", "Copy a file"))
        self.actionCopy.setShortcut(_translate("MainWindow", "Ctrl+C"))
        self.actionPaste.setText(_translate("MainWindow", "Paste"))
        self.actionPaste.setStatusTip(_translate("MainWindow", "Paste a file"))
        self.actionPaste.setShortcut(_translate("MainWindow", "Ctrl+V"))
        self.actionNew.setText(_translate("MainWindow", "New"))
        self.actionNew.setStatusTip(_translate("MainWindow", "Create a new file"))
        self.actionNew.setShortcut(_translate("MainWindow", "Ctrl+N"))
        self.actionSave.setText(_translate("MainWindow", "Save"))
        self.actionSave.setStatusTip(_translate("MainWindow", "Save a file"))
        self.actionSave.setShortcut(_translate("MainWindow", "Ctrl+S"))

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()

    sys.exit(app.exec_())

`

I export this code from pyqt designer  but when i clicked close button kernel did not stop, code was running. I could not run other code kernel was stuck on this code in spyder

Whenever i execute the code and close the window, it closes,but the python console in the IDE doesn't return the exit code,


问:
Substitution of string property from secretKeyRef not working
I am trying to create a CRD carrying the following components

```<code>               args:
                  items:
                    properties:
                      name:
                        type: string
                      value:
                        type: string
                      valueFrom:
                        properties:
                          secretKeyRef:
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                            - key
                            - name
                            type: object
                        type: object
                    required:
                    - name
                    type: object
                  type: array
</code>```

Further, there are spec elements of type string where I am trying to derive value using '{{args.arg-name}}'.

The substitution is not happening. The CR created carrying the unsubstituted value '{{args.arg-name}}' only.

I tried using secretKeyRef via arguments and directly in spec too.. Both are not working.

Body:
I am trying to create a CRD carrying the following components

               args:
                  items:
                    properties:
                      name:
                        type: string
                      value:
                        type: string
                      valueFrom:
                        properties:
                          secretKeyRef:
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                            - key
                            - name
                            type: object
                        type: object
                    required:
                    - name
                    type: object
                  type: array

Further, there are spec elements of type string where I am trying to derive value using '{{args.arg-name}}'.

The substitution is not happening. The CR created carrying the unsubstituted value '{{args.arg-name}}' only.

I tried using secretKeyRef via arguments and directly in spec too.. Both are not working.


问:
Row level security in Apache Kylin
I'm interessting is there a way to implement row level security in Apache Kylin (v4 or v5).
Or, can we get connected user login while hi is quering a cube? I see constant current_user, but i always return sa user login. In apache hive there is a function logged_in_user(), bot not in kylin

I know that in Hadoop ecosystem there is Apache Ranger, but cannot find Row Level Security for apache Kyline like for Apache Hive

Title: Row level security in Apache Kylin


问:
Why is it possible to animate in browser if delay_num of apng file is 0 on web?
If the value corresponding to delayN is 0 in the apng information, I wonder why it is animated normally in the browser

delayN information was referring to js lib (https://github.com/davidmz/apng-js/blob/master/src/library/parser.js#L62)).

The apng-js lib corrects frame.delay to 100, but does the browser do the same?
(https://github.com/davidmz/apng-js/blob/master/src/library/parser.js#L71)
If delayN(delay_num) is 0, shouldn't it not work in browser(chrome)?

I want to know how to handle it in the browser(chrome)

Ref.

https://www.w3.org/TR/png/#fcTL-chunk - delay_num

if the duration of apng is 0, then a crash occurred on the android app. So I was curious about the reason why it is animated normally in the browser.


问:
How to specify decimal separator for all input fields for a given property?
I have a property:

```<code>    public double FluidAddedQty { get; set; }
</code>```

I'm rendering an input field for that property in an Edit view

```<code>  <div class="form-group">
        <label asp-for="FluidAddedQty" class="control-label"></label>
        <input asp-for="FluidAddedQty" class="form-control" />
        <span asp-validation-for="FluidAddedQty" class="text-danger"></span>
    </div>
</code>```

Unfortunately the value is rendered with a comma not a dot as a decimal separator, and I accept dot only on the backend side.

How to make <input> render 100.234 instead of 100,234 ?

Body:
I have a property:

    public double FluidAddedQty { get; set; }

I'm rendering an input field for that property in an Edit view

        <input asp-for="FluidAddedQty" class="form-control" />

Unfortunately the value is rendered with a comma not a dot as a decimal separator, and I accept dot only on the backend side.

How to make <input> render 100.234 instead of 100,234 ?


问:
Python streamlit - subprocess
I have created a streamlit app which runs fine on my local machine. However, I cannot get it running on the streamlit-cloud. In a nutshell my app does the following:

take some user input

create a markdown file from the input ("deck.md")

convert markdown file to html file ("deck.html") using a npx command via subprocess

opens a new tab showing the html file via subprocess

On my local machine I use the following command to do steps 3 and 4:

import subprocess
def markdown2marp(file):

    # Create HTML
    marp_it = f"npx @marp-team/marp-cli@latest --theme custom.css --html {file}"
    file = file.split(".")[0] # remove .md
    proc = subprocess.run([marp_it], shell=True, stdout=subprocess.PIPE)

    # Open HTML in Browser
    subprocess.Popen(['open', f'{file}.html'])
    return proc
```

Now on the streamlit cloud this is not working obviously.

Question: is there a workaround to achieve the described functionality in the streamlit-cloud.

Any help is much appreciated!

Title: Python streamlit - subprocess

Body:
I have created a streamlit app which runs fine on my local machine. However, I cannot get it running on the streamlit-cloud. In a nutshell my app does the following:

take some user input

create a markdown file from the input ("deck.md")

convert markdown file to html file ("deck.html") using a npx command via subprocess

opens a new tab showing the html file via subprocess

On my local machine I use the following command to do steps 3 and 4:

import subprocess
def markdown2marp(file):

    # Create HTML
    marp_it = f"npx @marp-team/marp-cli@latest --theme custom.css --html {file}"
    file = file.split(".")[0] # remove .md
    proc = subprocess.run([marp_it], shell=True, stdout=subprocess.PIPE)

    # Open HTML in Browser
    subprocess.Popen(['open', f'{file}.html'])
    return proc

Now on the streamlit cloud this is not working obviously.

Question: is there a workaround to achieve the described functionality in the streamlit-cloud.

Any help is much appreciated!


问:
Overriding paintEvent for QSpinBox and drawing on top (PyQt5)
I am trying to subclass and draw on top of a QSpinBox by overriding its paintEvent. For example I try to draw an orange rect covering the entire spin box, but it only ends up going on top of some elements, and remains behind others, and moreover I discovered that passing/returning the paintEvent still draws the widget, so I am not sure I understand what is happening here. This is all on Windows btw.

So my precise question is, how do I draw a rect on top of a QSpinBox, such that it paitns on top of everythign else and is part of the subclassed widget's code (not externally painted)?

My second question is how to override the painting such that when the widget is shown it is not drawn at all?

My code:

```<code>
import sys
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QApplication, QSpinBox, QWidget
from PyQt6.QtGui import QPaintEvent, QBrush, QColor, QPainter

class CustomSpinBox(QSpinBox):
    def paintEvent(self, e: QPaintEvent) -> None:
        super().paintEvent(e)
        painter = QPainter(self)
        painter.setBrush(QBrush(QColor('orange'), Qt.BrushStyle.SolidPattern))
        painter.drawRect(0, 0, self.width(), self.height())

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = QWidget()
    window.setGeometry(500, 200, 400, 300)

    spin_box = CustomSpinBox(window)
    spin_box.move(100, 100)
    spin_box.setFixedSize(120, 40)

    window.show()
    app.exec()

</code>```

This paints over the spin box arrows, but below the actual value field. I am not sure how and where this layering order is defined, I assume it is something to do with how SubControls of ComplexControls are handled, but I could not really understand how this works exactly based on the information I found.

Body:
I am trying to subclass and draw on top of a QSpinBox by overriding its paintEvent. For example I try to draw an orange rect covering the entire spin box, but it only ends up going on top of some elements, and remains behind others, and moreover I discovered that passing/returning the paintEvent still draws the widget, so I am not sure I understand what is happening here. This is all on Windows btw.

So my precise question is, how do I draw a rect on top of a QSpinBox, such that it paitns on top of everythign else and is part of the subclassed widget's code (not externally painted)?

My second question is how to override the painting such that when the widget is shown it is not drawn at all?

My code:

import sys
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QApplication, QSpinBox, QWidget
from PyQt6.QtGui import QPaintEvent, QBrush, QColor, QPainter

class CustomSpinBox(QSpinBox):
    def paintEvent(self, e: QPaintEvent) -> None:
        super().paintEvent(e)
        painter = QPainter(self)
        painter.setBrush(QBrush(QColor('orange'), Qt.BrushStyle.SolidPattern))
        painter.drawRect(0, 0, self.width(), self.height())

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = QWidget()
    window.setGeometry(500, 200, 400, 300)

    spin_box = CustomSpinBox(window)
    spin_box.move(100, 100)
    spin_box.setFixedSize(120, 40)

    window.show()
    app.exec()

This paints over the spin box arrows, but below the actual value field. I am not sure how and where this layering order is defined, I assume it is something to do with how SubControls of ComplexControls are handled, but I could not really understand how this works exactly based on the information I found.


问:
Items retrived form servlet are empty
I have this problem where I am trying to get items from an ArrayList from a servlet and display it to a JSP file but when I try to get the variables from the item in the ArrayList, they don't show up.

Here is my JSP file

```<code><?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="com.product.Product"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport"
    content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<script src="https://kit.fontawesome.com/256fd9e75f.js"
    crossorigin="anonymous"></script>
<link rel="stylesheet"
    href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css"
    integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
    crossorigin="anonymous" />
<link rel="stylesheet" href="styles.css" />
<title>Home</title>
<link rel="icon" href="src/ShopLogo.png" type="image/x-icon" />
</head>
<body>
    <nav class="navbar fixed-top navbar-expand-md navbar-light"
        style="background-color: #f15c55"> <span
        class="navbar-brand mb-0 h1">Store</span>
    <button type="button" data-toggle="collapse" data-target="#navbarNav"
        class="navbar-toggler" aria-controls="navbarNav" aria-expanded="false"
        aria-label="Toggle Nav">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNav">
        <ul class="navbar-nav">
            <li class="nav-item active"><a href="ProductLoaderServlet"
                class="nav-link">Home</a></li>
            <li class="nav-item active"><a href="product.html"
                class="nav-link">Top Products</a></li>
            <li class="nav-item active"><a href="cart.html" class="nav-link"><i
                    class="fa-regular fa-cart-shopping"></i></a></li>
        </ul>
    </div>
    </nav>
    <div class="image-overlay">
        <img src="scr/main/resources/Shop.jpg" alt="" />
        <h1 class="centered">Shop</h1>
    </div>
    <%
    ArrayList<Product> products = (ArrayList) request.getAttribute("products");
    for (Product product : products) {
    %>
    <div class="cards">
        <div class="card" style="width: 18rem">
            <img class="card-img-top" src="<%product.getImgUrl();%>" alt="Image" />
            <div class="card-body">
                <h5 class="card-title">
                    <%
                    product.getName();
                    %>
                </h5>
                <a href="#" class="btn btn-primary">Details</a>
            </div>
        </div>
    </div>
    <%
    }
    %>

</body>
</html>
</code>```

and this is what I see My View

I assume that I am able to get the items because I can see 5 cards

But I want to know why my variables such as (name, or the image) aren't showing up

Many Thanks for your help

Title: Items retrived form servlet are empty

Body:
I have this problem where I am trying to get items from an ArrayList from a servlet and display it to a JSP file but when I try to get the variables from the item in the ArrayList, they don't show up.

Here is my JSP file

<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="com.product.Product"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta charset="utf-8" />
<meta name="viewport"
    content="width=device-width, initial-scale=1, shrink-to-fit=no" />

<link rel="stylesheet"
    href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css"
    integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
    crossorigin="anonymous" />
<link rel="stylesheet" href="styles.css" />
<title>Home</title>
<link rel="icon" href="src/ShopLogo.png" type="image/x-icon" />

     Store
    <button type="button" data-toggle="collapse" data-target="#navbarNav"
        class="navbar-toggler" aria-controls="navbarNav" aria-expanded="false"
        aria-label="Toggle Nav">

    </button>

Home

Top Products

Shop

    <%
    ArrayList<Product> products = (ArrayList) request.getAttribute("products");
    for (Product product : products) {
    %>

            <img class="card-img-top" src="<%product.getImgUrl();%>" alt="Image" />

                    <%
                    product.getName();
                    %>

                Details

    <%
    }
    %>

and this is what I see My View

I assume that I am able to get the items because I can see 5 cards

But I want to know why my variables such as (name, or the image) aren't showing up

Many Thanks for your help


问:
How to add the option to manually mark a customer review as "Verified owner" at woocommerce
I receive some reviews of my products from external marketplaces and I usually add them manually at my own shop (with a link to the source).

How can I mark those reviews as "Verified owner" (as they really are). I´m currently adding it via Database but I´m pretty sure it is possible to make it via Admin Dashboard.


问:
Running Traefik docker-proxy behind an apache server, redirecting/proxying some of the requests (or vice versa)
I have a Traefik-2 docker-compose-setup for dev (and one similar for prod) with multiple docker-compose projects containing multiple dc-images, each can be reached locally like this: https://docker-app1.docker-doamin1.loc, incl. HTTPS/SSL-Certs; "dns" via /etc/hosts.

This works like a charm, when the traefik-container is running and the apache is not (port conflict otherwise)

I also have some projects that can be run directly on a local apache (on ubuntu/debian) with configurations in /etc/apache2/sites-available/ like this:

```<code><VirtualHost *:80>
    ServerName apache-app1.apache-domain1.loc

    DocumentRoot /path-to/apache-app1.apache-domain1.loc/public
    <Directory /path-to/apache-app1.apache-domain1.loc/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Require all granted
            Fallbackresource /index.php
    </Directory>

    DirectoryIndex index.php index.html

</VirtualHost>
</code>```

But only if the apache is running and the docker-traefik container ist not, again because of the conflicting 80/443

I need (or want) both Versions to run simultaneously.

My idea was to run the docker-traefik container on different ports (20080/20443) and redirect/ProxyPass from apache to that docker-proxy-container (the other way round would be okay too)

I tried (e.g.)this:

```<code><VirtualHost *:443>
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName docker-app1.docker-doamin1.loc
  ServerAlias www.https://docker-app1.docker-doamin1.loc
  ProxyPass / https://docker-app1.docker-doamin1.loc:20443/
  ProxyPassReverse / https://docker-app1.docker-doamin1.loc:20443/
</VirtualHost>
</code>```

having

```<code>127.0.1.1 docker-app1.docker-doamin1.loc
</code>```

in my /etc/hosts.

But it does not work. And it would be better in each case to have wildcards redirected like this: *.docker-doamin1.loc.

For now all of this is for a local dev environment, so security is not that relevant.

It would be great, if someone had some hints here.

Body:
I have a Traefik-2 docker-compose-setup for dev (and one similar for prod) with multiple docker-compose projects containing multiple dc-images, each can be reached locally like this: https://docker-app1.docker-doamin1.loc, incl. HTTPS/SSL-Certs; "dns" via /etc/hosts.

This works like a charm, when the traefik-container is running and the apache is not (port conflict otherwise)

I also have some projects that can be run directly on a local apache (on ubuntu/debian) with configurations in /etc/apache2/sites-available/ like this:

<VirtualHost *:80>
    ServerName apache-app1.apache-domain1.loc

    DocumentRoot /path-to/apache-app1.apache-domain1.loc/public
    <Directory /path-to/apache-app1.apache-domain1.loc/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Require all granted
            Fallbackresource /index.php
    </Directory>

    DirectoryIndex index.php index.html

</VirtualHost>

But only if the apache is running and the docker-traefik container ist not, again because of the conflicting 80/443

I need (or want) both Versions to run simultaneously.

My idea was to run the docker-traefik container on different ports (20080/20443) and redirect/ProxyPass from apache to that docker-proxy-container (the other way round would be okay too)

I tried (e.g.)this:

<VirtualHost *:443>
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName docker-app1.docker-doamin1.loc
  ServerAlias www.https://docker-app1.docker-doamin1.loc
  ProxyPass / https://docker-app1.docker-doamin1.loc:20443/
  ProxyPassReverse / https://docker-app1.docker-doamin1.loc:20443/
</VirtualHost>

having

127.0.1.1 docker-app1.docker-doamin1.loc

in my /etc/hosts.

But it does not work. And it would be better in each case to have wildcards redirected like this: *.docker-doamin1.loc.

For now all of this is for a local dev environment, so security is not that relevant.

It would be great, if someone had some hints here.


问:
String length calculation and print in emu8086
I start newly learning emu8086, trying to code string length calculation and print, below the code

```<code>name "Text-Size"
code segment;(Segment code)
assume CS:Code, Ds:Code,SS:Code,ES:Code

org 100h
jmp start
start:
     mov ax, code
     mov ds,ax
     mov ah, 9
     mov dx, offset text
     mov bl,0
     int 21h

     count_length:
         mov [dx], al; saving input in string
         inc dx
         inc bl
         cmp dx,ah
         int 21h
         jmp print_lenght:

print_lenght:
    mov dl,bl
    mov ah,2
    add dl,48
    int 21h
ret

text DB 'Hello world',0DH,'$'
code ends
</code>```

I am getting the error: wrong parameters MOV[dx],al probably it s undefined var [dx]

I am expecting to have String length calculated and printed.

Body:
I start newly learning emu8086, trying to code string length calculation and print, below the code

name "Text-Size"
code segment;(Segment code)
assume CS:Code, Ds:Code,SS:Code,ES:Code

org 100h
jmp start
start:
     mov ax, code
     mov ds,ax
     mov ah, 9
     mov dx, offset text
     mov bl,0
     int 21h

     count_length:
         mov [dx], al; saving input in string
         inc dx
         inc bl
         cmp dx,ah
         int 21h
         jmp print_lenght:

print_lenght:
    mov dl,bl
    mov ah,2
    add dl,48
    int 21h
ret

text DB 'Hello world',0DH,'$'
code ends

I am getting the error: wrong parameters MOV[dx],al probably it s undefined var [dx]

I am expecting to have String length calculated and printed.


问:
How to manage balance on Stripe test card?
I want to use 4242 4242 4242 4242 card because it is a verified card. But is there a way I can change the balance of the card and set, for example, 1 dollar balance for it?

My system has verified the card, but I need this card to have low balance in order to get a warning about 'insufficient balance' when the payment process starts.


问:
Can I have multiple data sources in spring without specifying the primary one?
The situation is as follows.
I have a microservice that imports a module. I want that module to be reusable by other microservices and to have it's own data source.

I managed to do this by manually configuring the data source in the module (in a @Config glass), but if I want to import the module, I also have to manually configure my data source in each micro service and specify that it's the primary one.

Is there any way to only configure the module's data base and to let spring do it's automatic config inside the microservices? Thanks, any help is appreaciated.


问:
ScrollView is not smooth when loading HTML content into Label CollectionViewCell
i am making status app where all status are being fetched from my Wordpress Website , all working fine but i found some problem when i fetch html content and showing it in cells using UILabel. when i fetch default excerpt all works fine but when i add tags like

 etc in excerpt then scrollview is not smooth and it stopped sometime , although i don't get any error in Xcode.. this is the code how i convert html to text..

```<code> cell.titleLabel.text = String(htmlEncodedString:newsData[indexPath.row].excerpt.rendered)
</code>```

please help.. thanks

Body:
i am making status app where all status are being fetched from my Wordpress Website , all working fine but i found some problem when i fetch html content and showing it in cells using UILabel. when i fetch default excerpt all works fine but when i add tags like

 etc in excerpt then scrollview is not smooth and it stopped sometime , although i don't get any error in Xcode.. this is the code how i convert html to text..

 cell.titleLabel.text = String(htmlEncodedString:newsData[indexPath.row].excerpt.rendered)

please help.. thanks


问:
Adding microsoft repository in docker
I am trying to install some azxure tools in a docker container and following the instructions here:

https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v3%2Clinux%2Ccsharp%2Cportal%2Cbash&view=form-recog-3.0.0

I setup my docker file as follows:

```<code>FROM --platform=linux/amd64 python:3.9-slim AS build

RUN apt-get update \
    && apt-get install --no-install-recommends -y \
    build-essential \
    curl \
    gpg

RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
RUN mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main"
RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/debian/$(lsb_release -rs | cut -d'.' -f 1)/prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'

RUN apt-get update
</code>```

Now on the last update statement, I am getting the error:

```<code>> [ 7/11] RUN apt-get update:
#10 0.835 E: Malformed entry 1 in list file /etc/apt/sources.list.d/dotnetdev.list (Component)
#10 0.835 E: The list of sources could not be read.
</code>```

I am also not sure how to debug this. I would like to see the output of the generated list file but am unable to echo it during the build process.

EDIT
What was needed was a change in the base image. Changing it to:

```<code>FROM --platform=linux/amd64 python:3.9-slim-bullseye AS build
</code>```

works. I think the older one was based on Alpine.

Title: Adding microsoft repository in docker

Body:
I am trying to install some azxure tools in a docker container and following the instructions here:

https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v3%2Clinux%2Ccsharp%2Cportal%2Cbash&view=form-recog-3.0.0

I setup my docker file as follows:

FROM --platform=linux/amd64 python:3.9-slim AS build

RUN apt-get update \
    && apt-get install --no-install-recommends -y \
    build-essential \
    curl \
    gpg

RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
RUN mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main"
RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/debian/$(lsb_release -rs | cut -d'.' -f 1)/prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'

RUN apt-get update

Now on the last update statement, I am getting the error:

> [ 7/11] RUN apt-get update:
#10 0.835 E: Malformed entry 1 in list file /etc/apt/sources.list.d/dotnetdev.list (Component)
#10 0.835 E: The list of sources could not be read.

I am also not sure how to debug this. I would like to see the output of the generated list file but am unable to echo it during the build process.

EDIT
What was needed was a change in the base image. Changing it to:

FROM --platform=linux/amd64 python:3.9-slim-bullseye AS build

works. I think the older one was based on Alpine.


问:
Display elapse time for automated viewpager change
I have implemented an auto changing viewpager with fragments. What I want is to show elapse time for each fragment. I have implemented it using threads but not working as I expected. On each onPageSelected event, new thread is creating. I think thread are heavy weighted. I tried to interrupt the thread. But no luck. Is this ok or do we have any other way of implementing this?</p>
```<code>private ViewPager2 lifeMainViewPager;
private final Handler sliderHandler = new Handler();
private final int handlerTimeNormal = 1000 * 16;
private final int handlerTimeForHospital = 1000 * 80;
private int viewPagerPosition = 0;

    CommonFragmentData deathFragment = new CommonFragmentData();
    deathFragment.setmFragment(new LifeDeathClaimsFragment());
    deathFragment.setFragmentName(getResources().getString(R.string.life_service_level_claims));

    CommonFragmentData deathFragment2 = new CommonFragmentData();
    deathFragment2.setmFragment(new LifeDeathClaimsFragment());
    deathFragment2.setFragmentName(getResources().getString(R.string.life_service_level_claims));

    CommonFragmentData hospitalFragment = new CommonFragmentData();
    hospitalFragment.setmFragment(new LifeHospitalClaimsFragment());
    hospitalFragment.setFragmentName(getResources().getString(R.string.life_service_level_hospital_claims));

    CommonFragmentData policyFragment = new CommonFragmentData();
    policyFragment.setmFragment(new LifeNewBusinessPolicyFragment());
    policyFragment.setFragmentName(getResources().getString(R.string.life_policy_summary_new_business));

    CommonFragmentData proposalFragment = new CommonFragmentData();
    proposalFragment.setmFragment(new LifeNewBusinessProposalFragment());
    proposalFragment.setFragmentName(getResources().getString(R.string.life_proposal_summary_new_business));

    CommonFragmentData proposalFragment2 = new CommonFragmentData();
    proposalFragment2.setmFragment(new LifeNewBusinessProposalFragment());
    proposalFragment2.setFragmentName(getResources().getString(R.string.life_proposal_summary_new_business));

    LifeMainViewpagerAdapter lifeMainViewPagerAdapter = new LifeMainViewpagerAdapter(getSupportFragmentManager(), getLifecycle());

    // add Fragments in your ViewPagerFragmentAdapter class
    lifeMainViewPagerAdapter.addFragment(deathFragment);
    lifeMainViewPagerAdapter.addFragment(proposalFragment);
    lifeMainViewPagerAdapter.addFragment(policyFragment);
    lifeMainViewPagerAdapter.addFragment(hospitalFragment);
    lifeMainViewPagerAdapter.addFragment(deathFragment2);
    lifeMainViewPagerAdapter.addFragment(proposalFragment2);

    // set Orientation in your ViewPager2
    lifeMainViewPager.setOrientation(ViewPager2.ORIENTATION_HORIZONTAL);
    lifeMainViewPager.setAdapter(lifeMainViewPagerAdapter);

    lifeMainViewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            super.onPageScrolled(position, positionOffset, positionOffsetPixels);
        }

        @Override
        public void onPageSelected(int position) {
            super.onPageSelected(position);
            viewPagerPosition = position;
            headerTitleTxt.setText(lifeMainViewPagerAdapter.getFragmentName(viewPagerPosition));
            sliderHandler.removeCallbacks(sliderRunnable);
            Thread.currentThread().interrupt();
            if (viewPagerPosition == 3) {

                sliderHandler.postDelayed(sliderRunnable, handlerTimeForHospital);
                new Thread(() -> {
                    for (int i = handlerTimeForHospital / 1000; i >= 0; i--) {
                        int finalI = i;
                        runOnUiThread(() -> timerTxt.setText(finalI + ""));
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }).start();

            } else {

                sliderHandler.postDelayed(sliderRunnable, handlerTimeNormal);
                new Thread(() -> {
                    for (int i = handlerTimeNormal / 1000; i >= 0; i--) {
                        int finalI = i;
                        runOnUiThread(() -> timerTxt.setText(finalI + ""));
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }).start();

            }
        }

        @Override
        public void onPageScrollStateChanged(int state) {
            super.onPageScrollStateChanged(state);
            if (state == ViewPager2.SCROLL_STATE_IDLE || state == ViewPager2.SCROLL_STATE_DRAGGING) {
                int curr = lifeMainViewPager.getCurrentItem();
                if (lifeMainViewPager.getAdapter() != null) {
                    int itemCount = lifeMainViewPager.getAdapter().getItemCount();
                    if (curr == itemCount - 1) {
                        lifeMainViewPager.setCurrentItem(1, false);
                    } else if (curr == 0) {
                        lifeMainViewPager.setCurrentItem(itemCount - 2, false);
                    }
                }
            }
        }
    });

    lifeMainViewPager.setCurrentItem(1);

@Override
protected void onResume() {
    super.onResume();
    if (viewPagerPosition == 3) {
        sliderHandler.postDelayed(sliderRunnable, handlerTimeForHospital);
    } else {
        sliderHandler.postDelayed(sliderRunnable, handlerTimeNormal);
    }
}

private final Runnable sliderRunnable = new Runnable() {
    @Override
    public void run() {
        lifeMainViewPager.setCurrentItem(lifeMainViewPager.getCurrentItem() + 1);
    }
};
</code>```

Body:
I have implemented an auto changing viewpager with fragments. What I want is to show elapse time for each fragment. I have implemented it using threads but not working as I expected. On each onPageSelected event, new thread is creating. I think thread are heavy weighted. I tried to interrupt the thread. But no luck. Is this ok or do we have any other way of implementing this?

private ViewPager2 lifeMainViewPager;
private final Handler sliderHandler = new Handler();
private final int handlerTimeNormal = 1000 * 16;
private final int handlerTimeForHospital = 1000 * 80;
private int viewPagerPosition = 0;

    CommonFragmentData deathFragment = new CommonFragmentData();
    deathFragment.setmFragment(new LifeDeathClaimsFragment());
    deathFragment.setFragmentName(getResources().getString(R.string.life_service_level_claims));

    CommonFragmentData deathFragment2 = new CommonFragmentData();
    deathFragment2.setmFragment(new LifeDeathClaimsFragment());
    deathFragment2.setFragmentName(getResources().getString(R.string.life_service_level_claims));

    CommonFragmentData hospitalFragment = new CommonFragmentData();
    hospitalFragment.setmFragment(new LifeHospitalClaimsFragment());
    hospitalFragment.setFragmentName(getResources().getString(R.string.life_service_level_hospital_claims));

    CommonFragmentData policyFragment = new CommonFragmentData();
    policyFragment.setmFragment(new LifeNewBusinessPolicyFragment());
    policyFragment.setFragmentName(getResources().getString(R.string.life_policy_summary_new_business));

    CommonFragmentData proposalFragment = new CommonFragmentData();
    proposalFragment.setmFragment(new LifeNewBusinessProposalFragment());
    proposalFragment.setFragmentName(getResources().getString(R.string.life_proposal_summary_new_business));

    CommonFragmentData proposalFragment2 = new CommonFragmentData();
    proposalFragment2.setmFragment(new LifeNewBusinessProposalFragment());
    proposalFragment2.setFragmentName(getResources().getString(R.string.life_proposal_summary_new_business));

    LifeMainViewpagerAdapter lifeMainViewPagerAdapter = new LifeMainViewpagerAdapter(getSupportFragmentManager(), getLifecycle());

    // add Fragments in your ViewPagerFragmentAdapter class
    lifeMainViewPagerAdapter.addFragment(deathFragment);
    lifeMainViewPagerAdapter.addFragment(proposalFragment);
    lifeMainViewPagerAdapter.addFragment(policyFragment);
    lifeMainViewPagerAdapter.addFragment(hospitalFragment);
    lifeMainViewPagerAdapter.addFragment(deathFragment2);
    lifeMainViewPagerAdapter.addFragment(proposalFragment2);

    // set Orientation in your ViewPager2
    lifeMainViewPager.setOrientation(ViewPager2.ORIENTATION_HORIZONTAL);
    lifeMainViewPager.setAdapter(lifeMainViewPagerAdapter);

    lifeMainViewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            super.onPageScrolled(position, positionOffset, positionOffsetPixels);
        }

        @Override
        public void onPageSelected(int position) {
            super.onPageSelected(position);
            viewPagerPosition = position;
            headerTitleTxt.setText(lifeMainViewPagerAdapter.getFragmentName(viewPagerPosition));
            sliderHandler.removeCallbacks(sliderRunnable);
            Thread.currentThread().interrupt();
            if (viewPagerPosition == 3) {

                sliderHandler.postDelayed(sliderRunnable, handlerTimeForHospital);
                new Thread(() -> {
                    for (int i = handlerTimeForHospital / 1000; i >= 0; i--) {
                        int finalI = i;
                        runOnUiThread(() -> timerTxt.setText(finalI + ""));
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }).start();

            } else {

                sliderHandler.postDelayed(sliderRunnable, handlerTimeNormal);
                new Thread(() -> {
                    for (int i = handlerTimeNormal / 1000; i >= 0; i--) {
                        int finalI = i;
                        runOnUiThread(() -> timerTxt.setText(finalI + ""));
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }).start();

            }
        }

        @Override
        public void onPageScrollStateChanged(int state) {
            super.onPageScrollStateChanged(state);
            if (state == ViewPager2.SCROLL_STATE_IDLE || state == ViewPager2.SCROLL_STATE_DRAGGING) {
                int curr = lifeMainViewPager.getCurrentItem();
                if (lifeMainViewPager.getAdapter() != null) {
                    int itemCount = lifeMainViewPager.getAdapter().getItemCount();
                    if (curr == itemCount - 1) {
                        lifeMainViewPager.setCurrentItem(1, false);
                    } else if (curr == 0) {
                        lifeMainViewPager.setCurrentItem(itemCount - 2, false);
                    }
                }
            }
        }
    });

    lifeMainViewPager.setCurrentItem(1);

@Override
protected void onResume() {
    super.onResume();
    if (viewPagerPosition == 3) {
        sliderHandler.postDelayed(sliderRunnable, handlerTimeForHospital);
    } else {
        sliderHandler.postDelayed(sliderRunnable, handlerTimeNormal);
    }
}

private final Runnable sliderRunnable = new Runnable() {
    @Override
    public void run() {
        lifeMainViewPager.setCurrentItem(lifeMainViewPager.getCurrentItem() + 1);
    }
};


问:
Why laravel localhost API not getting any data while using in the same project but working fine in Postman
I have tried two methods to fetch data from the APIs.

1 file_get_contents() then decoding it.

Guzzle Http::get.

Both of the methods working fine with external API urls but not working when I use the APIs of this same project. Shows this error, but I also have increased the Operation time in the php.ini file to 3600.

enter image description here

How can I use the localhost APIs in the same project?

Tried external APIs and tried increasing the operation time.


问:
Unable to locate table in VS2019 Server explorer using ODT
We have recently upgraded from VS15 to VS19 for a legacy WinForms/DevExpress application, and during this upgrade we decided to use ODT for VS (19.3.3). The Oracle database is running 12c Enterprise Edition Release 12.2.0.1.0.

The issue is that I am unable to find a specific table (let's call it Table A)
When we are trying to modify a Datatable, which uses Table A, it seems like VS19 is trying to validate something behind the scenes, and since ODT isn't able to locate the table which is specified in the query, Visual Studio 2019 just crashes. This happens every time I adjust this specific Datatable.

I have tried to create a new dataset, with no success. Table A is the only table, as of now, which isn't available in the table explorer. For reference the table has 170 colums, I don't think that is an issue, as we have tables which work, with more colums.

Is there any way to force VS not to validate the query given? Or some other work around?


问:
How can I debug and fix, My app crash when openning on ios12?
My app crash when openning on ios12，how to debug，fix it.

I try to download app from app store，My app crash when openning on ios12. But, when I debug it did not crash.


问:
Expo Material Bottom Tabs Navigator doesn't work -> showing default BottomNavigation from React-Native-Paper
I've been trying to create a normal material bottom tabs navigator and it just doesnt want to work. I also tried another identical code I had and there it works like it should, but with this code the Material bottom Tabs Navigator shows the BottomNavigation from React-Native-Paper. Is there any help?Anything i have to change?

```<code>
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import AuthScreen from './screens/AuthScreen';
import HomeScreen from './screens/HomeScreen';
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { userAuthStateListener } from './redux/actions/auth';

const Stack = createNativeStackNavigator()

export default function Main() {

    const currenUserObject = useSelector(state => state.auth) // access data from redux from here

    const dispatch = useDispatch()
    useEffect(() => {
        dispatch(userAuthStateListener());
    }, []);

    if (currenUserObject == null) {
        console.log("nothing in user obj")
    } else {
        console.log("this prints" + { currenUserObject })
    }

    return (
        <NavigationContainer>
            <Stack.Navigator>
                {currenUserObject.currentUser == null ?
                    <Stack.Screen name='AuthScreen' component={AuthScreen} options={{ headerShown: false }} />
                    :
                    <>
                        <Stack.Screen name='hb' component={HomeScreen} options={{ headerShown: false }} />
                    </>
                }
            </Stack.Navigator>
        </NavigationContainer>
    )
}

</code>```

And the HomeScreen should have the material bottom tabs navigator.

```<code>import { View, Text, StyleSheet, SafeAreaView } from 'react-native'
import React from 'react'
import { Feather } from '@expo/vector-icons'
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';

const Tab = createMaterialBottomTabNavigator();

const Test = () => {
  return (
    <View style={{backgroundColor:"blue"}}>
      <Text>Test</Text>
    </View>
  )
}
//options={{ tabBarIcon: ({ color }) => (<Feather name="home" size={24} color={color} />)}}
//barStyle={{ backgroundColor: "black" }}
export default function HomeScreen() {
  return (
    <Tab.Navigator barStyle={{ backgroundColor: 'black' }} activeColor="white" shifting={true}>
      <Tab.Screen name="Home" component={Test}  />
      <Tab.Screen name="Search" component={Test} options={{ tabBarColor:"white",tabBarBadge:false, tabBarIcon: ({ color }) => (<Feather name="search" size={24} color={color} />) }} />
      <Tab.Screen name="Post" component={Test} options={{ tabBarIcon: ({ color }) => (<Feather name="plus-square" size={24} color={color} />) }} />
      <Tab.Screen name="Chat" component={Test} options={{ tabBarIcon: ({ color }) => (<Feather name="message-square" size={24} color={color} />) }} />
      <Tab.Screen name="Me" component={Test} options={{ tabBarIcon: ({ color }) => (<Feather name="user" size={24} color={color} />) }} />
    </Tab.Navigator>
  )
}
</code>```

But it doesnt show the right material-bottom-tabs-navigator.
It shows this:
Image of wrong navigator

Show right material-bottom-tabs-navigator but it actually shows the bottomnavigation from react-native-paper

Body:
I've been trying to create a normal material bottom tabs navigator and it just doesnt want to work. I also tried another identical code I had and there it works like it should, but with this code the Material bottom Tabs Navigator shows the BottomNavigation from React-Native-Paper. Is there any help?Anything i have to change?

import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import AuthScreen from './screens/AuthScreen';
import HomeScreen from './screens/HomeScreen';
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { userAuthStateListener } from './redux/actions/auth';

const Stack = createNativeStackNavigator()

export default function Main() {

    const currenUserObject = useSelector(state => state.auth) // access data from redux from here

    const dispatch = useDispatch()
    useEffect(() => {
        dispatch(userAuthStateListener());
    }, []);

    if (currenUserObject == null) {
        console.log("nothing in user obj")
    } else {
        console.log("this prints" + { currenUserObject })
    }

    return (
        <NavigationContainer>
            <Stack.Navigator>
                {currenUserObject.currentUser == null ?
                    <Stack.Screen name='AuthScreen' component={AuthScreen} options={{ headerShown: false }} />
                    :
                    <>
                        <Stack.Screen name='hb' component={HomeScreen} options={{ headerShown: false }} />
                    </>
                }
            </Stack.Navigator>
        </NavigationContainer>
    )
}

And the HomeScreen should have the material bottom tabs navigator.

import { View, Text, StyleSheet, SafeAreaView } from 'react-native'
import React from 'react'
import { Feather } from '@expo/vector-icons'
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';

const Tab = createMaterialBottomTabNavigator();

const Test = () => {
  return (
    <View style={{backgroundColor:"blue"}}>
      <Text>Test</Text>
    </View>
  )
}
//options={{ tabBarIcon: ({ color }) => (<Feather name="home" size={24} color={color} />)}}
//barStyle={{ backgroundColor: "black" }}
export default function HomeScreen() {
  return (
    <Tab.Navigator barStyle={{ backgroundColor: 'black' }} activeColor="white" shifting={true}>
      <Tab.Screen name="Home" component={Test}  />
      <Tab.Screen name="Search" component={Test} options={{ tabBarColor:"white",tabBarBadge:false, tabBarIcon: ({ color }) => (<Feather name="search" size={24} color={color} />) }} />
      <Tab.Screen name="Post" component={Test} options={{ tabBarIcon: ({ color }) => (<Feather name="plus-square" size={24} color={color} />) }} />
      <Tab.Screen name="Chat" component={Test} options={{ tabBarIcon: ({ color }) => (<Feather name="message-square" size={24} color={color} />) }} />
      <Tab.Screen name="Me" component={Test} options={{ tabBarIcon: ({ color }) => (<Feather name="user" size={24} color={color} />) }} />
    </Tab.Navigator>
  )
}

But it doesnt show the right material-bottom-tabs-navigator.
It shows this:
Image of wrong navigator

Show right material-bottom-tabs-navigator but it actually shows the bottomnavigation from react-native-paper


问:
How can I pass a function as a parameter in C++?
I'm trying to make this code work, and I was given a binary tree .cpp and header, with objects Billete. How can I make a function to call another static function, to print all of its Billete? I am trying to make it work but I don't seem to understand function pointers. Thank you so much!

arbolABB.h

```<code>class ArbolABB{
  private:
   //// Clase local de Lista para Nodo de ArbolBinario:
   class Nodo {
     public:
      // Constructor:
      Nodo(Billete dat, Nodo *izq=NULL, Nodo *der=NULL) :
        dato(dat), izquierdo(izq), derecho(der) {}
      // Miembros:
      Billete dato;
      Nodo *izquierdo;
      Nodo *derecho;
   };

   // Punteros de la lista, para cabeza y nodo actual:
   Nodo *raiz;
   Nodo *actual;
   int contador;
   int altura;

  public:
   void InOrden(void (*func)(Billete&) , Nodo *nodo=NULL, bool r=true);
   //etc
</code>```

arbolABB.cpp

```<code>// Recorrido de árbol en inorden, aplicamos la función func, que tiene
// el prototipo:
// void func(Billete&);
void ArbolABB::InOrden(void (*func)(Billete&) , Nodo *nodo, bool r)
{
   if(r) nodo = raiz;
   if(nodo->izquierdo) InOrden(func, nodo->izquierdo, false);
   func(nodo->dato);
   if(nodo->derecho) InOrden(func, nodo->derecho, false);
}

void ArbolABB::mostrar(){
    InOrden(&Billete::mostrar); //here is where I'm failing to make it work
    }
</code>```

Billete.cpp

```<code>void Billete::mostrar(){
    cout << "________________________________________________________" << endl;
    cout << "PNR: " << PNR << "\t\t\t\t\t\t|"<< endl;
    cout << "Nombre: " << nombre << "\t\t\t\t|"<< endl;
    cout << "DNI: " << DNI << "\t\t\t\t\t\t|"<<endl;
    cout << "Vuelo: " << vuelo.idVuelo << "\t Origen: " << vuelo.origen << "\t Destino: " << vuelo.destino << "\t\t|" <<endl;
    cout << "Fecha: " << vuelo.fecha << "\t Hora de salida: " << vuelo.hora << "\t\t\t|"<<endl;
    cout << "Asiento: " << asiento << "\t\t\t\t\t\t|"<<endl;
    cout << "________________________________________________________|" << endl;
    if (!equipaje.esVacia()){
        cout << "\nListado de equipaje: \n"<< "--------------------"<< endl;
        equipaje.mostrar();
    }else{
        cout << "Pasajero sin equipaje." << endl;
    }
    cout << "________________________________________________________\n\n\n" << endl;
}
</code>```

Body:
I'm trying to make this code work, and I was given a binary tree .cpp and header, with objects Billete. How can I make a function to call another static function, to print all of its Billete? I am trying to make it work but I don't seem to understand function pointers. Thank you so much!

arbolABB.h

class ArbolABB{
  private:
   //// Clase local de Lista para Nodo de ArbolBinario:
   class Nodo {
     public:
      // Constructor:
      Nodo(Billete dat, Nodo *izq=NULL, Nodo *der=NULL) :
        dato(dat), izquierdo(izq), derecho(der) {}
      // Miembros:
      Billete dato;
      Nodo *izquierdo;
      Nodo *derecho;
   };

   // Punteros de la lista, para cabeza y nodo actual:
   Nodo *raiz;
   Nodo *actual;
   int contador;
   int altura;

  public:
   void InOrden(void (*func)(Billete&) , Nodo *nodo=NULL, bool r=true);
   //etc

arbolABB.cpp

// Recorrido de árbol en inorden, aplicamos la función func, que tiene
// el prototipo:
// void func(Billete&);
void ArbolABB::InOrden(void (*func)(Billete&) , Nodo *nodo, bool r)
{
   if(r) nodo = raiz;
   if(nodo->izquierdo) InOrden(func, nodo->izquierdo, false);
   func(nodo->dato);
   if(nodo->derecho) InOrden(func, nodo->derecho, false);
}

void ArbolABB::mostrar(){
    InOrden(&Billete::mostrar); //here is where I'm failing to make it work
    }

Billete.cpp

void Billete::mostrar(){
    cout << "________________________________________________________" << endl;
    cout << "PNR: " << PNR << "\t\t\t\t\t\t|"<< endl;
    cout << "Nombre: " << nombre << "\t\t\t\t|"<< endl;
    cout << "DNI: " << DNI << "\t\t\t\t\t\t|"<<endl;
    cout << "Vuelo: " << vuelo.idVuelo << "\t Origen: " << vuelo.origen << "\t Destino: " << vuelo.destino << "\t\t|" <<endl;
    cout << "Fecha: " << vuelo.fecha << "\t Hora de salida: " << vuelo.hora << "\t\t\t|"<<endl;
    cout << "Asiento: " << asiento << "\t\t\t\t\t\t|"<<endl;
    cout << "________________________________________________________|" << endl;
    if (!equipaje.esVacia()){
        cout << "\nListado de equipaje: \n"<< "--------------------"<< endl;
        equipaje.mostrar();
    }else{
        cout << "Pasajero sin equipaje." << endl;
    }
    cout << "________________________________________________________\n\n\n" << endl;
}


问:
SSO using Microsoft.Identity.Web.UI between multiple App Services in Azure
In Azure we have multiple App Services all running .net core 6 with Microsoft.Identity.Web.UI and users in a AAD B2B. All apps are accessed from the same domain, but on separate routes like: app1.com/portal app2.com/management.

When users access these apps they are authenticated against the AD using OpenId. But they need to be authenticated for each app they access. How can we reuse the access token across the apps, so sign in only needs to be done 1 once per session and not per app service?

In Startup.cs we have under ConfigureServices():

```<code>services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
  .AddCookie()
  .AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"), OpenIdConnectDefaults.AuthenticationScheme, "App1");
</code>```

the cookie name is different across the App Services.

And in Configure() we have:

```<code>app.UseCookiePolicy();
app.UseAuthentication();
app.UseAuthorization();
</code>```

What needs to be added to enable sharing the session?

Body:
In Azure we have multiple App Services all running .net core 6 with Microsoft.Identity.Web.UI and users in a AAD B2B. All apps are accessed from the same domain, but on separate routes like: app1.com/portal app2.com/management.

When users access these apps they are authenticated against the AD using OpenId. But they need to be authenticated for each app they access. How can we reuse the access token across the apps, so sign in only needs to be done 1 once per session and not per app service?

In Startup.cs we have under ConfigureServices():

services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
  .AddCookie()
  .AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"), OpenIdConnectDefaults.AuthenticationScheme, "App1");

the cookie name is different across the App Services.

And in Configure() we have:

app.UseCookiePolicy();
app.UseAuthentication();
app.UseAuthorization();

What needs to be added to enable sharing the session?


问:
Does the rsync command will end once it is completed
I'm running a command to sync the folder.

I would like to know whether the rsync command will keep on running even if all files are synced.

Since I'm having script

```<code>#!/bin/bash

function simSync {

ssh zsclxengcc1d mkdir -p $RESULTS
rsync -avzh --include=d3plot* --include=binout* $SCRATCH/ HOST1:$RESULTS

}
# Sync the Files
simSync

#Run simulation
mpirun   -report-bindings  $SOLVER ncpus=$NCPU i=$IFILE memory=${MEMORY}m memory2=$(($MEMORY/$NCPU))m && cleanup
</code>```

Does this code start the Sync process and run simulation immediately.
I need to end up all progress once run simulation command is completed

Body:
I'm running a command to sync the folder.

I would like to know whether the rsync command will keep on running even if all files are synced.

Since I'm having script

#!/bin/bash

function simSync {

ssh zsclxengcc1d mkdir -p $RESULTS
rsync -avzh --include=d3plot* --include=binout* $SCRATCH/ HOST1:$RESULTS

}
# Sync the Files
simSync

#Run simulation
mpirun   -report-bindings  $SOLVER ncpus=$NCPU i=$IFILE memory=${MEMORY}m memory2=$(($MEMORY/$NCPU))m && cleanup

Does this code start the Sync process and run simulation immediately.
I need to end up all progress once run simulation command is completed


问:
Connection refused when trying to push to Harbor registry
We have an internal Harbor registry setup on a CentOS server for storing the Docker images. It is accessed through a SSL URL.
The SSL configuration is done on the load balancer. The server where Harbor registry is setup just has the basic application configuration with the http port defined as 5044.
When we try to push any images from any remote machine using the ip:port combination, it works fine.
However, when using the SSL URL, it fails with the below error:

dial tcp <load balancer ip>:80: connect: connection refused

We haven't configured port 80 to be used explicitly. We checked the Harbor and nginx configuration files but doesn't seem like we have port 80 mentioned anywhere.

The load balancer is configured to use  and port 5044.

Also, the pull works as expected with ip:port and SSL URL both.

Can someone help on what might we be missing in the configuration?

Thank you!


问:
integrating unity with android studio
Can someone please me on how to solve my problem, when I try to run my project on android studio and click the button that integrates the unity it's just keep on going back to the home screen or keeps stoping the app. Thank you, I hope someone can help me with this cause it's for our school requirement.

I keep on searching for answers in the internet and even checking the possible errors but i'm still confuse with this one.

Title: integrating unity with android studio