问:
Adding a default value to google-places-auto-complete
I'm trying to use the city of a user as a default value to google-places-auto-complete input.

I've tried to use cityAutoComplete?.setAddressText(city) outside of the ref prop but it won't work, and I've tried using it inside of the Ref prop and then it works but won't let me type anything else into that input (in order to change city for exmple).

here's the code which lets me put a default value but won't let me type into the input.

```<code>  <GooglePlacesAutocomplete
                            ref={(ref) => {
                                cityAutoComplete = ref
                                cityAutoComplete?.setAddressText(city)
                            }}
                            styles={{
                                textInputContainer: { height: scale(50) },
                                container: {
                                    width: "100%",
                                    backgroundColor: "transparent",
                                },
                                textInput: {
                                    borderBottomWidth: 1,
                                    marginTop: scale(10),
                                    textAlign: "center",
                                    fontSize: 18,
                                    fontFamily: "Heebo-Regular",
                                    backgroundColor: "transparent",
                                    paddingBottom: 4,
                                    width: scale(200),
                                },
                            }}
                            placeholder={strings("City")}
                            value={city}
                            onPress={(data, details = null) => {
                                setCity(data.terms[0].value);
                                setNeedReload(true);
                            }}
                            query={{
                                types: "(cities)",
                                key: globals.GOOGLE_API_KEY,
                                language: "he",
                            }}
                        />
</code>```

Body:
I'm trying to use the city of a user as a default value to google-places-auto-complete input.

I've tried to use cityAutoComplete?.setAddressText(city) outside of the ref prop but it won't work, and I've tried using it inside of the Ref prop and then it works but won't let me type anything else into that input (in order to change city for exmple).

here's the code which lets me put a default value but won't let me type into the input.

  <GooglePlacesAutocomplete
                            ref={(ref) => {
                                cityAutoComplete = ref
                                cityAutoComplete?.setAddressText(city)
                            }}
                            styles={{
                                textInputContainer: { height: scale(50) },
                                container: {
                                    width: "100%",
                                    backgroundColor: "transparent",
                                },
                                textInput: {
                                    borderBottomWidth: 1,
                                    marginTop: scale(10),
                                    textAlign: "center",
                                    fontSize: 18,
                                    fontFamily: "Heebo-Regular",
                                    backgroundColor: "transparent",
                                    paddingBottom: 4,
                                    width: scale(200),
                                },
                            }}
                            placeholder={strings("City")}
                            value={city}
                            onPress={(data, details = null) => {
                                setCity(data.terms[0].value);
                                setNeedReload(true);
                            }}
                            query={{
                                types: "(cities)",
                                key: globals.GOOGLE_API_KEY,
                                language: "he",
                            }}
                        />


来源: stackexchange

问:
How to restore default options for webdriver in selenium (using Python)
I tried to make edge in selenium work headless by settings --headless and --disable-gpu options, but now nothing works. Neither edge, nor chrome or firefox. Every time I encounter an error stating something like "Message: 'MicrosoftWebDriver.exe' executable needs to be in PATH".

How do I fix this?

I tried adding the driver to my workspace but it did nothing. Also, the terminal gives a link to download the driver, but it does not work.

ContentLicense: CC BY-SA 4.0


问:
Laravel Cashier stripe webhook response failed but everything works
So I do not understand fully what is happening but I suspect I am missing something silly.

I am creating a subscription in stripe via cahier with the usage of the stripe hosted checkout page. This is all in testing and not live.

Now when I click subscribe button I go to checkout and I create new sub and go back to my system. That is all great. I see sub in my database and I see new sub on stripe.

I see in local stripe CLI something like this

```<code>2022-12-08 11:19:45  --> setup_intent.succeeded [evt_1MCi8jEgkYGsrIK1noJjDJzl]
2022-12-08 11:19:45  --> setup_intent.created [evt_1MCi8jEgkYGsrIK1IaP2tuw9]
2022-12-08 11:19:45 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8jEgkYGsrIK1noJjDJzl]
2022-12-08 11:19:45 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8jEgkYGsrIK1IaP2tuw9]
2022-12-08 11:19:46  --> checkout.session.completed [evt_1MCi8kEgkYGsrIK1e8rGl5KO]
2022-12-08 11:19:46 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1e8rGl5KO]
2022-12-08 11:19:46  --> invoice.created [evt_1MCi8kEgkYGsrIK1v2x9UsFC]
2022-12-08 11:19:46 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1v2x9UsFC]
2022-12-08 11:19:46  --> invoice.finalized [evt_1MCi8kEgkYGsrIK12Gc2WKwy]
2022-12-08 11:19:46 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK12Gc2WKwy]
2022-12-08 11:19:46  --> invoice.paid [evt_1MCi8kEgkYGsrIK1zBrQaMLG]
2022-12-08 11:19:46 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1zBrQaMLG]
2022-12-08 11:19:46  --> invoice.payment_succeeded [evt_1MCi8kEgkYGsrIK1iovWPu3A]
2022-12-08 11:19:47 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1iovWPu3A]
2022-12-08 11:19:47  --> customer.subscription.created [evt_1MCi8kEgkYGsrIK1gBbRRIWs]
2022-12-08 11:19:47 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1gBbRRIWs]
</code>```

In my .env as a webhook key I've put the one that stripe client gives me when I start it.

In my stripe dashboard I can see some problems though each and every webhook call gives me Failed to connect to remote host
Is that something to do with testing setup or it supposed to be like that when I am using CLI or did I do something wrong?

I have Laravel 9 , vue3 and I followed just regular instructions for cashier.

Body:
So I do not understand fully what is happening but I suspect I am missing something silly.

I am creating a subscription in stripe via cahier with the usage of the stripe hosted checkout page. This is all in testing and not live.

Now when I click subscribe button I go to checkout and I create new sub and go back to my system. That is all great. I see sub in my database and I see new sub on stripe.

I see in local stripe CLI something like this

2022-12-08 11:19:45  --> setup_intent.succeeded [evt_1MCi8jEgkYGsrIK1noJjDJzl]
2022-12-08 11:19:45  --> setup_intent.created [evt_1MCi8jEgkYGsrIK1IaP2tuw9]
2022-12-08 11:19:45 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8jEgkYGsrIK1noJjDJzl]
2022-12-08 11:19:45 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8jEgkYGsrIK1IaP2tuw9]
2022-12-08 11:19:46  --> checkout.session.completed [evt_1MCi8kEgkYGsrIK1e8rGl5KO]
2022-12-08 11:19:46 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1e8rGl5KO]
2022-12-08 11:19:46  --> invoice.created [evt_1MCi8kEgkYGsrIK1v2x9UsFC]
2022-12-08 11:19:46 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1v2x9UsFC]
2022-12-08 11:19:46  --> invoice.finalized [evt_1MCi8kEgkYGsrIK12Gc2WKwy]
2022-12-08 11:19:46 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK12Gc2WKwy]
2022-12-08 11:19:46  --> invoice.paid [evt_1MCi8kEgkYGsrIK1zBrQaMLG]
2022-12-08 11:19:46 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1zBrQaMLG]
2022-12-08 11:19:46  --> invoice.payment_succeeded [evt_1MCi8kEgkYGsrIK1iovWPu3A]
2022-12-08 11:19:47 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1iovWPu3A]
2022-12-08 11:19:47  --> customer.subscription.created [evt_1MCi8kEgkYGsrIK1gBbRRIWs]
2022-12-08 11:19:47 <-- [200] POST http://contract.test/stripe/webhook [evt_1MCi8kEgkYGsrIK1gBbRRIWs]

In my .env as a webhook key I've put the one that stripe client gives me when I start it.

In my stripe dashboard I can see some problems though each and every webhook call gives me Failed to connect to remote host
Is that something to do with testing setup or it supposed to be like that when I am using CLI or did I do something wrong?

I have Laravel 9 , vue3 and I followed just regular instructions for cashier.


问:
Getting Error while running Plesk additional deployment actions
Trying to run node app after automatic deployment
I've using Plesk server and Bitbucket for my application. And successfully deployed and built. However, when it come across npm run start:prod, it says mongoose connection uri is undefined. But I've added my connection string plesk environment.

As I've using NestJs, I've used

```<code>configService.get('MONGO_URI')
</code>```

first and then tried

```<code>process.env.MONGO_URI.
</code>```

But failed on both. But it works fine when I manually restart the app.

Body:
Trying to run node app after automatic deployment
I've using Plesk server and Bitbucket for my application. And successfully deployed and built. However, when it come across npm run start:prod, it says mongoose connection uri is undefined. But I've added my connection string plesk environment.

As I've using NestJs, I've used

configService.get('MONGO_URI')

first and then tried

process.env.MONGO_URI.

But failed on both. But it works fine when I manually restart the app.


问:
How to remove a project from VS code that I might have cloned by mistake?
How to remove a project from VS code that I might have cloned by mistake?

I'm a newbie. Please explain.


问:
Managing externalized properties files for multiple enviroments
I have a Java Spring Boot application, which is running for different clients. All of the clients use the same .jar file, which is uploaded to the Ubuntu machine.

The .jar file has bundled application.yml file, which contains some configuration properties, common to all of the clients. Each client also has their own application.yml with more detailed config, specific to that client. Everything is controlled with supervisord - all of the instances have defined path to .jar file (common to all), to configuration file, logs, etc.

It all works like a charm expect a situation when a new config variable is added to application.yml (for example if there was a new feature added which requires such a change). If it is common to all - no problem, I can add it to the bundled application.yml. But if it has to be specific to each client, then I need to manually edit each of the application.eml files in order to add this new variable and its value. It is a nightmare, especially if there are more and more clients.

Is there any convenient way to manage externalized properties files for multiple clients? I have been browsing the Internet for a solution, but I couldn't find anything. Or maybe should I change approach to the configuration of the application?

I would be glad for any help.


问:
Is there a simple way to cache a variable in a Shopware plugin?
We want to avoid fetching the same values from DB over a million times. How do we cache variables in a simple way in Shopware? Preferably using Redis?

Trying to use this,
https://symfony.com/doc/current/components/cache.html

... but I'm new to Symfony.
Also I't seams like a lot of work compared to Laravel!


问:
How do I get all users in Yammer group into Pandas dataframe with REST api?
I am able to successfully execute an API call and receive a .json response with the requests package. However, it looks like a constraint of the Yammer API is that it only loads 50 users at a time.

I can tell at the bottom of the .json response, there are some additional fields which would indicate there are more pages.

How can I create a loop to continually append users to a dataframe until there are no more records?

Here's the code I have so far:

```<code>import requests

class BearerAuth(requests.auth.AuthBase):
    def __init__(self, token):
        self.token = token

    def __call__(self, r):
        r.headers["authorization"] = "Bearer " + self.token
        return r

def yammer():
    access_token = "12345-AccessTokenString"
    group_id = "YammerGroupString"

    url = (
        f"https://www.yammer.com/api/v1/users/in_group/{group_id}.json"
    )

    r = requests.get(url, auth=BearerAuth(access_token))

def main():
    yammer()

if __name__ == "__main__":
    main()
</code>```

Any help/guidance would be much appreciated!

Body:
I am able to successfully execute an API call and receive a .json response with the requests package. However, it looks like a constraint of the Yammer API is that it only loads 50 users at a time.

I can tell at the bottom of the .json response, there are some additional fields which would indicate there are more pages.

How can I create a loop to continually append users to a dataframe until there are no more records?

Here's the code I have so far:

import requests

class BearerAuth(requests.auth.AuthBase):
    def __init__(self, token):
        self.token = token

    def __call__(self, r):
        r.headers["authorization"] = "Bearer " + self.token
        return r

def yammer():
    access_token = "12345-AccessTokenString"
    group_id = "YammerGroupString"

    url = (
        f"https://www.yammer.com/api/v1/users/in_group/{group_id}.json"
    )

    r = requests.get(url, auth=BearerAuth(access_token))

def main():
    yammer()

if __name__ == "__main__":
    main()

Any help/guidance would be much appreciated!


问:
Migrating from Shopify Private App to Shopify Customer App
I have a few questions regarding ShopifySharp package and Shopify Custom App and Private App.
It has a warning that says:

Some of your private apps and/or admin webhook subscriptions may not work as expected because they are using deprecated API versions.

It also has say, private apps need to be updated before January 1, 2023.

To give you an idea, we created an application in C# built using ShopifySharp. It has been working for years already. It has API Key, password, and domain to connect to, to get the essential data from. It's understandable. Now here comes the confusion. I created a new app in Shopify by clicking "Create an app" in the Settings, putting the name, etc. So, it now says it's a Custom App below the app name.

It made me confused because I don't know if I'm going to replace the old Private App with the new Custom App and use its credentials.

I also don't know if those credentials I am seeing is what I am going to put in my C# application, like the API key and secret key. I don't even know the use of "Admin API access token". I am new this Shopify thingy by the way but I have been developing and updating the C# app but I was just concern on the API key and password in the Private App.

I am also seeing Webhooks subscription default to "2022-10" but I don't know what to do with it.

I already asked the ShopifySharp maintainer but I am not satisfied with the answer. All I have to do it to change the https://myshop.myshopify.com/admin/api/2020-07 to https://myshop.myshopify.com/admin/api/2022-04? Is that all?


问:
How do I make new variable on loop based on input value?
I want to make something like this:

```<code>x = 5
while x >= 1
  s(x) = input("something: ")
  x = x - 1
</code>```

So then there will be five separate input variable, that is S1, S2, S3, etc.

Body:
I want to make something like this:

x = 5
while x >= 1
  s(x) = input("something: ")
  x = x - 1

So then there will be five separate input variable, that is S1, S2, S3, etc.


问:
react router dom v6 go back functionality
hey I'm using react v18 with react router dom v6
and I'm trying to implement back button functionality to be present at the navbar and also I  have other routes in the navbar

in my case, I've started by importing useNavigate from 'react-router-dom
and then declaring the function inside the component using useNavigate hook

```<code>  const navigate = useNavigate();
  const goBack = () => {
      navigate(-1);
  };
</code>```

and that works fine in case you click at any route in the navbar at once and then click the go back  button
but in case you clicked many times at the same route, the go back  button will not work as expected at will keep you at the same route
for example, if I have 3 buttons(route A, route B, and route C) in the navbar plus the back button and the default route is route A and then click at route B (you will be directed to the route B) and then click many times at route B then click on back button to go back to route A as expected but the behavior is not as expected you need  to click also many times to go back to route A

in the previous version of react router dom we use history.push to navigate between routes and history.goBack to open the previous page

```<code>import { useHistory } from "react-router-dom";

let history = useHistory();
<button onClick={history.goBack}>Back</button>
</code>```

any explanation or help would be appreciated

Body:
hey I'm using react v18 with react router dom v6
and I'm trying to implement back button functionality to be present at the navbar and also I  have other routes in the navbar

in my case, I've started by importing useNavigate from 'react-router-dom
and then declaring the function inside the component using useNavigate hook

  const navigate = useNavigate();
  const goBack = () => {
      navigate(-1);
  };

and that works fine in case you click at any route in the navbar at once and then click the go back  button
but in case you clicked many times at the same route, the go back  button will not work as expected at will keep you at the same route
for example, if I have 3 buttons(route A, route B, and route C) in the navbar plus the back button and the default route is route A and then click at route B (you will be directed to the route B) and then click many times at route B then click on back button to go back to route A as expected but the behavior is not as expected you need  to click also many times to go back to route A

in the previous version of react router dom we use history.push to navigate between routes and history.goBack to open the previous page

import { useHistory } from "react-router-dom";

let history = useHistory();
<button onClick={history.goBack}>Back</button>

any explanation or help would be appreciated


问:
Turning csv file into api
I want to create a project. I have a huge list of data in a single .csv file. It has Millions of Data and I want to access them remotely using an api call.

My csv files looks similar like this:

Name
Age

Red
20

Blue
25

It's a single csv file and it has over Millions of Data
I want to turn this csv file into a api so that I can access it from anywhere anytime using HTTPS request.
Like, www.myapi.example/api/csvfile/red
When I submit this call, I should get response Age:20 Something like that.
Please give me Idea how to do that. Thanks

I expect to get response like this after a HTTPS request :

{"Blue":"25"}

Title: Turning csv file into api


问:
Identify which where clause condition was used to get the record in mssql
I am writing a query wherein there are multiple conditions in where clause and want to identify which "where" clause condition was used to get the particular record.

I have pasted an example below but its not working for me for 2 reasons,

There are around 10 conditions in "where" clause and they are heavy ones. Its taking lot of time to execute mainly because of the subquery used.

It can have multiple conditions matched in "where" clause to get a record.

Any idea how can we implement this. I am using MSSQL.

```<code>select
column1,
column2,
column3,
CASE
  WHEN CONDITION1 THEN 'Condition1 met'
  WHEN
    (select count(t.column2) from table t
      where t.column1 = parent.column1
      group by t.column2
    ) IS NOT NULL THEN 'Condition2 met'
END as conditionsUsed
from table
where
Condition1
OR
(select count(t.column2) from table t
where
t.column1 = parent.column1
group by t.column2 ) IS NOT NULL
</code>```

Body:
I am writing a query wherein there are multiple conditions in where clause and want to identify which "where" clause condition was used to get the particular record.

I have pasted an example below but its not working for me for 2 reasons,

There are around 10 conditions in "where" clause and they are heavy ones. Its taking lot of time to execute mainly because of the subquery used.

It can have multiple conditions matched in "where" clause to get a record.

Any idea how can we implement this. I am using MSSQL.

select
column1,
column2,
column3,
CASE
  WHEN CONDITION1 THEN 'Condition1 met'
  WHEN
    (select count(t.column2) from table t
      where t.column1 = parent.column1
      group by t.column2
    ) IS NOT NULL THEN 'Condition2 met'
END as conditionsUsed
from table
where
Condition1
OR
(select count(t.column2) from table t
where
t.column1 = parent.column1
group by t.column2 ) IS NOT NULL


问:
How to install latest Android SDK with Delphi SDK Manager?
I am using Delphi 10.4 and I would like to install Android 31 API SDK. Delphi has its own SDK manager, available e.g. from 'Options - Deployment - SDK Manager'. And this SDK Manager has option 'Add...' 'Add a New SDK' - 'Select an SDK version' - 'Add New...'.

So far everything is fine. But 'Add New...' opens 'Create a new Android SDK' which does not provide options for downloading and installing SDKs, it just requires to the directories to an already installed SDK. It also suggests, that 'Android SDK Base path' could be '/Documents/Embarcader/Studio/21.0/CatalogRepository/AndroidSDK-2525'.

So, this suggests, that I should manually downaload Android SDK (specific API level) in unzip/install into the CatalogRepository for the specific Delphi version.

The strange thing is that Google/Android does not provide the option to download specific, standalone SDK. Android, instead, suggests to download its own SDK Manager tools https://developer.android.com/studio/#command-tools and then do all the SDK management from that tool. While I can expect that this command line tool smoothly integrates with Android Studio, there is not suggestion that it integrates with Delphi SDK Manager.

I am aware of Target Android API 29 on Delphi 10.3.3 and https://docwiki.embarcadero.com/RADStudio/Rio/en/Adding_an_Android_SDK, there is no suggestion how can I get SDK of specific API level to my computer.

So - how to get SDK of specific API level to my computer ready to be used by Delphi SDK manager.

Additional Information: I am reading https://delphiworlds.com/2020/09/manual-android-sdk-ndk-install-delphi/ and http://delphi.org/2019/06/manually-installing-android-sdk-ndk-and-java-for-firemonkey-development/ and they may give the answers. Delphi has it own peculiarities.


问:
How to build a simple graph federated learning framework?
Now I want to build a simple graph federated learning framework. At present, I have the following questions：

In addition to FedML, is there any other graph federated learning framework?

How to start building such a framework? I don't konw where to start.

What pre-requisite knowledge is required to complete such a framework?

Is there any article or source code that I can refer to ?

I have tried read some papers about machine learning system but I think they are helpless to my question and

I'm still clueless. I think all I nedd is how to start besides any article or source code I can refer to.


问:
Angular lazy loading for datatable makes sorting filtering paging not functional
Hello i implemented lazyloading for my datatable but the issue is now that my sorting and filtering and paging doesnt work. if i remove lazy loading then it works just fine

this is my html

```<code> <p-table
      #dt
      [value]="lazy"
      [columns]="cols"
      [scrollable]="true"
      [tableStyle]="{ 'min-width': '50rem' }"
      scrollHeight="flex"
      [globalFilterFields]="['time','temperature','humidity','wind', 'pressure', 'direction', 'precipitation', 'rain', 'cloudcover','soilTemperature']"
      [rows]="10"
      [paginator]="true"
      [lazy]="true"
      (onLazyLoad)="loadData($event)"
      [loading]="loading"
    >
    <ng-template pTemplate="caption">
      <div *ngIf="filterSwitch" class="flex">
          <button pButton label="Clear"
          class="p-button-outlined"
          icon="pi pi-filter-slash"
          (click)="clearFilters(dt)">
        </button>
          <span >
              <i class="pi pi-search"></i>
              <input
              class="filter-input"
              pInputText
              type="text"
              (input)="dt.filterGlobal($event.target.value, 'contains')" />
          </span>
      </div>
  </ng-template>
      <ng-template pTemplate="header" let-columns>
        <tr class="icons">
          <th
          style="min-width:250px"
          [pSortableColumn]="col.field"
          *ngFor="let col of columns">
            <fa-icon [icon]="col.icon"></fa-icon>
            {{col.header}}
            <p-sortIcon [field]="col.field"></p-sortIcon>
            <p-columnFilter
            *ngIf="filterSwitch"
            [type]="col.type"
            display="menu"
            [field]="col.field">
          </p-columnFilter>
          </th>
      </ng-template>
      <ng-template pTemplate="body" let-weather let-columns="columns">
        <tr>
          <td *ngFor="let col of columns">{{ weather[col.field] + col.value }}</td>
        </tr>
      </ng-template>
    </p-table>
</code>```

this is my ts

```<code>export class WeatherDataComponent implements OnInit, OnDestroy {
  @ViewChild('dt') table: Table;
  showError: string;
  weatherData: WeatherDataItem[] = [];
  private componentDestroyed$: Subject<boolean> = new Subject();
  weatherDataLoading: boolean;
  icons: IconDefinition[] = [
    faClock,
    faTemperatureHigh,
    faPercent,
    faWind,
    faGem,
    faDirections,
    faWater,
    faCloud,
  ];
  cols: WeatherDataCol[];
  loading: boolean = false;
  lazy: any;

  constructor(
    private weatherService: WeatherService,
    public datePipe: DatePipe
  ) {
    this.cols = [
      new WeatherDataCol('time', 'Time', 'text', '', this.icons[0]),
      new WeatherDataCol(
        'temperature',
        'Temperature',
        'text',
        '°C',
        this.icons[1]
      ),
      new WeatherDataCol('humidity', 'Humidity', 'numeric', '%', this.icons[2]),
      new WeatherDataCol('wind', 'Wind Speed', 'text', ' km/h', this.icons[3]),
      new WeatherDataCol(
        'pressure',
        'Air Pressure',
        'text',
        ' hPa',
        this.icons[4]
      ),
      new WeatherDataCol(
        'direction',
        'Wind Direction',
        'numeric',
        '°',
        this.icons[5]
      ),
      new WeatherDataCol(
        'precipitation',
        'Precipitation',
        'numeric',
        'mm',
        this.icons[6]
      ),
      new WeatherDataCol('rain', 'Rain', 'numeric', 'mm', this.icons[6]),
      new WeatherDataCol(
        'cloudcover',
        'Cloudcover',
        'numeric',
        'mm',
        this.icons[7]
      ),
      new WeatherDataCol(
        'soilTemperature',
        'Soil Temperature',
        'text',
        '°C',
        this.icons[1]
      ),
    ];
  }

  ngOnInit(): void {
    this.weatherDataLoading = true;
    this.weatherService
      .getWeatherData()
      .pipe(
        finalize(() => (this.weatherDataLoading = false)),
        takeUntil(this.componentDestroyed$)
      )
      .subscribe({
        next: (historicalWeatherData) => {
          const temperatures = historicalWeatherData.hourly.temperature_2m;
          const times = historicalWeatherData.hourly.time.map((time) =>
            this.datePipe.transform(time, 'shortTime')
          );
          const humidities = historicalWeatherData.hourly.relativehumidity_2m;
          const windSpeeds = historicalWeatherData.hourly.windspeed_10m;
          const airPressures = historicalWeatherData.hourly.surface_pressure;
          const windDirections = historicalWeatherData.hourly.winddirection_10m;
          const precipitations = historicalWeatherData.hourly.precipitation;
          const rain = historicalWeatherData.hourly.rain;
          const cloudcover = historicalWeatherData.hourly.cloudcover;
          const soilTemperatures =
            historicalWeatherData.hourly.soil_temperature_0_to_7cm;

          temperatures.forEach((value, i) => {
            this.weatherData.push(
              new WeatherDataItem(
                value,
                times[i],
                humidities[i],
                windSpeeds[i],
                airPressures[i],
                windDirections[i],
                precipitations[i],
                rain[i],
                cloudcover[i],
                soilTemperatures[i]
              )
            );
          });
        },
        error: () =>
          (this.showError =
            'Something went wrong. Please try refreshing the page'),
      });
    this.loading = true;
  }

  loadData(event: LazyLoadEvent) {
   this.loading = true;
    setTimeout(() => {
      if (this.weatherData) {
        this.lazy = this.weatherData.slice(event.first, event.first + event.rows);
        this.loading = false;
        console.log(this.weatherData);
      }
    }, 1000);
  }
</code>```

for lazy loading i added this function

```<code>loadData(event: LazyLoadEvent) {
this.loading = true;
    setTimeout(() => {
      if (this.weatherData) {
        this.lazy = this.weatherData.slice(event.first, event.first + event.rows);
        this.loading = false;
        console.log(this.weatherData);
      }
    }, 1000);
  }

</code>```

it doesnt work and i cant think of anything else that might be wrong, any ideas please ?

Body:
Hello i implemented lazyloading for my datatable but the issue is now that my sorting and filtering and paging doesnt work. if i remove lazy loading then it works just fine

this is my html

    <ng-template pTemplate="caption">

          <button pButton label="Clear"
          class="p-button-outlined"
          icon="pi pi-filter-slash"
          (click)="clearFilters(dt)">
        </button>

              <input
              class="filter-input"
              pInputText
              type="text"
              (input)="dt.filterGlobal($event.target.value, 'contains')" />

  </ng-template>
      <ng-template pTemplate="header" let-columns>

            <fa-icon [icon]="col.icon"></fa-icon>
            {{col.header}}

      </ng-template>
      <ng-template pTemplate="body" let-weather let-columns="columns">

          {{ weather[col.field] + col.value }}

      </ng-template>

this is my ts

export class WeatherDataComponent implements OnInit, OnDestroy {
  @ViewChild('dt') table: Table;
  showError: string;
  weatherData: WeatherDataItem[] = [];
  private componentDestroyed$: Subject<boolean> = new Subject();
  weatherDataLoading: boolean;
  icons: IconDefinition[] = [
    faClock,
    faTemperatureHigh,
    faPercent,
    faWind,
    faGem,
    faDirections,
    faWater,
    faCloud,
  ];
  cols: WeatherDataCol[];
  loading: boolean = false;
  lazy: any;

  constructor(
    private weatherService: WeatherService,
    public datePipe: DatePipe
  ) {
    this.cols = [
      new WeatherDataCol('time', 'Time', 'text', '', this.icons[0]),
      new WeatherDataCol(
        'temperature',
        'Temperature',
        'text',
        '°C',
        this.icons[1]
      ),
      new WeatherDataCol('humidity', 'Humidity', 'numeric', '%', this.icons[2]),
      new WeatherDataCol('wind', 'Wind Speed', 'text', ' km/h', this.icons[3]),
      new WeatherDataCol(
        'pressure',
        'Air Pressure',
        'text',
        ' hPa',
        this.icons[4]
      ),
      new WeatherDataCol(
        'direction',
        'Wind Direction',
        'numeric',
        '°',
        this.icons[5]
      ),
      new WeatherDataCol(
        'precipitation',
        'Precipitation',
        'numeric',
        'mm',
        this.icons[6]
      ),
      new WeatherDataCol('rain', 'Rain', 'numeric', 'mm', this.icons[6]),
      new WeatherDataCol(
        'cloudcover',
        'Cloudcover',
        'numeric',
        'mm',
        this.icons[7]
      ),
      new WeatherDataCol(
        'soilTemperature',
        'Soil Temperature',
        'text',
        '°C',
        this.icons[1]
      ),
    ];
  }

  ngOnInit(): void {
    this.weatherDataLoading = true;
    this.weatherService
      .getWeatherData()
      .pipe(
        finalize(() => (this.weatherDataLoading = false)),
        takeUntil(this.componentDestroyed$)
      )
      .subscribe({
        next: (historicalWeatherData) => {
          const temperatures = historicalWeatherData.hourly.temperature_2m;
          const times = historicalWeatherData.hourly.time.map((time) =>
            this.datePipe.transform(time, 'shortTime')
          );
          const humidities = historicalWeatherData.hourly.relativehumidity_2m;
          const windSpeeds = historicalWeatherData.hourly.windspeed_10m;
          const airPressures = historicalWeatherData.hourly.surface_pressure;
          const windDirections = historicalWeatherData.hourly.winddirection_10m;
          const precipitations = historicalWeatherData.hourly.precipitation;
          const rain = historicalWeatherData.hourly.rain;
          const cloudcover = historicalWeatherData.hourly.cloudcover;
          const soilTemperatures =
            historicalWeatherData.hourly.soil_temperature_0_to_7cm;

          temperatures.forEach((value, i) => {
            this.weatherData.push(
              new WeatherDataItem(
                value,
                times[i],
                humidities[i],
                windSpeeds[i],
                airPressures[i],
                windDirections[i],
                precipitations[i],
                rain[i],
                cloudcover[i],
                soilTemperatures[i]
              )
            );
          });
        },
        error: () =>
          (this.showError =
            'Something went wrong. Please try refreshing the page'),
      });
    this.loading = true;
  }

  loadData(event: LazyLoadEvent) {
   this.loading = true;
    setTimeout(() => {
      if (this.weatherData) {
        this.lazy = this.weatherData.slice(event.first, event.first + event.rows);
        this.loading = false;
        console.log(this.weatherData);
      }
    }, 1000);
  }

for lazy loading i added this function

loadData(event: LazyLoadEvent) {
this.loading = true;
    setTimeout(() => {
      if (this.weatherData) {
        this.lazy = this.weatherData.slice(event.first, event.first + event.rows);
        this.loading = false;
        console.log(this.weatherData);
      }
    }, 1000);
  }

it doesnt work and i cant think of anything else that might be wrong, any ideas please ?


问:
General error: SQLSTATE[HY000]: General error: 1364 Field 'file_material' doesn't have a default value
I am trying to assign the user_id with the current user but it give me this error

```<code>SQLSTATE[HY000]: General error: 1364 Field 'file_material' doesn't have a default value
</code>```

Images error

with these Model

```<code>protected $primaryKey = 'id_sub_detail';
    protected $table = 'subject_details';
    protected $fillable = [
        'id_sub_detail',
        'id_subject',
        'start_date',
        'time',
        'title',
        'sub_topics',
        'room',
        'file_material',
    ];
</code>```

However this method do the job

```<code>public function UploadSubjectDetail(Request $request){
        $addSubjectDetail= new SubjectDetail();

        $addSubjectDetail->id_subject = $request->input('id_subject');
        $addSubjectDetail->start_date = $request->input('start_date');
        $addSubjectDetail->time = $request->input('time');
        $addSubjectDetail->title = $request->input('title');
        $addSubjectDetail->sub_topics = $request->input('sub_topics');
        $addSubjectDetail->room = $request->input('room');

        if ($request->file('file_material')) {
            $file = $request->file('file_material');
            $filename = date('YmdHi').$file->getClientOriginalName();
            $file->move(public_path('upload/material/'), $filename);
            $addSubjectDetail['file_material'] = $filename;
        }

        $addSubjectDetail->save();
        return redirect()->back();
</code>```

any idea why this fail?
Images XAMPP Mysqli

Body:
I am trying to assign the user_id with the current user but it give me this error

SQLSTATE[HY000]: General error: 1364 Field 'file_material' doesn't have a default value

Images error

with these Model

protected $primaryKey = 'id_sub_detail';
    protected $table = 'subject_details';
    protected $fillable = [
        'id_sub_detail',
        'id_subject',
        'start_date',
        'time',
        'title',
        'sub_topics',
        'room',
        'file_material',
    ];

However this method do the job

public function UploadSubjectDetail(Request $request){
        $addSubjectDetail= new SubjectDetail();

        $addSubjectDetail->id_subject = $request->input('id_subject');
        $addSubjectDetail->start_date = $request->input('start_date');
        $addSubjectDetail->time = $request->input('time');
        $addSubjectDetail->title = $request->input('title');
        $addSubjectDetail->sub_topics = $request->input('sub_topics');
        $addSubjectDetail->room = $request->input('room');

        if ($request->file('file_material')) {
            $file = $request->file('file_material');
            $filename = date('YmdHi').$file->getClientOriginalName();
            $file->move(public_path('upload/material/'), $filename);
            $addSubjectDetail['file_material'] = $filename;
        }

        $addSubjectDetail->save();
        return redirect()->back();

any idea why this fail?
Images XAMPP Mysqli


问:
Send all products data in woocommerce_proceed_to_checkout action webhook
We are trying to build a 3rd party application to manage the stock on woocommerce, For that we created a webhook action: woocommerce_proceed_to_checkout
The webhook job will be send all the item details + their vendors details to the 3rd party application and the 3rd party application will check if the product is available on the vendor website and return true or false stock status.

When we tested the webhook it return the below Raw Content

```<code>{
  "action": "woocommerce_proceed_to_checkout",
  "arg": ""
}
</code>```

Is there a way to send all the products details in the cart via the webhook?
Your help will be appreciated...

Body:
We are trying to build a 3rd party application to manage the stock on woocommerce, For that we created a webhook action: woocommerce_proceed_to_checkout
The webhook job will be send all the item details + their vendors details to the 3rd party application and the 3rd party application will check if the product is available on the vendor website and return true or false stock status.

When we tested the webhook it return the below Raw Content

{
  "action": "woocommerce_proceed_to_checkout",
  "arg": ""
}

Is there a way to send all the products details in the cart via the webhook?
Your help will be appreciated...


问:
Spark Pi Applications running on Ideal Dataproc Cluster
I witness a lot of Spark Pi application runs on my ideal Dataproc Cluster. These runs took place every 5 minutes on different workers and master node. My cluster is linked to a PHS, these Spark Pi jobs end up spamming the PHS Spark UI.

Any reason why Spark Pi jobs are running on the cluster? Also any way to disable these Spark Pi jobs?


问:
How to calculate Bits Per Pixel (BPP) in Autoencoder latent space representation?
I am a beginner in image compression domain using Deep learning Autoencoders. I understood the concept of Bits per pixel of an image but I confused how to calculate it while performing image compression using autoencoders.

I have read a lot of research articles (eg: Variable Rate Deep Image Compression with a conditional autoencoder by Yoojin Choi et al. and many other similar articles) in the net which include the bpp values in them calculated from latent space representation for comparison between different autoencoder models but I could not find any straight forward way or description on how to calculate the bpp value while performing compression using autoencoders.

How to calculate Bits Per pixel in autoencoder using latent space representation?

I have spent weeks sorting it out but no luck still.
Kindly guide me in this. Thanks in advance


问:
How to add tags to links via form in django?
I am working on a business directory and i wanna make form like this.

Some links can have dofollow tag, some links can have nofollow or sponsored. How can i do this via using form in django.


问:
celery scheduled aws upload_file timeout
```<code>
def upload_file_to_aws(file_name):
    """Upload a file to an S3 bucket
    :param file_name: File to upload
    :return: True if file was uploaded, else False
    """

    bucket = get_bucket()
    # If S3 object_name was not specified, use file_name

    object_name = file_name.split("/")[-1]
    # Upload the file
    s3_client = boto3.client(
        "s3",
        aws_access_key_id=AWS_ACCESS_KEY_ID,
        aws_secret_access_key=AWS_SECRET_ACCESS_KEY
    )
    ce_logger.info(f"s3_client:{s3_client}")
    try:
        s3_client.upload_file(file_name, bucket, object_name)
    except Exception as e:
        logger.info(e)
        return False
    return True
</code>```

When I run the above method locally, it can work normally and upload the file to s3,, but when I put this task in celery schedule, use the s3_client.upload_file(file_name, bucket, object_name) method. It will timeout. celery log is displayed

[the 2022-12-08 13:40:03, 205: INFO/ForkPoolWorker-1]  project.invoice.tasks.download_gmail_attachment_create_invoice[14b98680-7f38-45fb-9dbe-283330c304b0]: s3_client:<botocore.client.S3 object at 0x7f0a8a5f35e0>
[13:45:11 2022-12-08, 162: INFO/ForkPoolWorker-1]  project.invoice.tasks.download_gmail_attachment_create_invoice[14b98680-7f38-45fb-9dbe-283330c304b0]:  Connect timeout on endpoint URL: "https://karbon-text.s3.ap-south-1.amazonaws.com/upload_aSZcLIM.pdf"
```
<p>This is a scheduled task</p>
<pre class="lang-py prettyprint-override"><code>app.conf.beat_schedule = {
    "download_gmail_attachment_create_invoice": {
        "task": "project.invoice.tasks.download_gmail_attachment_create_invoice",
        "schedule": crontab(minute="*/10"),
    },

}
</code>```

@shared_task
def download_gmail_attachment_create_invoice():
    file_name = get_file_name()
    upload_file_to_aws(file_name)
```

Why does this happen

I want to upload files to aws s3 successfully in the celery schedule

Body:
def upload_file_to_aws(file_name):
    """Upload a file to an S3 bucket
    :param file_name: File to upload
    :return: True if file was uploaded, else False
    """

    bucket = get_bucket()
    # If S3 object_name was not specified, use file_name

    object_name = file_name.split("/")[-1]
    # Upload the file
    s3_client = boto3.client(
        "s3",
        aws_access_key_id=AWS_ACCESS_KEY_ID,
        aws_secret_access_key=AWS_SECRET_ACCESS_KEY
    )
    ce_logger.info(f"s3_client:{s3_client}")
    try:
        s3_client.upload_file(file_name, bucket, object_name)
    except Exception as e:
        logger.info(e)
        return False
    return True

When I run the above method locally, it can work normally and upload the file to s3,, but when I put this task in celery schedule, use the s3_client.upload_file(file_name, bucket, object_name) method. It will timeout. celery log is displayed

[the 2022-12-08 13:40:03, 205: INFO/ForkPoolWorker-1]  project.invoice.tasks.download_gmail_attachment_create_invoice[14b98680-7f38-45fb-9dbe-283330c304b0]: s3_client:<botocore.client.S3 object at 0x7f0a8a5f35e0>
[13:45:11 2022-12-08, 162: INFO/ForkPoolWorker-1]  project.invoice.tasks.download_gmail_attachment_create_invoice[14b98680-7f38-45fb-9dbe-283330c304b0]:  Connect timeout on endpoint URL: "https://karbon-text.s3.ap-south-1.amazonaws.com/upload_aSZcLIM.pdf"

This is a scheduled task

app.conf.beat_schedule = {
    "download_gmail_attachment_create_invoice": {
        "task": "project.invoice.tasks.download_gmail_attachment_create_invoice",
        "schedule": crontab(minute="*/10"),
    },

}

@shared_task
def download_gmail_attachment_create_invoice():
    file_name = get_file_name()
    upload_file_to_aws(file_name)

Why does this happen

I want to upload files to aws s3 successfully in the celery schedule


问:
mysql can't start in centOS7
when I input ‘systemctl start mysqld’，most time my linux is just is stuck.But sometimes it can output 'Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details.'

This is my first time to install MySQL on my Linux.

The following is  mysql status information：
enter image description here

just Uninstall and install MySQL again

Title: mysql can't start in centOS7


问:
Block CSS and Image when Internet is slow in React.JS?
I want to check internet bandwidth and block CSS and image if it is below certain threshold. I am aware about puppeteer but it works only on server side. Is there any way we can do this on client side??</p>


问:
Why this error appeared "No module named fsspec " and before it was working well
I am using pandas to read from gcs buckets and after making the required transformation and want to save it as parquet i got this error No module named fsspec, I solved it by just installing fsspec,gcsfs libraries but I just want to know why this error appeared and before it was running well.

I installed two libraries (fsspec,gcsfs) and works well but I want to know what the reason behind this error


问:
How to merge two github repos including their respective PR history?
We are looking to merge two repos where the result will be one repo with two branches (one of each).

We were able to handle all git history. However, we lose the PR history (the one in the github ui).

Do you know of any way to also migrate PRs during such a merge? so in the end we will have the history of both repo PRs ?

** BTW, we understand it will include re-enumeration of the PRs.. but that is not a problem currently.


问:
Contact Form 7 Math Logic
I have been using form crafts to get people to complete a personality quiz. Each answer is worth a certain value and at the end I combine various values to spit out a result to the quiz. I have been using wordpress to do this. I know that using the online version of form crafts allows for more functionality but I don't want to pay a premium every month for it.

I am using a plugin to integrate it into Active Campaign, but the costs are getting quite high. So I am looking to move to Engage Bay, but now the issue is that form crafts doesn't connect to Engage Bay. I tried using a 3rd party software called Make, it's like Zapier. But after alot of trial and error, I found out that the wordpress version of form crafts doesn't allow an integration to anything like Zapier.

So my next try is using contact form 7. This is where I need the help. I am trying to figure out how to assign a value to a radio button and then combining those values at the end of the quiz. I found an addon that will do the calculation, but I cannot figure out how to assign the value. I tried to use the pipes option but that completely messes up the mailer that goes out. I use the label text in the mail that is returned to user.

It works when I put values as the options... but that doesn't help me

Title: Contact Form 7 Math Logic


问:
How to write this python post request in axios?
I have this post request written in python, which works just fine:

import requests

requests.request(
    "POST",
     "http://locahost:8086/parse",
     data={
        "names": ["name1", "name2"],
        "surnames": ["surname1", "surname2"]
     },
     files=[
        ("choices", ("choices-1", open("file1.txt", "rb"))),
        ("choices", ("choices-2", open("file2.txt", "rb"))),
        ("references", ("references-1", open("file3.txt", "rb"))),
        ("references", ("references-2", open("file4.txt", "rb"))),

     ]
)
```
<p>The server application endpoint is written in <strong>fastapi</strong> and has the following structure:</p>
<pre class="lang-py prettyprint-override"><code>@app.post("/test")
async def test_endpoint(
    names: List[str] = Form(...),
    surnames: List[str] = Form(...),
    references: List[UploadFile] = File(...),
    choices: List[UploadFile] = File(...)
):

</code>```

My question is: How can I consume this endpoint in Node.js using axios?

I tried with the following:

const axios = require("axios");
const fs = require("fs");
const FormData = require("form-data");

const formData = new FormData();
formData.append("names", "name1");
formData.append("names", "name2");
formData.append("surnames", "surname1");
formData.append("surnames", "surname2");
formData.append("references", fs.createReadStream('file1.txt'));
formData.append("references", fs.createReadStream('file2.txt'));
formData.append("choices", fs.createReadStream('file3.txt'));
formData.append("choices", fs.createReadStream('file4.txt'));

axios.post("http://localhost:8086/parse", formData).then(response => {
    console.log(response.data);
}).catch(err => {
    console.log(err);
});
```

But I've got the 422 error, I also tried to replace the fs.createReadStream('file1.txt') with fs.readFileSync('file1.txt') and formData.append("names", '["name1", "name2"]') but it did not work as well. Can someone help me out to make this post work?

Obs: The backend should accept a variable number of names, surnames, references and choices, that is why it is structured like this. I am also using the axios version 0.21 and node 10.19.0.

Body:
I have this post request written in python, which works just fine:

import requests

requests.request(
    "POST",
     "http://locahost:8086/parse",
     data={
        "names": ["name1", "name2"],
        "surnames": ["surname1", "surname2"]
     },
     files=[
        ("choices", ("choices-1", open("file1.txt", "rb"))),
        ("choices", ("choices-2", open("file2.txt", "rb"))),
        ("references", ("references-1", open("file3.txt", "rb"))),
        ("references", ("references-2", open("file4.txt", "rb"))),

     ]
)

The server application endpoint is written in fastapi and has the following structure:

@app.post("/test")
async def test_endpoint(
    names: List[str] = Form(...),
    surnames: List[str] = Form(...),
    references: List[UploadFile] = File(...),
    choices: List[UploadFile] = File(...)
):

My question is: How can I consume this endpoint in Node.js using axios?

I tried with the following:

const axios = require("axios");
const fs = require("fs");
const FormData = require("form-data");

const formData = new FormData();
formData.append("names", "name1");
formData.append("names", "name2");
formData.append("surnames", "surname1");
formData.append("surnames", "surname2");
formData.append("references", fs.createReadStream('file1.txt'));
formData.append("references", fs.createReadStream('file2.txt'));
formData.append("choices", fs.createReadStream('file3.txt'));
formData.append("choices", fs.createReadStream('file4.txt'));

axios.post("http://localhost:8086/parse", formData).then(response => {
    console.log(response.data);
}).catch(err => {
    console.log(err);
});

But I've got the 422 error, I also tried to replace the fs.createReadStream('file1.txt') with fs.readFileSync('file1.txt') and formData.append("names", '["name1", "name2"]') but it did not work as well. Can someone help me out to make this post work?

Obs: The backend should accept a variable number of names, surnames, references and choices, that is why it is structured like this. I am also using the axios version 0.21 and node 10.19.0.


问:
How to install a package with a specific dependency version with poetry?
One package mylib-a have a dependency mylib-b with version 1.0.0, but I have another package in my application called mylib-c that have the dependency mylib-b too, with version latest (2.0.0, for example).

How can I fix the version 1.0.0 of dependency mylib-b to my package mylib-c in pyproject.toml?


问:
Stomp over Websocket: Connection is established but messages are not received on the channel. Probably more related to Javascript
I implement chat using WebSocket and SockJs in the client and spring-websocket on the server, I have established a connection but when I send a message it never gets to the server - or it appears so based on the lack of log from handling method. It looks like the client (and the coder :P) is at fault here but I cannot spot the mistake.

Client:

```<code>import Stomp from 'stompjs';
...
function connect() {
    var socket = new WebSocket('ws://localhost:8080/chat', "v10.stomp");
    stompClient = Stomp.over(socket);
    stompClient.connect({}, function(frame) {
        setConnected(true);
        console.log('Connected: ' + frame);
        stompClient.subscribe('/topic/greeting', function(messageOutput) {
            console.log(messageOutput.body);
            showMessageOutput(JSON.parse(messageOutput.body));
        });
    });
}

function sendMessage() {
    let message = JSON.stringify({"from":"User1", "messageBody":"Connected", "to":''});
    console.log(message);
    stompClient.send("app/greeting", {}, message); // tried to change destination to topic/greeting - with no positive results
}
...
</code>```

Clients package.json dependencies:

```<code>"devDependencies": {
    "css-loader": "^6.7.2",
    "postcss-loader": "^7.0.2",
    "sass": "^1.56.1",
    "sass-loader": "^13.2.0",
    "style-loader": "^3.3.1",
    "webpack": "^5.75.0",
    "webpack-cli": "^5.0.1",
    "webpack-dev-server": "^4.11.1"
  },
  "main": "webpack.config.js",
  "description": "",
  "dependencies": {
    "bootstrap": "^5.2.3",
    "html-webpack-plugin": "^5.5.0",
    "jquery": "^3.6.1",
    "net": "^1.0.2",
    "sockjs-client": "^1.6.1",
    "stomp-websocket": "^2.3.4-next",
    "stompjs": "^2.3.3",
    "websocket": "^1.0.34"
  }
</code>```

Server:

```<code>@RequiredArgsConstructor
@Controller
@Slf4j
class WebSocketController {

    private static final Map<String, String> userToSessionMap = new ConcurrentHashMap<>();
    SimpMessagingTemplate simpMessagingTemplate;

    @MessageMapping("/greeting")
    public void addUserAndNotifyOthers(@Header("simpSessionId") String sessionId, @Payload Message initialMessage) {
        userToSessionMap.put(initialMessage.getFrom(), sessionId);
        log.warn(initialMessage.toString()); // THIS LOG IS NEVER DISPLAYED
        simpMessagingTemplate.convertAndSend("topic/greeting", initialMessage);
    }
...
}

@Data
@AllArgsConstructor
public class Message {
    String to;
    String from;
    String messageBody;
}

@Configuration
@EnableWebSocketMessageBroker
public class WebsocketConfiguration implements WebSocketMessageBrokerConfigurer {

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/chat").setAllowedOrigins("http://localhost:5000");
        registry.addEndpoint("/chat").setAllowedOrigins("http://localhost:5000").withSockJS();
    }

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.enableSimpleBroker("/topic", "/queue");
        registry.setApplicationDestinationPrefixes("/app");
    }
}

</code>```

LOGS

```<code>Web Socket Opened... stomp.js:134:104
>>> CONNECT
accept-version:1.1,1.0
heart-beat:10000,10000

� stomp.js:134:104
<<< CONNECTED
version:1.1
heart-beat:0,0

� stomp.js:134:104
connected to server undefined stomp.js:134:104
Connected: CONNECTED
heart-beat:0,0
version:1.1

index.js:32:17
>>> SUBSCRIBE
id:sub-0
destination:/topic/greeting

� stomp.js:134:104
SENDING:  {"from":"User1","messageBody":"Connected","to":""} index.js:54:13
>>> SEND
destination:topic/greeting
content-length:50

{"from":"User1","messageBody":"Connected","to":""}�
// END OF LOGS: I never get Received log
</code>```

Body:
I implement chat using WebSocket and SockJs in the client and spring-websocket on the server, I have established a connection but when I send a message it never gets to the server - or it appears so based on the lack of log from handling method. It looks like the client (and the coder :P) is at fault here but I cannot spot the mistake.

Client:

import Stomp from 'stompjs';
...
function connect() {
    var socket = new WebSocket('ws://localhost:8080/chat', "v10.stomp");
    stompClient = Stomp.over(socket);
    stompClient.connect({}, function(frame) {
        setConnected(true);
        console.log('Connected: ' + frame);
        stompClient.subscribe('/topic/greeting', function(messageOutput) {
            console.log(messageOutput.body);
            showMessageOutput(JSON.parse(messageOutput.body));
        });
    });
}

function sendMessage() {
    let message = JSON.stringify({"from":"User1", "messageBody":"Connected", "to":''});
    console.log(message);
    stompClient.send("app/greeting", {}, message); // tried to change destination to topic/greeting - with no positive results
}
...

Clients package.json dependencies:

"devDependencies": {
    "css-loader": "^6.7.2",
    "postcss-loader": "^7.0.2",
    "sass": "^1.56.1",
    "sass-loader": "^13.2.0",
    "style-loader": "^3.3.1",
    "webpack": "^5.75.0",
    "webpack-cli": "^5.0.1",
    "webpack-dev-server": "^4.11.1"
  },
  "main": "webpack.config.js",
  "description": "",
  "dependencies": {
    "bootstrap": "^5.2.3",
    "html-webpack-plugin": "^5.5.0",
    "jquery": "^3.6.1",
    "net": "^1.0.2",
    "sockjs-client": "^1.6.1",
    "stomp-websocket": "^2.3.4-next",
    "stompjs": "^2.3.3",
    "websocket": "^1.0.34"
  }

Server:

@RequiredArgsConstructor
@Controller
@Slf4j
class WebSocketController {

    private static final Map<String, String> userToSessionMap = new ConcurrentHashMap<>();
    SimpMessagingTemplate simpMessagingTemplate;

    @MessageMapping("/greeting")
    public void addUserAndNotifyOthers(@Header("simpSessionId") String sessionId, @Payload Message initialMessage) {
        userToSessionMap.put(initialMessage.getFrom(), sessionId);
        log.warn(initialMessage.toString()); // THIS LOG IS NEVER DISPLAYED
        simpMessagingTemplate.convertAndSend("topic/greeting", initialMessage);
    }
...
}

@Data
@AllArgsConstructor
public class Message {
    String to;
    String from;
    String messageBody;
}

@Configuration
@EnableWebSocketMessageBroker
public class WebsocketConfiguration implements WebSocketMessageBrokerConfigurer {

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/chat").setAllowedOrigins("http://localhost:5000");
        registry.addEndpoint("/chat").setAllowedOrigins("http://localhost:5000").withSockJS();
    }

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.enableSimpleBroker("/topic", "/queue");
        registry.setApplicationDestinationPrefixes("/app");
    }
}

LOGS

Web Socket Opened... stomp.js:134:104
>>> CONNECT
accept-version:1.1,1.0
heart-beat:10000,10000

� stomp.js:134:104
<<< CONNECTED
version:1.1
heart-beat:0,0

� stomp.js:134:104
connected to server undefined stomp.js:134:104
Connected: CONNECTED
heart-beat:0,0
version:1.1

index.js:32:17
>>> SUBSCRIBE
id:sub-0
destination:/topic/greeting

� stomp.js:134:104
SENDING:  {"from":"User1","messageBody":"Connected","to":""} index.js:54:13
>>> SEND
destination:topic/greeting
content-length:50

{"from":"User1","messageBody":"Connected","to":""}�
// END OF LOGS: I never get Received log


问:
How to import jobs in jenkins if source jenkins is integrated with AD
How to import jobs in jenkins if source jenkins is integrated with AD

Jenkins is integrated with AD and i want to to import jobs in new jenkins


问:
Type definition for props
I am trying to get generated type from GRAPHQL for my account but I need only types for account.D how can I get it for right type?

```<code> export type A = {
      __typename?: 'B';
      me: {
        __typename?: 'C';
        id: string;
        account:
          | {
              __typename?: 'D';
              id: string;
              name: string;
            }
          | {
              __typename?: 'E';
              id: string;

            };
          }
        }
      }
    }
</code>```

Title: Type definition for props

Body:
I am trying to get generated type from GRAPHQL for my account but I need only types for account.D how can I get it for right type?

 export type A = {
      __typename?: 'B';
      me: {
        __typename?: 'C';
        id: string;
        account:
          | {
              __typename?: 'D';
              id: string;
              name: string;
            }
          | {
              __typename?: 'E';
              id: string;

            };
          }
        }
      }
    }


问:
Google API is very slow while downloading multiple files
I'm struggling with a thorny issue.
My file downloads via Google Api C# are very slow for an totally unknown reason.

The files I get are well the good ones, no corrupted files, no duplicates files The content is fine.
For the test, I have 15 files with size between 1MB and 3MB for a total size of 28MB on a Shared Team Drive.

My home download speed is 3MB/s (it should be then about 9 / 10 seconds for 28MB, this is the time I get when downloading via Google Drive application directly). But it takes 117 seconds to finish.

I am using the "Google.Apis.Drive.v3" package:

I tried to make my code as simpliest as possible to isolate the issue :

```<code>            Stopwatch sw = Stopwatch.StartNew();
            foreach (GD.File file in files)
                await service.Files.Get(file.Id).DownloadAsync(new MemoryStream());
            sw.Stop();
</code>```

"files" contains the 15 files I described above, I do a simple foreach on it and I use DownloadAsync function.
Here i am doing nothing with the stream but this is for test purposes. I tried with synchronous, asynchronous.

I tried also with a very high speed connection like 100MB/s connection and it takes 114 seconds to finish.

I tried with MediaDownloader class directly, but I couldn't make it work at all (it downloads empty files...).

Do you have any idea why do I have this type of issue ?
And do you have any suggestion how I can debug this ?

[EDIT]
I tried also with a single file which has 63MB size. And I tracked the downloaded bytes into a JSON. I capture bytes downloaded at a certain time...

                Stopwatch sw = Stopwatch.StartNew();
                JsonArray eventsJSON = new();
                JsonObject fileJSON = new() {
                        { "id", fileId },
                        { "events", eventsJSON }
                    };

                FilesResource.GetRequest getRequest = service.Files.Get(fileId);
                getRequest.MediaDownloader.ChunkSize = 262144;
                getRequest.MediaDownloader.ProgressChanged += progress =>
                {
                    JsonObject eventJSON = new()
                        {
                            { "time", sw.ElapsedMilliseconds / 1000.0 },
                            { "bytes", progress.BytesDownloaded  },
                            { "finished", progress.Status == DownloadStatus.Completed }
                        };
                    eventsJSON.Add(eventJSON);
                };
                await getRequest.DownloadAsync(new MemoryStream());

                sw.Stop();

                fileJSON.Add(new KeyValuePair<string, JsonNode?>("finalTime", sw.ElapsedMilliseconds / 1000.0));
                await hRes.WriteAsJsonAsync(fileJSON);
```

The result is surprising : the first bytes received began 30 seconds after I call the download function and finished at 57 seconds, 57 - 30 = 27 seconds is a normal speed for this file size !
What's happenning !? Why I need 30 seconds to begin the download !? Do you have any idea ?

[EDIT 2]
I used Wireshark to check what's happening exactly between Google Drive API and my program. The result is exactly the same, it takes 30 seconds when I request a download, look at the time values :

Wireshark is confirming that nothing happens in these 30 seconds. I am going to lose hope...

[EDIT 3]
I tried to directly send the request via Postman instead of using C# client API, I have the exact same issue.
I tried also with the built-in Google developpers UI where I can send the request, and it takes 38 seconds (about 20 seconds better !), WHY !? In all cases, 38 seconds still slow... It should be 25 seconds max...

I forgot to mention that is only the get files content which is slow, if I ask anything else, like listing files in a folder, it's like instant.

[EDIT 4]
I understand now that Google Drive API is checking viruses on files, every files... Including files within a zip archive. This is a big issue for me as I am suggesting only Excel and Powerpoint files to my users (I remind you MS Office files are archives).

So the strange thing is :

that Google Drive "classic" (I mean using normal Google Drive) seems to be ignoring the virus scan when this is an archive and the download begins quickly.

that Google Drive API keeps checking viruses at any cost...

So, YES, if I am not wrong, Google Drive API is well the issue !
Is someone aware of any workaround ?

Body:
I'm struggling with a thorny issue.
My file downloads via Google Api C# are very slow for an totally unknown reason.

The files I get are well the good ones, no corrupted files, no duplicates files The content is fine.
For the test, I have 15 files with size between 1MB and 3MB for a total size of 28MB on a Shared Team Drive.

My home download speed is 3MB/s (it should be then about 9 / 10 seconds for 28MB, this is the time I get when downloading via Google Drive application directly). But it takes 117 seconds to finish.

I am using the "Google.Apis.Drive.v3" package:

I tried to make my code as simpliest as possible to isolate the issue :

            Stopwatch sw = Stopwatch.StartNew();
            foreach (GD.File file in files)
                await service.Files.Get(file.Id).DownloadAsync(new MemoryStream());
            sw.Stop();

"files" contains the 15 files I described above, I do a simple foreach on it and I use DownloadAsync function.
Here i am doing nothing with the stream but this is for test purposes. I tried with synchronous, asynchronous.

I tried also with a very high speed connection like 100MB/s connection and it takes 114 seconds to finish.

I tried with MediaDownloader class directly, but I couldn't make it work at all (it downloads empty files...).

Do you have any idea why do I have this type of issue ?
And do you have any suggestion how I can debug this ?

[EDIT]
I tried also with a single file which has 63MB size. And I tracked the downloaded bytes into a JSON. I capture bytes downloaded at a certain time...

                Stopwatch sw = Stopwatch.StartNew();
                JsonArray eventsJSON = new();
                JsonObject fileJSON = new() {
                        { "id", fileId },
                        { "events", eventsJSON }
                    };

                FilesResource.GetRequest getRequest = service.Files.Get(fileId);
                getRequest.MediaDownloader.ChunkSize = 262144;
                getRequest.MediaDownloader.ProgressChanged += progress =>
                {
                    JsonObject eventJSON = new()
                        {
                            { "time", sw.ElapsedMilliseconds / 1000.0 },
                            { "bytes", progress.BytesDownloaded  },
                            { "finished", progress.Status == DownloadStatus.Completed }
                        };
                    eventsJSON.Add(eventJSON);
                };
                await getRequest.DownloadAsync(new MemoryStream());

                sw.Stop();

                fileJSON.Add(new KeyValuePair<string, JsonNode?>("finalTime", sw.ElapsedMilliseconds / 1000.0));
                await hRes.WriteAsJsonAsync(fileJSON);

The result is surprising : the first bytes received began 30 seconds after I call the download function and finished at 57 seconds, 57 - 30 = 27 seconds is a normal speed for this file size !
What's happenning !? Why I need 30 seconds to begin the download !? Do you have any idea ?

[EDIT 2]
I used Wireshark to check what's happening exactly between Google Drive API and my program. The result is exactly the same, it takes 30 seconds when I request a download, look at the time values :

Wireshark is confirming that nothing happens in these 30 seconds. I am going to lose hope...

[EDIT 3]
I tried to directly send the request via Postman instead of using C# client API, I have the exact same issue.
I tried also with the built-in Google developpers UI where I can send the request, and it takes 38 seconds (about 20 seconds better !), WHY !? In all cases, 38 seconds still slow... It should be 25 seconds max...

I forgot to mention that is only the get files content which is slow, if I ask anything else, like listing files in a folder, it's like instant.

[EDIT 4]
I understand now that Google Drive API is checking viruses on files, every files... Including files within a zip archive. This is a big issue for me as I am suggesting only Excel and Powerpoint files to my users (I remind you MS Office files are archives).

So the strange thing is :

that Google Drive "classic" (I mean using normal Google Drive) seems to be ignoring the virus scan when this is an archive and the download begins quickly.

that Google Drive API keeps checking viruses at any cost...

So, YES, if I am not wrong, Google Drive API is well the issue !
Is someone aware of any workaround ?


问:
Apache Reverse Proxy, using different protocol on inbound traffic and outbound traffic
I would like to configure a simple Apache Reverse Proxy that only accept TLSv1.2 connection for incoming traffic from Outside and use TLSv1.1 to communicate within the internal network. The reason being of this requirement is that I am not able to update the Application Server source code to accept TLSv1.2 for now due to code freeze.

Outside Traffic <------ TLSv1.2 ------> Reverse Proxy <------ TLSv1.1 ------> Application Server


问:
Email to BCC recepient is not sent
I am trying to send an email using

```<code>amazonSimpleEmailService.sendRawEmail
</code>```

Sending an e-mail works only when the e-mail is sent to a person in the BCC header, and it does not work when someone is in the TO: or CC: section. does anyone know why? I couldn't find anything in the AWS documentation https://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html

```<code>  public void send(Payload request) throws MessagingException, IOException {
      List<String> recipients = new LinkedList<>();

      String from = request.getFrom();
      String targetEmail = request.getRecipient();
      String ccEmail = request.getCc();
      String bccEmail = request.getBcc();

      Session session = Session.getDefaultInstance(new Properties());
      MimeMessage message = new MimeMessage(session);

      message.setSubject(request.getSubject());
      message.setFrom(new InternetAddress(from));
      if (targetEmail != null) {
          message.setRecipients(RecipientType.TO, InternetAddress.parse(targetEmail));
          recipients.add(targetEmail);
      }
      if (ccEmail != null) {
          message.setRecipients(RecipientType.CC, InternetAddress.parse(ccEmail));
          recipients.add(ccEmail);
      }
      if (bccEmail != null) {
          message.setRecipients(RecipientType.BCC, InternetAddress.parse(bccEmail));
          recipients.add(bccEmail);
      }
      MimeBodyPart htmlPart = new MimeBodyPart();
      htmlPart.setContent(request.getBody(), "text/html; charset=UTF-8;");

      MimeMultipart bodyContainer = new MimeMultipart("alternative");
      bodyContainer.addBodyPart(htmlPart);

      MimeBodyPart htmlWrapper = new MimeBodyPart();
      htmlWrapper.setContent(bodyContainer);

      MimeMultipart messageContainer = new MimeMultipart("mixed");
      messageContainer.addBodyPart(htmlWrapper);

      Attachment attachment = request.getAttachment();
      if (Objects.nonNull(attachment)) {
          MimeBodyPart attachmentBodyPart = new MimeBodyPart();
          DataHandler dataHandler = new DataHandler(attachment.getByteArrayDataSource());

          attachmentBodyPart.setDataHandler(dataHandler);
          attachmentBodyPart.setFileName(attachment.getFileName());

          messageContainer.addBodyPart(attachmentBodyPart);
      }

      message.setContent(messageContainer);

      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      message.writeTo(outputStream);

      RawMessage rawMessage = new RawMessage(ByteBuffer.wrap(outputStream.toByteArray()));

      SendRawEmailRequest rawEmailRequest = new SendRawEmailRequest(rawMessage);
      rawEmailRequest.withSource(from);
      rawEmailRequest.withDestinations(recipients);

      SendRawEmailResult sendRawEmailResult = amazonSimpleEmailService.sendRawEmail(rawEmailRequest);
      log.info("Email sent. MessageId: {}", targetEmail, ccEmail, bccEmail, sendRawEmailResult.getMessageId());
  }
</code>```

Title: Email to BCC recepient is not sent

Body:
I am trying to send an email using

amazonSimpleEmailService.sendRawEmail

Sending an e-mail works only when the e-mail is sent to a person in the BCC header, and it does not work when someone is in the TO: or CC: section. does anyone know why? I couldn't find anything in the AWS documentation https://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html

  public void send(Payload request) throws MessagingException, IOException {
      List<String> recipients = new LinkedList<>();

      String from = request.getFrom();
      String targetEmail = request.getRecipient();
      String ccEmail = request.getCc();
      String bccEmail = request.getBcc();

      Session session = Session.getDefaultInstance(new Properties());
      MimeMessage message = new MimeMessage(session);

      message.setSubject(request.getSubject());
      message.setFrom(new InternetAddress(from));
      if (targetEmail != null) {
          message.setRecipients(RecipientType.TO, InternetAddress.parse(targetEmail));
          recipients.add(targetEmail);
      }
      if (ccEmail != null) {
          message.setRecipients(RecipientType.CC, InternetAddress.parse(ccEmail));
          recipients.add(ccEmail);
      }
      if (bccEmail != null) {
          message.setRecipients(RecipientType.BCC, InternetAddress.parse(bccEmail));
          recipients.add(bccEmail);
      }
      MimeBodyPart htmlPart = new MimeBodyPart();
      htmlPart.setContent(request.getBody(), "text/html; charset=UTF-8;");

      MimeMultipart bodyContainer = new MimeMultipart("alternative");
      bodyContainer.addBodyPart(htmlPart);

      MimeBodyPart htmlWrapper = new MimeBodyPart();
      htmlWrapper.setContent(bodyContainer);

      MimeMultipart messageContainer = new MimeMultipart("mixed");
      messageContainer.addBodyPart(htmlWrapper);

      Attachment attachment = request.getAttachment();
      if (Objects.nonNull(attachment)) {
          MimeBodyPart attachmentBodyPart = new MimeBodyPart();
          DataHandler dataHandler = new DataHandler(attachment.getByteArrayDataSource());

          attachmentBodyPart.setDataHandler(dataHandler);
          attachmentBodyPart.setFileName(attachment.getFileName());

          messageContainer.addBodyPart(attachmentBodyPart);
      }

      message.setContent(messageContainer);

      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      message.writeTo(outputStream);

      RawMessage rawMessage = new RawMessage(ByteBuffer.wrap(outputStream.toByteArray()));

      SendRawEmailRequest rawEmailRequest = new SendRawEmailRequest(rawMessage);
      rawEmailRequest.withSource(from);
      rawEmailRequest.withDestinations(recipients);

      SendRawEmailResult sendRawEmailResult = amazonSimpleEmailService.sendRawEmail(rawEmailRequest);
      log.info("Email sent. MessageId: {}", targetEmail, ccEmail, bccEmail, sendRawEmailResult.getMessageId());
  }


问:
How can I create a re-usable CloudFormation template for my Lambda function?
can someone help me to create a reusable lambda function in reusable Cloudformationtemplate?

tried in different articles but couldn't find which allows us to use existing IAM, VPC, SG and etc.


问:
How to integrate yeoman excel add-ins without running the project?
I am facing an issue with yeoman where I am not able to use the created add-in without keeping the webpack-cli alive.
Whenever I am closing the prompt running webpack the add-in cannot be used anymore and I am getting the following:

Error

I tried searching for some solutions concerning webpack and how to disable webpack but nothing seems to work


问:
Python Socket [Errno 11001] getaddrinfo failed; Parse Server
This is the code I'm trying to run this code for creating an object on the Parse-Server

```<code>import http.client
import json

connection = http.client.HTTPConnection("http://Server.Ip",443)
connection.connect()
connection.request('POST', '/parse/classes/Vitals', json.dumps({
    "Name": "Wahab",
    "BPM": 75,
    "SpO2": 99,
    "ECG":[70,75,80,95,80,75,70,85,90,95,90,85],
    "Temperature": 98,
    "Ambient_Temperature": 27,
    "Humidity": 73
}), {
    "X-Parse-Application-Id": "${APPLICATION_ID}",
    "X-Parse-REST-API-Key": "${REST_API_KEY}",
    "Content-Type": "application/json"
})
results = json.loads(connection.getresponse().read())

</code>```

Code
This is the outpu that I'm gettingOutput

I was expecting a connection established to the server and getting an output 201 created.

Body:
This is the code I'm trying to run this code for creating an object on the Parse-Server

import http.client
import json

connection = http.client.HTTPConnection("http://Server.Ip",443)
connection.connect()
connection.request('POST', '/parse/classes/Vitals', json.dumps({
    "Name": "Wahab",
    "BPM": 75,
    "SpO2": 99,
    "ECG":[70,75,80,95,80,75,70,85,90,95,90,85],
    "Temperature": 98,
    "Ambient_Temperature": 27,
    "Humidity": 73
}), {
    "X-Parse-Application-Id": "${APPLICATION_ID}",
    "X-Parse-REST-API-Key": "${REST_API_KEY}",
    "Content-Type": "application/json"
})
results = json.loads(connection.getresponse().read())

Code
This is the outpu that I'm gettingOutput

I was expecting a connection established to the server and getting an output 201 created.


问:
Google Calendar Add multiple events at same time
I'm trying to add/update multiples event at same time in Google Calendar, in the example below I've to execute 1 by 1, but I want to use only one .Execute...

Sometimes I've to update 30-50 events at same time and every .Execute takes aprox. 1 second each.

I also tried to make a UpdateRequest list but I couldn't execute them at same time, I had to execute 1 by 1.

Private Sub AddEvents()
    Dim newEvent1 As New [Event]() With {
        .Summary = "Event1",
        .Description = "Desc1",
        .Start = New EventDateTime() With {.DateTime = DataHora, .TimeZone = TimeZone},
        .End = New EventDateTime() With {.DateTime = DateAdd(DateInterval.Hour, 1, DataHora), .TimeZone = TimeZone},
        .Reminders = New [Event].RemindersData() With {.UseDefault = True},
        .ColorId = CorEvento
    }

    Dim newEvent2 As New [Event]() With {
        .Summary = "Event2",
        .Description = "Desc2",
        .Start = New EventDateTime() With {.DateTime = DataHora, .TimeZone = TimeZone},
        .End = New EventDateTime() With {.DateTime = DateAdd(DateInterval.Hour, 1, DataHora), .TimeZone = TimeZone},
        .Reminders = New [Event].RemindersData() With {.UseDefault = True},
        .ColorId = CorEvento
    }

    Dim request1 As EventsResource.UpdateRequest = service.Events.Update(newEvent1, RetornaCalendario(), EventID1)
    request1.Execute()

    Dim request2 As EventsResource.UpdateRequest = service.Events.Update(newEvent2, RetornaCalendario(), EventID2)
    request2.Execute()
End Sub
```


问:
How to use the interceptor to get the value in PathVariable
Prompt NPE when I use the following interceptor to get

```<code>public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    Map<String, String> pathVars = (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
    return HandlerInterceptor.super.preHandle(request, response, handler);
}
</code>```

java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "pathVars" is null

```<code>public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    Map<String, String> pathVars = (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
    return HandlerInterceptor.super.preHandle(request, response, handler);
}
</code>```

java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "pathVars" is null

Body:
Prompt NPE when I use the following interceptor to get

public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    Map<String, String> pathVars = (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
    return HandlerInterceptor.super.preHandle(request, response, handler);
}

java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "pathVars" is null

public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    Map<String, String> pathVars = (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
    return HandlerInterceptor.super.preHandle(request, response, handler);
}

java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "pathVars" is null


问:
Initialize Angular component from inserted 3rd-party HTML
I have ComponentA that uses a 3rd-party vanilla JavaScript plugin that generates HTML and inserts it into the DOM in the first ngOnChanges(). The HTML created by the plugin contains an element that matches the selector of ComponentB, but it isn't recognized or initialized as a ComponentB instance. How can I get Angular to recognize the inserted HTML as ComponentB and convert / initialize it?

I have tried all manner of Change Detection in all lifecycle hooks to no avail. I have also successfully used a MutationObserver to know when the HTML is inserted and used viewContainerRef to createComponent but that just creates a second, useless instance.


问:
Php-fpm alpine can't resolve gitlab on my domain
I wrote myself a dockerfile that puts an application in Symfony. Unfortunately, the problem is that using the php:7.4.9-fpm-buster image everything works, but when php:7.4-fpm-alpine works it is a problem with the host service.

On alpine I get an error when installing composer:

```<code>#0 0.284   ssh: Could not resolve hostname gitlab.pawel.com: Name does not resolve
#0 0.284   fatal: Could not read from remote repository.
#0 0.284   Please make sure you have the correct access rights
#0 0.284   and the repository exists.
</code>```

I already tried adding to /etc/hosts

```<code>193.33.111.185 gitlab.pawel.com
</code>```

I also tried this /etc/resolv.conf

```<code>nameserver 8.8.8.8
nameserver 8.8.4.4
</code>```

I need a working image for alpine, but I have no idea what the problem is. This i my all code

```<code>FROM php:7.4-fpm-alpine

ARG ABSOLUTE_PATH=./app
ARG CONFIG_PATH=./config/web_adapter

RUN apk update && apk add openssh-client

#COPY CONFIG
RUN ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY $CONFIG_PATH/conf.d/api-platform.ini $PHP_INI_DIR/conf.d/api-platform.ini
COPY $CONFIG_PATH/www.conf /usr/local/etc/php-fpm.d/www.conf

RUN adduser -D app

WORKDIR /srv
COPY $ABSOLUTE_PATH/composer.json $ABSOLUTE_PATH/composer.lock $ABSOLUTE_PATH/symfony.lock ./
RUN set -eux; \
    composer update symfony/flex --no-plugins --no-scripts; \
    composer install --prefer-dist --no-autoloader --no-scripts --no-progress --no-suggest; \
    composer clear-cache

COPY $ABSOLUTE_PATH/bin bin/
COPY $ABSOLUTE_PATH/config config/
COPY $ABSOLUTE_PATH/public public/
COPY $ABSOLUTE_PATH/src src/
RUN mkdir -p var/cache var/log var/cache/prod

RUN chown -R app:app /srv

RUN set -eux; \
    mkdir -p var/cache var/log; \
    composer dump-autoload --classmap-authoritative --no-dev; \
    composer run-script --no-dev post-install-cmd; \
    chmod +x bin/console; sync

#ENTRYPOINT
COPY $CONFIG_PATH/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
USER app
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]
</code>```

Of course IP and domain name is only as a example. Any idea what I did wrong?

Body:
I wrote myself a dockerfile that puts an application in Symfony. Unfortunately, the problem is that using the php:7.4.9-fpm-buster image everything works, but when php:7.4-fpm-alpine works it is a problem with the host service.

On alpine I get an error when installing composer:

#0 0.284   ssh: Could not resolve hostname gitlab.pawel.com: Name does not resolve
#0 0.284   fatal: Could not read from remote repository.
#0 0.284   Please make sure you have the correct access rights
#0 0.284   and the repository exists.

I already tried adding to /etc/hosts

193.33.111.185 gitlab.pawel.com

I also tried this /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

I need a working image for alpine, but I have no idea what the problem is. This i my all code

FROM php:7.4-fpm-alpine

ARG ABSOLUTE_PATH=./app
ARG CONFIG_PATH=./config/web_adapter

RUN apk update && apk add openssh-client

#COPY CONFIG
RUN ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY $CONFIG_PATH/conf.d/api-platform.ini $PHP_INI_DIR/conf.d/api-platform.ini
COPY $CONFIG_PATH/www.conf /usr/local/etc/php-fpm.d/www.conf

RUN adduser -D app

WORKDIR /srv
COPY $ABSOLUTE_PATH/composer.json $ABSOLUTE_PATH/composer.lock $ABSOLUTE_PATH/symfony.lock ./
RUN set -eux; \
    composer update symfony/flex --no-plugins --no-scripts; \
    composer install --prefer-dist --no-autoloader --no-scripts --no-progress --no-suggest; \
    composer clear-cache

COPY $ABSOLUTE_PATH/bin bin/
COPY $ABSOLUTE_PATH/config config/
COPY $ABSOLUTE_PATH/public public/
COPY $ABSOLUTE_PATH/src src/
RUN mkdir -p var/cache var/log var/cache/prod

RUN chown -R app:app /srv

RUN set -eux; \
    mkdir -p var/cache var/log; \
    composer dump-autoload --classmap-authoritative --no-dev; \
    composer run-script --no-dev post-install-cmd; \
    chmod +x bin/console; sync

#ENTRYPOINT
COPY $CONFIG_PATH/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
USER app
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]

Of course IP and domain name is only as a example. Any idea what I did wrong?


问:
How to specify set of valid string values for a property?
I have a class:

```<code>public class Product
    public Guid Guid {get;set;}

    [Required]
    public string Brand { get; set; }
}
</code>```

I want to specify what values are legal values for property Brand, for instance "Audi,BMW,Mercedes".
Is that is possible to do without custom validator?

Body:
I have a class:

public class Product
    public Guid Guid {get;set;}

    [Required]
    public string Brand { get; set; }
}

I want to specify what values are legal values for property Brand, for instance "Audi,BMW,Mercedes".
Is that is possible to do without custom validator?


问:
Connection failed: No such file or directory (IONOS)
I keep receiving Connection failed: No such file or directory when opening my php files hosted on IONOS , even tho the files path are correct and the connection is working

this is the connection example script

```<code><?php
  $host_name = 'test.hosting-data.io';
  $database = 'dbstest';
  $user_name = 'dbutest';
  $password = 'test';

  $link = new mysqli($host_name, $user_name, $password, $database);

  if ($link->connect_error) {
    die('<p>La connexion au serveur MySQL a échoué: '. $link->connect_error .'</p>');
  } else {
    echo '<p>Connexion au serveur MySQL établie avec succès.</p>';
  }
?>
</code>```

none of the solutions of similar questions worked for me

Body:
I keep receiving Connection failed: No such file or directory when opening my php files hosted on IONOS , even tho the files path are correct and the connection is working

this is the connection example script

<?php
  $host_name = 'test.hosting-data.io';
  $database = 'dbstest';
  $user_name = 'dbutest';
  $password = 'test';

  $link = new mysqli($host_name, $user_name, $password, $database);

  if ($link->connect_error) {
    die('
La connexion au serveur MySQL a échoué: '. $link->connect_error .'
');
  } else {
    echo '
Connexion au serveur MySQL établie avec succès.
';
  }
?>

none of the solutions of similar questions worked for me


问:
How to dynamically create tasks based on xcom value of previous task or airflow variable in airflow?
Using Airflow 2.2.3 with k8s executor.

I have a workflow like below,
Task2 generates a list and saves it to airflow variable "var1". the output varies on each execution. example: var1 = [1,2,3,4]
branch_operator takes the value from var1 and generates dynamic tasks 1-4.
Sometimes it doesn't take the latest values from var1 instead uses previous values when task2 executes within few seconds.

Tried adding time.sleep(30) in task2 works. because dag is refreshed based on configuration AIRFLOW__SCHEDULER__MIN_FILE_PROCESS_INTERVAL value is 30.

Is there any way to force refresh dag or any other better way to do this so that branch operator always takes the latest value and scheduled?


问:
How to solve cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number
I get an error while trying to insert data into my oracle database with python. I already created a connection and a table in Oracle database.  Please how do i solve this error?

Here's my code

```<code>import requests
from bs4 import BeautifulSoup
import csv
from csv import writer
import cx_Oracle

conStr = 'system/Maxesafrica2@localhost:1521/orclXDB'
cnx = cx_Oracle.connect(conStr)
cursor = cnx.cursor()

print("Connected to Database!")

cursor = cnx.cursor()

html_text = requests.get('https://www.jobberman.com/jobs/hospitality-leisure').text
soup = BeautifulSoup(html_text, 'lxml')

jobs = soup.find_all('div', class_ = 'mx-5 md:mx-0 flex flex-wrap col-span-1 mb-5 bg-white rounded-lg border border-gray-300 hover:border-gray-400 focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-gray-500')

salary_scale = ''

job_list = []
for job in jobs:
    company_name = job.find('p', class_ = 'text-sm text-brand-linked').get_text(strip=True)
    kills = job.find('p', class_ = 'text-lg font-medium break-words text-brand-linked').get_text(strip=True)
    job_desc = job.find('p', class_ = 'text-sm font-normal text-gray-700 md:text-gray-500 md:pl-5').get_text(strip=True)
    job_link = job.find("a", href=True)["href"]
    salary_scale1 = job.find('span', class_ = 'mr-1')

    if salary_scale1:
       salary_scale = salary_scale1.get_text(strip=True)
    else:
       salary_scale = 'Not Mentioned'

    all_details = (company_name, skills, job_desc, job_link, salary_scale)
    all_details = tuple(all_details)
    job_list.append(all_details)

    insert_query = """INSERT INTO jobberman_tbl (company_name, skills, job_desc, job_link, salary_scale)
                              VALUES (%s, %s, %s, %s, %s)"""

    records_to_insert = job_list
      cnx = cx_Oracle.connect(conStr)

        cursor = cnx.cursor()
        cursor.executemany(insert_query, records_to_insert)

 cnx.commit()
 cursor.close()
 cnx.close()

 print('Done!')
</code>```

HERE'S THE ERROR I GET

File "c:\Users\LP\Documents\python\Oracle\oracle.py", line 90, in

cursor.executemany(insert_query, records_to_insert)

cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number

Body:
I get an error while trying to insert data into my oracle database with python. I already created a connection and a table in Oracle database.  Please how do i solve this error?

Here's my code

import requests
from bs4 import BeautifulSoup
import csv
from csv import writer
import cx_Oracle

conStr = 'system/Maxesafrica2@localhost:1521/orclXDB'
cnx = cx_Oracle.connect(conStr)
cursor = cnx.cursor()

print("Connected to Database!")

cursor = cnx.cursor()

html_text = requests.get('https://www.jobberman.com/jobs/hospitality-leisure').text
soup = BeautifulSoup(html_text, 'lxml')

jobs = soup.find_all('div', class_ = 'mx-5 md:mx-0 flex flex-wrap col-span-1 mb-5 bg-white rounded-lg border border-gray-300 hover:border-gray-400 focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-gray-500')

salary_scale = ''

job_list = []
for job in jobs:
    company_name = job.find('p', class_ = 'text-sm text-brand-linked').get_text(strip=True)
    kills = job.find('p', class_ = 'text-lg font-medium break-words text-brand-linked').get_text(strip=True)
    job_desc = job.find('p', class_ = 'text-sm font-normal text-gray-700 md:text-gray-500 md:pl-5').get_text(strip=True)
    job_link = job.find("a", href=True)["href"]
    salary_scale1 = job.find('span', class_ = 'mr-1')

    if salary_scale1:
       salary_scale = salary_scale1.get_text(strip=True)
    else:
       salary_scale = 'Not Mentioned'

    all_details = (company_name, skills, job_desc, job_link, salary_scale)
    all_details = tuple(all_details)
    job_list.append(all_details)

    insert_query = """INSERT INTO jobberman_tbl (company_name, skills, job_desc, job_link, salary_scale)
                              VALUES (%s, %s, %s, %s, %s)"""

    records_to_insert = job_list
      cnx = cx_Oracle.connect(conStr)

        cursor = cnx.cursor()
        cursor.executemany(insert_query, records_to_insert)

 cnx.commit()
 cursor.close()
 cnx.close()

 print('Done!')

HERE'S THE ERROR I GET

File "c:\Users\LP\Documents\python\Oracle\oracle.py", line 90, in

cursor.executemany(insert_query, records_to_insert)

cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number