问:
c# parse ZoneTransfer information of a file
I want to parse ZoneTransfer information of a file using C#.

In PowerShell it can be achieved as the following:

```<code>PS D:\Source> Get-Content 7z1900.exe -Stream Zone.Identifier

[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://www.7-zip.org/download.htmlHostUrl=https://www.7-zip.org/a/7z1900.exe
</code>```

Body:
I want to parse ZoneTransfer information of a file using C#.

In PowerShell it can be achieved as the following:

PS D:\Source> Get-Content 7z1900.exe -Stream Zone.Identifier

[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://www.7-zip.org/download.htmlHostUrl=https://www.7-zip.org/a/7z1900.exe


来源: stackexchange

问:
set the new coordinates on the user after editing the address
I'm trying to edit the lat and lng on edit user. I manage to get the location displayed when I add a new user (I use getLocation() for both "add new user" and "edit user"), but the values of the lat and lng don't update when I run the edit function.

I tried to console.log the values and I do get the values of the user I'm editing in the console as well as the new coordinates but the user itself isn't updating.

any ideas?

(I use "vue-browser-geolocation")

```<code>export default {
....
  name: "UsersBox",
  data() {
    return {
      users: [],
      // notEditing: true,
      editingId: "",
      showAddBox: false,

      user: {
        img: "janeth carton.jpg",
        name: "",
        role: "",
        liveLocation: "Riviera State 32/106",
        address1: "",
        address2: "",
        phone: "",
        coordinates: {
          lat: 0,
          lng: 0,
        },
      },
    };
  },
  async mounted() {
    this.users = await this.fetchUsers();
  },
</code>```
```<code>  methods: {

    async saveEdit(userData) {
      await this.getLocation(userData);
      await fetch(`api/users/${userData.id}`, {
        method: "PUT",
        headers: {
          "Content-type": "application/json",
        },

        body: JSON.stringify(userData),
      })
        .then((response) => response.json())
        .then((userData) => console.log(userData));

      this.editingId = "";
    },

    async getLocation(newUser) {
      const API_KEY = "AIzaSyDkWzva7dAFQTO6rQVxZZawYTrcuo04PfI";
      const API_URL = `https://maps.googleapis.com/maps/api/geocode/json?address=${newUser.address1}+${newUser.address2}&key=${API_KEY}`;
      const apiResponse = await fetch(API_URL);
      const locationData = await apiResponse.json();
      console.log(locationData, "location");
      console.log(locationData.results[0].geometry.location.lng, "lng");
      console.log(locationData.results[0].geometry.location.lat, "lat");
      console.log(this.user.coordinates.lat, "edit user lat");
      this.user.coordinates.lat = locationData.results[0].geometry.location.lng;
      this.user.coordinates.lng = locationData.results[0].geometry.location.lat;
    },

    ....
  },
};
</script>
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I'm trying to edit the lat and lng on edit user. I manage to get the location displayed when I add a new user (I use getLocation() for both "add new user" and "edit user"), but the values of the lat and lng don't update when I run the edit function.

I tried to console.log the values and I do get the values of the user I'm editing in the console as well as the new coordinates but the user itself isn't updating.

any ideas?

(I use "vue-browser-geolocation")

export default {
....
  name: "UsersBox",
  data() {
    return {
      users: [],
      // notEditing: true,
      editingId: "",
      showAddBox: false,

      user: {
        img: "janeth carton.jpg",
        name: "",
        role: "",
        liveLocation: "Riviera State 32/106",
        address1: "",
        address2: "",
        phone: "",
        coordinates: {
          lat: 0,
          lng: 0,
        },
      },
    };
  },
  async mounted() {
    this.users = await this.fetchUsers();
  },

  methods: {

    async saveEdit(userData) {
      await this.getLocation(userData);
      await fetch(`api/users/${userData.id}`, {
        method: "PUT",
        headers: {
          "Content-type": "application/json",
        },

        body: JSON.stringify(userData),
      })
        .then((response) => response.json())
        .then((userData) => console.log(userData));

      this.editingId = "";
    },

    async getLocation(newUser) {
      const API_KEY = "AIzaSyDkWzva7dAFQTO6rQVxZZawYTrcuo04PfI";
      const API_URL = `https://maps.googleapis.com/maps/api/geocode/json?address=${newUser.address1}+${newUser.address2}&key=${API_KEY}`;
      const apiResponse = await fetch(API_URL);
      const locationData = await apiResponse.json();
      console.log(locationData, "location");
      console.log(locationData.results[0].geometry.location.lng, "lng");
      console.log(locationData.results[0].geometry.location.lat, "lat");
      console.log(this.user.coordinates.lat, "edit user lat");
      this.user.coordinates.lat = locationData.results[0].geometry.location.lng;
      this.user.coordinates.lng = locationData.results[0].geometry.location.lat;
    },

    ....
  },
};
</script>


问:
how to update File Name in Visual Studio Project Template based on user input
I am trying to create a Visual Studio 2022 Project Template. I am using a custom Windows form, where I accept multiple user inputs and have a class that implements IWizard, where I add it to the replacementsDictionary so that file contents are updated to replace the place holder template variables.

```<code>public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
{
    replacementsDictionary.Add("$MyTemplateInput1$", UserInputForm.SomeField.Text);
}
</code>```

However, I am not able to use the user input value to specify a target file name.

Within MyTemplate.vstemplate file, I have tried the below options.

```<code>  <TemplateContent>
    <Project TargetFileName="$projectname$.csproj" File="MyCustom.Templates.csproj" ReplaceParameters="true">
      <Folder Name="Properties" TargetFolderName="Properties">
        <ProjectItem ReplaceParameters="true" TargetFileName="launchSettings.json">launchSettings.json</ProjectItem>
      </Folder>
      <Folder Name="manifests" TargetFolderName="manifests">
        <ProjectItem ReplaceParameters="true" TargetFileName="$manifestFilePrefix$-trace-off.yaml">app-mytemplate-trace-off.yaml</ProjectItem>
        <ProjectItem ReplaceParameters="true" TargetFileName="app-$MyTemplateInput1$-trace-on.yaml">app-mytemplate-trace-on.yaml</ProjectItem>
      </Folder>
      <ProjectItem ReplaceParameters="true" TargetFileName="$projectname$_Local.csproj">MyCustom.Templates_Local.csproj</ProjectItem>
      <ProjectItem ReplaceParameters="true" TargetFileName="Program.cs">Program.cs</ProjectItem>
      <ProjectItem ReplaceParameters="true" TargetFileName="Startup.cs">Startup.cs</ProjectItem>
      <ProjectItem ReplaceParameters="true" TargetFileName="web.config">web.config</ProjectItem>
      <CustomParameters>
        <CustomParameter Name="$manifestFilePrefix$" Value="app-$MyTemplateInput1$"/>
      </CustomParameters>
    </Project>
  </TemplateContent>
</code>```

While $projectname$ gets replaced in target file name properly, neither the use of custom parameter approach works nor the direct use of replacement variable. In both cases, I am getting the file name as manifestFilePrefix$-trace-off.yaml and app-$MyTemplateInput1$-trace-on.yaml.

Any idea on how to get the file name populated dynamically based on user input.

Thanks!

Body:
I am trying to create a Visual Studio 2022 Project Template. I am using a custom Windows form, where I accept multiple user inputs and have a class that implements IWizard, where I add it to the replacementsDictionary so that file contents are updated to replace the place holder template variables.

public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
{
    replacementsDictionary.Add("$MyTemplateInput1$", UserInputForm.SomeField.Text);
}

However, I am not able to use the user input value to specify a target file name.

Within MyTemplate.vstemplate file, I have tried the below options.

  <TemplateContent>
    <Project TargetFileName="$projectname$.csproj" File="MyCustom.Templates.csproj" ReplaceParameters="true">
      <Folder Name="Properties" TargetFolderName="Properties">
        <ProjectItem ReplaceParameters="true" TargetFileName="launchSettings.json">launchSettings.json</ProjectItem>
      </Folder>
      <Folder Name="manifests" TargetFolderName="manifests">
        <ProjectItem ReplaceParameters="true" TargetFileName="$manifestFilePrefix$-trace-off.yaml">app-mytemplate-trace-off.yaml</ProjectItem>
        <ProjectItem ReplaceParameters="true" TargetFileName="app-$MyTemplateInput1$-trace-on.yaml">app-mytemplate-trace-on.yaml</ProjectItem>
      </Folder>
      <ProjectItem ReplaceParameters="true" TargetFileName="$projectname$_Local.csproj">MyCustom.Templates_Local.csproj</ProjectItem>
      <ProjectItem ReplaceParameters="true" TargetFileName="Program.cs">Program.cs</ProjectItem>
      <ProjectItem ReplaceParameters="true" TargetFileName="Startup.cs">Startup.cs</ProjectItem>
      <ProjectItem ReplaceParameters="true" TargetFileName="web.config">web.config</ProjectItem>
      <CustomParameters>
        <CustomParameter Name="$manifestFilePrefix$" Value="app-$MyTemplateInput1$"/>
      </CustomParameters>
    </Project>
  </TemplateContent>

While $projectname$ gets replaced in target file name properly, neither the use of custom parameter approach works nor the direct use of replacement variable. In both cases, I am getting the file name as manifestFilePrefix$-trace-off.yaml and app-$MyTemplateInput1$-trace-on.yaml.

Any idea on how to get the file name populated dynamically based on user input.

Thanks!


问:
Cannot find symbol error in my minimum absolute difference pairs algorithm
Below is my implementation of the minimum absolute difference pairs algorithm.

```<code>import java.util.*;
public class Greedy{
    public static void main(String args[]){
        int A[]={4,1,8,7};
        int B[]={2,3,6,5};
        Arrays.sort(A);
        Arrays.sort(B);
        int minDiff=0;
        for(int i=0;i<A.length;i++){
            minDiff+=Math.abs(A[i]-B[i]);

        }
        System.out.println("minDiff absolute diff ="+ minDiff);
    }
}
</code>```

This gives me the error below, however:

```<code>Greedy.java:120: error: cannot find symbol
        Arrays.sort(A);
              ^
  symbol:   method sort(int[])
  location: class Arrays
Greedy.java:121: error: cannot find symbol
        Arrays.sort(B);
              ^
  symbol:   method sort(int[])
  location: class Arrays
2 errors
</code>```

Can anyone identify the error in the code and provide a solution?

Body:
Below is my implementation of the minimum absolute difference pairs algorithm.

import java.util.*;
public class Greedy{
    public static void main(String args[]){
        int A[]={4,1,8,7};
        int B[]={2,3,6,5};
        Arrays.sort(A);
        Arrays.sort(B);
        int minDiff=0;
        for(int i=0;i<A.length;i++){
            minDiff+=Math.abs(A[i]-B[i]);

        }
        System.out.println("minDiff absolute diff ="+ minDiff);
    }
}

This gives me the error below, however:

Greedy.java:120: error: cannot find symbol
        Arrays.sort(A);
              ^
  symbol:   method sort(int[])
  location: class Arrays
Greedy.java:121: error: cannot find symbol
        Arrays.sort(B);
              ^
  symbol:   method sort(int[])
  location: class Arrays
2 errors

Can anyone identify the error in the code and provide a solution?


问:
reference to type 'icommandexecutor' claims it is defined in 'webdriver' when using IOSDriver
Updating my Selenium project to Selenium 4 results with the following error:
reference to type 'icommandexecutor' claims it is defined in 'webdriver'.
The error is actually pointing to the following line:
m_driver = new IOSDriver<IOSElement>(new Uri(""), caps);
This line works as expected with Selenium v3.141.

I have the following dependencies installed:

Selenium Support - v4.0,
Selenium Webdriver - v4.0,
DotNetSeleniumExtras.WaitHelpers  - V3.11.0,
Appium.Webdriver - v4.0

I have tried downgrade Selenium Support to 3.141 but still getting the same error.


问:
Apache Beam - Fire one window at a time
I'm trying to use Apache Beam to create a pipeline that -

Reads messages from a stream

Groups the messages by some id

Appends the message to a file with a corresponding id

The append operation is not atomic - it's composed of reading the file's content, appending the new messages in memory, and overriding the file with the new content. I'm using fixed windowing, and I noticed that sometimes I have two consecutive windows that are fired together which causes a race with writing the file.

A way to reproduce this behavior is to use FixedWindows(5) (fixed window of 5 seconds) with AfterProcessingTime(20) which causes a window to be fired only every 20 seconds. So, 4 windows contained in this 20 seconds period will be fired together. For example, look at the following code -

```<code>pipeline_options = PipelineOptions(
    streaming=True
)

with beam.Pipeline(options=pipeline_options) as p:
    class SleepAndCon(beam.DoFn):
        def process(self, element, timestamp=beam.DoFn.TimestampParam, window=beam.DoFn.WindowParam):
            window_start = str(window.start.to_utc_datetime()).split()[1]
            window_end = str(window.end.to_utc_datetime()).split()[1]
            timestamp = str(timestamp.to_utc_datetime()).split()[1]
            curr_time = str(datetime.utcnow()).split()[1].split(".")[0]
            print(f"sleep_and_con {curr_time}-{timestamp}-{window_start}-{window_end}")

            return [element]

    def print_end(e):
        print("end")

    (p
        | beam.io.ReadFromPubSub(subscription="...")
        | beam.Map(lambda x: ('a', x))
        | beam.WindowInto(
            window.FixedWindows(5),
            trigger=Repeatedly(AfterProcessingTime(20)),
            accumulation_mode=False
        )
        | beam.GroupByKey()
        | beam.ParDo(SleepAndCon())
        | beam.Map(print_end)
    )
</code>```

After running and sending 5 messages every 5 seconds, we got the following output:

```<code>sleep_and_con 13:58:19-13:57:39.999999-13:57:35-13:57:40
sleep_and_con 13:58:19-13:57:44.999999-13:57:40-13:57:45
sleep_and_con 13:58:19-13:57:49.999999-13:57:45-13:57:50
sleep_and_con 13:58:19-13:57:54.999999-13:57:50-13:57:55
sleep_and_con 13:58:19-13:57:59.999999-13:57:55-13:58:00
end
end
end
end
end
</code>```

But this behavior happens to me also without the AfterProcessingTime trigger, randomly (I didn't manage to understand when exactly it happens)

My question is - is there a way to block a window trigger until a previous window finishes the pipeline ?

Thanks!

Title: Apache Beam - Fire one window at a time

Body:
I'm trying to use Apache Beam to create a pipeline that -

Reads messages from a stream

Groups the messages by some id

Appends the message to a file with a corresponding id

The append operation is not atomic - it's composed of reading the file's content, appending the new messages in memory, and overriding the file with the new content. I'm using fixed windowing, and I noticed that sometimes I have two consecutive windows that are fired together which causes a race with writing the file.

A way to reproduce this behavior is to use FixedWindows(5) (fixed window of 5 seconds) with AfterProcessingTime(20) which causes a window to be fired only every 20 seconds. So, 4 windows contained in this 20 seconds period will be fired together. For example, look at the following code -

pipeline_options = PipelineOptions(
    streaming=True
)

with beam.Pipeline(options=pipeline_options) as p:
    class SleepAndCon(beam.DoFn):
        def process(self, element, timestamp=beam.DoFn.TimestampParam, window=beam.DoFn.WindowParam):
            window_start = str(window.start.to_utc_datetime()).split()[1]
            window_end = str(window.end.to_utc_datetime()).split()[1]
            timestamp = str(timestamp.to_utc_datetime()).split()[1]
            curr_time = str(datetime.utcnow()).split()[1].split(".")[0]
            print(f"sleep_and_con {curr_time}-{timestamp}-{window_start}-{window_end}")

            return [element]

    def print_end(e):
        print("end")

    (p
        | beam.io.ReadFromPubSub(subscription="...")
        | beam.Map(lambda x: ('a', x))
        | beam.WindowInto(
            window.FixedWindows(5),
            trigger=Repeatedly(AfterProcessingTime(20)),
            accumulation_mode=False
        )
        | beam.GroupByKey()
        | beam.ParDo(SleepAndCon())
        | beam.Map(print_end)
    )

After running and sending 5 messages every 5 seconds, we got the following output:

sleep_and_con 13:58:19-13:57:39.999999-13:57:35-13:57:40
sleep_and_con 13:58:19-13:57:44.999999-13:57:40-13:57:45
sleep_and_con 13:58:19-13:57:49.999999-13:57:45-13:57:50
sleep_and_con 13:58:19-13:57:54.999999-13:57:50-13:57:55
sleep_and_con 13:58:19-13:57:59.999999-13:57:55-13:58:00
end
end
end
end
end

But this behavior happens to me also without the AfterProcessingTime trigger, randomly (I didn't manage to understand when exactly it happens)

My question is - is there a way to block a window trigger until a previous window finishes the pipeline ?

Thanks!


问:
Any way to add a decorative border around a chrome tab using css?

Sorry if my question is silly; I am a total amateur when it comes to css.

I wanted to make a chrome extension that would allow the user to add a custom decorative border around chrome tabs like the image attached.

At first I thought that it might not be possible, but I encountered an extension called browser pets which creates a little animal which walks across your screen. From this I deduce that putting images on top of a chrome browser is not impossible?

Thank you for taking the time to read this, and I'd love if someone knows the answer.


问:
Is there any Python equivalent library as the Filehash in R programming?
I have been using R's filehash library to solve the "out of memory" problem, to store the large datasets in hashfiles, and the load/updating the file when use it. Given that most of the systems are now using SSD harddisk, I found this solution is good enough for me to solve my "out of memory" problem and a good balance between running time. I am now writing my codes in Python, but could not find any equivalent package. Could anyone shed some light for me? Thanks.

I have been reading some information about hashlib package in Python, but not quite sure if it is the samilar application as to create a hashfile and load it out.


问:
vb.net sql Admin/user login
I have accounts in my database with user types example (user1 is admin user2 is just a user) I'm trying to make admins have more privileges on my form so If I login as an admin A button will be enabled and if I logged in as user the button is disabled but I don't know how to code it can you help me?

I tried

```<code>if txtUsername.text = "Admin" then
   frmMain.btnAccountmanage.enabled = true
else
   frmMain.btnAccountmanage.enabled = false
</code>```

this is not an effective as it doesn't access my database any tips?

Title: vb.net sql Admin/user login

Body:
I have accounts in my database with user types example (user1 is admin user2 is just a user) I'm trying to make admins have more privileges on my form so If I login as an admin A button will be enabled and if I logged in as user the button is disabled but I don't know how to code it can you help me?

I tried

if txtUsername.text = "Admin" then
   frmMain.btnAccountmanage.enabled = true
else
   frmMain.btnAccountmanage.enabled = false

this is not an effective as it doesn't access my database any tips?


问:
Repeated error in prophet package in python in model.predict step
i'm trying to build a model to forecast y based on certain regressors using prophet package. An error is appearing to me as below
ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
i followed the following steps

```<code>feature_columns = [
    'sessions', 'add_to_cart', 'begin_checkout','plp',
       'select_item', 'search', 'delivery_continue',
]
target_column = ['place_order']
train_size = int(0.85 * len(df))
multivariate_df = df[['Day'] + target_column + feature_columns].copy()
multivariate_df.columns = ['ds', 'y'] + feature_columns
multivariate_df
</code>```

then tried to check if there is nan or zeros

```<code>multivariate_df['sessions'] = multivariate_df['sessions'].replace(0, np.nan)
multivariate_df['add_to_cart'] = multivariate_df['add_to_cart'].replace(0, np.nan)
multivariate_df['begin_checkout'] = multivariate_df['begin_checkout'].replace(0, np.nan)
multivariate_df['plp'] = multivariate_df['plp'].replace(0, np.nan)
multivariate_df['select_item'] = multivariate_df['select_item'].replace(0, np.nan)
multivariate_df['search'] = multivariate_df['search'].replace(0, np.nan)
multivariate_df['delivery_continue'] =
multivariate_df['delivery_continue'].replace(0, np.nan)
</code>```

multivariate_df.isna().sum()

ds                   0
y                    0
sessions             0
add_to_cart          0
begin_checkout       0
plp                  0
select_item          0
search               0
delivery_continue    0
dtype: int64

```<code>train = multivariate_df.iloc[:train_size, :]
x_train, y_train = pd.DataFrame(multivariate_df.iloc[:train_size, [0,2,3,4,5,6,7,8]]), pd.DataFrame(multivariate_df.iloc[:train_size, 1])
x_valid, y_valid = pd.DataFrame(multivariate_df.iloc[train_size:, [0,2,3,4,5,6,7,8]]), pd.DataFrame(multivariate_df.iloc[train_size:, 1])

model = Prophet()
model.add_regressor('sessions')
model.add_regressor('add_to_cart')
model.add_regressor('begin_checkout')
model.add_regressor('plp')
model.add_regressor('select_item')
model.add_regressor('search')
model.add_regressor('delivery_continue')

model.fit(train)

y_pred = model.predict(x_valid)
</code>```

the error appeared after model.predict
i tried several searches but without a result. i appreciate your help that will save much time and efforts. Thanks

Body:
i'm trying to build a model to forecast y based on certain regressors using prophet package. An error is appearing to me as below
ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
i followed the following steps

feature_columns = [
    'sessions', 'add_to_cart', 'begin_checkout','plp',
       'select_item', 'search', 'delivery_continue',
]
target_column = ['place_order']
train_size = int(0.85 * len(df))
multivariate_df = df[['Day'] + target_column + feature_columns].copy()
multivariate_df.columns = ['ds', 'y'] + feature_columns
multivariate_df

then tried to check if there is nan or zeros

multivariate_df['sessions'] = multivariate_df['sessions'].replace(0, np.nan)
multivariate_df['add_to_cart'] = multivariate_df['add_to_cart'].replace(0, np.nan)
multivariate_df['begin_checkout'] = multivariate_df['begin_checkout'].replace(0, np.nan)
multivariate_df['plp'] = multivariate_df['plp'].replace(0, np.nan)
multivariate_df['select_item'] = multivariate_df['select_item'].replace(0, np.nan)
multivariate_df['search'] = multivariate_df['search'].replace(0, np.nan)
multivariate_df['delivery_continue'] =
multivariate_df['delivery_continue'].replace(0, np.nan)

multivariate_df.isna().sum()

ds                   0
y                    0
sessions             0
add_to_cart          0
begin_checkout       0
plp                  0
select_item          0
search               0
delivery_continue    0
dtype: int64

train = multivariate_df.iloc[:train_size, :]
x_train, y_train = pd.DataFrame(multivariate_df.iloc[:train_size, [0,2,3,4,5,6,7,8]]), pd.DataFrame(multivariate_df.iloc[:train_size, 1])
x_valid, y_valid = pd.DataFrame(multivariate_df.iloc[train_size:, [0,2,3,4,5,6,7,8]]), pd.DataFrame(multivariate_df.iloc[train_size:, 1])

model = Prophet()
model.add_regressor('sessions')
model.add_regressor('add_to_cart')
model.add_regressor('begin_checkout')
model.add_regressor('plp')
model.add_regressor('select_item')
model.add_regressor('search')
model.add_regressor('delivery_continue')

model.fit(train)

y_pred = model.predict(x_valid)

the error appeared after model.predict
i tried several searches but without a result. i appreciate your help that will save much time and efforts. Thanks


问:
Casting to an actor
Hello everyone and Happy New Year!

I'm stuck  with a problem. I'm making a project game in UE5 and making an ammo box for my tank to get additional ammo. I made a class AmmoBox:
AmmoBox.h

```<code>#pragma once

#include "Cannon.h"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "AmmoBox.generated.h"

UCLASS()
class TANKOGEDDON_API AAmmoBox : public AActor
{
    GENERATED_BODY()

public:
    AAmmoBox();

protected:
    UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = "Components")
    UStaticMeshComponent* Mesh;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
    TSubclassOf<ACannon> CannonClass;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
    int additionalAmmo = 5;

    UFUNCTION()
    void OnMeshOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const
FHitResult& SweepResult);
</code>```

AmmoBox.cpp

```<code>#include "AmmoBox.h"
#include "TankPawn.h"
#include "Components/StaticMeshComponent.h"
#include "Engine/World.h"
#include "GameFramework/PlayerController.h"

// Sets default values
AAmmoBox::AAmmoBox()
{
    PrimaryActorTick.bCanEverTick = false;

    USceneComponent * sceneCpm = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
    RootComponent = sceneCpm;
    Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
    Mesh->SetupAttachment(RootComponent);
    Mesh->OnComponentBeginOverlap.AddDynamic(this, &AAmmoBox::OnMeshOverlapBegin);
    Mesh->SetCollisionProfileName(FName("OverlapAll"));
    Mesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
    Mesh->SetGenerateOverlapEvents(true);

}

void AAmmoBox::OnMeshOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
    UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    ATankPawn * TankPawn = Cast<ATankPawn>(OtherActor);
    TSubclassOf<ACannon> testActor;
    ACannon* Cannon = Cast<ACannon>(testActor);
    if(TankPawn)
    {
        Cannon->AddAmmo(additionalAmmo);
        TankPawn->SetFirstCannon(CannonClass);
        TankPawn->SetupCannon(CannonClass);
        Destroy();
    }
}
</code>```

And have another class Cannon that has an int variable EquippedAmmo and a method AddAmmo():

```<code>void ACannon::AddAmmo(int addedAmmo)
{
    Ammo+=addedAmmo;
}
</code>```

And I still don't understand casting to quite well. I'm trying to get the AddAmmo method in the AmmoBox.cpp in OnMeshOverlapBegin function to add ammo to my cannon. And Compiler doesn't show any issues. But whenever I overlap an ammobox with my tank the game instantly  crashes. This is what I get:

```<code>=== Critical error: ===
Error        LogWindows                Fatal error!
Error        LogWindows                Unhandled Exception: EXCEPTION_ACCESS_VIOLATION writing address 0x0000000000000400
Error        LogWindows                [Callstack] 0x00007ffbb2413250 UnrealEditor-Tankogeddon.dll!ACannon::AddAmmo() [D:\GeekBrains\UE Course\Tankogeddon\Tankogeddon\Source\Tankogeddon\Cannon.cpp:155]
Error        LogWindows                [Callstack] 0x00007ffbb24124f8 UnrealEditor-Tankogeddon.dll!AAmmoBox::OnMeshOverlapBegin() [D:\GeekBrains\UE Course\Tankogeddon\Tankogeddon\Source\Tankogeddon\AmmoBox.cpp:37]
Error        LogWindows                [Callstack] 0x00007ffbb2418e27 UnrealEditor-Tankogeddon.dll!AAmmoBox::execOnMeshOverlapBegin() [D:\GeekBrains\UE Course\Tankogeddon\Tankogeddon\Intermediate\Build\Win64\UnrealEditor\Inc\Tankogeddon\AmmoBox.gen.cpp:35]
Error        LogWindows                [Callstack] 0x00007ffc21f1bc07 UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc22141837 UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd34e03f4 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd33998fb UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd3a47e9d UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd3a4761d UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd3a94646 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd3a75caa UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd34f08ff UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbb2418504 UnrealEditor-Tankogeddon.dll!ATankPawn::Tick() [D:\GeekBrains\UE Course\Tankogeddon\Tankogeddon\Source\Tankogeddon\TankPawn.cpp:70]
Error        LogWindows                [Callstack] 0x00007ffbd34f82b2 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd34bea96 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd4fd5a0f UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd4fdccf8 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1f783a9d UnrealEditor-Core.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1f783f3e UnrealEditor-Core.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1f78d6af UnrealEditor-Core.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd4ff2f0a UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd4ff98b0 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd403f08f UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd40479c0 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1d5de5f5 UnrealEditor-UnrealEd.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1df6aac6 UnrealEditor-UnrealEd.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef082f6 UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef20d9c UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef20e8a UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef23c4d UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef35564 UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef38736 UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc768355a0 KERNEL32.DLL!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc7804485b ntdll.dll!UnknownFunction []
Log          LogExit                   Executing StaticShutdownAfterError
</code>```

Cannon.h

```<code>#pragma once

#include "CoreMinimal.h"
#include "GameStructs.h"
#include "GameFramework/Actor.h"
#include "Cannon.generated.h"

UCLASS()
class TANKOGEDDON_API ACannon : public AActor
{
    GENERATED_BODY()

public:
    ACannon();

    void Fire();
    void SpecialFire();
    void Reload();
    void ReloadSpecial();
    bool IsReadyToFire();
    bool IsReadyToFireSpecial();

    void AddAmmo(int32 addedAmmo);

    FTimerHandle ReloadTimer;
    FTimerHandle ReloadTimerSpecial;

protected:

    virtual void BeginPlay() override;

    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
    class UStaticMeshComponent* CannonMesh;

    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
    class UArrowComponent* ProjectileSpawnPoint;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
    TSubclassOf<class AProjectile> ProjectileClass;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
    ECannonType CannonType = ECannonType::FireProjectile;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    float FireRate = 1.0f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    float FireRange = 1000.0f;

    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Fire params")
    float FireDamage = 1.0f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    int Ammo = 10;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    int SpecialAmmo = 4;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    float SpecialFireRate = 0.3f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    int SpecialFireProjectilesQty = 4;

private:
    bool bReadyToFire = false;
    bool bReadyToFireSpecial = false;

};
</code>```

Cannon.cpp

```<code>#include "Cannon.h"

#include "Projectile.h"
#include "Components/ArrowComponent.h"
#include "Components/StaticMeshComponent.h"
#include "TimerManager.h"
#include "Engine/Engine.h"

ACannon::ACannon()
{

    PrimaryActorTick.bCanEverTick = false;

    USceneComponent* sceneComp = CreateDefaultSubobject<USceneComponent>(TEXT("SceneRoot"));
    RootComponent = sceneComp;

    CannonMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("CannonMesh"));
    CannonMesh->SetupAttachment(sceneComp);

    ProjectileSpawnPoint = CreateDefaultSubobject<UArrowComponent>(TEXT("ProjectileSpawnPoint"));
    ProjectileSpawnPoint->SetupAttachment(CannonMesh);

}

void ACannon::BeginPlay()
{
    Super::BeginPlay();
    Reload();
    ReloadSpecial();
}

void ACannon::Fire()
{
    if(!IsReadyToFire())
    {
        return;
    }
    bReadyToFire = false;
    Ammo--;

    if(CannonType == ECannonType::FireProjectile)
    {
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, \
            FString::Printf(TEXT("Fire projectile. %d ammo left"), Ammo));
        AProjectile* projectile = GetWorld()->SpawnActor<AProjectile>(ProjectileClass,
            ProjectileSpawnPoint->GetComponentLocation(), ProjectileSpawnPoint->GetComponentRotation());
        if(projectile)
        {
            projectile->Start();
        }
    }
    else
    {
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, FString::Printf(TEXT("Fire trace")));
        FHitResult hitResult;
        FCollisionQueryParams traceParams = FCollisionQueryParams(FName(TEXT("FireTrace")), true, this);
        traceParams.bTraceComplex = true;
        traceParams.bReturnPhysicalMaterial = false;

        FVector Start = ProjectileSpawnPoint->GetComponentLocation();
        FVector End = Start + ProjectileSpawnPoint->GetForwardVector() * FireRange;

        if(GetWorld()->LineTraceSingleByChannel(hitResult, Start, End, ECC_Visibility, traceParams))
        {
            DrawDebugLine(GetWorld(), Start, hitResult.Location, FColor::Purple, false, \
                1.0f, 0, 5.0f);
            if(hitResult.GetActor())
            {
                UE_LOG(LogTemp,Warning, TEXT("trace overlap : %s"), *hitResult.GetActor()->GetName());
                hitResult.GetActor()->Destroy();
            }
        }
        else
        {
            DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, \
                1.0f, 0, 5.0f);
        }

    }

    GetWorld()->GetTimerManager().SetTimer(ReloadTimer, this, &ACannon::Reload, 1/FireRate,  false);
}

void ACannon::SpecialFire()
{
    if(!IsReadyToFireSpecial())
    {
        return;
    }
    bReadyToFireSpecial = false;
    SpecialAmmo --;

    if(CannonType == ECannonType::FireProjectile)
    {
        for(int i = 0; i < SpecialFireProjectilesQty; i++)
        {
            GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, \
            FString::Printf(TEXT("Special fire!")));
        }
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, \
            FString::Printf(TEXT(" %d special ammo left"), SpecialAmmo));
    }
    else
    {
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, FString::Printf(TEXT("Fire trace")));
    }

    GetWorld()->GetTimerManager().SetTimer(ReloadTimerSpecial, this, &ACannon::ReloadSpecial, 1/SpecialFireRate,  false);
}

void ACannon::Reload()
{
    bReadyToFire = true;
    if(Ammo <=0)
    {
        bReadyToFire = false;
    }

}

void ACannon::ReloadSpecial()
{
    bReadyToFireSpecial = true;
    if(SpecialAmmo <=0)
    {
        bReadyToFireSpecial = false;
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, FString::Printf(TEXT("No Special Ammo")));
    }
}

bool ACannon::IsReadyToFire()
{
    return bReadyToFire;
}

bool ACannon::IsReadyToFireSpecial()
{
    return bReadyToFireSpecial;
}

void ACannon::AddAmmo(int addedAmmo)
{
    Ammo+=addedAmmo;
}
</code>```

Title: Casting to an actor

Body:
Hello everyone and Happy New Year!

I'm stuck  with a problem. I'm making a project game in UE5 and making an ammo box for my tank to get additional ammo. I made a class AmmoBox:
AmmoBox.h

#pragma once

#include "Cannon.h"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "AmmoBox.generated.h"

UCLASS()
class TANKOGEDDON_API AAmmoBox : public AActor
{
    GENERATED_BODY()

public:
    AAmmoBox();

protected:
    UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = "Components")
    UStaticMeshComponent* Mesh;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
    TSubclassOf<ACannon> CannonClass;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
    int additionalAmmo = 5;

    UFUNCTION()
    void OnMeshOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const
FHitResult& SweepResult);

AmmoBox.cpp

#include "AmmoBox.h"
#include "TankPawn.h"
#include "Components/StaticMeshComponent.h"
#include "Engine/World.h"
#include "GameFramework/PlayerController.h"

// Sets default values
AAmmoBox::AAmmoBox()
{
    PrimaryActorTick.bCanEverTick = false;

    USceneComponent * sceneCpm = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
    RootComponent = sceneCpm;
    Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
    Mesh->SetupAttachment(RootComponent);
    Mesh->OnComponentBeginOverlap.AddDynamic(this, &AAmmoBox::OnMeshOverlapBegin);
    Mesh->SetCollisionProfileName(FName("OverlapAll"));
    Mesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
    Mesh->SetGenerateOverlapEvents(true);

}

void AAmmoBox::OnMeshOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
    UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    ATankPawn * TankPawn = Cast<ATankPawn>(OtherActor);
    TSubclassOf<ACannon> testActor;
    ACannon* Cannon = Cast<ACannon>(testActor);
    if(TankPawn)
    {
        Cannon->AddAmmo(additionalAmmo);
        TankPawn->SetFirstCannon(CannonClass);
        TankPawn->SetupCannon(CannonClass);
        Destroy();
    }
}

And have another class Cannon that has an int variable EquippedAmmo and a method AddAmmo():

void ACannon::AddAmmo(int addedAmmo)
{
    Ammo+=addedAmmo;
}

And I still don't understand casting to quite well. I'm trying to get the AddAmmo method in the AmmoBox.cpp in OnMeshOverlapBegin function to add ammo to my cannon. And Compiler doesn't show any issues. But whenever I overlap an ammobox with my tank the game instantly  crashes. This is what I get:

=== Critical error: ===
Error        LogWindows                Fatal error!
Error        LogWindows                Unhandled Exception: EXCEPTION_ACCESS_VIOLATION writing address 0x0000000000000400
Error        LogWindows                [Callstack] 0x00007ffbb2413250 UnrealEditor-Tankogeddon.dll!ACannon::AddAmmo() [D:\GeekBrains\UE Course\Tankogeddon\Tankogeddon\Source\Tankogeddon\Cannon.cpp:155]
Error        LogWindows                [Callstack] 0x00007ffbb24124f8 UnrealEditor-Tankogeddon.dll!AAmmoBox::OnMeshOverlapBegin() [D:\GeekBrains\UE Course\Tankogeddon\Tankogeddon\Source\Tankogeddon\AmmoBox.cpp:37]
Error        LogWindows                [Callstack] 0x00007ffbb2418e27 UnrealEditor-Tankogeddon.dll!AAmmoBox::execOnMeshOverlapBegin() [D:\GeekBrains\UE Course\Tankogeddon\Tankogeddon\Intermediate\Build\Win64\UnrealEditor\Inc\Tankogeddon\AmmoBox.gen.cpp:35]
Error        LogWindows                [Callstack] 0x00007ffc21f1bc07 UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc22141837 UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd34e03f4 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd33998fb UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd3a47e9d UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd3a4761d UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd3a94646 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd3a75caa UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd34f08ff UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbb2418504 UnrealEditor-Tankogeddon.dll!ATankPawn::Tick() [D:\GeekBrains\UE Course\Tankogeddon\Tankogeddon\Source\Tankogeddon\TankPawn.cpp:70]
Error        LogWindows                [Callstack] 0x00007ffbd34f82b2 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd34bea96 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd4fd5a0f UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd4fdccf8 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1f783a9d UnrealEditor-Core.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1f783f3e UnrealEditor-Core.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1f78d6af UnrealEditor-Core.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd4ff2f0a UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd4ff98b0 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd403f08f UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffbd40479c0 UnrealEditor-Engine.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1d5de5f5 UnrealEditor-UnrealEd.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc1df6aac6 UnrealEditor-UnrealEd.dll!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef082f6 UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef20d9c UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef20e8a UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef23c4d UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef35564 UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ff71ef38736 UnrealEditor.exe!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc768355a0 KERNEL32.DLL!UnknownFunction []
Error        LogWindows                [Callstack] 0x00007ffc7804485b ntdll.dll!UnknownFunction []
Log          LogExit                   Executing StaticShutdownAfterError

Cannon.h

#pragma once

#include "CoreMinimal.h"
#include "GameStructs.h"
#include "GameFramework/Actor.h"
#include "Cannon.generated.h"

UCLASS()
class TANKOGEDDON_API ACannon : public AActor
{
    GENERATED_BODY()

public:
    ACannon();

    void Fire();
    void SpecialFire();
    void Reload();
    void ReloadSpecial();
    bool IsReadyToFire();
    bool IsReadyToFireSpecial();

    void AddAmmo(int32 addedAmmo);

    FTimerHandle ReloadTimer;
    FTimerHandle ReloadTimerSpecial;

protected:

    virtual void BeginPlay() override;

    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
    class UStaticMeshComponent* CannonMesh;

    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
    class UArrowComponent* ProjectileSpawnPoint;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
    TSubclassOf<class AProjectile> ProjectileClass;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
    ECannonType CannonType = ECannonType::FireProjectile;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    float FireRate = 1.0f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    float FireRange = 1000.0f;

    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Fire params")
    float FireDamage = 1.0f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    int Ammo = 10;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    int SpecialAmmo = 4;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    float SpecialFireRate = 0.3f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Fire params")
    int SpecialFireProjectilesQty = 4;

private:
    bool bReadyToFire = false;
    bool bReadyToFireSpecial = false;

};

Cannon.cpp

#include "Cannon.h"

#include "Projectile.h"
#include "Components/ArrowComponent.h"
#include "Components/StaticMeshComponent.h"
#include "TimerManager.h"
#include "Engine/Engine.h"

ACannon::ACannon()
{

    PrimaryActorTick.bCanEverTick = false;

    USceneComponent* sceneComp = CreateDefaultSubobject<USceneComponent>(TEXT("SceneRoot"));
    RootComponent = sceneComp;

    CannonMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("CannonMesh"));
    CannonMesh->SetupAttachment(sceneComp);

    ProjectileSpawnPoint = CreateDefaultSubobject<UArrowComponent>(TEXT("ProjectileSpawnPoint"));
    ProjectileSpawnPoint->SetupAttachment(CannonMesh);

}

void ACannon::BeginPlay()
{
    Super::BeginPlay();
    Reload();
    ReloadSpecial();
}

void ACannon::Fire()
{
    if(!IsReadyToFire())
    {
        return;
    }
    bReadyToFire = false;
    Ammo--;

    if(CannonType == ECannonType::FireProjectile)
    {
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, \
            FString::Printf(TEXT("Fire projectile. %d ammo left"), Ammo));
        AProjectile* projectile = GetWorld()->SpawnActor<AProjectile>(ProjectileClass,
            ProjectileSpawnPoint->GetComponentLocation(), ProjectileSpawnPoint->GetComponentRotation());
        if(projectile)
        {
            projectile->Start();
        }
    }
    else
    {
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, FString::Printf(TEXT("Fire trace")));
        FHitResult hitResult;
        FCollisionQueryParams traceParams = FCollisionQueryParams(FName(TEXT("FireTrace")), true, this);
        traceParams.bTraceComplex = true;
        traceParams.bReturnPhysicalMaterial = false;

        FVector Start = ProjectileSpawnPoint->GetComponentLocation();
        FVector End = Start + ProjectileSpawnPoint->GetForwardVector() * FireRange;

        if(GetWorld()->LineTraceSingleByChannel(hitResult, Start, End, ECC_Visibility, traceParams))
        {
            DrawDebugLine(GetWorld(), Start, hitResult.Location, FColor::Purple, false, \
                1.0f, 0, 5.0f);
            if(hitResult.GetActor())
            {
                UE_LOG(LogTemp,Warning, TEXT("trace overlap : %s"), *hitResult.GetActor()->GetName());
                hitResult.GetActor()->Destroy();
            }
        }
        else
        {
            DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, \
                1.0f, 0, 5.0f);
        }

    }

    GetWorld()->GetTimerManager().SetTimer(ReloadTimer, this, &ACannon::Reload, 1/FireRate,  false);
}

void ACannon::SpecialFire()
{
    if(!IsReadyToFireSpecial())
    {
        return;
    }
    bReadyToFireSpecial = false;
    SpecialAmmo --;

    if(CannonType == ECannonType::FireProjectile)
    {
        for(int i = 0; i < SpecialFireProjectilesQty; i++)
        {
            GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, \
            FString::Printf(TEXT("Special fire!")));
        }
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, \
            FString::Printf(TEXT(" %d special ammo left"), SpecialAmmo));
    }
    else
    {
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, FString::Printf(TEXT("Fire trace")));
    }

    GetWorld()->GetTimerManager().SetTimer(ReloadTimerSpecial, this, &ACannon::ReloadSpecial, 1/SpecialFireRate,  false);
}

void ACannon::Reload()
{
    bReadyToFire = true;
    if(Ammo <=0)
    {
        bReadyToFire = false;
    }

}

void ACannon::ReloadSpecial()
{
    bReadyToFireSpecial = true;
    if(SpecialAmmo <=0)
    {
        bReadyToFireSpecial = false;
        GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, FString::Printf(TEXT("No Special Ammo")));
    }
}

bool ACannon::IsReadyToFire()
{
    return bReadyToFire;
}

bool ACannon::IsReadyToFireSpecial()
{
    return bReadyToFireSpecial;
}

void ACannon::AddAmmo(int addedAmmo)
{
    Ammo+=addedAmmo;
}


问:
How do I accept an input from the Output Console in Visual Studio Code?
I am trying to run a simple Rock Paper Scissors code in Python. Here is the code

```<code>    import random

    def get_choices():
        player_choice = input("Enter a choice (rock, paper, scissors: ")
        options = ["rock", "paper", "scissors"]
        computer_choice = random.choice(options)
        choices = {"player": player_choice, "computer": computer_choice}
        return choices

    choices = get_choices()
    print(choices)
</code>```

When I ran the code via Run Code , the code ran properly showing the input "Enter a choice (rock, paper, scissors:" in the Output Console, but when I tried to input the response (ex. rock) it did not allow me to type in the Output console, however, when I ran the code via Run Python file, I could write my input in the Terminal Console. Here is a screenshot of the output console. I cannot write anything in here, but I can write in the Terminal Console shown here.

I tried using the Run and Debug feature but that did not fix the issue. The only thing which is close to a solution is simply only using the Terminal console and running the python file. I would really prefer to use the output console as it is less clogged than the Terminal console. If it helps, I downloaded Python through the Windows store and running python --version in cmd prompt works fine. I also use Code Runner. Any help is appreciated <3

Body:
I am trying to run a simple Rock Paper Scissors code in Python. Here is the code

    import random

    def get_choices():
        player_choice = input("Enter a choice (rock, paper, scissors: ")
        options = ["rock", "paper", "scissors"]
        computer_choice = random.choice(options)
        choices = {"player": player_choice, "computer": computer_choice}
        return choices

    choices = get_choices()
    print(choices)

When I ran the code via Run Code , the code ran properly showing the input "Enter a choice (rock, paper, scissors:" in the Output Console, but when I tried to input the response (ex. rock) it did not allow me to type in the Output console, however, when I ran the code via Run Python file, I could write my input in the Terminal Console. Here is a screenshot of the output console. I cannot write anything in here, but I can write in the Terminal Console shown here.

I tried using the Run and Debug feature but that did not fix the issue. The only thing which is close to a solution is simply only using the Terminal console and running the python file. I would really prefer to use the output console as it is less clogged than the Terminal console. If it helps, I downloaded Python through the Windows store and running python --version in cmd prompt works fine. I also use Code Runner. Any help is appreciated <3


问:
Option within select mouse hover
I am css beginner and I have got a little problem
How change background color of option within select element while mouse hover, I mean the blue background and white text color, without change the white background color and other options that the mouse dosen't hover on its?

option:hover {
  background-color: #ffb81f;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="role">
  <label for="role">أي الخيارات التالية تمثل وضعك الحالي :</label><br>
  <select id="role" required>
    <option value="">اختر واحدة</option>
    <option value="طالب">طالب</option>
    <option value="موظف بدوام كامل">موظف بدوام كامل</option>
    <option value="">متفرغ للتعلم</option>
    <option value="لا أفضل الإجابة">لا أفضل الإجابة</option>
    <option value="غير ذلك">غير ذلك</option>
  </select>
</div></code>```

Title: Option within select mouse hover

Body:
I am css beginner and I have got a little problem
How change background color of option within select element while mouse hover, I mean the blue background and white text color, without change the white background color and other options that the mouse dosen't hover on its?

option:hover {
  background-color: #ffb81f;
}

  أي الخيارات التالية تمثل وضعك الحالي :

  <select id="role" required>
    <option value="">اختر واحدة</option>
    <option value="طالب">طالب</option>
    <option value="موظف بدوام كامل">موظف بدوام كامل</option>
    <option value="">متفرغ للتعلم</option>
    <option value="لا أفضل الإجابة">لا أفضل الإجابة</option>
    <option value="غير ذلك">غير ذلك</option>
  </select>


问:
Migrate old Java 8 maven/netbeans project to a modern GraalVM/Java 19 in VScode
I'm studying Visual Studio Code and GraalVM, I have this pack [1] and an old Java 8 project. What is the best way to make VScode/Maven/Netbeans Language Server to compile my project with the latest Java to see what should I fix?

Here's the pom:

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.vsetec</groupId>
    <artifactId>vsetec-utilities</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>javax.sip</groupId>
            <artifactId>jain-sip-ri</artifactId>
            <version>1.3.0-91</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
            <type>jar</type>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <name>Utilities</name>
    <description>Some reusable procedures</description>
</project>
</code>```

Everything is a bit old, so I'm going to make it check against the modern Java and fix dependencies one by one, but I'm guessing the "compiler source and target" are already an obsolete Maven plugin configurations. Any tips?

[1] https://www.graalvm.org/latest/tools/vscode/graalvm-extension-pack/

Body:
I'm studying Visual Studio Code and GraalVM, I have this pack [1] and an old Java 8 project. What is the best way to make VScode/Maven/Netbeans Language Server to compile my project with the latest Java to see what should I fix?

Here's the pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.vsetec</groupId>
    <artifactId>vsetec-utilities</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>javax.sip</groupId>
            <artifactId>jain-sip-ri</artifactId>
            <version>1.3.0-91</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
            <type>jar</type>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <name>Utilities</name>
    <description>Some reusable procedures</description>
</project>

Everything is a bit old, so I'm going to make it check against the modern Java and fix dependencies one by one, but I'm guessing the "compiler source and target" are already an obsolete Maven plugin configurations. Any tips?

[1] https://www.graalvm.org/latest/tools/vscode/graalvm-extension-pack/


问:
Remove a node from the DOM upon successful onClick event, vuejs3
Here's a fragment of my component:-

```<code><template>
    <h2>Categories</h2>
    <table class=" table">
        <thead class="table-light">
        <tr>
            <td>Name</td>
            <td>Status</td>
            <td>Created at</td>
            <td></td>
            <td></td>
        </tr>
       </thead>
       <tbody>
        <template :key="foo" v-for="categories in info">
            <template v-for="attributes in categories">
                <tr>
                    <td>{{ attributes.attributes.name }}</td>
                    <td>{{ attributes.attributes.status }}</td>
                    <td>{{ formatDate(attributes.attributes.created_at) }}</td>
                    <td>
                        <button @click="deleteCategory(attributes.id)">delete</button>
                    </td>
                  <td></td>
                </tr>
            </template>
        </template>
      </tbody>
...
</template>
</code>```
```<code>deleteCategory(id) {
  axios.delete('http://127.0.0.1:8000/api/categories/' + id, {
         headers: {
           Authorization: 'Bearer ' + localStorage.getItem('apiToken')
        }
    })
     .then((response) => {
         alert('Category successfully deleted');
         this.foo.forceUpdate();

   }).catch((error) => {
                console.log(error);
   });
},

</code>```

On click of deleteCategory my code deletes the record in the db successfully. I'd like to reload/refresh the component thud removing the deleted record from the dom following my alert? I'm trying:-

```<code>this.foo.forceUpdate();
this.foo.$forceUpdate();
</code>```

Body:
Here's a fragment of my component:-

<template>

Categories

            Name
            Status
            Created at

        <template :key="foo" v-for="categories in info">
            <template v-for="attributes in categories">

                    {{ attributes.attributes.name }}
                    {{ attributes.attributes.status }}
                    {{ formatDate(attributes.attributes.created_at) }}

                        <button @click="deleteCategory(attributes.id)">delete</button>

            </template>
        </template>

...
</template>

deleteCategory(id) {
  axios.delete('http://127.0.0.1:8000/api/categories/' + id, {
         headers: {
           Authorization: 'Bearer ' + localStorage.getItem('apiToken')
        }
    })
     .then((response) => {
         alert('Category successfully deleted');
         this.foo.forceUpdate();

   }).catch((error) => {
                console.log(error);
   });
},

On click of deleteCategory my code deletes the record in the db successfully. I'd like to reload/refresh the component thud removing the deleted record from the dom following my alert? I'm trying:-

this.foo.forceUpdate();
this.foo.$forceUpdate();


问:
webview only showing the first page
```<code>import UIKit
import WebKit

class FactsheetViewController: UIViewController {

    let webView = WKWebView()

    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(webView)

        guard let url = URL(string: "https://doc.morningstar.com/LatestDoc.aspx?clientid=stanlibpro&key=35d0c11e52f21126&documenttype=52&investmentidtype=1&ISIN=ZAE000084869") else {
            return
        }
        webView.load(URLRequest(url: url))
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        webView.frame = view.bounds
    }

}

</code>```

this code only shows the first page of the document. How do I show everything?

tried the code above and it only shows the first page whereas I was expecting to see the whole document

Title: webview only showing the first page

Body:
import UIKit
import WebKit

class FactsheetViewController: UIViewController {

    let webView = WKWebView()

    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(webView)

        guard let url = URL(string: "https://doc.morningstar.com/LatestDoc.aspx?clientid=stanlibpro&key=35d0c11e52f21126&documenttype=52&investmentidtype=1&ISIN=ZAE000084869") else {
            return
        }
        webView.load(URLRequest(url: url))
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        webView.frame = view.bounds
    }

}

this code only shows the first page of the document. How do I show everything?

tried the code above and it only shows the first page whereas I was expecting to see the whole document


问:
How to end / stop the casting session with chrome-cast or TV once user kills the application?
I am using google-cast-SDK for the casting feature the issue I am facing is that once I kill the application I want to stop / End the current ongoing session with the chrome-cast or TV.

I have tried to end the session in AppDelegate Using the method
applicationWillTerminate but the session is not being ended.

Uses of end session:

```<code>func applicationWillTerminate(_ application: UIApplication) {
    GCKCastContext.sharedInstance().discoveryManager.stopDiscovery()
    GCKCastContext.sharedInstance().sessionManager.endSession()
    GCKCastContext.sharedInstance().sessionManager.endSessionAndStopCasting(true)
}
</code>```

SDK Version: google-cast-sdk (4.6.1)

iOS:16.0

Body:
I am using google-cast-SDK for the casting feature the issue I am facing is that once I kill the application I want to stop / End the current ongoing session with the chrome-cast or TV.

I have tried to end the session in AppDelegate Using the method
applicationWillTerminate but the session is not being ended.

Uses of end session:

func applicationWillTerminate(_ application: UIApplication) {
    GCKCastContext.sharedInstance().discoveryManager.stopDiscovery()
    GCKCastContext.sharedInstance().sessionManager.endSession()
    GCKCastContext.sharedInstance().sessionManager.endSessionAndStopCasting(true)
}

SDK Version: google-cast-sdk (4.6.1)

iOS:16.0


问:
How to use same lib different versions from cpp and python
I have a project that uses both python and cpp (and cython to connect between both).
in python Im using "import pyarrow" (version 6.0.0)
in cpp I just added a use (I use CMAKE) for libarrow versions 10.0.1

This caused segmentation fault when running python (cpp side works)

I tried to use :

'pyarrow.require("pyarrow==6.0.0")'

in python but it didn't help

I also tried upgrading pyarrow to 10.0.1, but then I got another segmantation fault. in this situation I have 2 libs in 2 different pathes (one sys_LIB and another one)


问:
Bottom-Container is Overwrite why?
The footer div is overwrite why??

i created a new bottom-container but it overwrite to the middle container why?
i created two main div container
top-container, middle-container, bottom-container but when i create a new continer for the footer it is overwirte in the middle container(div) why

HTML

```<code><!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Baljit Singh</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link rel="icon" href="favicon.png?v=2">
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=Merriweather&family=Montserrat&family=Sacramento&display=swap');
    </style>
</head>

<body>

    <div class="top-container">
        <img class="top-cloud" src="images/cloud.png" alt="">

        <h1>I'm Baljit</h1>
        <h2>a <span class="pro">pro</span>grammer</h2>

        <img class="bottom-cloud" src="images/cloud.png" alt="">
        <img src="images/mountain.png" alt="">

    </div>
    <div class="middle-container">
        <div class="profile">
            <img class="prof-img" src="/images/angela.png" alt="profile-img">
            <h2>Hello.</h2>
            <p class="intro" >I am an IOS and Web Developer. I'm the founder and CTO of the App Brewery. I ❤ coffee and brew my own beers.</p>
        </div>
        <hr>
        <div class="skills">
            <h2>My Skills</h2>
            <div class="skill-row">
                <img class="code-img2" src="/images/computer.png" alt="img">

                <h3>Web Development</h3>
                <p >A web developer is a programmer who develops World Wide Web applications using a client–server model. The applications typically use HTML, CSS, and JavaScript in the client, and any general-purpose programming language in the server. </p>
            </div>
            <div class="skill-row">
                <img class="chilli-img" src="/images/chillies.png" alt="img">
                <h3>Chhili Developer</h3>
               <p >Chili peppers, from Nahuatl chīlli, are varieties of the berry-fruit of plants from the genus Capsicum, which are members of the nightshade family Solanaceae, cultivated for their pungency. Chili peppers are widely used in many cuisines as a spice to add "heat" to</p>
            </div>
        </div>
        <hr>
        <div class="contact-me">
            <h2>Get In Touch</h2>
            <h3>if you love hot wings as much as I do</h3>
            <p class="contact-message" >Love hot wings as much as I do? Let's talk about how awesome they are! We can code while we eat hot wings!</p>
            <a class="btn" href="mailto:name@gamail.com">Contact Me</a>
        </div>

        <div class="bottom-container">
            <a class="footer-link" href="https://www.linkedin.com/thebaljitsingh">Linkedin</a>
            <a class="footer-link" href="https://twitter.com/thebaljitsingh">Twitter</a>
            <a class="footer-link" href="https://www.appbrewery.com">website</a>
            <p>© Baljit Singh</p>
    </div>
    </div>

</body>

</html>
</code>```

CSS

```<code>body{
    color: #40514E;
    margin: 0;
    text-align: center;
    font-family:"Merriweather",serif ;
    /* font-size: 2em; */

}
h1{
    color: #66BFBF;
    line-height: 1;
    font-size: 5.625rem;
    margin: 50px, auto, 0, auto;
    font-family: 'Sacramento',cursive;

}
h2{
    color: #66BFBF;
    font-size: 2.5rem;
    font-family:'Montserrat', sans-serif ;
    font-weight: normal;
    padding-bottom: 10px;

}
h3{
    color: #11999E;
    font-family: 'Montserrat',sans-serif;

}
a{
    color: #11999E;
}

p{
    margin-top: 10px;
    line-height:2;
}
.pro{
    text-decoration: underline;
}
hr{
    border: dotted #EAF6F6 6px;
    border-bottom: none;
    width: 4%;
    margin: 100px auto;
}
.intro{
    width: 30%;
    margin:auto;

}

.btn {
    background: #11999e;
    background-image: -webkit-linear-gradient(top, #11999e, #11999e);
    background-image: -moz-linear-gradient(top, #11999e, #11999e);
    background-image: -ms-linear-gradient(top, #11999e, #11999e);
    background-image: -o-linear-gradient(top, #11999e, #11999e);
    background-image: linear-gradient(to bottom, #11999e, #11999e);
    -webkit-border-radius: 28;
    -moz-border-radius: 28;
    border-radius: 28px;
    font-family:"Merriweather",serif ;
    color: #ffffff;
    font-size: 20px;
    padding: 10px 20px 10px 20px;
    text-decoration: none;
  }

  .btn:hover {
    background: #30e3cb;
    background-image: -webkit-linear-gradient(top, #30e3cb, #30e3cb);
    background-image: -moz-linear-gradient(top, #30e3cb, #30e3cb);
    background-image: -ms-linear-gradient(top, #30e3cb, #30e3cb);
    background-image: -o-linear-gradient(top, #30e3cb, #30e3cb);
    background-image: linear-gradient(to bottom, #30e3cb, #30e3cb);
    text-decoration: none;
  }

.contact-message{
    width: 40%;
    margin: 40px auto 60px;

}
.top-container{
    background-color: #E4F9F5;
    position: relative;
    padding-top: 100px;

}
.middle-container{
    /* background-color: red; */
    width: 100%;
    height: 200px;

}
.bottom-container{
    background-color: #66BFBF;
    width: 100%;
    height: 200px;
}

.bottom-cloud{
    position: absolute;
    left: 250px;
    bottom: 300px;

}
.top-cloud{
    position: absolute;
    right: 300px;
    top: 40px;

}
.code-img2{
    border-radius: 50%;
    width: 25%;
    float: left;
    margin-right: 30px;
}
.chilli-img{
    width: 25%;
    float: right;
    margin-left: 30px;

}
.prof-img{
    margin-top: 70px;
}
.skill-row{
    width: 50%;
    margin: 100px auto 100px auto;
    text-align: left;
    line-height: 2;
}

</code>```

the problem is my bootem-container is overwrite when i create a new div to add content but it is overwrite?? i want to fix it

Title: Bottom-Container is Overwrite why?

Body:
The footer div is overwrite why??

i created a new bottom-container but it overwrite to the middle container why?
i created two main div container
top-container, middle-container, bottom-container but when i create a new continer for the footer it is overwirte in the middle container(div) why

HTML

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Baljit Singh</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link rel="icon" href="favicon.png?v=2">

I'm Baljit

a programmer

Hello.

I am an IOS and Web Developer. I'm the founder and CTO of the App Brewery. I ❤ coffee and brew my own beers.

My Skills

Web Development

A web developer is a programmer who develops World Wide Web applications using a client–server model. The applications typically use HTML, CSS, and JavaScript in the client, and any general-purpose programming language in the server.

Chhili Developer

Chili peppers, from Nahuatl chīlli, are varieties of the berry-fruit of plants from the genus Capsicum, which are members of the nightshade family Solanaceae, cultivated for their pungency. Chili peppers are widely used in many cuisines as a spice to add "heat" to

Get In Touch

if you love hot wings as much as I do

Love hot wings as much as I do? Let's talk about how awesome they are! We can code while we eat hot wings!

            Contact Me

            Linkedin
            Twitter
            website

© Baljit Singh

CSS

body{
    color: #40514E;
    margin: 0;
    text-align: center;
    font-family:"Merriweather",serif ;
    /* font-size: 2em; */

}
h1{
    color: #66BFBF;
    line-height: 1;
    font-size: 5.625rem;
    margin: 50px, auto, 0, auto;
    font-family: 'Sacramento',cursive;

}
h2{
    color: #66BFBF;
    font-size: 2.5rem;
    font-family:'Montserrat', sans-serif ;
    font-weight: normal;
    padding-bottom: 10px;

}
h3{
    color: #11999E;
    font-family: 'Montserrat',sans-serif;

}
a{
    color: #11999E;
}

p{
    margin-top: 10px;
    line-height:2;
}
.pro{
    text-decoration: underline;
}
hr{
    border: dotted #EAF6F6 6px;
    border-bottom: none;
    width: 4%;
    margin: 100px auto;
}
.intro{
    width: 30%;
    margin:auto;

}

.btn {
    background: #11999e;
    background-image: -webkit-linear-gradient(top, #11999e, #11999e);
    background-image: -moz-linear-gradient(top, #11999e, #11999e);
    background-image: -ms-linear-gradient(top, #11999e, #11999e);
    background-image: -o-linear-gradient(top, #11999e, #11999e);
    background-image: linear-gradient(to bottom, #11999e, #11999e);
    -webkit-border-radius: 28;
    -moz-border-radius: 28;
    border-radius: 28px;
    font-family:"Merriweather",serif ;
    color: #ffffff;
    font-size: 20px;
    padding: 10px 20px 10px 20px;
    text-decoration: none;
  }

  .btn:hover {
    background: #30e3cb;
    background-image: -webkit-linear-gradient(top, #30e3cb, #30e3cb);
    background-image: -moz-linear-gradient(top, #30e3cb, #30e3cb);
    background-image: -ms-linear-gradient(top, #30e3cb, #30e3cb);
    background-image: -o-linear-gradient(top, #30e3cb, #30e3cb);
    background-image: linear-gradient(to bottom, #30e3cb, #30e3cb);
    text-decoration: none;
  }

.contact-message{
    width: 40%;
    margin: 40px auto 60px;

}
.top-container{
    background-color: #E4F9F5;
    position: relative;
    padding-top: 100px;

}
.middle-container{
    /* background-color: red; */
    width: 100%;
    height: 200px;

}
.bottom-container{
    background-color: #66BFBF;
    width: 100%;
    height: 200px;
}

.bottom-cloud{
    position: absolute;
    left: 250px;
    bottom: 300px;

}
.top-cloud{
    position: absolute;
    right: 300px;
    top: 40px;

}
.code-img2{
    border-radius: 50%;
    width: 25%;
    float: left;
    margin-right: 30px;
}
.chilli-img{
    width: 25%;
    float: right;
    margin-left: 30px;

}
.prof-img{
    margin-top: 70px;
}
.skill-row{
    width: 50%;
    margin: 100px auto 100px auto;
    text-align: left;
    line-height: 2;
}

the problem is my bootem-container is overwrite when i create a new div to add content but it is overwrite?? i want to fix it


问:
Share the same Redux store between two apps causing memory leak
I have got three apps : Background, MainApp and Settings.

I have created the store in the background and I am accessing it in MainApp and Settings. Everything works well but whenever I close one of my app, I get a "detached window" (a memory leak) according to Chrome Dev tools.

MainApp.tsx

```<code>const backgroundStore = getBackgroundWindowHTMLObject().myStore

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
        <Provider store={backgroundStore}>
            <MainApp/>
        </Provider>
);

</code>```

SettingsApp.tsx

```<code>const backgroundStore = getBackgroundWindowHTMLObject().myStore

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
        <Provider store={backgroundStore}>
            <SettingsApp/>
        </Provider>
);

</code>```

How can I unset the reference to the store in <Provider store={backgroundStore}> before closing my settings window?

Body:
I have got three apps : Background, MainApp and Settings.

I have created the store in the background and I am accessing it in MainApp and Settings. Everything works well but whenever I close one of my app, I get a "detached window" (a memory leak) according to Chrome Dev tools.

MainApp.tsx

const backgroundStore = getBackgroundWindowHTMLObject().myStore

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
        <Provider store={backgroundStore}>
            <MainApp/>
        </Provider>
);

SettingsApp.tsx

const backgroundStore = getBackgroundWindowHTMLObject().myStore

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
        <Provider store={backgroundStore}>
            <SettingsApp/>
        </Provider>
);

How can I unset the reference to the store in <Provider store={backgroundStore}> before closing my settings window?


问:
I'm trying to change the chart to a dynamic chart
i have this code that work perfect but not dynamically, i need the chart to show the comoponent name below, even if it is more the 8 that was in the begining.

```<code>const tableData = JSON.parse('{{ data|tojson }}')
        console.log("tableData", tableData);
        document.addEventListener('DOMContentLoaded', function () {
            for (let i = 0; i < tableData.length; i++) {
                const data = tableData[i]
                var canvas = document.createElement('canvas'),
                    chartId = 'chart' + i;
                canvas.id = chartId;
                canvas.classList.add("chartarea");

                // css for styling
                canvas.style.height = '100px';
                // canvas.style.width = '200px';

                // document.body.appendChild(canvas);
                const chaDiv = document.getElementById('chartContainer');
                chaDiv.appendChild(canvas);
                var context = document.getElementById(chartId).getContext('2d');
                new Chart(context, {
                    type: 'line',
                    data: {
                        // labels will show the x axis values and hover value
                        labels: [`${data.component}`, 'Data 2', 'Data 3', 'Data 4', 'Data 5', 'Data 6', 'Data 7', 'Data 8', 'More1'],
                        datasets: [{
                        label: `No. ${data.id}`,
                            label: `Component ${data.component}`,
                            // this data is y axis values
                            // this data work as bar position as well.
                            data: [
                                data.data1,
                                data.data2,
                                data.data3,
                                data.data4,
                                data.data5,
                                data.data6,
                                data.data7,
                                data.data8,
                            ],
                            fill: false,
                            borderColor: '#01baef',
                            tension: 0.1,
                            borderWidth: 3
                        }]
                    },

                    options: {
                        // maintainAspectRatio: false,
                        title: {
                            display: true,
                            text: i+1,
                        },
                        tooltips: {
                            mode: 'index',
                            intersect: false
                        },
                        responsive: true,
                        scales: {
                            xAxes: [{
                                stacked: true,

                            }],
                            yAxes: [{
                                stacked: true
                            }]
                        }
                    }
                });
            }
        });
</code>```

i tried to change it to this:

```<code>const tableData = JSON.parse('{{ data|tojson }}')
        console.log("tableData", tableData);
        document.addEventListener('DOMContentLoaded', function () {
            for (let i = 0; i < tableData.length; i++) {
                const data = tableData[i]
                var canvas = document.createElement('canvas'),
                    chartId = 'chart' + i;
                canvas.id = chartId;
                canvas.classList.add("chartarea");

                // css for styling
                canvas.style.height = '100px';
                // canvas.style.width = '200px';

                // document.body.appendChild(canvas);
                const chaDiv = document.getElementById('chartContainer');
                chaDiv.appendChild(canvas);
                var context = document.getElementById(chartId).getContext('2d');
                new Chart(context, {
                    type: 'line',
                    data: {
                        // labels will show the x axis values and hover value
                        labels: {data.component[i]},
                        datasets: [{
                        label: `No. ${data.id}`,
                            label: `Component ${data.component}`,
                            // this data is y axis values
                            // this data work as bar position as well.
                            data: data.data[i]
                            ,
                            fill: false,
                            borderColor: '#01baef',
                            tension: 0.1,
                            borderWidth: 3
                        }]
                    },

                    options: {
                        // maintainAspectRatio: false,
                        title: {
                            display: true,
                            text: i+1,
                        },
                        tooltips: {
                            mode: 'index',
                            intersect: false
                        },
                        responsive: true,
                        scales: {
                            xAxes: [{
                                stacked: true,

                            }],
                            yAxes: [{
                                stacked: true
                            }]
                        }
                    }
                });
            }
        });
    </script>
</code>```

i tried to do this (like i saw here someone that had a similar problem)

```<code>const tableData = JSON.parse('{{ data|tojson }}')
        console.log("tableData", tableData);
        document.addEventListener('DOMContentLoaded', function () {
            for (let i = 0; i < tableData.length; i++) {
                const data = tableData[i]
                var canvas = document.createElement('canvas'),
                    chartId = 'chart' + i;
                canvas.id = chartId;
                canvas.classList.add("chartarea");

                // css for styling
                canvas.style.height = '100px';
                // canvas.style.width = '200px';

                // document.body.appendChild(canvas);
                const chaDiv = document.getElementById('chartContainer');
                chaDiv.appendChild(canvas);
                var context = document.getElementById(chartId).getContext('2d');
                new Chart(context, {
                    type: 'line',
                    data: {
                        // labels will show the x axis values and hover value
                        labels: {data.component[i]},
                        datasets: [{
                        label: `No. ${data.id}`,
                            label: `Component ${data.component}`,
                            // this data is y axis values
                            // this data work as bar position as well.
                            data: data.data[i]
                            ,
                            fill: false,
                            borderColor: '#01baef',
                            tension: 0.1,
                            borderWidth: 3
                        }]
                    },

                    options: {
                        // maintainAspectRatio: false,
                        title: {
                            display: true,
                            text: i+1,
                        },
                        tooltips: {
                            mode: 'index',
                            intersect: false
                        },
                        responsive: true,
                        scales: {
                            xAxes: [{
                                stacked: true,

                            }],
                            yAxes: [{
                                stacked: true
                            }]
                        }
                    }
                });
            }
        });
    </script>
</code>```

but no success. the chart don't show anything. and i'm not familiar with chart.js just learning with a code i already have and need to be change.
thank you

Body:
i have this code that work perfect but not dynamically, i need the chart to show the comoponent name below, even if it is more the 8 that was in the begining.

const tableData = JSON.parse('{{ data|tojson }}')
        console.log("tableData", tableData);
        document.addEventListener('DOMContentLoaded', function () {
            for (let i = 0; i < tableData.length; i++) {
                const data = tableData[i]
                var canvas = document.createElement('canvas'),
                    chartId = 'chart' + i;
                canvas.id = chartId;
                canvas.classList.add("chartarea");

                // css for styling
                canvas.style.height = '100px';
                // canvas.style.width = '200px';

                // document.body.appendChild(canvas);
                const chaDiv = document.getElementById('chartContainer');
                chaDiv.appendChild(canvas);
                var context = document.getElementById(chartId).getContext('2d');
                new Chart(context, {
                    type: 'line',
                    data: {
                        // labels will show the x axis values and hover value
                        labels: [`${data.component}`, 'Data 2', 'Data 3', 'Data 4', 'Data 5', 'Data 6', 'Data 7', 'Data 8', 'More1'],
                        datasets: [{
                        label: `No. ${data.id}`,
                            label: `Component ${data.component}`,
                            // this data is y axis values
                            // this data work as bar position as well.
                            data: [
                                data.data1,
                                data.data2,
                                data.data3,
                                data.data4,
                                data.data5,
                                data.data6,
                                data.data7,
                                data.data8,
                            ],
                            fill: false,
                            borderColor: '#01baef',
                            tension: 0.1,
                            borderWidth: 3
                        }]
                    },

                    options: {
                        // maintainAspectRatio: false,
                        title: {
                            display: true,
                            text: i+1,
                        },
                        tooltips: {
                            mode: 'index',
                            intersect: false
                        },
                        responsive: true,
                        scales: {
                            xAxes: [{
                                stacked: true,

                            }],
                            yAxes: [{
                                stacked: true
                            }]
                        }
                    }
                });
            }
        });

i tried to change it to this:

const tableData = JSON.parse('{{ data|tojson }}')
        console.log("tableData", tableData);
        document.addEventListener('DOMContentLoaded', function () {
            for (let i = 0; i < tableData.length; i++) {
                const data = tableData[i]
                var canvas = document.createElement('canvas'),
                    chartId = 'chart' + i;
                canvas.id = chartId;
                canvas.classList.add("chartarea");

                // css for styling
                canvas.style.height = '100px';
                // canvas.style.width = '200px';

                // document.body.appendChild(canvas);
                const chaDiv = document.getElementById('chartContainer');
                chaDiv.appendChild(canvas);
                var context = document.getElementById(chartId).getContext('2d');
                new Chart(context, {
                    type: 'line',
                    data: {
                        // labels will show the x axis values and hover value
                        labels: {data.component[i]},
                        datasets: [{
                        label: `No. ${data.id}`,
                            label: `Component ${data.component}`,
                            // this data is y axis values
                            // this data work as bar position as well.
                            data: data.data[i]
                            ,
                            fill: false,
                            borderColor: '#01baef',
                            tension: 0.1,
                            borderWidth: 3
                        }]
                    },

                    options: {
                        // maintainAspectRatio: false,
                        title: {
                            display: true,
                            text: i+1,
                        },
                        tooltips: {
                            mode: 'index',
                            intersect: false
                        },
                        responsive: true,
                        scales: {
                            xAxes: [{
                                stacked: true,

                            }],
                            yAxes: [{
                                stacked: true
                            }]
                        }
                    }
                });
            }
        });
    </script>

i tried to do this (like i saw here someone that had a similar problem)

const tableData = JSON.parse('{{ data|tojson }}')
        console.log("tableData", tableData);
        document.addEventListener('DOMContentLoaded', function () {
            for (let i = 0; i < tableData.length; i++) {
                const data = tableData[i]
                var canvas = document.createElement('canvas'),
                    chartId = 'chart' + i;
                canvas.id = chartId;
                canvas.classList.add("chartarea");

                // css for styling
                canvas.style.height = '100px';
                // canvas.style.width = '200px';

                // document.body.appendChild(canvas);
                const chaDiv = document.getElementById('chartContainer');
                chaDiv.appendChild(canvas);
                var context = document.getElementById(chartId).getContext('2d');
                new Chart(context, {
                    type: 'line',
                    data: {
                        // labels will show the x axis values and hover value
                        labels: {data.component[i]},
                        datasets: [{
                        label: `No. ${data.id}`,
                            label: `Component ${data.component}`,
                            // this data is y axis values
                            // this data work as bar position as well.
                            data: data.data[i]
                            ,
                            fill: false,
                            borderColor: '#01baef',
                            tension: 0.1,
                            borderWidth: 3
                        }]
                    },

                    options: {
                        // maintainAspectRatio: false,
                        title: {
                            display: true,
                            text: i+1,
                        },
                        tooltips: {
                            mode: 'index',
                            intersect: false
                        },
                        responsive: true,
                        scales: {
                            xAxes: [{
                                stacked: true,

                            }],
                            yAxes: [{
                                stacked: true
                            }]
                        }
                    }
                });
            }
        });
    </script>

but no success. the chart don't show anything. and i'm not familiar with chart.js just learning with a code i already have and need to be change.
thank you


问:
Python: calling a private method within static method
What is the correct way and best practice to call a private method from within a static method in python 3.x? See example below:

```<code>class Class_A:
    def __init__(self, some_attribute):
        self.some_attr = some_attribute

    def __private_method(arg_a):
        print(arg)

    @staticmethod
    def some_static_method(arg_a):
        __private_method(arg_a) # "__private_method" is not defined
</code>```

Now, if I instantiate a Class_A object and call the static method:

```<code>my_instance = Class_A("John Doe")
my_instance.some_static_method("Not his real name")
</code>```

I get a NameError: NameError: name '__private_method' is not defined

Body:
What is the correct way and best practice to call a private method from within a static method in python 3.x? See example below:

class Class_A:
    def __init__(self, some_attribute):
        self.some_attr = some_attribute

    def __private_method(arg_a):
        print(arg)

    @staticmethod
    def some_static_method(arg_a):
        __private_method(arg_a) # "__private_method" is not defined

Now, if I instantiate a Class_A object and call the static method:

my_instance = Class_A("John Doe")
my_instance.some_static_method("Not his real name")

I get a NameError: NameError: name '__private_method' is not defined


问:
React Native UI Kitten with expo - web page is blank
I am a new user of ui-kitten for react-native.
I managed to get it working with the expo on Expo go for Android and iOS.
But it is not working for the web.

import React from 'react';
import * as eva from '@eva-design/eva';
import { ApplicationProvider, Layout, Text } from '@ui-kitten/components';

const HomeScreen = () => (
    <Layout style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <Text category='h1'>HOME Alone</Text>
    </Layout>
);

export default function App() {
    return (
        <ApplicationProvider {...eva} theme={eva.light}>
            <HomeScreen />
        </ApplicationProvider>
    );
}
```
<p>I also have the <code>index.js</code> file as per the expo instructions.</p>
<pre class="lang-js prettyprint-override"><code>import { Platform } from 'react-native';
import {registerRootComponent} from 'expo';
import App from 'App';

if (Platform.OS === 'web') {
  registerRootComponent(App);
}
</code>```

I get a blank webpage on http://localhost:19006/

NOTE: When I replace ui-kitten with normal react-native components, it works fine on the web.

What am I going wrong?

Body:
I am a new user of ui-kitten for react-native.
I managed to get it working with the expo on Expo go for Android and iOS.
But it is not working for the web.

import React from 'react';
import * as eva from '@eva-design/eva';
import { ApplicationProvider, Layout, Text } from '@ui-kitten/components';

const HomeScreen = () => (
    <Layout style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <Text category='h1'>HOME Alone</Text>
    </Layout>
);

export default function App() {
    return (
        <ApplicationProvider {...eva} theme={eva.light}>
            <HomeScreen />
        </ApplicationProvider>
    );
}

I also have the index.js file as per the expo instructions.

import { Platform } from 'react-native';
import {registerRootComponent} from 'expo';
import App from 'App';

if (Platform.OS === 'web') {
  registerRootComponent(App);
}

I get a blank webpage on http://localhost:19006/

NOTE: When I replace ui-kitten with normal react-native components, it works fine on the web.

What am I going wrong?