问:
How to create a button that slides out when the mouse hovers over it? (Unity2D)
I have a button that I want to slide out from Y position 295 to 205 when the mouse hovers/touches the button, than slides back if the mouse no longer touches the button.

This is my code, the script is on the button I want to move, I tried using RaycastHit2Ds to detect mouse position.

```<code>
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class SlideButton : MonoBehaviour
{
    public Button button;
    float slideDownY = 205f;
    float slideUpY = 295f;
    public float slideSpeed = 5f;

    public RectTransform rectTransform;

    private void Start()
    {
        button.onClick.AddListener(OnButtonClick);
    }
    // Update is called once per frame
    void Update()
    {
        RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

        if(hit.collider != null)
        {
            Debug.Log("success");
            rectTransform.anchoredPosition = Vector2.Lerp(rectTransform.anchoredPosition, new Vector2(rectTransform.anchoredPosition.x, slideDownY), slideSpeed * Time.deltaTime);
        }
        else
        {
            rectTransform.anchoredPosition = Vector2.Lerp(rectTransform.anchoredPosition, new Vector2(rectTransform.anchoredPosition.x, slideUpY), slideSpeed * Time.deltaTime);
        }
    }

    void OnButtonClick()
    {
        // add after slider works
    }
}

</code>```

I have also tried OnMouseEnter/OnMouseExit and OnPointerEnter/OnPointerExit but none have worked either. I haven't found anything that has solved this problem, other answers are all in different languages or not specific enough to help.

Body:
I have a button that I want to slide out from Y position 295 to 205 when the mouse hovers/touches the button, than slides back if the mouse no longer touches the button.

This is my code, the script is on the button I want to move, I tried using RaycastHit2Ds to detect mouse position.

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class SlideButton : MonoBehaviour
{
    public Button button;
    float slideDownY = 205f;
    float slideUpY = 295f;
    public float slideSpeed = 5f;

    public RectTransform rectTransform;

    private void Start()
    {
        button.onClick.AddListener(OnButtonClick);
    }
    // Update is called once per frame
    void Update()
    {
        RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

        if(hit.collider != null)
        {
            Debug.Log("success");
            rectTransform.anchoredPosition = Vector2.Lerp(rectTransform.anchoredPosition, new Vector2(rectTransform.anchoredPosition.x, slideDownY), slideSpeed * Time.deltaTime);
        }
        else
        {
            rectTransform.anchoredPosition = Vector2.Lerp(rectTransform.anchoredPosition, new Vector2(rectTransform.anchoredPosition.x, slideUpY), slideSpeed * Time.deltaTime);
        }
    }

    void OnButtonClick()
    {
        // add after slider works
    }
}

I have also tried OnMouseEnter/OnMouseExit and OnPointerEnter/OnPointerExit but none have worked either. I haven't found anything that has solved this problem, other answers are all in different languages or not specific enough to help.


来源: stackexchange

问:
WSO2 ESB does not return ERROR_MESSAGE, but it does inside ERROR_RESPONSE
I am implementing failure sequence for a service in WSO2 EBS, but it just never return ERROR_MESSAGE or other failure properties like ERROR_REASON.

However it does return this fields inside $ctx:ERROR_RESPONSE.

how come is this possible? any clue how to extract this fields outside ERROR_RESPONSE?

```<code><?xml version="1.0" encoding="UTF-8"?>
<sequence name="Failure" statistics="enable" trace="enable" xmlns="http://ws.apache.org/ns/synapse">
    <log description="Log error details in case of failure" level="full">
        <property name="MESSAGE" value="An unexpected error occurred."/>

        <property expression="$ctx:ERROR_CODE" name="ERROR_CODE"/>
        <property expression="$ctx:ERROR_RESPONSE" name="ERROR_RESPONSE"/>
        <property expression="$ctx:ERROR_MESSAGE" name="ERROR_MESSAGE"/>

    </log>
    <payloadFactory description="Build payload with error information" media-type="json">
        <format>
            {
            "status": "An unexpected error occurred.",

            "code": $1,
            "response": $2,
            "message": $3,

             }

        </format>
        <args>
            <arg evaluator="xml" expression="$ctx:ERROR_CODE"/>
            <arg evaluator="xml" expression="$ctx:ERROR_RESPONSE"/>
            <arg evaluator="xml" expression="$ctx:ERROR_MESSAGE"/>

        </args>
    </payloadFactory>
    <respond description="Respond back to client with custom error payload"/>
</sequence>
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am implementing failure sequence for a service in WSO2 EBS, but it just never return ERROR_MESSAGE or other failure properties like ERROR_REASON.

However it does return this fields inside $ctx:ERROR_RESPONSE.

how come is this possible? any clue how to extract this fields outside ERROR_RESPONSE?

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="Failure" statistics="enable" trace="enable" xmlns="http://ws.apache.org/ns/synapse">
    <log description="Log error details in case of failure" level="full">
        <property name="MESSAGE" value="An unexpected error occurred."/>

        <property expression="$ctx:ERROR_CODE" name="ERROR_CODE"/>
        <property expression="$ctx:ERROR_RESPONSE" name="ERROR_RESPONSE"/>
        <property expression="$ctx:ERROR_MESSAGE" name="ERROR_MESSAGE"/>

    </log>
    <payloadFactory description="Build payload with error information" media-type="json">
        <format>
            {
            "status": "An unexpected error occurred.",

            "code": $1,
            "response": $2,
            "message": $3,

             }

        </format>
        <args>
            <arg evaluator="xml" expression="$ctx:ERROR_CODE"/>
            <arg evaluator="xml" expression="$ctx:ERROR_RESPONSE"/>
            <arg evaluator="xml" expression="$ctx:ERROR_MESSAGE"/>

        </args>
    </payloadFactory>
    <respond description="Respond back to client with custom error payload"/>
</sequence>


问:
I am getting below error in jenkins. how to resolve the error?

I created an ec2 instance in aws . And installed jenkins in it through mobaxterm after installation of jenkins i am getting an error while adding git repo (an internal error occurred during form field validation (http:500). please reload the page and if the problem persists ask the administrator.)


问:
Why edgedriver is crashed while chromedriver / firefoxdriver are working fine?
Why edgedriver is crashed while chromedriver / firefoxdriver are working fine?

Here are the error message

```<code>Only local connections are allowed.
Please see https://aka.ms/WebDriverSecurity for suggestions on keeping Microsoft Edge WebDriver safe.

Microsoft Edge WebDriver was started successfully.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Microsoft Edge failed to start: crashed.
  (chrome not reachable)
  (The process started from msedge location /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge is no longer running, so msedgedriver is assuming that msedge has crashed.)
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: 'Alans-MacBook-Pro.local', ip: 'fe80:0:0:0:1c1d:b4b6:77a2:3994%en0', os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '12.3', java.version: '19.0.1'
Driver info: org.openqa.selenium.edge.EdgeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [--no-sandbox, --disable-dev-shm-usage], extensions: []}}], desiredCapabilities=Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [--no-sandbox, --disable-dev-shm-usage], extensions: []}}}]
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:144)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:547)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:157)
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:101)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:54)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:46)
    at testingdriver.main(testingdriver.java:29)
</code>```

Here is my pom.xml

```<code>\<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --\>
\<dependency\>
\<groupId\>org.seleniumhq.selenium\</groupId\>
\<artifactId\>selenium-java\</artifactId\>
\<version\>4.4.0\</version\>
\</dependency\>

\<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager --\>
\<dependency\>
\<groupId\>io.github.bonigarcia\</groupId\>
\<artifactId\>webdrivermanager\</artifactId\>
\<version\>5.3.1\</version\>
\</dependency\>
</code>```

and here is my code

```<code>WebDriverManager.edgedriver().setup();

        EdgeOptions options = new EdgeOptions();

        options.addArguments("--no-sandbox");
        options.addArguments("--disable-dev-shm-usage");
        WebDriver driver = new EdgeDriver(options);

        driver.get("https://google.com");
        System.out.println("success");
        driver.quit();
</code>```

I have tried almost every method that shared in the web. However, I dont manage to see any possible reason this is happening.

I tried with downloading edgedriver from the official microsoft web and declare the path in the
System.setProperty("webdriver.edge.driver","//Users/alanliew/Desktop/Automation/Selenium-Java/CGWeb/untitled2/msedgedriver");

but the same error happen.

Anyone able to find solution to this ?

Body:
Why edgedriver is crashed while chromedriver / firefoxdriver are working fine?

Here are the error message

Only local connections are allowed.
Please see https://aka.ms/WebDriverSecurity for suggestions on keeping Microsoft Edge WebDriver safe.

Microsoft Edge WebDriver was started successfully.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Microsoft Edge failed to start: crashed.
  (chrome not reachable)
  (The process started from msedge location /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge is no longer running, so msedgedriver is assuming that msedge has crashed.)
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: 'Alans-MacBook-Pro.local', ip: 'fe80:0:0:0:1c1d:b4b6:77a2:3994%en0', os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '12.3', java.version: '19.0.1'
Driver info: org.openqa.selenium.edge.EdgeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [--no-sandbox, --disable-dev-shm-usage], extensions: []}}], desiredCapabilities=Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [--no-sandbox, --disable-dev-shm-usage], extensions: []}}}]
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:144)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:547)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:157)
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:101)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:54)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:46)
    at testingdriver.main(testingdriver.java:29)

Here is my pom.xml

\


问:
IntegrityError at /station/Add/ (1048, "Column 'user_type_id' cannot be null")
I'm trying to create new station using generic views
when i try without user forigen key I received this error
IntegrityError at /station/Add/
(1048, "Column 'user_type_id' cannot be null")

if i tried without user_type and submit button cilck form automatic refresh and same clean
Here is my code: station/views.py

```<code>class StationCreateView(LoginRequiredMixin, CreateView):
    model = Station
    fields = ('station_name', 'station_address','connectors','status', 'start_time','end_time','open_day',
                'state', 'city', 'area', 'user')
    template_name = 'owner/add_station.html'

    def form_valid(self, form):
        form.instance.user = self.request.user
        return super().form_valid(form)

</code>```
```<code>class Station(models.Model):
STAUTUS_CHOICE = (
    ("ACTIVE", "ACTIVE"),
    ("INACTIVE", "INACTIVE")
    )
DAY_CHOICE = (
    ("MONDAY", "MONDAY"),
    ("Tuesday", "TUESDAY"),
    ("WEDNESDAY", "WEDNESDAY"),
    ("THURSDAY", "THURSDAY"),
    ("FRIDAY", "FRIDAY"),
    ("SATURDAY", "SATURDAY"),
    ("SUNDAY", "SUNDAY"),
    ("ALL DAY", "ALL DAY")
)
station_id = models.AutoField(primary_key=True)
state = models.ForeignKey(State, on_delete=models.CASCADE)
city = models.ForeignKey(City, on_delete=models.CASCADE)
area = models.ForeignKey(Area, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
station_name = models.CharField(max_length=50)
station_address = models.CharField(max_length=255)
connectors = models.CharField(max_length=50)
status = models.CharField(max_length=20, choices=STAUTUS_CHOICE, default="ACTIVE")
start_time = models.TimeField(null=True)
end_time = models.TimeField(null=True)
open_day = models.CharField(max_length=20, choices=DAY_CHOICE, default="ALL DAY")
# give_feedback = models.CharField(max_length=255, null=True)
deleted = models.IntegerField(default=0, unique=False)
</code>```

here is my code: add_station.html

```<code> <form method="post" action="" novalidate>
                                            {% csrf_token %}
                                            <div class="form-row">

                                            <div class="form-group col-md-12 mb-0">
                                                {{ form.station_name|as_crispy_field }}
                                            </div>

                                            <div class="form-group col-md-12 mb-0">
                                                {{ form.station_address|as_crispy_field }}
                                            </div>

                                            <div class="form-group col-md-6 mb-0">
                                                {{ form.connectors|as_crispy_field }}
                                            </div>

                                            <div class="form-group col-md-6 mb-0">
                                                {{ form.status|as_crispy_field }}
                                            </div>

                                            <div class="form-group col-md-6 mb-0">
                                                {{ form.start_time|as_crispy_field }}
                                            </div>

                                            <div class="form-group col-md-6 mb-0">
                                                {{ form.end_time|as_crispy_field }}
                                            </div>

                                            <div class="form-group col-md-6 mb-0">
                                                {{ form.open_day|as_crispy_field }}
                                            </div>

                                            <div class="form-group col-md-6 mb-0">
                                                {{ form.state|as_crispy_field }}
                                            </div>

                                            <div class="form-group col-md-6 mb-0">
                                                {{ form.city|as_crispy_field }}
                                            </div>

                                            <div class="form-group col-md-6 mb-0">
                                                {{ form.area|as_crispy_field }}
                                            </div>

                                            <button type="submit" class="w-full rounded-full bg-red-gradient p-3 text-white font-bold hover:ring">Add Station</button>
                                            </div>
                                        </form>
</code>```

Body:
I'm trying to create new station using generic views
when i try without user forigen key I received this error
IntegrityError at /station/Add/
(1048, "Column 'user_type_id' cannot be null")

if i tried without user_type and submit button cilck form automatic refresh and same clean
Here is my code: station/views.py

class StationCreateView(LoginRequiredMixin, CreateView):
    model = Station
    fields = ('station_name', 'station_address','connectors','status', 'start_time','end_time','open_day',
                'state', 'city', 'area', 'user')
    template_name = 'owner/add_station.html'

    def form_valid(self, form):
        form.instance.user = self.request.user
        return super().form_valid(form)

class Station(models.Model):
STAUTUS_CHOICE = (
    ("ACTIVE", "ACTIVE"),
    ("INACTIVE", "INACTIVE")
    )
DAY_CHOICE = (
    ("MONDAY", "MONDAY"),
    ("Tuesday", "TUESDAY"),
    ("WEDNESDAY", "WEDNESDAY"),
    ("THURSDAY", "THURSDAY"),
    ("FRIDAY", "FRIDAY"),
    ("SATURDAY", "SATURDAY"),
    ("SUNDAY", "SUNDAY"),
    ("ALL DAY", "ALL DAY")
)
station_id = models.AutoField(primary_key=True)
state = models.ForeignKey(State, on_delete=models.CASCADE)
city = models.ForeignKey(City, on_delete=models.CASCADE)
area = models.ForeignKey(Area, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
station_name = models.CharField(max_length=50)
station_address = models.CharField(max_length=255)
connectors = models.CharField(max_length=50)
status = models.CharField(max_length=20, choices=STAUTUS_CHOICE, default="ACTIVE")
start_time = models.TimeField(null=True)
end_time = models.TimeField(null=True)
open_day = models.CharField(max_length=20, choices=DAY_CHOICE, default="ALL DAY")
# give_feedback = models.CharField(max_length=255, null=True)
deleted = models.IntegerField(default=0, unique=False)

here is my code: add_station.html

 <form method="post" action="" novalidate>
                                            {% csrf_token %}

                                                {{ form.station_name|as_crispy_field }}

                                                {{ form.station_address|as_crispy_field }}

                                                {{ form.connectors|as_crispy_field }}

                                                {{ form.status|as_crispy_field }}

                                                {{ form.start_time|as_crispy_field }}

                                                {{ form.end_time|as_crispy_field }}

                                                {{ form.open_day|as_crispy_field }}

                                                {{ form.state|as_crispy_field }}

                                                {{ form.city|as_crispy_field }}

                                                {{ form.area|as_crispy_field }}

                                            <button type="submit" class="w-full rounded-full bg-red-gradient p-3 text-white font-bold hover:ring">Add Station</button>

                                        </form>


问:
OAuth2Strategy requires a authorizationURL option
```<code>[Nest] 8860  - 13/01/2023, 11:50:03 am   ERROR [ExceptionHandler] OAuth2Strategy requires a authorizationURL option
TypeError: OAuth2Strategy requires a authorizationURL option
    at new OAuth2Strategy
</code>```

google strategy :

```<code>import { Injectable } from "@nestjs/common";
import { PassportStrategy } from "@nestjs/passport";
import { Profile } from "passport";
import { VerifyCallback, Strategy } from "passport-oauth2";

@Injectable()
export class GoogleStrategy extends PassportStrategy(Strategy) {
    constructor() {
        super({
            clientID: "clientId",
            clientSecret: "clientSecret",
            callbackURL: "http://localhost:3000/google/callback",
            scope: ["email", "profile"]
        })
    }

    async validate(accessToken: string, refresToken: string, profile: Profile, done: VerifyCallback) {
      done(null,profile);
    }
}
</code>```

where can i get authorizationURL and tokenURL ?
im getting this error while using passport-oauth2 this package but after using passport-google-oauth20 package this error is gone.

after using passport-google-oauth20 im getting a new error after hitting http://localhost:3000/google route which is :

```<code>[Nest] 8608  - 13/01/2023, 11:58:43 am   ERROR [ExceptionsHandler] Failed to obtain access token
InternalOAuthError: Failed to obtain access token
</code>```

how to solve this ?

Body:
[Nest] 8860  - 13/01/2023, 11:50:03 am   ERROR [ExceptionHandler] OAuth2Strategy requires a authorizationURL option
TypeError: OAuth2Strategy requires a authorizationURL option
    at new OAuth2Strategy

google strategy :

import { Injectable } from "@nestjs/common";
import { PassportStrategy } from "@nestjs/passport";
import { Profile } from "passport";
import { VerifyCallback, Strategy } from "passport-oauth2";

@Injectable()
export class GoogleStrategy extends PassportStrategy(Strategy) {
    constructor() {
        super({
            clientID: "clientId",
            clientSecret: "clientSecret",
            callbackURL: "http://localhost:3000/google/callback",
            scope: ["email", "profile"]
        })
    }

    async validate(accessToken: string, refresToken: string, profile: Profile, done: VerifyCallback) {
      done(null,profile);
    }
}

where can i get authorizationURL and tokenURL ?
im getting this error while using passport-oauth2 this package but after using passport-google-oauth20 package this error is gone.

after using passport-google-oauth20 im getting a new error after hitting http://localhost:3000/google route which is :

[Nest] 8608  - 13/01/2023, 11:58:43 am   ERROR [ExceptionsHandler] Failed to obtain access token
InternalOAuthError: Failed to obtain access token

how to solve this ?


问:
Alertmanager as alternate context (url/alertmanager) in ingress on k8s showing 404 not found
I have setup Prometheus grafana stack (helm charts, version 43.3.0) on kubernetes. The version is of prometheus used is v2.40.5. Alertmanager is v0.25.0. Installation is success.
Able to access alertmanager when exposed the service type as LoadBalancer.
When trying to access alertmanager (using existing nginx ingress and changing alertmanager service to clusterIP) and the path set is /alertmanager results in 404 not found.

Ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/auth-type: basic
nginx.ingress.kubernetes.io/auth-secret: basic-auth
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - admin'
spec:
tls:
- hosts:
- example.com
secretName: tls-secret
rules:
host: example.com
http:
paths:
backend:
service:
name: alertmanager-service
port:
number: 80
path: /alertmanager
pathType: Prefix```

Is there any way where I could use the alertmanager service in the existing ingress.

Body:
I have setup Prometheus grafana stack (helm charts, version 43.3.0) on kubernetes. The version is of prometheus used is v2.40.5. Alertmanager is v0.25.0. Installation is success.
Able to access alertmanager when exposed the service type as LoadBalancer.
When trying to access alertmanager (using existing nginx ingress and changing alertmanager service to clusterIP) and the path set is /alertmanager results in 404 not found.

Ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/auth-type: basic
nginx.ingress.kubernetes.io/auth-secret: basic-auth
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - admin'
spec:
tls:
- hosts:
- example.com
secretName: tls-secret
rules:
host: example.com
http:
paths:
backend:
service:
name: alertmanager-service
port:
number: 80
path: /alertmanager
pathType: Prefix

Is there any way where I could use the alertmanager service in the existing ingress.


问:
Spring Cloud Config Client is not able to receive events from SpringCloudBus
Auto-refresh of properties not working in Spring Cloud Config Server. The properties are getting refreshed in Config server but not in Config Client.

I have configured the /monitor endpoint as a webhook in GitLab.

application.properties of client application

```<code>spring.cloud.config.uri=http://localhost:8888/config
spring.config.import=optional:configserver:http://localhost:8888/config
spring.cloud.config.label=uat
spring.cloud.config.enabled=true
spring.cloud.bus.enabled=true
spring.profiles.active=uat
server.port=8081
logging.level.root=INFO
runtime-env=local
management.security.enabled=false
management.endpoints.web.exposure.include=*
spring.application.name=thoth
spring.cloud.stream.kafka.binder.zkNodes=localhost:2181
spring.cloud.stream.kafka.binder.brokers=localhost:19092
</code>```

The Client application is not able to receive the RefreshRemoteApplicationEvent. How do I configure my client to start receiving these events?

I tried changing one of the properties from GitLab and the properties of Config server changed automatically, however the property change did not reflect on Client side.

Body:
Auto-refresh of properties not working in Spring Cloud Config Server. The properties are getting refreshed in Config server but not in Config Client.

I have configured the /monitor endpoint as a webhook in GitLab.

application.properties of client application

spring.cloud.config.uri=http://localhost:8888/config
spring.config.import=optional:configserver:http://localhost:8888/config
spring.cloud.config.label=uat
spring.cloud.config.enabled=true
spring.cloud.bus.enabled=true
spring.profiles.active=uat
server.port=8081
logging.level.root=INFO
runtime-env=local
management.security.enabled=false
management.endpoints.web.exposure.include=*
spring.application.name=thoth
spring.cloud.stream.kafka.binder.zkNodes=localhost:2181
spring.cloud.stream.kafka.binder.brokers=localhost:19092

The Client application is not able to receive the RefreshRemoteApplicationEvent. How do I configure my client to start receiving these events?

I tried changing one of the properties from GitLab and the properties of Config server changed automatically, however the property change did not reflect on Client side.


问:
Python Scapy execution problem with sendpfast
In Linux, I have a problem with scapy using sendpfast
Is there anyone who experiences the same problem as me?

I will be very grateful to someone who has a solution to this.

my code after I implemented python on Linux terminal

```<code>import sys

from scapy.all import *

pkt = Ether(src="00:00:00:00:00:01", dst="00:00:00:00:00:02")/IP(src="10.1.1.1", dst="10.1.1.2")/UDP(sport=5001, dport=5002)/Raw(RandString(size=1460))

sendpfast(pkt, pps=1000, loop=10000)
</code>```

and this is a error code written on terminal.

```<code>Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/scapy/sendrecv.py", line 398, in sendpfast
    log_runtime.info(stdout.decode())
  File "/usr/local/lib/python2.7/dist-packages/scapy/utils.py", line 555, in __exit__
    raise OSError(msg)
OSError: sendpfast(): executing 'tcpreplay' failed`
</code>```

I reinstalled tcpreplay(version 4.4.2) with the scapy.
My python version is 2.7 and I don't know what's the problem.

Body:
In Linux, I have a problem with scapy using sendpfast
Is there anyone who experiences the same problem as me?

I will be very grateful to someone who has a solution to this.

my code after I implemented python on Linux terminal

import sys

from scapy.all import *

pkt = Ether(src="00:00:00:00:00:01", dst="00:00:00:00:00:02")/IP(src="10.1.1.1", dst="10.1.1.2")/UDP(sport=5001, dport=5002)/Raw(RandString(size=1460))

sendpfast(pkt, pps=1000, loop=10000)

and this is a error code written on terminal.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/scapy/sendrecv.py", line 398, in sendpfast
    log_runtime.info(stdout.decode())
  File "/usr/local/lib/python2.7/dist-packages/scapy/utils.py", line 555, in __exit__
    raise OSError(msg)
OSError: sendpfast(): executing 'tcpreplay' failed`

I reinstalled tcpreplay(version 4.4.2) with the scapy.
My python version is 2.7 and I don't know what's the problem.


问:
docker-compose fails on RUN sudo gem update --system
Installed docker desktop for windows in a Hyper-V VM running Windows 10 21H2.  Have cloned a repository from GitHub using the GitHub desktop.  Started a PowerShell as administrator, navigated to the cloned repository location.  When I run docker-compose up I get the following error:

[+] Building 3.7s (5/9)
=> [internal] load build definition from Dockerfile                                                               0.0s
=> => transferring dockerfile: 32B                                                                                0.0s
=> [internal] load .dockerignore                                                                                0.1s
=> => transferring context: 2B                                                                                0.0s
=> [internal] load metadata for docker.io/circleci/ruby:2.7.5-node                                                3.3s
=> CACHED [1/6] FROM docker.io/circleci/ruby:2.7.5-node@sha256:23d760208eed58ff57f8721d20dcd8c9bc5f9ee8a5293fa14  0.0s
=> ERROR [2/6] RUN sudo gem update --system                                                                       0.2s

[2/6] RUN sudo gem update --system:
#0 0.197 sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

failed to solve: executor failed running [/bin/sh -c sudo gem update --system]: exit code: 1

docker itself installed ok and is running.  I've checked all the pre-reqs and can see no reason why this is happening.  Has anyone else experienced this?


问:
Round progress indicator with count and animation

how to create progress indicator with animation and the count.
Any help would appreciate.


问:
How edit input field with type = " "datetime-local"?
I need edit existing data in form.  When I load data in form from model to input field with type="datetime-local" - its empty. If i write new value to it and send then evetything is fine.
So, for example, for input field with type "time" in html:

```<code> <form action="#" th:action="@{/schendule}" th:object="${jobDetailDTO}" method="post">
   ...
  <div class="form-group">
        <label class="checkbox-inline">
            <input type="checkbox"  data-toggle="toggle" id="everyDay" > Every day timer:
        </label>

        <input type="time"  class="form-control" th:field="*{localTime}"  disabled>
    </div>
</code>```

and I send data to spring controller

```<code> @PostMapping(value = "/schendule", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 public String schenduleFtp(@Valid JobDetailDTO jobDetailDTO) throws SchedulerException {...
</code>```

When I want to edit input i add model:

```<code> modelAndView.addObject("jobDetailDTO", jobDetailDTO);
</code>```

Everything fine with field "time", but with type = dateTime-local, i have empty value in input tag whan trying to edit, how to bind LocalDateTime value from model to view ? In style like tinput time
tag?

Body:
I need edit existing data in form.  When I load data in form from model to input field with type="datetime-local" - its empty. If i write new value to it and send then evetything is fine.
So, for example, for input field with type "time" in html:

 <form action="#" th:action="@{/schendule}" th:object="${jobDetailDTO}" method="post">
   ...

            <input type="checkbox"  data-toggle="toggle" id="everyDay" > Every day timer:

        <input type="time"  class="form-control" th:field="*{localTime}"  disabled>

and I send data to spring controller

 @PostMapping(value = "/schendule", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
 public String schenduleFtp(@Valid JobDetailDTO jobDetailDTO) throws SchedulerException {...

When I want to edit input i add model:

 modelAndView.addObject("jobDetailDTO", jobDetailDTO);

Everything fine with field "time", but with type = dateTime-local, i have empty value in input tag whan trying to edit, how to bind LocalDateTime value from model to view ? In style like tinput time
tag?


问:
dataloader PIL.UnidentifiedImageError: cannot identify image file, but the image is not corrupt
When trying to iterate through dataloader, it returns 'PIL.UnidentifiedImageError: cannot identify image file'.

Searched for similar question and answers tend to points to corrupted image. However those images can be opened with Image.open() and file extension are all jpg.

What's a simple way to handle this?


问:
JPA Criteria subquery with tuple
I define two Entity

```<code>@Entity
class Template {
   @Id
   private String id;
   private String name;
   @OneToMany(fetch=FetchType.LAZY, mappedBy="template")
   private List<Edition> editions;
}

class Edition {
   @Id
   private String id;
   private Integer version;
   private String state;

   @ManyToOne(fetch=FetchType.LAZY)
   private Template template;
}

</code>```

And I want to query each template's newest version and edition's state, so my native sql is:

```<code>select
    a.id, a.name, b.version, b.state
from
    tb_pm_template a,
    tb_pm_edition b
where
    a.id = b.template_id and
    (b.template_id, b.version) in (select template_id, max(version) from tb_pm_edition group by template_id)
</code>```

The navtive sql work fine. But I want to write in jpa Criteria api way.

So, I try the code below:

```<code>CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Tuple> maxVersionQuery = cb.createTupleQuery();
Root<Edition> editionRoot = maxVersionQuery.from(Edition.class);
maxVersionQuery.multiselect(
    editionRoot.get("template").get("id").alias("templateId"),
    cb.max(editionRoot.get("version")).alias("maxVersion")
).groupBy(editionRoot.get("template").get("id"));

List<Tuple> maxVersion = entityManager.createQuery(maxVersionQuery).getResultList();
List<Map<String, Object>> maxVersionResult = new ArrayList<>(maxVersion.size());
for (Tuple tuple: maxVersion) {
    Map<String, Object> row = new HashMap<>(2);
    for (TupleElement element: tuple.getElements()) {
         row.put(element.getAlias(), tuple.get(element.getAlias()));
    }
    maxVersionResult.add(row);
}

// the maxVersion or maxVersionResult contain the template's newest version info I want, then I want to combine the version state and template name

CriteriaQuery<Tuple> templateQuery = cb.createTupleQuery();
Root<Edition> editionRoot1 = templateQuery.from(Edition.class);
templateQuery.multiselect(
    editionRoot1.get("template").get("id").alias("id"),
    editionRoot1.get("template").get("name").alias("name"),
    editionRoot1.get("version").alias("version"),
    editionRoot1.get("state").alias("versioinState")
).where(
    // here I don't know how to connect the conditions
    // I try the cb.in, but it needs Expression type
    // I also try to use the Subquery api, but since I need the subquery return template_id and version, so I define Subquery<Tuple>, but the Subquery instance's select method only take one parameter
    // I check the official document in comments, the example only show the aggregate without groupby

);

</code>```

Is my implementation way wrong? On this basis, I also need to add paging and sorting, so if it is divided into two or more SQL statements, will it affect the paging count?

Title: JPA Criteria subquery with tuple

Body:
I define two Entity

@Entity
class Template {
   @Id
   private String id;
   private String name;
   @OneToMany(fetch=FetchType.LAZY, mappedBy="template")
   private List<Edition> editions;
}

class Edition {
   @Id
   private String id;
   private Integer version;
   private String state;

   @ManyToOne(fetch=FetchType.LAZY)
   private Template template;
}

And I want to query each template's newest version and edition's state, so my native sql is:

select
    a.id, a.name, b.version, b.state
from
    tb_pm_template a,
    tb_pm_edition b
where
    a.id = b.template_id and
    (b.template_id, b.version) in (select template_id, max(version) from tb_pm_edition group by template_id)

The navtive sql work fine. But I want to write in jpa Criteria api way.

So, I try the code below:

CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Tuple> maxVersionQuery = cb.createTupleQuery();
Root<Edition> editionRoot = maxVersionQuery.from(Edition.class);
maxVersionQuery.multiselect(
    editionRoot.get("template").get("id").alias("templateId"),
    cb.max(editionRoot.get("version")).alias("maxVersion")
).groupBy(editionRoot.get("template").get("id"));

List<Tuple> maxVersion = entityManager.createQuery(maxVersionQuery).getResultList();
List<Map<String, Object>> maxVersionResult = new ArrayList<>(maxVersion.size());
for (Tuple tuple: maxVersion) {
    Map<String, Object> row = new HashMap<>(2);
    for (TupleElement element: tuple.getElements()) {
         row.put(element.getAlias(), tuple.get(element.getAlias()));
    }
    maxVersionResult.add(row);
}

// the maxVersion or maxVersionResult contain the template's newest version info I want, then I want to combine the version state and template name

CriteriaQuery<Tuple> templateQuery = cb.createTupleQuery();
Root<Edition> editionRoot1 = templateQuery.from(Edition.class);
templateQuery.multiselect(
    editionRoot1.get("template").get("id").alias("id"),
    editionRoot1.get("template").get("name").alias("name"),
    editionRoot1.get("version").alias("version"),
    editionRoot1.get("state").alias("versioinState")
).where(
    // here I don't know how to connect the conditions
    // I try the cb.in, but it needs Expression type
    // I also try to use the Subquery api, but since I need the subquery return template_id and version, so I define Subquery<Tuple>, but the Subquery instance's select method only take one parameter
    // I check the official document in comments, the example only show the aggregate without groupby

);

Is my implementation way wrong? On this basis, I also need to add paging and sorting, so if it is divided into two or more SQL statements, will it affect the paging count?


问:
(Python html) write python result in html, face simple layout error
the python script can rewrite all content of specify .html (in this case is "simple_website.html"), and showing the data extract from mysql

.py

```<code>import mysql.connector
import webbrowser
import time

mydb = mysql.connector.connect(
  host="196.100.100.141",
  user="root",
  password="password456",
  database="database_db",
  auth_plugin='mysql_native_password'
)

mycursor = mydb.cursor()
mycursor.execute("SELECT row_01 FROM first_db")

myresult = mycursor.fetchall()

list_01 = []

for row in myresult:
  temp_val = row[0]
  list_01.append(temp_val)

print(list_01[5])    # get specific data from MySQL

html_content = f"<html><h1>this is the data extract from mysql:{list_01[5]} </h1></html>"

with open("simple_website.html","w") as html_file:
  html_file.write(html_content)     # show specific data on website

time.sleep(2)
webbrowser.open_new_tab("simple_website.html")
</code>```

the output website pic with this logic

Q: if I just want to insert/replace "extract data (from mysql)" to certain area, how can I do so?

such as I just want to change the title , or part of the content in website, with "extract data"

original .html file (works fine)

```<code><!DOCTYPE html>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Rayson Technology - Your best OEM/ODM partner for Bluetooth solution</title>
    <meta name="description" content=" content, we are the best company">
    <meta name="keywords" content="content, where thestory begin" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Favicon -->
    <link rel="icon" href="../images/favicon.png">

    <!-- CSS ============================================ -->

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="../assets/css/vendor/bootstrap.min.css">

    <!-- Font Family CSS -->
    <link rel="stylesheet" href="../assets/css/vendor/cerebrisans.css">

    <!-- FontAwesome CSS -->
    <link rel="stylesheet" href="../assets/css/vendor/fontawesome-all.min.css">
    <link rel="stylesheet" href="../assets/css/vendor/linea-icons.css">

    <!-- Swiper slider CSS -->
    <link rel="stylesheet" href="../assets/css/plugins/swiper.min.css">

    <!-- animate-text CSS -->
    <link rel="stylesheet" href="../assets/css/plugins/animate-text.css">

    <!-- Animate CSS -->
    <link rel="stylesheet" href="../assets/css/plugins/animate.min.css">

    <!-- Light gallery CSS -->
    <link rel="stylesheet" href="../assets/css/plugins/lightgallery.min.css">

    <!-- Main Style CSS -->
    <link rel="stylesheet" href="../assets/css/Custom.css">
    <link rel="stylesheet" href="../assets/css/style.css">
</head>

<body>

    <div class="preloader-activate preloader-active open_tm_preloader">
        <div class="preloader-area-wrap">
            <div class="spinner d-flex justify-content-center align-items-center h-100">
                <div class="bounce1"></div>
                <div class="bounce2"></div>
                <div class="bounce3"></div>
            </div>
        </div>
    </div>

        <!-- Header Bottom Wrap Start -->
        <div class="header-bottom-wrap header-sticky">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="header default-menu-style position-relative">

                            <!-- brand logo -->
                            <div class="header__logo">
                                <a href="index.html">
                                    <img src="../images/logo.png" width="160" height="48" class="img-fluid" alt="">
                                </a>
                            </div>

                            <!-- header midle box  -->
                            <div class="header-midle-box">
                                <div class="header-bottom-wrap d-md-block d-none">
                                    <div class="header-bottom-inner">
                                        <div class="header-bottom-left-wrap">
                                            <!-- navigation menu -->
                                            <div class="header__navigation d-none d-xl-block">
                                                <nav class="navigation-menu primary--menu">
                                                    <ul>
                                                        <li class="has-children has-children--multilevel-submenu">
                                                            <a href="product_list.html"><span>Products</span></a>
                                                            <ul class="submenu">
                                                                <li><a href="product_nodic.html"><span>Nordic</span></a></li>
                                                                <li><a href="product_microchip.html"><span>product_02</span></a></li>   <!-- # the line I want to change with mysql data  -->
                                                                <li><a href="product_dk.html"><span>product_03</span></a></li>
                                                            </ul>
                                                        </li>
                                                        <li>
                                                            <a href="software_support.html"><span>Software Support</span></a>
                                                        </li>
                                                        <li>
                                                            <a href="customizations.html"><span>Customization</span></a>
                                                        </li>
                                                        <li>
                                                            <a href="success_stories.html"><span>Success Stories</span></a>
                                                        </li>
                                                        <li>
                                                            <a href="contact.html"><span>Contact</span></a>
                                                        </li>
                                                    </ul>
                                                </nav>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>

                            <!-- header right box -->
                            <div class="header-right-box">
                                <div class="header-right-inner" id="hidden-icon-wrapper">

                                    <!-- language-menu -->
                                    <div class="language-menu">
                                        <ul>
                                            <li>
                                                <a href="#" class="">
                                                    <span class="wpml-ls-native">English</span>
                                                </a>
                                                <ul class="ls-sub-menu">
                                                    <li class="">
                                                        <a href="../chinese/" class="">
                                                            <span class="wpml-ls-native">繁體中文</span>
                                                        </a>
                                                    </li>
                                                    <li class="">
                                                        <a href="../schinese/" class="">
                                                            <span class="wpml-ls-native">簡體中文</span>
                                                        </a>
                                                    </li>
                                                </ul>
                                            </li>
                                        </ul>
                                    </div>

                                    <!-- header-search-form -->
                                    <div class="header-search-form default-search">
                                        <form action="search.html" class="search-form-top">
                                            <input class="search-field" type="text" placeholder="Search…">
                                            <button class="search-submit">
                                                <i class="search-btn-icon fa fa-search"></i>
                                            </button>
                                        </form>
                                    </div>
                                </div>

            <div class="footer-copyright-area section-space--ptb_15">
                <div class="container-fluid">
                    <div class="row align-items-center">
                        <div class="col-md-6 text-center text-md-start">
                            <!-- breadcrumb-list start -->
                            <ul class="breadcrumb-list">
                                <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                                <li class="breadcrumb-item"><a href="product_list.html">Products</a></li>
                                <li class="breadcrumb-item active">Nordic</li>
                            </ul>
                            <!-- breadcrumb-list end -->
                        </div>
                        <div class="col-md-6 text-center text-md-end">
                            <span class="copyright-text">© 2022 sam_JR Technology co.,Ltd. All Rights Reserved.</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--====================  End of footer area  ====================-->

</body>

</html>
</code>```

idea: that I put the original html code with html_content = f"  , and the old content will replace with {list_01[5]} , it  should works fine, as the above logic showing, what do I need to change for code

I did

put original website html into .py script in  html_content = f"

replace the old content with extract mysql data {list_01[5]} , in line 109

tried in .py script

```<code>import mysql.connector
import webbrowser
import time

mydb = mysql.connector.connect(
  host="196.100.100.141",
  user="root",
  password="password456",
  database="database_db",
  auth_plugin='mysql_native_password'
)

mycursor = mydb.cursor()
mycursor.execute("SELECT row_01 FROM first_db")

myresult = mycursor.fetchall()

list_01 = []

for row in myresult:
  temp_val = row[0]
  list_01.append(temp_val)

print(list_01[5])    # get specific data from MySQL

html_content = f"<!DOCTYPE html>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Rayson Technology - Your best OEM/ODM partner for Bluetooth solution</title>
    <meta name="description" content=" content, we are the best company">
    <meta name="keywords" content="content, where thestory begin" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Favicon -->
    <link rel="icon" href="../images/favicon.png">

    <!-- CSS ============================================ -->

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="../assets/css/vendor/bootstrap.min.css">

    <!-- Font Family CSS -->
    <link rel="stylesheet" href="../assets/css/vendor/cerebrisans.css">

    <!-- FontAwesome CSS -->
    <link rel="stylesheet" href="../assets/css/vendor/fontawesome-all.min.css">
    <link rel="stylesheet" href="../assets/css/vendor/linea-icons.css">

    <!-- Swiper slider CSS -->
    <link rel="stylesheet" href="../assets/css/plugins/swiper.min.css">

    <!-- animate-text CSS -->
    <link rel="stylesheet" href="../assets/css/plugins/animate-text.css">

    <!-- Animate CSS -->
    <link rel="stylesheet" href="../assets/css/plugins/animate.min.css">

    <!-- Light gallery CSS -->
    <link rel="stylesheet" href="../assets/css/plugins/lightgallery.min.css">

    <!-- Main Style CSS -->
    <link rel="stylesheet" href="../assets/css/Custom.css">
    <link rel="stylesheet" href="../assets/css/style.css">
</head>

<body>

    <div class="preloader-activate preloader-active open_tm_preloader">
        <div class="preloader-area-wrap">
            <div class="spinner d-flex justify-content-center align-items-center h-100">
                <div class="bounce1"></div>
                <div class="bounce2"></div>
                <div class="bounce3"></div>
            </div>
        </div>
    </div>

        <!-- Header Bottom Wrap Start -->
        <div class="header-bottom-wrap header-sticky">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="header default-menu-style position-relative">

                            <!-- brand logo -->
                            <div class="header__logo">
                                <a href="index.html">
                                    <img src="../images/logo.png" width="160" height="48" class="img-fluid" alt="">
                                </a>
                            </div>

                            <!-- header midle box  -->
                            <div class="header-midle-box">
                                <div class="header-bottom-wrap d-md-block d-none">
                                    <div class="header-bottom-inner">
                                        <div class="header-bottom-left-wrap">
                                            <!-- navigation menu -->
                                            <div class="header__navigation d-none d-xl-block">
                                                <nav class="navigation-menu primary--menu">
                                                    <ul>
                                                        <li class="has-children has-children--multilevel-submenu">
                                                            <a href="product_list.html"><span>Products</span></a>
                                                            <ul class="submenu">
                                                                <li><a href="product_nodic.html"><span>Nordic</span></a></li>
                                                                <li><a href="product_microchip.html"><span>{list_01[5]}</span></a></li>   <!-- # the line I want to change with mysql data  -->
                                                                <li><a href="product_dk.html"><span>product_03</span></a></li>
                                                            </ul>
                                                        </li>
                                                        <li>
                                                            <a href="software_support.html"><span>Software Support</span></a>
                                                        </li>
                                                        <li>
                                                            <a href="customizations.html"><span>Customization</span></a>
                                                        </li>
                                                        <li>
                                                            <a href="success_stories.html"><span>Success Stories</span></a>
                                                        </li>
                                                        <li>
                                                            <a href="contact.html"><span>Contact</span></a>
                                                        </li>
                                                    </ul>
                                                </nav>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>

                            <!-- header right box -->
                            <div class="header-right-box">
                                <div class="header-right-inner" id="hidden-icon-wrapper">

                                    <!-- language-menu -->
                                    <div class="language-menu">
                                        <ul>
                                            <li>
                                                <a href="#" class="">
                                                    <span class="wpml-ls-native">English</span>
                                                </a>
                                                <ul class="ls-sub-menu">
                                                    <li class="">
                                                        <a href="../chinese/" class="">
                                                            <span class="wpml-ls-native">繁體中文</span>
                                                        </a>
                                                    </li>
                                                    <li class="">
                                                        <a href="../schinese/" class="">
                                                            <span class="wpml-ls-native">簡體中文</span>
                                                        </a>
                                                    </li>
                                                </ul>
                                            </li>
                                        </ul>
                                    </div>

                                    <!-- header-search-form -->
                                    <div class="header-search-form default-search">
                                        <form action="search.html" class="search-form-top">
                                            <input class="search-field" type="text" placeholder="Search…">
                                            <button class="search-submit">
                                                <i class="search-btn-icon fa fa-search"></i>
                                            </button>
                                        </form>
                                    </div>
                                </div>

            <div class="footer-copyright-area section-space--ptb_15">
                <div class="container-fluid">
                    <div class="row align-items-center">
                        <div class="col-md-6 text-center text-md-start">
                            <!-- breadcrumb-list start -->
                            <ul class="breadcrumb-list">
                                <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                                <li class="breadcrumb-item"><a href="product_list.html">Products</a></li>
                                <li class="breadcrumb-item active">Nordic</li>
                            </ul>
                            <!-- breadcrumb-list end -->
                        </div>
                        <div class="col-md-6 text-center text-md-end">
                            <span class="copyright-text">© 2022 sam_JR Technology co.,Ltd. All Rights Reserved.</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--====================  End of footer area  ====================-->

</body>

</html>"

with open("simple_website.html","w") as html_file:
  html_file.write(html_content)     # show specific data on website

time.sleep(2)
webbrowser.open_new_tab("simple_website.html"
</code>```

should be the same logic, just need to improve layout/format of try .py code

Body:
the python script can rewrite all content of specify .html (in this case is "simple_website.html"), and showing the data extract from mysql

.py

import mysql.connector
import webbrowser
import time

mydb = mysql.connector.connect(
  host="196.100.100.141",
  user="root",
  password="password456",
  database="database_db",
  auth_plugin='mysql_native_password'
)

mycursor = mydb.cursor()
mycursor.execute("SELECT row_01 FROM first_db")

myresult = mycursor.fetchall()

list_01 = []

for row in myresult:
  temp_val = row[0]
  list_01.append(temp_val)

print(list_01[5])    # get specific data from MySQL

html_content = f"
this is the data extract from mysql:{list_01[5]}
"

with open("simple_website.html","w") as html_file:
  html_file.write(html_content)     # show specific data on website

time.sleep(2)
webbrowser.open_new_tab("simple_website.html")

the output website pic with this logic

Q: if I just want to insert/replace "extract data (from mysql)" to certain area, how can I do so?

such as I just want to change the title , or part of the content in website, with "extract data"

original .html file (works fine)

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Rayson Technology - Your best OEM/ODM partner for Bluetooth solution</title>
    <meta name="description" content=" content, we are the best company">
    <meta name="keywords" content="content, where thestory begin" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="icon" href="../images/favicon.png">

    <link rel="stylesheet" href="../assets/css/vendor/bootstrap.min.css">

    <link rel="stylesheet" href="../assets/css/vendor/cerebrisans.css">

    <link rel="stylesheet" href="../assets/css/vendor/fontawesome-all.min.css">
    <link rel="stylesheet" href="../assets/css/vendor/linea-icons.css">

    <link rel="stylesheet" href="../assets/css/plugins/swiper.min.css">

    <link rel="stylesheet" href="../assets/css/plugins/animate-text.css">

    <link rel="stylesheet" href="../assets/css/plugins/animate.min.css">

    <link rel="stylesheet" href="../assets/css/plugins/lightgallery.min.css">

    <link rel="stylesheet" href="../assets/css/Custom.css">
    <link rel="stylesheet" href="../assets/css/style.css">

                                                            Products

Nordic

product_02

product_03

                                                            Software Support

                                                            Customization

                                                            Success Stories

                                                            Contact

                                                    English

                                                            繁體中文

                                                            簡體中文

                                        <form action="search.html" class="search-form-top">
                                            <input class="search-field" type="text" placeholder="Search…">
                                            <button class="search-submit">

                                            </button>
                                        </form>

Home

Products

Nordic

                            © 2022 sam_JR Technology co.,Ltd. All Rights Reserved.

idea: that I put the original html code with html_content = f"  , and the old content will replace with {list_01[5]} , it  should works fine, as the above logic showing, what do I need to change for code

I did

put original website html into .py script in  html_content = f"

replace the old content with extract mysql data {list_01[5]} , in line 109

tried in .py script

import mysql.connector
import webbrowser
import time

mydb = mysql.connector.connect(
  host="196.100.100.141",
  user="root",
  password="password456",
  database="database_db",
  auth_plugin='mysql_native_password'
)

mycursor = mydb.cursor()
mycursor.execute("SELECT row_01 FROM first_db")

myresult = mycursor.fetchall()

list_01 = []

for row in myresult:
  temp_val = row[0]
  list_01.append(temp_val)

print(list_01[5])    # get specific data from MySQL

html_content = f"<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Rayson Technology - Your best OEM/ODM partner for Bluetooth solution</title>
    <meta name="description" content=" content, we are the best company">
    <meta name="keywords" content="content, where thestory begin" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="icon" href="../images/favicon.png">

    <link rel="stylesheet" href="../assets/css/vendor/bootstrap.min.css">

    <link rel="stylesheet" href="../assets/css/vendor/cerebrisans.css">

    <link rel="stylesheet" href="../assets/css/vendor/fontawesome-all.min.css">
    <link rel="stylesheet" href="../assets/css/vendor/linea-icons.css">

    <link rel="stylesheet" href="../assets/css/plugins/swiper.min.css">

    <link rel="stylesheet" href="../assets/css/plugins/animate-text.css">

    <link rel="stylesheet" href="../assets/css/plugins/animate.min.css">

    <link rel="stylesheet" href="../assets/css/plugins/lightgallery.min.css">

    <link rel="stylesheet" href="../assets/css/Custom.css">
    <link rel="stylesheet" href="../assets/css/style.css">

                                                            Products

Nordic

{list_01[5]}

product_03

                                                            Software Support

                                                            Customization

                                                            Success Stories

                                                            Contact

                                                    English

                                                            繁體中文

                                                            簡體中文

                                        <form action="search.html" class="search-form-top">
                                            <input class="search-field" type="text" placeholder="Search…">
                                            <button class="search-submit">

                                            </button>
                                        </form>

Home

Products

Nordic

                            © 2022 sam_JR Technology co.,Ltd. All Rights Reserved.

"

with open("simple_website.html","w") as html_file:
  html_file.write(html_content)     # show specific data on website

time.sleep(2)
webbrowser.open_new_tab("simple_website.html"

should be the same logic, just need to improve layout/format of try .py code


问:
Using EF Core, how to update database's newly created schema within code?
I created new schema within code using EF Core in Postgres. But then I need to migrate my migrations to new created schema (not "public" schema) at runtime. And all this is in one dataContext.

```<code>string command = $"CREATE SCHEMA IF NOT EXISTS {name} AUTHORIZATION CURRENT_USER";
dataContext.Database.ExecuteSqlRaw(command);
</code>```

I create new schemas at runtime with this command.

and then tried running:

```<code>dataContext.Database.Migrate();
</code>```

Body:
I created new schema within code using EF Core in Postgres. But then I need to migrate my migrations to new created schema (not "public" schema) at runtime. And all this is in one dataContext.

string command = $"CREATE SCHEMA IF NOT EXISTS {name} AUTHORIZATION CURRENT_USER";
dataContext.Database.ExecuteSqlRaw(command);

I create new schemas at runtime with this command.

and then tried running:

dataContext.Database.Migrate();


问:
I want to disable the collect errors option in details of the chrome extension by default In menifest version 3
I want to disable the collect errors option in details of the chrome extension by default

I am using menifest version 3


问:
How can I adjust the height of tableviewcell based on the content for wkwebview
I have an issue regarding the height of UITableViewCell in Swift: The height of the UITableViewCell should be updated with the embedded HTML code in WKWebView, but it doesn't.

import UIKit
import WebKit

class SocialVideoPlayer: UITableViewCell, WKUIDelegate {

    var url: URL!
    var scroll = false
    var variable = (String)()
    @IBOutlet weak var webView: WKWebView!
    @IBOutlet weak var view: UIView!
    @IBOutlet weak var webviewheight: NSLayoutConstraint!

    override func awakeFromNib() {
        super.awakeFromNib()
        webView.scrollView.isScrollEnabled = scroll
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        let e = ""
        webView.loadHTMLContent(e)
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        webView.navigationDelegate = self
        webView.uiDelegate = self
        webView.backgroundColor = UIColor.clear
        webView.isOpaque = false
        webView.contentMode = .scaleAspectFill
        webView.sizeToFit()
        webView.autoresizesSubviews = true
    }
}

extension WKWebView {
    func loadHTMLContent(_ htmlContent: String) {
        let htmlStart = "<!doctype html><meta charset='utf-8'/><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'>
"
        let htmlEnd = "
"
        let htmlString = "\(htmlStart)\(htmlContent)\(htmlEnd)"
        loadHTMLString(htmlString, baseURL: nil)
    }
}

extension SocialVideoPlayer: WKNavigationDelegate {
    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
        webView.evaluateJavaScript("document.readyState", completionHandler: { (complete, error) in
            if complete != nil {
                webView.evaluateJavaScript("document.body.scrollHeight") { (result, error) in
                    if error == nil {
                        guard let height = result as? CGFloat else { return }
                        self.webviewheight.constant = height
                        NotificationCenter.default.post(name: Notification.Name("fbFinishload"), object: "")
                    }
                }
            }
        })
    }

    func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
        guard case .linkActivated = navigationAction.navigationType,
              let url = navigationAction.request.url
        else {
            decisionHandler(.allow)
            return
        }
        decisionHandler(.cancel)
        UIApplication.shared.open(url)
    }
}
```


问:
When notifications are bundled, clicking any to them give sends same to data to the activity's onNewIntent()
I have an activity that gets opened when a notification is clicked and it displays data from the payload of the notification. But when there are multiple notifications bundled and I click on one of them, the activity displays its data, and then clicking on any notification from the bundle results does call onNewIntent() of the receiving activity, but gives the same previous data instead of new one from the clicked notification's payload. When a notification isn't bundled, it works just fine.</p>


问:
contiki-ng : actuating practice

```<code>insung@ubuntu:~/actuating$ make TARGET=zoul
  LD        build/zoul/remote-revb/actuating.elf
build/zoul/remote-revb/obj/actuating.o: In function `process_thread_sensing_process':
actuating.c:(.text.process_thread_sensing_process+0x4c): undefined reference to `button_sensor'
collect2: error: ld returned 1 exit status
/home/insung/contiki-ng//arch/cpu/arm/cortex-m/Makefile.customrules-cortex-m:10: recipe for target 'build/zoul/remote-revb/actuating.elf' failed
make: *** [build/zoul/remote-revb/actuating.elf] Error 1
</code>```

I got this undefined reference to 'button_sensor' error
I can compile with TARGET=sky but, when I Target to "TARGET=zoul" like above image
it occurs error
i can't see any problem in the codes
How can i Solve it?

```<code>#include "contiki.h"
#include "leds.h"
#include "dev/button-sensor.h"

#include <stdio.h>

PROCESS(sensing_process, "Sensing process");
AUTOSTART_PROCESSES(&sensing_process);

PROCESS_THREAD(sensing_process, ev, data){
    PROCESS_BEGIN();

    printf("Demo actuating ...\n");
    SENSORS_ACTIVATE(button_sensor);
    leds_off(LEDS_ALL);

    while(1){
        PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event && data == &button_sensor);
        leds_toggle(LEDS_BLUE);
    }

    SENSORS_DEACTIVATE(button_sensor);
    PROCESS_END();
}
</code>```
```<code>CONTIKI_PROJECT = actuating
all: $(CONTIKI_PROJECT)

CONTIKI = /home/insung/contiki-ng/
include $(CONTIKI)/Makefile.include

</code>```

I declare that button_sensor variable  too

Title: contiki-ng : actuating practice

Body:
insung@ubuntu:~/actuating$ make TARGET=zoul
  LD        build/zoul/remote-revb/actuating.elf
build/zoul/remote-revb/obj/actuating.o: In function `process_thread_sensing_process':
actuating.c:(.text.process_thread_sensing_process+0x4c): undefined reference to `button_sensor'
collect2: error: ld returned 1 exit status
/home/insung/contiki-ng//arch/cpu/arm/cortex-m/Makefile.customrules-cortex-m:10: recipe for target 'build/zoul/remote-revb/actuating.elf' failed
make: *** [build/zoul/remote-revb/actuating.elf] Error 1

I got this undefined reference to 'button_sensor' error
I can compile with TARGET=sky but, when I Target to "TARGET=zoul" like above image
it occurs error
i can't see any problem in the codes
How can i Solve it?

#include "contiki.h"
#include "leds.h"
#include "dev/button-sensor.h"

#include <stdio.h>

PROCESS(sensing_process, "Sensing process");
AUTOSTART_PROCESSES(&sensing_process);

PROCESS_THREAD(sensing_process, ev, data){
    PROCESS_BEGIN();

    printf("Demo actuating ...\n");
    SENSORS_ACTIVATE(button_sensor);
    leds_off(LEDS_ALL);

    while(1){
        PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event && data == &button_sensor);
        leds_toggle(LEDS_BLUE);
    }

    SENSORS_DEACTIVATE(button_sensor);
    PROCESS_END();
}

CONTIKI_PROJECT = actuating
all: $(CONTIKI_PROJECT)

CONTIKI = /home/insung/contiki-ng/
include $(CONTIKI)/Makefile.include

I declare that button_sensor variable  too


问:
React and Axios - using interceptor to refresh token upon first failure
I have a React application and I'm using Axios to make http calls. Calls are authorized with an authorization header.

In Axios I'm using the response interceptor and in case I get a 401 from one of the calls I make another call to get a new token using a refresh token obtained upon login and stored in the browser, and then retry the original call using the new token. It works well.

The issue starts with the way it's handled in my application. I have pages where there are multiple components that request data from the server, at the same time. The page returns a 401 causing my logic to ask for a refresh token - so basically all requests are also asking for a new token using that refresh token. The issue is that the first request asking the new token is served while the others are failing - this is because when asking a new token using the refresh token a new refresh token it granted. Meanwhile the other calls for a new token all use an "old" refresh token that cannot be validated on the server side because it had been replaced on the first call - making the request fail.

Also in the above logic - the login is called more then it should - it should be called only once when the first call detects that it should.

What I'm looking for is a way that if the first call fails due to the need to refresh the token, how do I make the other calls understand that a call for a new token is already made and hang until it's returned (or retry with the newly stored token once it's available)?


问:
Unable release multiple android apps through ci-cd with single Google account configuration
I have single account for Android play store, I tried to CI-CD with one project which is linked an Access API under Google account project access, it's working and deploye to play store but when try with other app to run ci-cd it's not working.

Any suggestion?

Is their possiblity to upload multiple Android apps build through CI-CD with single Google account


问:
how i fix multilib problem with cloudlinux
i have a problem with my vps and after installing cloudlinux i cat do yum update

please help me
centos 7
whm
cloudlinux

thank you so much

```<code>Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:

         1. You have an upgrade for ea-php80-pear which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of ea-php80-pear of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude ea-php80-pear.otherarch ... this should give you an error
            message showing the root cause of the problem.

         2. You have multiple architectures of ea-php80-pear installed, but
            yum can only see an upgrade for one of those architectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.

         3. You have duplicate versions of ea-php80-pear installed already.
            You can use "yum check" to get yum show these errors.

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).

       Protected multilib versions: 1:ea-php80-pear-1.10.12-1.el7.cloudlinux.noarch != ea-php80-pear-1.10.12-6.15.4.cpanel.noarch

</code>```

nothing too much now

Body:
i have a problem with my vps and after installing cloudlinux i cat do yum update

please help me
centos 7
whm
cloudlinux

thank you so much

Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:

         1. You have an upgrade for ea-php80-pear which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of ea-php80-pear of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude ea-php80-pear.otherarch ... this should give you an error
            message showing the root cause of the problem.

         2. You have multiple architectures of ea-php80-pear installed, but
            yum can only see an upgrade for one of those architectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.

         3. You have duplicate versions of ea-php80-pear installed already.
            You can use "yum check" to get yum show these errors.

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).

       Protected multilib versions: 1:ea-php80-pear-1.10.12-1.el7.cloudlinux.noarch != ea-php80-pear-1.10.12-6.15.4.cpanel.noarch

nothing too much now


问:
clang LibTooling: weird include paths in Clang Invocation ---> clang's headers not found
I'm trying to make simple working tool with SyntaxOnlyAction and custom CompilationDatabase subclass which returns single file and command: clang++ -c -v -o target/test-object.cpp.o test-object.cpp.

But unless I add -I/usr/lib/clang/14.0.6/include to that command line, it does not find stddef.h, then stdarg.h, etc.

-v option reports weird thing: ... "-resource-dir" "/home/me/work/tmp/lib/clang/14.0.6" ... "-internal-isystem" "/home/me/work/tmp/lib/clang/14.0.6/include" ... Looks like it prepends clang's include paths with my working directory /home/me/work/tmp. Other paths look weird too (some start with /../), but clang accepts them.

What am I doing wrong & how can I fix it without manually adding clang's includes?

Thanks.

My system is ArtixLinux / x86-64.

tool.cpp

```<code>#include <clang/Basic/Version.inc>
#include <clang/Frontend/FrontendActions.h>
#include <clang/Tooling/CompilationDatabase.h>
#include <clang/Tooling/Tooling.h>

class MyCompilationDatabase : public clang::tooling::CompilationDatabase {
    std::vector<std::string> cpps;
public:
    // This example is cut from larger source where move() is inappropriate.
    MyCompilationDatabase(const std::vector<std::string>& cpps) : cpps(cpps) {}

    std::vector<std::string> getAllFiles() const override { return cpps; }

    std::vector<clang::tooling::CompileCommand> getCompileCommands(llvm::StringRef filePath) const override {
        // This is a bug: filePath is absolute; but fixing it doesn't change anything:
        // clang invocation does not contain -o option.
        std::string o = "target/" + filePath.str() + ".o";
        std::vector<std::string> cmd = {"clang++", "-c", "-v", /*"-I/usr/lib/clang/" CLANG_VERSION_STRING "/include",*/ "-o", o, filePath.str()};
        return {clang::tooling::CompileCommand(".", filePath, std::move(cmd), o)};
    }
};

int main() {
    MyCompilationDatabase db({"test-object.cpp"});
    clang::tooling::ClangTool tool(db, db.getAllFiles());
    return tool.run(clang::tooling::newFrontendActionFactory<clang::SyntaxOnlyAction>().get());
}
</code>```

test-object.cpp

```<code>#include <stdio.h>

int main() {
    puts("Hello world!");
}
</code>```

makefile (yes I'm using gcc as main compiler -- for historical reasons, cross-compilation to Windows, ensuring that gcc & clang work together this way in a "hostile environment", etc.)

```<code>.PHONY: all
all: target/tool
    $<; echo "Tool exit status: $$?"

target/%: %.cpp
    mkdir -p target
    g++ -std=c++20 -fno-rtti -Wall -Wextra -Wpedantic -Werror=format -Werror=return-type -O2 -flto -o $@ $< -lclang-cpp -lclang -lLLVM-14
</code>```

full output

```<code>$ make
mkdir -p target
g++ -std=c++20 -fno-rtti -Wall -Wextra -Wpedantic -Werror=format -Werror=return-type -O2 -flto -o target/tool tool.cpp -lclang-cpp -lclang -lLLVM-14
target/tool; echo "Tool exit status: $?"
clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir:
Found candidate GCC installation: /../lib/gcc/x86_64-pc-linux-gnu/12.2.0
Found candidate GCC installation: /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0
Selected GCC installation: /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
clang Invocation:
 "clang++" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-fsyntax-only" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test-object.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-v" "-fcoverage-compilation-dir=/home/me/work/tmp" "-resource-dir" "/home/me/work/tmp/lib/clang/14.0.6" "-c-isystem" "/home/me/include" "-c-isystem" "." "-cxx-isystem" "/home/me/include" "-cxx-isystem" "." "-internal-isystem" "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0" "-internal-isystem" "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/x86_64-pc-linux-gnu" "-internal-isystem" "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/backward" "-internal-isystem" "/home/me/work/tmp/lib/clang/14.0.6/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir=/home/me/work/tmp" "-ferror-limit" "19" "-stack-protector" "2" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-fcolor-diagnostics" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-x" "c++" "/home/me/work/tmp/test-object.cpp"

clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/home/me/work/tmp/lib/clang/14.0.6/include"
ignoring nonexistent directory "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/me/include
 .
 /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0
 /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/x86_64-pc-linux-gnu
 /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/backward
 /usr/local/include
 /usr/include
End of search list.
In file included from /home/me/work/tmp/test-object.cpp:1:
/usr/include/stdio.h:33:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
         ^~~~~~~~~~
1 error generated.
Error while processing /home/me/work/tmp/test-object.cpp.
Tool exit status: 1
</code>```

Body:
I'm trying to make simple working tool with SyntaxOnlyAction and custom CompilationDatabase subclass which returns single file and command: clang++ -c -v -o target/test-object.cpp.o test-object.cpp.

But unless I add -I/usr/lib/clang/14.0.6/include to that command line, it does not find stddef.h, then stdarg.h, etc.

-v option reports weird thing: ... "-resource-dir" "/home/me/work/tmp/lib/clang/14.0.6" ... "-internal-isystem" "/home/me/work/tmp/lib/clang/14.0.6/include" ... Looks like it prepends clang's include paths with my working directory /home/me/work/tmp. Other paths look weird too (some start with /../), but clang accepts them.

What am I doing wrong & how can I fix it without manually adding clang's includes?

Thanks.

My system is ArtixLinux / x86-64.

tool.cpp

#include <clang/Basic/Version.inc>
#include <clang/Frontend/FrontendActions.h>
#include <clang/Tooling/CompilationDatabase.h>
#include <clang/Tooling/Tooling.h>

class MyCompilationDatabase : public clang::tooling::CompilationDatabase {
    std::vector<std::string> cpps;
public:
    // This example is cut from larger source where move() is inappropriate.
    MyCompilationDatabase(const std::vector<std::string>& cpps) : cpps(cpps) {}

    std::vector<std::string> getAllFiles() const override { return cpps; }

    std::vector<clang::tooling::CompileCommand> getCompileCommands(llvm::StringRef filePath) const override {
        // This is a bug: filePath is absolute; but fixing it doesn't change anything:
        // clang invocation does not contain -o option.
        std::string o = "target/" + filePath.str() + ".o";
        std::vector<std::string> cmd = {"clang++", "-c", "-v", /*"-I/usr/lib/clang/" CLANG_VERSION_STRING "/include",*/ "-o", o, filePath.str()};
        return {clang::tooling::CompileCommand(".", filePath, std::move(cmd), o)};
    }
};

int main() {
    MyCompilationDatabase db({"test-object.cpp"});
    clang::tooling::ClangTool tool(db, db.getAllFiles());
    return tool.run(clang::tooling::newFrontendActionFactory<clang::SyntaxOnlyAction>().get());
}

test-object.cpp

#include <stdio.h>

int main() {
    puts("Hello world!");
}

makefile (yes I'm using gcc as main compiler -- for historical reasons, cross-compilation to Windows, ensuring that gcc & clang work together this way in a "hostile environment", etc.)

.PHONY: all
all: target/tool
    $<; echo "Tool exit status: $$?"

target/%: %.cpp
    mkdir -p target
    g++ -std=c++20 -fno-rtti -Wall -Wextra -Wpedantic -Werror=format -Werror=return-type -O2 -flto -o $@ $< -lclang-cpp -lclang -lLLVM-14

full output

$ make
mkdir -p target
g++ -std=c++20 -fno-rtti -Wall -Wextra -Wpedantic -Werror=format -Werror=return-type -O2 -flto -o target/tool tool.cpp -lclang-cpp -lclang -lLLVM-14
target/tool; echo "Tool exit status: $?"
clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir:
Found candidate GCC installation: /../lib/gcc/x86_64-pc-linux-gnu/12.2.0
Found candidate GCC installation: /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0
Selected GCC installation: /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
clang Invocation:
 "clang++" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-fsyntax-only" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test-object.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-v" "-fcoverage-compilation-dir=/home/me/work/tmp" "-resource-dir" "/home/me/work/tmp/lib/clang/14.0.6" "-c-isystem" "/home/me/include" "-c-isystem" "." "-cxx-isystem" "/home/me/include" "-cxx-isystem" "." "-internal-isystem" "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0" "-internal-isystem" "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/x86_64-pc-linux-gnu" "-internal-isystem" "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/backward" "-internal-isystem" "/home/me/work/tmp/lib/clang/14.0.6/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir=/home/me/work/tmp" "-ferror-limit" "19" "-stack-protector" "2" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-fcolor-diagnostics" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-x" "c++" "/home/me/work/tmp/test-object.cpp"

clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/home/me/work/tmp/lib/clang/14.0.6/include"
ignoring nonexistent directory "/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/me/include
 .
 /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0
 /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/x86_64-pc-linux-gnu
 /../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/backward
 /usr/local/include
 /usr/include
End of search list.
In file included from /home/me/work/tmp/test-object.cpp:1:
/usr/include/stdio.h:33:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
         ^~~~~~~~~~
1 error generated.
Error while processing /home/me/work/tmp/test-object.cpp.
Tool exit status: 1


问:
how to calculate sum of column in a filtered table saved within a row (dynamic window / custom window)
PROBLEM: how to calculate sum of column in a filtered table saved within a row (dynamic window / custom window)

see below sample dataset:

Desired output is column: SUM dynamic window

```<code>d={'code':['A','A','A','A','B','B','B','C','C','C'],
   'price':[10,8,11,13,1.1,1.3,1.5,100,101,104],
   'group_index':[1,2,3,4,1,2,3,1,2,3],
   'index_start':[1,1,2,2,1,1,2,1,1,1],
   'SUM dynamic window':[10,18,19,32,1.1,2.4,2.8,100,201,305]}

df_dynamic_window = (
   pd
    .DataFrame(data=d)
    .astype({'SUM dynamic window':'int32'})
)
</code>```

I tried to filter table then apply sum. But unable to calculate it. filtered table is saved in a dataframe and Im unable to do aggregation on it.

```<code>df_dynamic_window['sum'] = (
     df_dynamic_window
       .apply(lambda df: df_dynamic_window
       .loc[
           Filter_Rows := (
               (df_dynamic_window['code']        == df['code']) &
               (df_dynamic_window['group_index'] <= df['group_index']) &
               (df_dynamic_window['group_index'] >= df['index_start']) ),
           ['price']],
       axis=1
       )
     )
df_dynamic_window['.sum()'] = df_dynamic_window['sum'].sum()

df_dynamic_window
</code>```

Appreciate your help!

Body:
PROBLEM: how to calculate sum of column in a filtered table saved within a row (dynamic window / custom window)

see below sample dataset:

Desired output is column: SUM dynamic window

d={'code':['A','A','A','A','B','B','B','C','C','C'],
   'price':[10,8,11,13,1.1,1.3,1.5,100,101,104],
   'group_index':[1,2,3,4,1,2,3,1,2,3],
   'index_start':[1,1,2,2,1,1,2,1,1,1],
   'SUM dynamic window':[10,18,19,32,1.1,2.4,2.8,100,201,305]}

df_dynamic_window = (
   pd
    .DataFrame(data=d)
    .astype({'SUM dynamic window':'int32'})
)

I tried to filter table then apply sum. But unable to calculate it. filtered table is saved in a dataframe and Im unable to do aggregation on it.

df_dynamic_window['sum'] = (
     df_dynamic_window
       .apply(lambda df: df_dynamic_window
       .loc[
           Filter_Rows := (
               (df_dynamic_window['code']        == df['code']) &
               (df_dynamic_window['group_index'] <= df['group_index']) &
               (df_dynamic_window['group_index'] >= df['index_start']) ),
           ['price']],
       axis=1
       )
     )
df_dynamic_window['.sum()'] = df_dynamic_window['sum'].sum()

df_dynamic_window

Appreciate your help!


问:
Exoplayer didn't show full screen video, even if I have used Resize_Mode_Zoom
AspectRatioFrameLayout is setting the correct height of the view according to the real video ratio (calcuclating based on width, height and pixelRatio).
So the Question is, How can we calculate width ,height and pixel ratio, so that we can zoom the parent layout as per the display height and width?

I want to customize, to Match_Parent to the layout.


问:
How to remove bottom white line in dark mode
I am designing an application in flutter for light mode and dark mode. But in dark mode it shows white line in few devices only. Not in all devices. Currently I am testing on OnePlus 6T. Attached a screenshot with white bottom line and without bottom line.

Is it possible to remove this white bottom line from bottom.


问:
How to bind data based on web part added in section?
I have created a SharePoint Framework web part.

I have dynamically bound boxes under that web part.

I have added that web part to SharePoint modern page one-third right section.

Below is the screenshot of the page section layout.

I need to bind boxes based on the web part added in the section,

If the web part is added in the left side (more width) section. Boxes should bind in a below manner,

If the web part is added in the right side (less width) section. Boxes should bind in a below manner,

In short, if the section is big boxes bind in 3 column layout, and if the section is small boxes bind in 2 column layout.

Can anyone help me with the same?


问:
How to move QInputDialog to centre of it's parent
I want my QInputDialog input move to the centre like in this VS code window

But i can't move it properly like in the above picture,

Here is my code

```<code>import sys
from PyQt6 import QtWidgets, QtGui, QtCore
from PyQt6.QtWidgets import QApplication

class MainWindow(QtWidgets.QMainWindow):

    def __init__(self):

        super().__init__()

        self.setMinimumSize(600, 600)
        self.main_frame = QtWidgets.QFrame(self)
        self.main_layout = QtWidgets.QVBoxLayout(self.main_frame)
        self.setCentralWidget(self.main_frame)

        self.create_ui()

    def create_ui(self):
        self.menu_bar = self.menuBar()

        self.view_menu = QtWidgets.QMenu('View')
        self.backup_menu = QtWidgets.QMenu('Backup')

        self.wakeup_time_backup = QtGui.QAction('Wakeup time')
        self.wakeup_time_backup.triggered.connect(self.open_backup)
        self.backup_menu.addAction(self.wakeup_time_backup)

        self.view_menu.addAction(self.wakeup_time_backup)
        self.menu_bar.addMenu(self.view_menu)

    def open_backup(self):
        wakeup_time_input = QtWidgets.QInputDialog(self, QtCore.Qt.WindowType.Popup)
        wakeup_time_input.setLabelText('Wakeup time')
        wakeup_time_input.setOkButtonText('Save')
        parent_x = self.rect().center().x()
        parent_y = self.rect().center().y()
        wakeup_time_input.move(QtCore.QPoint(parent_x, 10))
        wakeup_time_input.exec()

app = QApplication([])
win = MainWindow()
win.show()

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

Here is my output

I want the QInputDialog to move to the center of mainwinodow and just below the menubar

Body:
I want my QInputDialog input move to the centre like in this VS code window

But i can't move it properly like in the above picture,

Here is my code

import sys
from PyQt6 import QtWidgets, QtGui, QtCore
from PyQt6.QtWidgets import QApplication

class MainWindow(QtWidgets.QMainWindow):

    def __init__(self):

        super().__init__()

        self.setMinimumSize(600, 600)
        self.main_frame = QtWidgets.QFrame(self)
        self.main_layout = QtWidgets.QVBoxLayout(self.main_frame)
        self.setCentralWidget(self.main_frame)

        self.create_ui()

    def create_ui(self):
        self.menu_bar = self.menuBar()

        self.view_menu = QtWidgets.QMenu('View')
        self.backup_menu = QtWidgets.QMenu('Backup')

        self.wakeup_time_backup = QtGui.QAction('Wakeup time')
        self.wakeup_time_backup.triggered.connect(self.open_backup)
        self.backup_menu.addAction(self.wakeup_time_backup)

        self.view_menu.addAction(self.wakeup_time_backup)
        self.menu_bar.addMenu(self.view_menu)

    def open_backup(self):
        wakeup_time_input = QtWidgets.QInputDialog(self, QtCore.Qt.WindowType.Popup)
        wakeup_time_input.setLabelText('Wakeup time')
        wakeup_time_input.setOkButtonText('Save')
        parent_x = self.rect().center().x()
        parent_y = self.rect().center().y()
        wakeup_time_input.move(QtCore.QPoint(parent_x, 10))
        wakeup_time_input.exec()

app = QApplication([])
win = MainWindow()
win.show()

sys.exit(app.exec())

Here is my output

I want the QInputDialog to move to the center of mainwinodow and just below the menubar