问:
Unexpected end of input error in my html code
I was making a mini project out of html and jquery (btw i am still a student so my knowledge in programming is not so much).

While i was programming I got an error saying unexpected end of input I thought it was a syntax error so I checked my code but when Ichecked it there was no error i was hoping you guys can help me fix this. I have put my code below (jquery an html respectively)
Thank you!

```<code>var data = "";
const arr = [];
$(document).ready(function() {
    $("button").click(function(){
        var subjects = [];
        $.each($("input[name='subject']:checked"), function(){
        subjects.push($(this).val());

        var skills = [];
        $.each($("input[name='skill']:checked"), function(){
        skills.push($(this).val());
   });
        //alert("My chosen subjects are: " + subjects.join(", "));
        //alert("My chosen skills are: " + skills.join(", "));
        var email = $("#email").val();
        var password = $("#password").val();
        var dob = $("#dob").val();
        var gender = $("#gender").val();
        var address = $("#address").val();
        var city = $("#city").val();
        //var subjects = [];
        console.log("This is the email:", email);
        console.log("This is the password:", password);
        console.log("This is the date of birth:", dob);
        console.log("This is the gender:",  gender);
        console.log("This is the address:",  address);
        console.log("This/These is/are the subject/s:",  subjects)
        console.log("This/There is/are the subject/s:", skills)
        data = "Email: " + email + ", " + "Password: " + password + ", " + "Date Of Birth: " + dob + ", " + "Gender: " + gender + ", " + "Address: " + address + ", " + "City: " + city + ", " + "Subjects: " + subjects.join(", ") + ", " + "Skills: " + skills.join(", ");
        arr.push(data);
        console.log(arr);
    });
});

 <form>
    <label>Email:</label><br>
      <input id="email" type="email" required><br>
      <label>Date Of Birth:</label><br>
      <input id="dob" type="date" required><br>
      <label>Gender:</label><br>
      <select id="gender" required>
        <option>Male</option>
        <option>Female</option>
        <option>other</option>
      </select><br>
      <label>Address:</label><br/>
      <input id="address" type="text" required><br/>
      <label>City:</label><br>
      <input id="city" type="text" required><br>
    <label>Subject/s</label><br>
    <label><input type="checkbox" value="Math" name="subject"> Math</label>
    <label><input type="checkbox" value="Science" name="subject"> Science</label>
    <label><input type="checkbox" value="SST" name="subject"> SST</label>
    <label><input type="checkbox" value="English" name="subject"> English</label>
    <label><input type="checkbox" value="Computer Science" name="subject"> Computer Science</label>
    <label><input type="checkbox" value="Kannada" name="subject"> Kannada</label><br>
    <label><input type="checkbox" value="Hindi" name="subject"> Hindi</label><br>
    <label>Skill/s</label><BR>
    <label><input type="checkbox" value="Math" name="skill"> Drawing/Doodling</label>
    <label><input type="checkbox" value="Science" name="skill"> Instrument Playing</label>
    <label><input type="checkbox" value="SST" name="skill"> Dance and/or Music</label>
    <label><input type="checkbox" value="English" name="skill"> sports (any)</label>
    <label><input type="checkbox" value="Computer Science" name="skill"> Computer Science</label>
    <label><input type="checkbox" value="Kannada" name="skill"> Kannada</label>
    <label><input type="checkbox" value="Hindi" name="skill"> Hindi</label><br>
    <label>Password:</label><br>
    <input type="password" id="password"><br><br>
    <button type="button" value="submit">Submit</button>
</form>
</code>```

答:
You're missing }); at the end. Use an IDE such as Visual Studio Code to help you spot syntax issues.

var data = "";
const arr = [];
$(document).ready(function() {
  $("button").click(function() {
    var subjects = [];
    $.each($("input[name='subject']:checked"), function() {
      subjects.push($(this).val());

      var skills = [];
      $.each($("input[name='skill']:checked"), function() {
        skills.push($(this).val());
      });
      //alert("My chosen subjects are: " + subjects.join(", "));
      //alert("My chosen skills are: " + skills.join(", "));
      var email = $("#email").val();
      var password = $("#password").val();
      var dob = $("#dob").val();
      var gender = $("#gender").val();
      var address = $("#address").val();
      var city = $("#city").val();
      //var subjects = [];
      console.log("This is the email:", email);
      console.log("This is the password:", password);
      console.log("This is the date of birth:", dob);
      console.log("This is the gender:", gender);
      console.log("This is the address:", address);
      console.log("This/These is/are the subject/s:", subjects)
      console.log("This/There is/are the subject/s:", skills)
      data = "Email: " + email + ", " + "Password: " + password + ", " + "Date Of Birth: " + dob + ", " + "Gender: " + gender + ", " + "Address: " + address + ", " + "City: " + city + ", " + "Subjects: " + subjects.join(", ") + ", " + "Skills: " + skills.join(", ");
      arr.push(data);
      console.log(arr);
    });
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form>
  <label>Email:</label><br>
  <input id="email" type="email" required><br>
  <label>Date Of Birth:</label><br>
  <input id="dob" type="date" required><br>
  <label>Gender:</label><br>
  <select id="gender" required>
    <option>Male</option>
    <option>Female</option>
    <option>other</option>
  </select><br>
  <label>Address:</label><br/>
  <input id="address" type="text" required><br/>
  <label>City:</label><br>
  <input id="city" type="text" required><br>
  <label>Subject/s</label><br>
  <label><input type="checkbox" value="Math" name="subject"> Math</label>
  <label><input type="checkbox" value="Science" name="subject"> Science</label>
  <label><input type="checkbox" value="SST" name="subject"> SST</label>
  <label><input type="checkbox" value="English" name="subject"> English</label>
  <label><input type="checkbox" value="Computer Science" name="subject"> Computer Science</label>
  <label><input type="checkbox" value="Kannada" name="subject"> Kannada</label><br>
  <label><input type="checkbox" value="Hindi" name="subject"> Hindi</label><br>
  <label>Skill/s</label>
  <BR>
  <label><input type="checkbox" value="Math" name="skill"> Drawing/Doodling</label>
  <label><input type="checkbox" value="Science" name="skill"> Instrument Playing</label>
  <label><input type="checkbox" value="SST" name="skill"> Dance and/or Music</label>
  <label><input type="checkbox" value="English" name="skill"> sports (any)</label>
  <label><input type="checkbox" value="Computer Science" name="skill"> Computer Science</label>
  <label><input type="checkbox" value="Kannada" name="skill"> Kannada</label>
  <label><input type="checkbox" value="Hindi" name="skill"> Hindi</label><br>
  <label>Password:</label><br>
  <input type="password" id="password"><br><br>
  <button type="button" value="submit">Submit</button>
</form></code>```

Body:
I was making a mini project out of html and jquery (btw i am still a student so my knowledge in programming is not so much).

While i was programming I got an error saying unexpected end of input I thought it was a syntax error so I checked my code but when Ichecked it there was no error i was hoping you guys can help me fix this. I have put my code below (jquery an html respectively)
Thank you!

var data = "";
const arr = [];
$(document).ready(function() {
    $("button").click(function(){
        var subjects = [];
        $.each($("input[name='subject']:checked"), function(){
        subjects.push($(this).val());

        var skills = [];
        $.each($("input[name='skill']:checked"), function(){
        skills.push($(this).val());
   });
        //alert("My chosen subjects are: " + subjects.join(", "));
        //alert("My chosen skills are: " + skills.join(", "));
        var email = $("#email").val();
        var password = $("#password").val();
        var dob = $("#dob").val();
        var gender = $("#gender").val();
        var address = $("#address").val();
        var city = $("#city").val();
        //var subjects = [];
        console.log("This is the email:", email);
        console.log("This is the password:", password);
        console.log("This is the date of birth:", dob);
        console.log("This is the gender:",  gender);
        console.log("This is the address:",  address);
        console.log("This/These is/are the subject/s:",  subjects)
        console.log("This/There is/are the subject/s:", skills)
        data = "Email: " + email + ", " + "Password: " + password + ", " + "Date Of Birth: " + dob + ", " + "Gender: " + gender + ", " + "Address: " + address + ", " + "City: " + city + ", " + "Subjects: " + subjects.join(", ") + ", " + "Skills: " + skills.join(", ");
        arr.push(data);
        console.log(arr);
    });
});

 <form>
    Email:

      <input id="email" type="email" required>

      Date Of Birth:

      <input id="dob" type="date" required>

      Gender:

      <select id="gender" required>
        <option>Male</option>
        <option>Female</option>
        <option>other</option>
      </select>

      Address:

      <input id="address" type="text" required>

      City:

      <input id="city" type="text" required>

    Subject/s

    <input type="checkbox" value="Math" name="subject"> Math
    <input type="checkbox" value="Science" name="subject"> Science
    <input type="checkbox" value="SST" name="subject"> SST
    <input type="checkbox" value="English" name="subject"> English
    <input type="checkbox" value="Computer Science" name="subject"> Computer Science
    <input type="checkbox" value="Kannada" name="subject"> Kannada

    <input type="checkbox" value="Hindi" name="subject"> Hindi

    Skill/s

    <input type="checkbox" value="Math" name="skill"> Drawing/Doodling
    <input type="checkbox" value="Science" name="skill"> Instrument Playing
    <input type="checkbox" value="SST" name="skill"> Dance and/or Music
    <input type="checkbox" value="English" name="skill"> sports (any)
    <input type="checkbox" value="Computer Science" name="skill"> Computer Science
    <input type="checkbox" value="Kannada" name="skill"> Kannada
    <input type="checkbox" value="Hindi" name="skill"> Hindi

    Password:

    <input type="password" id="password">

    <button type="button" value="submit">Submit</button>
</form>

Body:
You're missing }); at the end. Use an IDE such as Visual Studio Code to help you spot syntax issues.

var data = "";
const arr = [];
$(document).ready(function() {
  $("button").click(function() {
    var subjects = [];
    $.each($("input[name='subject']:checked"), function() {
      subjects.push($(this).val());

      var skills = [];
      $.each($("input[name='skill']:checked"), function() {
        skills.push($(this).val());
      });
      //alert("My chosen subjects are: " + subjects.join(", "));
      //alert("My chosen skills are: " + skills.join(", "));
      var email = $("#email").val();
      var password = $("#password").val();
      var dob = $("#dob").val();
      var gender = $("#gender").val();
      var address = $("#address").val();
      var city = $("#city").val();
      //var subjects = [];
      console.log("This is the email:", email);
      console.log("This is the password:", password);
      console.log("This is the date of birth:", dob);
      console.log("This is the gender:", gender);
      console.log("This is the address:", address);
      console.log("This/These is/are the subject/s:", subjects)
      console.log("This/There is/are the subject/s:", skills)
      data = "Email: " + email + ", " + "Password: " + password + ", " + "Date Of Birth: " + dob + ", " + "Gender: " + gender + ", " + "Address: " + address + ", " + "City: " + city + ", " + "Subjects: " + subjects.join(", ") + ", " + "Skills: " + skills.join(", ");
      arr.push(data);
      console.log(arr);
    });
  });
});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form>
  <label>Email:</label><br>
  <input id="email" type="email" required><br>
  <label>Date Of Birth:</label><br>
  <input id="dob" type="date" required><br>
  <label>Gender:</label><br>
  <select id="gender" required>
    <option>Male</option>
    <option>Female</option>
    <option>other</option>
  </select><br>
  <label>Address:</label><br/>
  <input id="address" type="text" required><br/>
  <label>City:</label><br>
  <input id="city" type="text" required><br>
  <label>Subject/s</label><br>
  <label><input type="checkbox" value="Math" name="subject"> Math</label>
  <label><input type="checkbox" value="Science" name="subject"> Science</label>
  <label><input type="checkbox" value="SST" name="subject"> SST</label>
  <label><input type="checkbox" value="English" name="subject"> English</label>
  <label><input type="checkbox" value="Computer Science" name="subject"> Computer Science</label>
  <label><input type="checkbox" value="Kannada" name="subject"> Kannada</label><br>
  <label><input type="checkbox" value="Hindi" name="subject"> Hindi</label><br>
  <label>Skill/s</label>
  <BR>
  <label><input type="checkbox" value="Math" name="skill"> Drawing/Doodling</label>
  <label><input type="checkbox" value="Science" name="skill"> Instrument Playing</label>
  <label><input type="checkbox" value="SST" name="skill"> Dance and/or Music</label>
  <label><input type="checkbox" value="English" name="skill"> sports (any)</label>
  <label><input type="checkbox" value="Computer Science" name="skill"> Computer Science</label>
  <label><input type="checkbox" value="Kannada" name="skill"> Kannada</label>
  <label><input type="checkbox" value="Hindi" name="skill"> Hindi</label><br>
  <label>Password:</label><br>
  <input type="password" id="password"><br><br>
  <button type="button" value="submit">Submit</button>
</form>


来源: stackexchange

问:
Python/Json:Expecting property name enclosed in double quotes
I've been trying to figure out a good way to load JSON objects in Python.
I send this json data:

```<code>{'http://example.org/about': {'http://purl.org/dc/terms/title': [{'type': 'literal', 'value': "Anna's Homepage"}]}}
</code>```

to the backend where it will be received as a string then I used json.loads(data) to parse it.

But each time I got the same exception :

```<code>ValueError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
</code>```

I googled it but nothing seems to work besides this solution json.loads(json.dumps(data)) which personally seems for me not that efficient since it accept any kind of data even the ones that are not in json format.

Any suggestions will be much appreciated.

答: I would highly recommend usage of json prettify tools like JSON Prettifier for the same as it helped me fix the error of a trailing comma that I had in the JSON file, which yielded the same error.</p>

ContentLicense: CC BY-SA 3.0

Body:
I've been trying to figure out a good way to load JSON objects in Python.
I send this json data:

{'http://example.org/about': {'http://purl.org/dc/terms/title': [{'type': 'literal', 'value': "Anna's Homepage"}]}}

to the backend where it will be received as a string then I used json.loads(data) to parse it.

But each time I got the same exception :

ValueError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

I googled it but nothing seems to work besides this solution json.loads(json.dumps(data)) which personally seems for me not that efficient since it accept any kind of data even the ones that are not in json format.

Any suggestions will be much appreciated.

ContentLicense: CC BY-SA 4.0


问:
How to return all even numbers inside an array inside of a hash?
I've been given the following data structure:

```<code>users = {
  "Jonathan" => {
    :twitter => "tronathan",
    :favorite_numbers => [12, 42, 75],
  },
  "Erik" => {
    :twitter => "sferik",
    :favorite_numbers => [8, 12, 24],
  },
  "Anil" => {
    :twitter => "bridgpal",
    :favorite_numbers => [12, 14, 85],
  },
}
</code>```

I need to return all of Anils favourite numbers that are even.
This is what I have so far:

```<code>users["Anil"][:favorite_numbers].each do |evennum|
    if evennum.even?
        puts evennum
    end
end
</code>```

答:
You could do something like this

```<code>anil_favorite_even_numbers = users['Anil'][:favorite_numbers].select(&:even?)
</code>```

This takes for granted that a user Anil exists and the favourite_numbers inside it too and that's an array. Otherwise we need a little bit of extra work.

Body:
I've been given the following data structure:

users = {
  "Jonathan" => {
    :twitter => "tronathan",
    :favorite_numbers => [12, 42, 75],
  },
  "Erik" => {
    :twitter => "sferik",
    :favorite_numbers => [8, 12, 24],
  },
  "Anil" => {
    :twitter => "bridgpal",
    :favorite_numbers => [12, 14, 85],
  },
}

I need to return all of Anils favourite numbers that are even.
This is what I have so far:

users["Anil"][:favorite_numbers].each do |evennum|
    if evennum.even?
        puts evennum
    end
end

Body:
You could do something like this

anil_favorite_even_numbers = users['Anil'][:favorite_numbers].select(&:even?)

This takes for granted that a user Anil exists and the favourite_numbers inside it too and that's an array. Otherwise we need a little bit of extra work.


问:
I can connect an application to 2 databases in Django?
I have a web application in Python django. I need to import users and display data about them from another database, from another existing application. All I need is the user to be able to login and display information about them. What solutions are?</p>

答:
You can set 2 DATABASES in settings.py.

```<code>DATABASES = {
    'default': {
        ...
    },
    'user_data': {
        ...
    }
}
</code>```

Then in one database store User models with authentication and stuff, in another rest information. You can connect information about specific User with a field that is storing id of User from another database.

If you have multiple databases and create a model, you should declare on which db it is going to be stored. If you didn't, it will be in default one (if you have it declared).

```<code>class UserModel(models.Model):
    class Meta:
        db_table = 'default'

class UserDataModel(models.Model):
    class Meta:
        db_table = 'user_data'
</code>```

Body:
You can set 2 DATABASES in settings.py.

DATABASES = {
    'default': {
        ...
    },
    'user_data': {
        ...
    }
}

Then in one database store User models with authentication and stuff, in another rest information. You can connect information about specific User with a field that is storing id of User from another database.

If you have multiple databases and create a model, you should declare on which db it is going to be stored. If you didn't, it will be in default one (if you have it declared).

class UserModel(models.Model):
    class Meta:
        db_table = 'default'

class UserDataModel(models.Model):
    class Meta:
        db_table = 'user_data'


问:
FLUTTER: Overscroll glowing effect from ListView is not showing on android
I have a ListView.separated widget which is not showing the overscroll effect for Android. On iOS I can see the bouncing, but on Android is not showing the glowing effect, and I don't know why.

My purpose is to have the glowing effect for Android.

Here is a piece of my code structure:

```<code>SafeArea(
          child: LayoutBuilder(
            builder: (context, constraints) {
              return Container(
                ...
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    ...
                    ListView.separated(...)

                    ],
                  ],
                ),
              );
            },
          ),

</code>```

I use Flutter 2.8.1 version.

答:
After I took a look on the widget tree, I noticed that I have an widget called NotificationListener<OverscrollIndicatorNotification> where I disallowed glow effect. And it seems that, this setting was applying down to the widget tree.

My solution was to wrap my list in other NotificationListener widget. After doing that, the glowing effect appeared immediately.

Body:
I have a ListView.separated widget which is not showing the overscroll effect for Android. On iOS I can see the bouncing, but on Android is not showing the glowing effect, and I don't know why.

My purpose is to have the glowing effect for Android.

Here is a piece of my code structure:

SafeArea(
          child: LayoutBuilder(
            builder: (context, constraints) {
              return Container(
                ...
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    ...
                    ListView.separated(...)

                    ],
                  ],
                ),
              );
            },
          ),

I use Flutter 2.8.1 version.


问:
Download .zip from shared FolderLink (LuckyCloud) with batch-skript
I have the following problem:

When I run the command below I just get a .zip file which is 9kb and won't open but the original file has 43.9Mb. I've already tried several variants with curl, but all without success.
I have already tried the way for HTML redirect. Unfortunately without success

If it helps, here the shred Link for Download: https://sync.luckycloud.de/d/fb56e4a8239a4c6cac7a/

```<code>curl https://sync.luckycloud.de/d/fb56e4a8239a4c6cac7a/files/?p=%2FValheimServer%20Buddelkiste%20Modpack%20v3.4%20-%20Standart.zip -O -J -L
</code>```

I try the way with PowerShell too, but i get only the same 9kb file :/

```<code># Source file location
$source = 'https://sync.luckycloud.de/d/fb56e4a8239a4c6cac7a/files/?p=%2FValheimServer%20Buddelkiste%20Modpack%20v3.4%20-%20Standart.zip'
# Destination to save the file
$destination = 'C:\Users\Anonymos\Downloads\Test.zip'
#Download the file
Invoke-WebRequest -Uri $source -OutFile $destination
</code>```

答:
I couldn't solve it with curl. However, with the PowerShell command invoke.

```<code>powershell -c "Invoke-WebRequest 'https://sync.luckycloud.de/d/fb56e4a8239a4c6cac7a/files/?p=%%2FValheimServer%%20Buddelkiste%%20Modpack%%20v3.4%20-%%20Standart.zip&dl=1' -OutFile '%FilePath%installdir\Test.zip'"
</code>```

Be sure, that every % is transform to %% in the Link.

"&dl=1" is a specific ending from LuckyCLoud. Other Hoster use sometimes "&download=1"
You need this Link, to get the full file.

Body:
I have the following problem:

When I run the command below I just get a .zip file which is 9kb and won't open but the original file has 43.9Mb. I've already tried several variants with curl, but all without success.
I have already tried the way for HTML redirect. Unfortunately without success

If it helps, here the shred Link for Download: https://sync.luckycloud.de/d/fb56e4a8239a4c6cac7a/

curl https://sync.luckycloud.de/d/fb56e4a8239a4c6cac7a/files/?p=%2FValheimServer%20Buddelkiste%20Modpack%20v3.4%20-%20Standart.zip -O -J -L

I try the way with PowerShell too, but i get only the same 9kb file :/

# Source file location
$source = 'https://sync.luckycloud.de/d/fb56e4a8239a4c6cac7a/files/?p=%2FValheimServer%20Buddelkiste%20Modpack%20v3.4%20-%20Standart.zip'
# Destination to save the file
$destination = 'C:\Users\Anonymos\Downloads\Test.zip'
#Download the file
Invoke-WebRequest -Uri $source -OutFile $destination

Body:
I couldn't solve it with curl. However, with the PowerShell command invoke.

powershell -c "Invoke-WebRequest 'https://sync.luckycloud.de/d/fb56e4a8239a4c6cac7a/files/?p=%%2FValheimServer%%20Buddelkiste%%20Modpack%%20v3.4%20-%%20Standart.zip&dl=1' -OutFile '%FilePath%installdir\Test.zip'"

Be sure, that every % is transform to %% in the Link.

"&dl=1" is a specific ending from LuckyCLoud. Other Hoster use sometimes "&download=1"
You need this Link, to get the full file.


问:
Helm - Kubernetes cluster unreachable: the server has asked for the client to provide credentials
I'm trying to deploy an EKS self managed with Terraform. While I can deploy the cluster with addons, vpc, subnet and all other resources, it always fails at helm:

```<code>Error: Kubernetes cluster unreachable: the server has asked for the client to provide credentials
with module.eks-ssp-kubernetes-addons.module.ingress_nginx[0].helm_release.nginx[0]
on .terraform/modules/eks-ssp-kubernetes-addons/modules/kubernetes-addons/ingress-nginx/main.tf line 19, in resource "helm_release" "nginx":
resource "helm_release" "nginx" {
</code>```

This error repeats for metrics_server, lb_ingress, argocd, but cluster-autoscaler throws:

```<code>Warning: Helm release "cluster-autoscaler" was created but has a failed status.
with module.eks-ssp-kubernetes-addons.module.cluster_autoscaler[0].helm_release.cluster_autoscaler[0]
on .terraform/modules/eks-ssp-kubernetes-addons/modules/kubernetes-addons/cluster-autoscaler/main.tf line 1, in resource "helm_release" "cluster_autoscaler":
resource "helm_release" "cluster_autoscaler" {
</code>```

My main.tf looks like this:

```<code>terraform {

  backend "remote" {}

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 3.66.0"
    }
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = ">= 2.7.1"
    }
    helm = {
      source  = "hashicorp/helm"
      version = ">= 2.4.1"
    }
  }
}

data "aws_eks_cluster" "cluster" {
  name = module.eks-ssp.eks_cluster_id
}

data "aws_eks_cluster_auth" "cluster" {
  name = module.eks-ssp.eks_cluster_id
}

provider "aws" {
  access_key = "xxx"
  secret_key = "xxx"
  region     = "xxx"
  assume_role {
    role_arn = "xxx"
  }
}

provider "kubernetes" {
  host                   = data.aws_eks_cluster.cluster.endpoint
  cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
  token                  = data.aws_eks_cluster_auth.cluster.token
}

provider "helm" {
  kubernetes {
    host                   = data.aws_eks_cluster.cluster.endpoint
    token                  = data.aws_eks_cluster_auth.cluster.token
    cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
  }
}
</code>```

My eks.tf looks like this:

```<code>module "eks-ssp" {
    source = "github.com/aws-samples/aws-eks-accelerator-for-terraform"

    # EKS CLUSTER
    tenant            = "DevOpsLabs2b"
    environment       = "dev-test"
    zone              = ""
    terraform_version = "Terraform v1.1.4"

    # EKS Cluster VPC and Subnet mandatory config
    vpc_id             = "xxx"
    private_subnet_ids = ["xxx","xxx", "xxx", "xxx"]

    # EKS CONTROL PLANE VARIABLES
    create_eks         = true
    kubernetes_version = "1.19"

  # EKS SELF MANAGED NODE GROUPS
    self_managed_node_groups = {
    self_mg = {
      node_group_name        = "DevOpsLabs2b"
      subnet_ids             = ["xxx","xxx", "xxx", "xxx"]
      create_launch_template = true
      launch_template_os     = "bottlerocket"       # amazonlinux2eks  or bottlerocket or windows
      custom_ami_id          = "xxx"
      public_ip              = true                   # Enable only for public subnets
      pre_userdata           = <<-EOT
            yum install -y amazon-ssm-agent \
            systemctl enable amazon-ssm-agent && systemctl start amazon-ssm-agent \
        EOT

      disk_size     = 10
      instance_type = "t2.small"
      desired_size  = 2
      max_size      = 10
      min_size      = 0
      capacity_type = "" # Optional Use this only for SPOT capacity as  capacity_type = "spot"

      k8s_labels = {
        Environment = "dev-test"
        Zone        = ""
        WorkerType  = "SELF_MANAGED_ON_DEMAND"
      }

      additional_tags = {
        ExtraTag    = "t2x-on-demand"
        Name        = "t2x-on-demand"
        subnet_type = "public"
      }
      create_worker_security_group = false # Creates a dedicated sec group for this Node Group
    },
  }
}

    enable_amazon_eks_vpc_cni             = true
        amazon_eks_vpc_cni_config = {
        addon_name               = "vpc-cni"
        addon_version            = "v1.7.5-eksbuild.2"
        service_account          = "aws-node"
        resolve_conflicts        = "OVERWRITE"
        namespace                = "kube-system"
        additional_iam_policies  = []
        service_account_role_arn = ""
        tags                     = {}
    }
    enable_amazon_eks_kube_proxy          = true
        amazon_eks_kube_proxy_config = {
        addon_name               = "kube-proxy"
        addon_version            = "v1.19.8-eksbuild.1"
        service_account          = "kube-proxy"
        resolve_conflicts        = "OVERWRITE"
        namespace                = "kube-system"
        additional_iam_policies  = []
        service_account_role_arn = ""
        tags                     = {}
    }

    #K8s Add-ons
    enable_aws_load_balancer_controller   = true
    enable_metrics_server                 = true
    enable_cluster_autoscaler             = true
    enable_aws_for_fluentbit              = true
    enable_argocd                         = true
    enable_ingress_nginx                  = true

    depends_on = [module.eks-ssp.self_managed_node_groups]
}
</code>```

答:
OP has confirmed in the comment that the problem was resolved:

Of course. I think I found the issue. Doing "kubectl get svc" throws: "An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:iam::xxx:user/terraform_deploy is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::xxx:user/terraform_deploy"

Solved it by using my actual role, that's crazy. No idea why it was calling itself.

For similar problem look also this issue.

Body:
I'm trying to deploy an EKS self managed with Terraform. While I can deploy the cluster with addons, vpc, subnet and all other resources, it always fails at helm:

Error: Kubernetes cluster unreachable: the server has asked for the client to provide credentials
with module.eks-ssp-kubernetes-addons.module.ingress_nginx[0].helm_release.nginx[0]
on .terraform/modules/eks-ssp-kubernetes-addons/modules/kubernetes-addons/ingress-nginx/main.tf line 19, in resource "helm_release" "nginx":
resource "helm_release" "nginx" {

This error repeats for metrics_server, lb_ingress, argocd, but cluster-autoscaler throws:

Warning: Helm release "cluster-autoscaler" was created but has a failed status.
with module.eks-ssp-kubernetes-addons.module.cluster_autoscaler[0].helm_release.cluster_autoscaler[0]
on .terraform/modules/eks-ssp-kubernetes-addons/modules/kubernetes-addons/cluster-autoscaler/main.tf line 1, in resource "helm_release" "cluster_autoscaler":
resource "helm_release" "cluster_autoscaler" {

My main.tf looks like this:

terraform {

  backend "remote" {}

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 3.66.0"
    }
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = ">= 2.7.1"
    }
    helm = {
      source  = "hashicorp/helm"
      version = ">= 2.4.1"
    }
  }
}

data "aws_eks_cluster" "cluster" {
  name = module.eks-ssp.eks_cluster_id
}

data "aws_eks_cluster_auth" "cluster" {
  name = module.eks-ssp.eks_cluster_id
}

provider "aws" {
  access_key = "xxx"
  secret_key = "xxx"
  region     = "xxx"
  assume_role {
    role_arn = "xxx"
  }
}

provider "kubernetes" {
  host                   = data.aws_eks_cluster.cluster.endpoint
  cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
  token                  = data.aws_eks_cluster_auth.cluster.token
}

provider "helm" {
  kubernetes {
    host                   = data.aws_eks_cluster.cluster.endpoint
    token                  = data.aws_eks_cluster_auth.cluster.token
    cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
  }
}

My eks.tf looks like this:

module "eks-ssp" {
    source = "github.com/aws-samples/aws-eks-accelerator-for-terraform"

    # EKS CLUSTER
    tenant            = "DevOpsLabs2b"
    environment       = "dev-test"
    zone              = ""
    terraform_version = "Terraform v1.1.4"

    # EKS Cluster VPC and Subnet mandatory config
    vpc_id             = "xxx"
    private_subnet_ids = ["xxx","xxx", "xxx", "xxx"]

    # EKS CONTROL PLANE VARIABLES
    create_eks         = true
    kubernetes_version = "1.19"

  # EKS SELF MANAGED NODE GROUPS
    self_managed_node_groups = {
    self_mg = {
      node_group_name        = "DevOpsLabs2b"
      subnet_ids             = ["xxx","xxx", "xxx", "xxx"]
      create_launch_template = true
      launch_template_os     = "bottlerocket"       # amazonlinux2eks  or bottlerocket or windows
      custom_ami_id          = "xxx"
      public_ip              = true                   # Enable only for public subnets
      pre_userdata           = <<-EOT
            yum install -y amazon-ssm-agent \
            systemctl enable amazon-ssm-agent && systemctl start amazon-ssm-agent \
        EOT

      disk_size     = 10
      instance_type = "t2.small"
      desired_size  = 2
      max_size      = 10
      min_size      = 0
      capacity_type = "" # Optional Use this only for SPOT capacity as  capacity_type = "spot"

      k8s_labels = {
        Environment = "dev-test"
        Zone        = ""
        WorkerType  = "SELF_MANAGED_ON_DEMAND"
      }

      additional_tags = {
        ExtraTag    = "t2x-on-demand"
        Name        = "t2x-on-demand"
        subnet_type = "public"
      }
      create_worker_security_group = false # Creates a dedicated sec group for this Node Group
    },
  }
}

    enable_amazon_eks_vpc_cni             = true
        amazon_eks_vpc_cni_config = {
        addon_name               = "vpc-cni"
        addon_version            = "v1.7.5-eksbuild.2"
        service_account          = "aws-node"
        resolve_conflicts        = "OVERWRITE"
        namespace                = "kube-system"
        additional_iam_policies  = []
        service_account_role_arn = ""
        tags                     = {}
    }
    enable_amazon_eks_kube_proxy          = true
        amazon_eks_kube_proxy_config = {
        addon_name               = "kube-proxy"
        addon_version            = "v1.19.8-eksbuild.1"
        service_account          = "kube-proxy"
        resolve_conflicts        = "OVERWRITE"
        namespace                = "kube-system"
        additional_iam_policies  = []
        service_account_role_arn = ""
        tags                     = {}
    }

    #K8s Add-ons
    enable_aws_load_balancer_controller   = true
    enable_metrics_server                 = true
    enable_cluster_autoscaler             = true
    enable_aws_for_fluentbit              = true
    enable_argocd                         = true
    enable_ingress_nginx                  = true

    depends_on = [module.eks-ssp.self_managed_node_groups]
}


问:
CSS auto hyphens turn into question-mark boxes in Chrome
I use some automatic hyphenation with CSS on my website:

```<code>article > p,
article > li {
  -o-hyphens: auto;
  -o-hyphenate-limit-before: 3;
  -o-hyphenate-limit-after: 3;
  -o-hyphenate-limit-chars: 6 3 3;
  -o-hyphenate-limit-lines: 2;
  -o-hyphenate-limit-last: always;
  -o-hyphenate-limit-zone: 8%;

  -webkit-hyphens: auto;
  -webkit-hyphenate-limit-before: 3;
  -webkit-hyphenate-limit-after: 3;
  -webkit-hyphenate-limit-chars: 6 3 3;
  -webkit-hyphenate-limit-lines: 2;
  -webkit-hyphenate-limit-last: always;
  -webkit-hyphenate-limit-zone: 8%;

  -moz-hyphens: auto;
  -moz-hyphenate-limit-chars: 6 3 3;
  -moz-hyphenate-limit-lines: 2;
  -moz-hyphenate-limit-last: always;
  -moz-hyphenate-limit-zone: 8%;

  -ms-hyphens: auto;
  -ms-hyphenate-limit-chars: 6 3 3;
  -ms-hyphenate-limit-lines: 2;
  -ms-hyphenate-limit-last: always;
  -ms-hyphenate-limit-zone: 8%;

  hyphens: auto;
  hyphenate-limit-before: 3;
  hyphenate-limit-after: 3;
  hyphenate-limit-chars: 6 3 3;
  hyphenate-limit-lines: 2;
  hyphenate-limit-last: always;
  hyphenate-limit-zone: 8%;
}
</code>```

This works fine in Safari and Firefox:

It does not work fine in Chrome and Opera:

I use Gatsby JS.

UTF-8 is set correctly.

HTML example:

```<code><html lang="no" data-react-helmet="lang">
<head>
   <meta charset="utf-8">
   <meta http-equiv="x-ua-compatible" content="ie=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

   <meta name="generator" content="Gatsby 4.4.0">

   <noscript></noscript>

   <link rel="sitemap" type="application/xml" href="/sitemap/sitemap-index.xml">

   <link rel="icon" href="/favicon-32x32.png?v=429f78c1f3dc5d93dc42e43688e99546" type="image/png">
   <link rel="manifest" href="/manifest.webmanifest" crossorigin="anonymous">
   <link rel="apple-touch-icon" sizes="48x48" href="/icons/icon-48x48.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="72x72" href="/icons/icon-72x72.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="96x96" href="/icons/icon-96x96.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="144x144" href="/icons/icon-144x144.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="192x192" href="/icons/icon-192x192.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="256x256" href="/icons/icon-256x256.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="384x384" href="/icons/icon-384x384.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="512x512" href="/icons/icon-512x512.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <title>Somme blir meir liberale med åra, men for Paal Kloster (SV) har utviklinga vore motsett • Magnus Kolstad</title>
   <meta data-react-helmet="true" property="og:type" content="website">
   <meta data-react-helmet="true" name="twitter:card" content="summary">
   <meta data-react-helmet="true" name="twitter:creator" content="KolstadMagnus">
   <link as="script" rel="preload" href="/webpack-runtime-95b88ae9533d96786098.js">
   <link as="script" rel="preload" href="/framework-e413e527015be9a1bdfd.js">
   <link as="script" rel="preload" href="/app-b1e7242108012da03ecd.js">
   <link as="script" rel="preload" href="/commons-8da364920b56025cdfc9.js">
   <link as="script" rel="preload" href="/component---src-pages-index-js-5118d4ef2ab79253efe6.js">
   <link as="fetch" rel="preload" href="/page-data/index/page-data.json" crossorigin="anonymous">
   <link as="fetch" rel="preload" href="/page-data/sq/d/2774968152.json" crossorigin="anonymous">
   <link as="fetch" rel="preload" href="/page-data/app-data.json" crossorigin="anonymous">
   <meta name="description" content="58 år på jorda har lært Paal Kloster å forstå folk og komplekse samanhengar. Det har gjeve han ein trong til å stå opp for dei undertrykte i samfunnet." data-react-helmet="true">
   <meta property="og:title" content="Somme blir meir liberale med åra, men for Paal Kloster (SV) har utviklinga vore motsett" data-react-helmet="true">
   <meta property="og:description" content="58 år på jorda har lært Paal Kloster å forstå folk og komplekse samanhengar. Det har gjeve han ein trong til å stå opp for dei undertrykte i samfunnet." data-react-helmet="true">
   <meta name="twitter:title" content="Somme blir meir liberale med åra, men for Paal Kloster (SV) har utviklinga vore motsett" data-react-helmet="true">
   <meta name="twitter:description" content="58 år på jorda har lært Paal Kloster å forstå folk og komplekse samanhengar. Det har gjeve han ein trong til å stå opp for dei undertrykte i samfunnet." data-react-helmet="true">
</head>
</code>```

I researched and found people with similar problems. Yet I didn't find anyone with this problem only in Chromium browsers.

I know CSS hyphenation works better in Safari and Firefox in general—the above two images also demonstrate how Safari understands more of the CSS—but I've never encountered this before.

What's wrong here? How do I fix this? And why does this only happen in Chromium browsers?

答: This seems to be a bug with Chromium and macOS—not broken code from my part.</p>

Body:
I use some automatic hyphenation with CSS on my website:

article > p,
article > li {
  -o-hyphens: auto;
  -o-hyphenate-limit-before: 3;
  -o-hyphenate-limit-after: 3;
  -o-hyphenate-limit-chars: 6 3 3;
  -o-hyphenate-limit-lines: 2;
  -o-hyphenate-limit-last: always;
  -o-hyphenate-limit-zone: 8%;

  -webkit-hyphens: auto;
  -webkit-hyphenate-limit-before: 3;
  -webkit-hyphenate-limit-after: 3;
  -webkit-hyphenate-limit-chars: 6 3 3;
  -webkit-hyphenate-limit-lines: 2;
  -webkit-hyphenate-limit-last: always;
  -webkit-hyphenate-limit-zone: 8%;

  -moz-hyphens: auto;
  -moz-hyphenate-limit-chars: 6 3 3;
  -moz-hyphenate-limit-lines: 2;
  -moz-hyphenate-limit-last: always;
  -moz-hyphenate-limit-zone: 8%;

  -ms-hyphens: auto;
  -ms-hyphenate-limit-chars: 6 3 3;
  -ms-hyphenate-limit-lines: 2;
  -ms-hyphenate-limit-last: always;
  -ms-hyphenate-limit-zone: 8%;

  hyphens: auto;
  hyphenate-limit-before: 3;
  hyphenate-limit-after: 3;
  hyphenate-limit-chars: 6 3 3;
  hyphenate-limit-lines: 2;
  hyphenate-limit-last: always;
  hyphenate-limit-zone: 8%;
}

This works fine in Safari and Firefox:

It does not work fine in Chrome and Opera:

I use Gatsby JS.

UTF-8 is set correctly.

HTML example:

   <meta charset="utf-8">
   <meta http-equiv="x-ua-compatible" content="ie=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

   <meta name="generator" content="Gatsby 4.4.0">

   <link rel="sitemap" type="application/xml" href="/sitemap/sitemap-index.xml">

   <link rel="icon" href="/favicon-32x32.png?v=429f78c1f3dc5d93dc42e43688e99546" type="image/png">
   <link rel="manifest" href="/manifest.webmanifest" crossorigin="anonymous">
   <link rel="apple-touch-icon" sizes="48x48" href="/icons/icon-48x48.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="72x72" href="/icons/icon-72x72.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="96x96" href="/icons/icon-96x96.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="144x144" href="/icons/icon-144x144.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="192x192" href="/icons/icon-192x192.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="256x256" href="/icons/icon-256x256.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="384x384" href="/icons/icon-384x384.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <link rel="apple-touch-icon" sizes="512x512" href="/icons/icon-512x512.png?v=429f78c1f3dc5d93dc42e43688e99546">
   <title>Somme blir meir liberale med åra, men for Paal Kloster (SV) har utviklinga vore motsett • Magnus Kolstad</title>
   <meta data-react-helmet="true" property="og:type" content="website">
   <meta data-react-helmet="true" name="twitter:card" content="summary">
   <meta data-react-helmet="true" name="twitter:creator" content="KolstadMagnus">
   <link as="script" rel="preload" href="/webpack-runtime-95b88ae9533d96786098.js">
   <link as="script" rel="preload" href="/framework-e413e527015be9a1bdfd.js">
   <link as="script" rel="preload" href="/app-b1e7242108012da03ecd.js">
   <link as="script" rel="preload" href="/commons-8da364920b56025cdfc9.js">
   <link as="script" rel="preload" href="/component---src-pages-index-js-5118d4ef2ab79253efe6.js">
   <link as="fetch" rel="preload" href="/page-data/index/page-data.json" crossorigin="anonymous">
   <link as="fetch" rel="preload" href="/page-data/sq/d/2774968152.json" crossorigin="anonymous">
   <link as="fetch" rel="preload" href="/page-data/app-data.json" crossorigin="anonymous">
   <meta name="description" content="58 år på jorda har lært Paal Kloster å forstå folk og komplekse samanhengar. Det har gjeve han ein trong til å stå opp for dei undertrykte i samfunnet." data-react-helmet="true">
   <meta property="og:title" content="Somme blir meir liberale med åra, men for Paal Kloster (SV) har utviklinga vore motsett" data-react-helmet="true">
   <meta property="og:description" content="58 år på jorda har lært Paal Kloster å forstå folk og komplekse samanhengar. Det har gjeve han ein trong til å stå opp for dei undertrykte i samfunnet." data-react-helmet="true">
   <meta name="twitter:title" content="Somme blir meir liberale med åra, men for Paal Kloster (SV) har utviklinga vore motsett" data-react-helmet="true">
   <meta name="twitter:description" content="58 år på jorda har lært Paal Kloster å forstå folk og komplekse samanhengar. Det har gjeve han ein trong til å stå opp for dei undertrykte i samfunnet." data-react-helmet="true">

I researched and found people with similar problems. Yet I didn't find anyone with this problem only in Chromium browsers.

I know CSS hyphenation works better in Safari and Firefox in general—the above two images also demonstrate how Safari understands more of the CSS—but I've never encountered this before.

What's wrong here? How do I fix this? And why does this only happen in Chromium browsers?


答:
Your javascript function had braces in the wrong places and missing closing braces too. Some of the functions within the main click were not closed correctly and the variables declared within them had function scope so their values were not available to the end where you wish to combine all these values.

var data = "";
let arr = [];

$(document).ready(function() {
  var skills = [];
  var subjects = [];

  $("button").click(function() {
    $.each($("input[name='subject']:checked"), function() {
      subjects.push($(this).val());

    });

    $.each($("input[name='skill']:checked"), function() {
      skills.push($(this).val());
    });

    var email = $("#email").val();
    var password = $("#password").val();
    var dob = $("#dob").val();
    var gender = $("#gender").val();
    var address = $("#address").val();
    var city = $("#city").val();

    data = "Email: " + email + ", " + "Password: " + password + ", " + "Date Of Birth: " + dob + ", " + "Gender: " + gender + ", " + "Address: " + address + ", " + "City: " + city + ", " + "Subjects: " + subjects.join(", ") + ", " + "Skills: " + skills.join(", ");
    arr.push(data);
    console.log(data)
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form>
  <label>Email:</label><br>
  <input id="email" type="email" required><br>
  <label>Date Of Birth:</label><br>
  <input id="dob" type="date" required><br>
  <label>Gender:</label><br>
  <select id="gender" required>
    <option>Male</option>
    <option>Female</option>
    <option>other</option>
  </select><br>
  <label>Address:</label><br/>
  <input id="address" type="text" required><br/>
  <label>City:</label><br>
  <input id="city" type="text" required><br>
  <label>Subject/s</label><br>
  <label><input type="checkbox" value="Math" name="subject"> Math</label>
  <label><input type="checkbox" value="Science" name="subject"> Science</label>
  <label><input type="checkbox" value="SST" name="subject"> SST</label>
  <label><input type="checkbox" value="English" name="subject"> English</label>
  <label><input type="checkbox" value="Computer Science" name="subject"> Computer Science</label>
  <label><input type="checkbox" value="Kannada" name="subject"> Kannada</label><br>
  <label><input type="checkbox" value="Hindi" name="subject"> Hindi</label><br>
  <label>Skill/s</label>
  <BR>
  <label><input type="checkbox" value="Math" name="skill"> Drawing/Doodling</label>
  <label><input type="checkbox" value="Science" name="skill"> Instrument Playing</label>
  <label><input type="checkbox" value="SST" name="skill"> Dance and/or Music</label>
  <label><input type="checkbox" value="English" name="skill"> sports (any)</label>
  <label><input type="checkbox" value="Computer Science" name="skill"> Computer Science</label>
  <label><input type="checkbox" value="Kannada" name="skill"> Kannada</label>
  <label><input type="checkbox" value="Hindi" name="skill"> Hindi</label><br>
  <label>Password:</label><br>
  <input type="password" id="password"><br><br>
  <button type="button" value="submit">Submit</button>
</form></code>```

Title: Unexpected end of input error in my html code

Body:
Your javascript function had braces in the wrong places and missing closing braces too. Some of the functions within the main click were not closed correctly and the variables declared within them had function scope so their values were not available to the end where you wish to combine all these values.

var data = "";
let arr = [];

$(document).ready(function() {
  var skills = [];
  var subjects = [];

  $("button").click(function() {
    $.each($("input[name='subject']:checked"), function() {
      subjects.push($(this).val());

    });

    $.each($("input[name='skill']:checked"), function() {
      skills.push($(this).val());
    });

    var email = $("#email").val();
    var password = $("#password").val();
    var dob = $("#dob").val();
    var gender = $("#gender").val();
    var address = $("#address").val();
    var city = $("#city").val();

    data = "Email: " + email + ", " + "Password: " + password + ", " + "Date Of Birth: " + dob + ", " + "Gender: " + gender + ", " + "Address: " + address + ", " + "City: " + city + ", " + "Subjects: " + subjects.join(", ") + ", " + "Skills: " + skills.join(", ");
    arr.push(data);
    console.log(data)
  });
});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form>
  <label>Email:</label><br>
  <input id="email" type="email" required><br>
  <label>Date Of Birth:</label><br>
  <input id="dob" type="date" required><br>
  <label>Gender:</label><br>
  <select id="gender" required>
    <option>Male</option>
    <option>Female</option>
    <option>other</option>
  </select><br>
  <label>Address:</label><br/>
  <input id="address" type="text" required><br/>
  <label>City:</label><br>
  <input id="city" type="text" required><br>
  <label>Subject/s</label><br>
  <label><input type="checkbox" value="Math" name="subject"> Math</label>
  <label><input type="checkbox" value="Science" name="subject"> Science</label>
  <label><input type="checkbox" value="SST" name="subject"> SST</label>
  <label><input type="checkbox" value="English" name="subject"> English</label>
  <label><input type="checkbox" value="Computer Science" name="subject"> Computer Science</label>
  <label><input type="checkbox" value="Kannada" name="subject"> Kannada</label><br>
  <label><input type="checkbox" value="Hindi" name="subject"> Hindi</label><br>
  <label>Skill/s</label>
  <BR>
  <label><input type="checkbox" value="Math" name="skill"> Drawing/Doodling</label>
  <label><input type="checkbox" value="Science" name="skill"> Instrument Playing</label>
  <label><input type="checkbox" value="SST" name="skill"> Dance and/or Music</label>
  <label><input type="checkbox" value="English" name="skill"> sports (any)</label>
  <label><input type="checkbox" value="Computer Science" name="skill"> Computer Science</label>
  <label><input type="checkbox" value="Kannada" name="skill"> Kannada</label>
  <label><input type="checkbox" value="Hindi" name="skill"> Hindi</label><br>
  <label>Password:</label><br>
  <input type="password" id="password"><br><br>
  <button type="button" value="submit">Submit</button>
</form>


问:
how to blur background when modal pop up in react native
How to blur the background only when react native modal popup.my code
<View style={{styles.container }}>

```<code> <SafeAreaView>
  <FlatList />
 </SafeAreaView>
 <Modal
  animationType={'fade'}
  transparent={true}
  onRequestClose={() => { this.setState({ ItemmodalVisible: false }); }}
  visible={this.state.ItemmodalVisible}
 />
</View
</code>```

I want that when modal popup the flatlist should blur

答:
You can try using react-native-blur Following Usage</p>
```<code> <View style={styles.container}>
  <SafeAreaView>
   <FlatList />
   { this.state.ItemmodalVisible && <BlurView
      style={styles.absolute}
      blurType="light"
      blurAmount={10}
      reducedTransparencyFallbackColor="white"
    />}
  </SafeAreaView>
  <Modal
   ....
  />
</View>

const styles = StyleSheet.create({
  absolute: {
    position: "absolute",
    top: 0,
    left: 0,
    bottom: 0,
    right: 0
  }
});
</code>```

Body:
How to blur the background only when react native modal popup.my code
<View style={{styles.container }}>

 <SafeAreaView>
  <FlatList />
 </SafeAreaView>
 <Modal
  animationType={'fade'}
  transparent={true}
  onRequestClose={() => { this.setState({ ItemmodalVisible: false }); }}
  visible={this.state.ItemmodalVisible}
 />
</View

I want that when modal popup the flatlist should blur

Body:
You can try using react-native-blur Following Usage

 <View style={styles.container}>
  <SafeAreaView>
   <FlatList />
   { this.state.ItemmodalVisible && <BlurView
      style={styles.absolute}
      blurType="light"
      blurAmount={10}
      reducedTransparencyFallbackColor="white"
    />}
  </SafeAreaView>
  <Modal
   ....
  />
</View>

const styles = StyleSheet.create({
  absolute: {
    position: "absolute",
    top: 0,
    left: 0,
    bottom: 0,
    right: 0
  }
});


问:
How to connect firebase if I have multiple modules in my android native app
I am working on my Final year project, which is an android native app, using Kotlin. my question is how to connect firebase with all modules do I need to copy the JSON file in every module as well as add all the required dependencies in every module i.e. auth module, resources module, etc. I am confused about this I think this would be really hard to maintain.

Please give me some best suggestions on how to handle multi-module project effectively

答:
No need to add dependency in each and every module, let's just keep all the firebase related handling in separate firebase module and add that module in main app module. From app module you can simply call the implementation in firebase module and make it work.

PS: please make sure the project you are gonna develop has to be multi-module. Not every app needs to develop on multi-module approach IMO.


问:
How to change color in TextButton.icon
I want to have an icon with text, so I used TextButton.icon but I can not change the color of the text or icon!
Please suggest if anyone has a solution
this is my code:

```<code>SizedBox(height: 8,),
        TextButton.icon(
          icon: Icon(Icons.delete),
          label: Text('delete'),

          onPressed: (){},
        ),
</code>```

答:
You can use the TextButton.stylefrom on the style of the TextButton. In this method, you can use primary to set the colors of both the icon and label. If you want to set another color for the icon, you can set the icon color in Icon.</p>
```<code>TextButton.icon(
   onPressed:(){}),
   style: TextButton.styleFrom(
      primary: Colors.blue,
   ),
   icon: Icon(Icons.ac_unit, color: Colors.red),
   label: Text("label"),
 )
</code>```

Title: How to change color in TextButton.icon

Body:
I want to have an icon with text, so I used TextButton.icon but I can not change the color of the text or icon!
Please suggest if anyone has a solution
this is my code:

SizedBox(height: 8,),
        TextButton.icon(
          icon: Icon(Icons.delete),
          label: Text('delete'),

          onPressed: (){},
        ),

Body:
You can use the TextButton.stylefrom on the style of the TextButton. In this method, you can use primary to set the colors of both the icon and label. If you want to set another color for the icon, you can set the icon color in Icon.

TextButton.icon(
   onPressed:(){}),
   style: TextButton.styleFrom(
      primary: Colors.blue,
   ),
   icon: Icon(Icons.ac_unit, color: Colors.red),
   label: Text("label"),
 )


问:
How do i alter the step for time input for IOS?
I want to have a time input using html5 in ios. I have tried using the step="900" attribute to allow only intervals of 15 minutes, which works when running it in the browser, but not on my ipad which is what im developing for.

```<code><input type="time" id="deliveryTime" value="09:00:00"  step="900">
</code>```

However in IOS this still displays every minute 00-59.

Can anyone help?

答: For some reason iOS Chrome is not mentioned on caniuse.com but it does not handle "step" either.</p>

Body:
I want to have a time input using html5 in ios. I have tried using the step="900" attribute to allow only intervals of 15 minutes, which works when running it in the browser, but not on my ipad which is what im developing for.

<input type="time" id="deliveryTime" value="09:00:00"  step="900">

However in IOS this still displays every minute 00-59.

Can anyone help?


问:
asp.net DropDownList
Currently I have a drop downlist as follows:

```<code><asp:DropDownList  ID="DropDownList1" runat="server"  AutoPostBack="True"

    OnSelectedIndexChanged="SelectionHasChanged"
                DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="ID"
                 Width="214px">
            /asp:DropDownList>

            asp:SqlDataSource ID="SqlDataSource1" runat="server"
                ConnectionString="<%$ ConnectionStrings:MyDBConnectionString1 %>"
                SelectCommand="SELECT [ID], Name], [Name] FROM [Names]">
            /asp:SqlDataSource>
</code>```

There are two things I'm trying to get the list to do when selection is either updated or deleted:
1)Remove deleted contents from DropDownList
2)The first entry in the database is found in the field when the page is loaded, I would like it to either be blank or say "Select"

Currently I need to refress the page to refresh the dropdownlist of deleted items.

I have tried adding DropDownList1.DataBind(); in various methods (page_load, update, delete) and DropDownList1.DataSource = SqlDataSource1; (but I get a message to delete an object of (SqlDataSource1?)

I have added a tag/controll called EnableViewState="false", this refreshs the dropdownlist when I select another item, but when I delete an item I need the list to refresh right away.

答:
1.In order to delete an item from your dropdown list, what you do is to loop through the ListItem of dropdown list compare the value field (DataValueField) of ListItem item with the selection that has changed or deleted, remove it from dropdown list if it matches. e.g.:

```<code>private void removeItem(string ID)
    {
        for (int i = 0; i < dropdownList.Items.Count; i++)
            if (dropdownList.Items[i].Value == ID)
            {
                dropdownList.Items.RemoveAt(i);
                break;
            }
    }
</code>```

2.Just after binding your dropdownlist, in code behind, add a new ListItem at Index 0, it will solve your problem of displaying "Select" or Blank as a top most selection:

```<code>dropdownList.DataBind();
dropdownList.Items.Insert(0, new ListItem("Select"));
</code>```

Title: asp.net DropDownList

Body:
Currently I have a drop downlist as follows:

<asp:DropDownList  ID="DropDownList1" runat="server"  AutoPostBack="True"

    OnSelectedIndexChanged="SelectionHasChanged"
                DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="ID"
                 Width="214px">
            /asp:DropDownList>

            asp:SqlDataSource ID="SqlDataSource1" runat="server"
                ConnectionString="<%$ ConnectionStrings:MyDBConnectionString1 %>"
                SelectCommand="SELECT [ID], Name], [Name] FROM [Names]">
            /asp:SqlDataSource>

There are two things I'm trying to get the list to do when selection is either updated or deleted:
1)Remove deleted contents from DropDownList
2)The first entry in the database is found in the field when the page is loaded, I would like it to either be blank or say "Select"

Currently I need to refress the page to refresh the dropdownlist of deleted items.

I have tried adding DropDownList1.DataBind(); in various methods (page_load, update, delete) and DropDownList1.DataSource = SqlDataSource1; (but I get a message to delete an object of (SqlDataSource1?)

I have added a tag/controll called EnableViewState="false", this refreshs the dropdownlist when I select another item, but when I delete an item I need the list to refresh right away.

Body:
1.In order to delete an item from your dropdown list, what you do is to loop through the ListItem of dropdown list compare the value field (DataValueField) of ListItem item with the selection that has changed or deleted, remove it from dropdown list if it matches. e.g.:

private void removeItem(string ID)
    {
        for (int i = 0; i < dropdownList.Items.Count; i++)
            if (dropdownList.Items[i].Value == ID)
            {
                dropdownList.Items.RemoveAt(i);
                break;
            }
    }

2.Just after binding your dropdownlist, in code behind, add a new ListItem at Index 0, it will solve your problem of displaying "Select" or Blank as a top most selection:

dropdownList.DataBind();
dropdownList.Items.Insert(0, new ListItem("Select"));


问:
Remove unwanted parts from strings in Dataframe
I am looking for an efficient way to remove unwanted parts from strings in a DataFrame column.

My dataframe:

```<code>     Passengers

1    Sally Muller, President, Mark Smith, Vicepresident, John Doe, Chief of Staff
2    Sally Muller, President, Mark Smith, Vicepresident
3    Sally Muller, President, Mark Smith, Vicepresident, John Doe, Chief of Staff
4    Mark Smith, Vicepresident, John Doe, Chief of Staff, Peter Parker, Special Effects
5    Sally Muller, President, John Doe, Chief of Staff, Peter Parker, Special Effects, Lydia Johnson, Vice Chief of Staff
...
</code>```

desired form of df:

```<code>     Passengers

1    Sally Muller, Mark Smith, John Doe
2    Sally Muller, Mark Smith
3    Sally Muller, Mark Smith, John Doe
4    Mark Smith, John Doe, Peter Parker
5    Sally Muller, John Doe, Peter Parker, Lydia Johnson
...
</code>```

Up to now I did it with endless handmade copy/paste regex list:

```<code>df = df.replace(r'President,','', regex=True)
df = df.replace(r'Vicepresident,','', regex=True)
df = df.replace(r'Chief of Staff,','', regex=True)
df = df.replace(r'Special Effects,','', regex=True)
df = df.replace(r'Vice Chief of Staff,','', regex=True)
...
</code>```

Is there a more comfortable way to do this?

Edit

More accurate example of original df:

```<code>     Passengers

1    Sally Muller, President, EL Mark Smith, John Doe, Chief of Staff,  Peter Gordon, Director of Central Command
2    Sally Muller, President, EL Mark Smith, Vicepresident
3    Sally Muller, President, EL Mark Smith, Vicepresident, John Doe, Chief of Staff, Peter Gordon, Dir CC
4    Mark Smith, Vicepresident, John Doe, Chief of Staff, Peter Parker, Special Effects
5    President Sally Muller, John Doe Chief of Staff, Peter Parker, Special Effects, Lydia Johnson , Vice Chief of Staff
...
</code>```

desired form of df:

```<code>     Passengers

1    Sally Muller, Mark Smith, John Doe, Peter Gordon
2    Sally Muller, Mark Smith
3    Sally Muller, Mark Smith, John Doe, Peter Gordon
4    Mark Smith, John Doe, Peter Parker
5    Sally Muller, John Doe, Peter Parker, Lydia Johnson
...
</code>```

Up to now I did it with endless handmade copy/paste regex list:

```<code>df = df.replace(r'President','', regex=True)
df = df.replace(r'Director of Central Command,','', regex=True)
df = df.replace(r'Dir CC','', regex=True)
df = df.replace(r'Vicepresident','', regex=True)
df = df.replace(r'Chief of Staff','', regex=True)
df = df.replace(r'Special Effects','', regex=True)
df = df.replace(r'Vice Chief of Staff','', regex=True)
...
</code>```

messy output is like:

```<code>     Passengers

1    Sally Muller, , Mark Smith, John Doe, , Peter Gordon,
2    Sally Muller, Mark Smith,
3    Sally Muller, Mark Smith,, John Doe, Peter Gordon
4    Mark Smith, John Doe, Peter Parker
5    Sally Muller,, John Doe, Peter Parker , Lydia Johnson,
...
</code>```

答:
If every passenger has their title, then you can use str.split + explode, then select every second item starting from the first item, then groupby the index and join back:

```<code>out = df['Passengers'].str.split(',').explode()[::2].groupby(level=0).agg(', '.join)
</code>```

or str.split + explode and apply a lambda that does the selection + join

```<code>out = df['Passengers'].str.split(',').apply(lambda x: ', '.join(x[::2]))
</code>```

Output:

```<code>0                 Sally Muller,  Mark Smith,  John Doe
1                            Sally Muller,  Mark Smith
2                 Sally Muller,  Mark Smith,  John Doe
3                 Mark Smith,  John Doe,  Peter Parker
4    Sally Muller,  John Doe,  Peter Parker,  Lydia...
</code>```

Edit:

If not everyone has a title, then you can create a set of titles and split and filter out the titles. If the order of the names don't matter in each row, then you can use set difference and cast each set to a list in a list comprehension:

```<code>titles = {'President', 'Vicepresident', 'Chief of Staff', 'Special Effects', 'Vice Chief of Staff'}

out = pd.Series([list(set(x.split(', ')) - titles) for x in df['Passengers']])
</code>```

If order matters, then you can use a nested list comprehension:

```<code>out = pd.Series([[i for i in x.split(', ') if i not in titles] for x in df['Passengers']])
</code>```

Body:
I am looking for an efficient way to remove unwanted parts from strings in a DataFrame column.

My dataframe:

     Passengers

1    Sally Muller, President, Mark Smith, Vicepresident, John Doe, Chief of Staff
2    Sally Muller, President, Mark Smith, Vicepresident
3    Sally Muller, President, Mark Smith, Vicepresident, John Doe, Chief of Staff
4    Mark Smith, Vicepresident, John Doe, Chief of Staff, Peter Parker, Special Effects
5    Sally Muller, President, John Doe, Chief of Staff, Peter Parker, Special Effects, Lydia Johnson, Vice Chief of Staff
...

desired form of df:

     Passengers

1    Sally Muller, Mark Smith, John Doe
2    Sally Muller, Mark Smith
3    Sally Muller, Mark Smith, John Doe
4    Mark Smith, John Doe, Peter Parker
5    Sally Muller, John Doe, Peter Parker, Lydia Johnson
...

Up to now I did it with endless handmade copy/paste regex list:

df = df.replace(r'President,','', regex=True)
df = df.replace(r'Vicepresident,','', regex=True)
df = df.replace(r'Chief of Staff,','', regex=True)
df = df.replace(r'Special Effects,','', regex=True)
df = df.replace(r'Vice Chief of Staff,','', regex=True)
...

Is there a more comfortable way to do this?

Edit

More accurate example of original df:

     Passengers

1    Sally Muller, President, EL Mark Smith, John Doe, Chief of Staff,  Peter Gordon, Director of Central Command
2    Sally Muller, President, EL Mark Smith, Vicepresident
3    Sally Muller, President, EL Mark Smith, Vicepresident, John Doe, Chief of Staff, Peter Gordon, Dir CC
4    Mark Smith, Vicepresident, John Doe, Chief of Staff, Peter Parker, Special Effects
5    President Sally Muller, John Doe Chief of Staff, Peter Parker, Special Effects, Lydia Johnson , Vice Chief of Staff
...

desired form of df:

     Passengers

1    Sally Muller, Mark Smith, John Doe, Peter Gordon
2    Sally Muller, Mark Smith
3    Sally Muller, Mark Smith, John Doe, Peter Gordon
4    Mark Smith, John Doe, Peter Parker
5    Sally Muller, John Doe, Peter Parker, Lydia Johnson
...

Up to now I did it with endless handmade copy/paste regex list:

df = df.replace(r'President','', regex=True)
df = df.replace(r'Director of Central Command,','', regex=True)
df = df.replace(r'Dir CC','', regex=True)
df = df.replace(r'Vicepresident','', regex=True)
df = df.replace(r'Chief of Staff','', regex=True)
df = df.replace(r'Special Effects','', regex=True)
df = df.replace(r'Vice Chief of Staff','', regex=True)
...

messy output is like:

     Passengers

1    Sally Muller, , Mark Smith, John Doe, , Peter Gordon,
2    Sally Muller, Mark Smith,
3    Sally Muller, Mark Smith,, John Doe, Peter Gordon
4    Mark Smith, John Doe, Peter Parker
5    Sally Muller,, John Doe, Peter Parker , Lydia Johnson,
...

Body:
If every passenger has their title, then you can use str.split + explode, then select every second item starting from the first item, then groupby the index and join back:

out = df['Passengers'].str.split(',').explode()[::2].groupby(level=0).agg(', '.join)

or str.split + explode and apply a lambda that does the selection + join

out = df['Passengers'].str.split(',').apply(lambda x: ', '.join(x[::2]))

Output:

0                 Sally Muller,  Mark Smith,  John Doe
1                            Sally Muller,  Mark Smith
2                 Sally Muller,  Mark Smith,  John Doe
3                 Mark Smith,  John Doe,  Peter Parker
4    Sally Muller,  John Doe,  Peter Parker,  Lydia...

Edit:

If not everyone has a title, then you can create a set of titles and split and filter out the titles. If the order of the names don't matter in each row, then you can use set difference and cast each set to a list in a list comprehension:

titles = {'President', 'Vicepresident', 'Chief of Staff', 'Special Effects', 'Vice Chief of Staff'}

out = pd.Series([list(set(x.split(', ')) - titles) for x in df['Passengers']])

If order matters, then you can use a nested list comprehension:

out = pd.Series([[i for i in x.split(', ') if i not in titles] for x in df['Passengers']])


问:
Animate DOM Element on removal of Element
I have to animate the Toast Notifications, I am currently using the transition to show it coming from the top. It looks good to me, I want to stop the sudden moving of the other toast notifications so harshly, any way they can cover space smoothly ?

Current CSS :

```<code>.slds-transition-hide {
    transition: all 0.5s;
}
.slds-transition-show {
    transition: all 0.5s;
    animation: show 0.5s forwards;
}
@keyframes show {
    0% {
        transform: translateY(-50px);
    }
    25% {
        transform: translateY(-40px);
    }
    50% {
        transform: translateY(-20px);
    }
    75% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}
.slds-notify {
    pointer-events: all;
}
</code>```

Demo:

The elements are removed 0.5s after the fade out transition.

Additional Info: I am using LWC OSS, which is developed on Node JS.

答:
In order to achieve the same, I added another animation on closing, so basically whenI want to hide I am adding slds-transition-hide.

I have added another animation to the original fadeout of transition-hide of SLDS lib where I am dereasing the max-height so the other elements can slide up.

```<code>.slds-transition-hide {
    transition: all 0.5s;
    animation: hide 0.5s forwards;
}
.slds-transition-show {
    transition: all 0.5s;
    animation: show 0.5s forwards;
}
@keyframes hide {
    0% {
        max-height: 150px;
        transform: translateY(0px);
    }
    25% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(-20px);
    }
    75% {
        transform: translateY(-40px);
    }
    100% {
        max-height: 0px;
        padding: 0px;
        transform: translateY(-50px);
    }
}
</code>```

Body:
I have to animate the Toast Notifications, I am currently using the transition to show it coming from the top. It looks good to me, I want to stop the sudden moving of the other toast notifications so harshly, any way they can cover space smoothly ?

Current CSS :

.slds-transition-hide {
    transition: all 0.5s;
}
.slds-transition-show {
    transition: all 0.5s;
    animation: show 0.5s forwards;
}
@keyframes show {
    0% {
        transform: translateY(-50px);
    }
    25% {
        transform: translateY(-40px);
    }
    50% {
        transform: translateY(-20px);
    }
    75% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}
.slds-notify {
    pointer-events: all;
}

Demo:

The elements are removed 0.5s after the fade out transition.

Additional Info: I am using LWC OSS, which is developed on Node JS.

Body:
In order to achieve the same, I added another animation on closing, so basically whenI want to hide I am adding slds-transition-hide.

I have added another animation to the original fadeout of transition-hide of SLDS lib where I am dereasing the max-height so the other elements can slide up.

.slds-transition-hide {
    transition: all 0.5s;
    animation: hide 0.5s forwards;
}
.slds-transition-show {
    transition: all 0.5s;
    animation: show 0.5s forwards;
}
@keyframes hide {
    0% {
        max-height: 150px;
        transform: translateY(0px);
    }
    25% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(-20px);
    }
    75% {
        transform: translateY(-40px);
    }
    100% {
        max-height: 0px;
        padding: 0px;
        transform: translateY(-50px);
    }
}


问:
Store frequency of different strings appearing in parent data's column, while considering range of numbers in its other column
I have a DataFrame whose first 3 rows look like this:

```<code>   white_rating   opening_short_name
0          1500         Slav Defense
1          1322  Nimzowitsch Defense
2          1496     King's Pawn Game
3          1439    Queen's Pawn Game
4          1523     Philidor Defense
...
</code>```

and so on. Full DataFrame can be found here (3*20,000).
Now, I want to know how opening values change in frequency as rating increases from around 700 to around 2700.

For that, I had created another DataFrame of the top 10 openings, since there are a lot of openings, and I was trying to get one DataFrame for each of these openings where I can get the frequency of the times it was played at each rating interval, such as 700-800, 1500-1600, and so on.

```<code>opening=data["opening_short_name"].value_counts().nlargest(10) #Top 10 openings
SG = data[data['opening_short_name']=='Scotch Game'][['white_rating']] #Scotch Game data
A=pd.DataFrame(SG[SG['white_rating']>900])
</code>```

Above is an attempt at creating a range of data, but its obviously not able to get the frequency. Say, for 10 openings, and 20 intervals from 700 to 2700, it amounts to 10*20 DFs before I get proper data!

This is where I am stuck. I do not understand how to extract data for the number of times an opening appears, with the value of the cells being the frequency at which it appears at each interval of 100 ratings. I will then divide these vales with the number of all games played by players at that rating interval, to get a proper value of use factor.

The DataFrame I want is to help me create a histogram or an area chart showing the distribution.

This is how it should ideally look like, but with 10 openings' columns and the rows extending to all intervals to 2700-2800. Of course, the rows below are named to help make the idea clear, in practice, it needs to be named with the lower limit of rating:

```<code>             Queen's Gambit Italian Game Sicilian Defense
700-800               0.005         0.05            0.01
800-900                0.02          0.2            0.03
900-1000               0.09         0.05            0.04
...
2700-2800              0.02         0.05            0.09
</code>```

I think there can be a configuration of groupby(), sum(), iloc(). to achieve this, but I can't figure it out. I am new to pandas, so any help in figuring out the exact syntax will help. I have tried reading the pandas documentation, but to no avail.

答:
You can use groupby to apply value_counts after binning the data with pandas.cut:

```<code>df = pd.read_csv('RO - RD.csv', index_col=0)

(df['opening_short_name']
 .groupby(pd.cut(df['white_rating'],
                 range(700, 3000, 100)))
 .apply(lambda s: s.value_counts(normalize=True))
 .unstack(1, fill_value=0)
)
</code>```

(partial) output:

```<code>             Alekhine Defense  Alekhine Defense #2  Alekhine Defense #3  ...
white_rating
(700, 800]            0.000000             0.000000             0.000000
(800, 900]            0.018868             0.000000             0.000000
(900, 1000]           0.010582             0.000000             0.000000
(1000, 1100]          0.027273             0.000000             0.000000
(1100, 1200]          0.009825             0.000000             0.000000
(1200, 1300]          0.014055             0.000000             0.000000
(1300, 1400]          0.010160             0.000484             0.000000
(1400, 1500]          0.010386             0.000325             0.000325
(1500, 1600]          0.011136             0.000000             0.000000
...
</code>```

bonus: data visualization as clustermap

```<code>import seaborn as sns

df2 = (
 df['opening_short_name']
 .groupby(pd.cut(df['white_rating'],
                 range(700, 3000, 100)))
 .apply(lambda s: s.value_counts(normalize=True))
 .unstack(1, fill_value=0)
)

sns.clustermap(df2, cmap='Greys')
</code>```

on can clearly see that beginners and top players play very differently

output:

Body:
I have a DataFrame whose first 3 rows look like this:

   white_rating   opening_short_name
0          1500         Slav Defense
1          1322  Nimzowitsch Defense
2          1496     King's Pawn Game
3          1439    Queen's Pawn Game
4          1523     Philidor Defense
...

and so on. Full DataFrame can be found here (3*20,000).
Now, I want to know how opening values change in frequency as rating increases from around 700 to around 2700.

For that, I had created another DataFrame of the top 10 openings, since there are a lot of openings, and I was trying to get one DataFrame for each of these openings where I can get the frequency of the times it was played at each rating interval, such as 700-800, 1500-1600, and so on.

opening=data["opening_short_name"].value_counts().nlargest(10) #Top 10 openings
SG = data[data['opening_short_name']=='Scotch Game'][['white_rating']] #Scotch Game data
A=pd.DataFrame(SG[SG['white_rating']>900])

Above is an attempt at creating a range of data, but its obviously not able to get the frequency. Say, for 10 openings, and 20 intervals from 700 to 2700, it amounts to 10*20 DFs before I get proper data!

This is where I am stuck. I do not understand how to extract data for the number of times an opening appears, with the value of the cells being the frequency at which it appears at each interval of 100 ratings. I will then divide these vales with the number of all games played by players at that rating interval, to get a proper value of use factor.

The DataFrame I want is to help me create a histogram or an area chart showing the distribution.

This is how it should ideally look like, but with 10 openings' columns and the rows extending to all intervals to 2700-2800. Of course, the rows below are named to help make the idea clear, in practice, it needs to be named with the lower limit of rating:

             Queen's Gambit Italian Game Sicilian Defense
700-800               0.005         0.05            0.01
800-900                0.02          0.2            0.03
900-1000               0.09         0.05            0.04
...
2700-2800              0.02         0.05            0.09

I think there can be a configuration of groupby(), sum(), iloc(). to achieve this, but I can't figure it out. I am new to pandas, so any help in figuring out the exact syntax will help. I have tried reading the pandas documentation, but to no avail.

Body:
You can use groupby to apply value_counts after binning the data with pandas.cut:

df = pd.read_csv('RO - RD.csv', index_col=0)

(df['opening_short_name']
 .groupby(pd.cut(df['white_rating'],
                 range(700, 3000, 100)))
 .apply(lambda s: s.value_counts(normalize=True))
 .unstack(1, fill_value=0)
)

(partial) output:

             Alekhine Defense  Alekhine Defense #2  Alekhine Defense #3  ...
white_rating
(700, 800]            0.000000             0.000000             0.000000
(800, 900]            0.018868             0.000000             0.000000
(900, 1000]           0.010582             0.000000             0.000000
(1000, 1100]          0.027273             0.000000             0.000000
(1100, 1200]          0.009825             0.000000             0.000000
(1200, 1300]          0.014055             0.000000             0.000000
(1300, 1400]          0.010160             0.000484             0.000000
(1400, 1500]          0.010386             0.000325             0.000325
(1500, 1600]          0.011136             0.000000             0.000000
...

bonus: data visualization as clustermap

import seaborn as sns

df2 = (
 df['opening_short_name']
 .groupby(pd.cut(df['white_rating'],
                 range(700, 3000, 100)))
 .apply(lambda s: s.value_counts(normalize=True))
 .unstack(1, fill_value=0)
)

sns.clustermap(df2, cmap='Greys')

on can clearly see that beginners and top players play very differently

output:


问:
How to get properties in VideoModeDescriptor through WmiMonitorListedSupportedSourceModes?
I'm trying to get the Monitor properties in C#. I use the WMI to get the information I need.
Currently I can get correct PNPID from Win32_DesktopMonitor and compare with the result of InstanceName from WmiMonitorListedSupportedSourceModes.
Then I want to get detail information of the monitor by VideoModeDescriptor. Here are my codes below, but I always get the fail as "invalid query" of scherDM2c.Get().
May I know what kind of mistake I made?

private void MonitorBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ManagementObjectSearcher searcherM = new ManagementObjectSearcher($"SELECT * FROM Win32_DesktopMonitor Where Name Like '%{MonitorBox.Text}%'");

            foreach (ManagementObject wmi in searcherM.Get())
            {
                dMaker.Text = wmi.GetPropertyValue("MonitorManufacturer").ToString();
                dID.Text = wmi.GetPropertyValue("PNPDeviceID").ToString();
                ManagementObjectSearcher searcherDM2a = new ManagementObjectSearcher("root\\wmi", "SELECT * FROM WmiMonitorListedSupportedSourceModes");

                foreach (ManagementObject sbu_wmi in searcherDM2a.Get())
                {
                    string WMIID = sbu_wmi.GetPropertyValue("InstanceName").ToString();

                    if (WMIID.ToUpper().Contains(dID.Text.ToUpper()))
                    {
                        ManagementObjectSearcher scherDM2c = new ManagementObjectSearcher("root\\wmi", $"SELECT * FROM WmiMonitorListedSupportedSourceModes Where InstanceName Like %{WMIID}%");
                        //ManagementObjectCollection MColl = scherDM2c.Get();

                        foreach (ManagementObject ModeList in scherDM2c.Get())
                        {
                            listBox1.Items.Add(ModeList.GetPropertyValue("HorizontalActivePixels").ToString());
                        }

                        /*listBox1.Items.Add(sbu_wmi.GetPropertyValue("PreferredMonitorSourceModeIndex").ToString());
                        var i = sbu_wmi.GetPropertyValue("PreferredMonitorSourceModeIndex").ToString();
                        listBox1.Items.Add(sbu_wmi.GetPropertyValue("MonitorSourceModes").ToString());*/
                    }
                }

                /*listBox1.Items.Add(wmi.GetPropertyValue("CreationClassName").ToString());
                listBox1.Items.Add(wmi.GetPropertyValue("Caption").ToString());
                listBox1.Items.Add(wmi.GetPropertyValue("MonitorType").ToString());*/
            }
        }
```

答:
Try this,You forgot to add ''</p>
```<code>ManagementObjectSearcher scherDM2c = new ManagementObjectSearcher("root\\wmi", $"SELECT * FROM WmiMonitorListedSupportedSourceModes Where InstanceName Like '%{WMIID}%'");
</code>```

Body:
Try this,You forgot to add ''

ManagementObjectSearcher scherDM2c = new ManagementObjectSearcher("root\\wmi", $"SELECT * FROM WmiMonitorListedSupportedSourceModes Where InstanceName Like '%{WMIID}%'");


问:
Android How to adjust layout in Full Screen Mode when softkeyboard is visible
I have researched a lot to adjust the layout when softkeyboard is active and I have successfully implemented it but the problem comes when I use android:theme="@android:style/Theme.NoTitleBar.Fullscreen" this in my activity tag in manifest file.

For this I have used android:windowSoftInputMode="adjustPan|adjustResize|stateHidden" with different options but no luck.

After that I implemented FullScreen programmatically and tried various layout to work with FullScreen but all in vain.

I referred these links and have looked many posts here related to this issue:

http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

http://davidwparker.com/2011/08/30/android-how-to-float-a-row-above-keyboard/

Here is xml code:

```<code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/masterContainerView"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#ffffff">

    <ScrollView android:id="@+id/parentScrollView"
        android:layout_width="fill_parent" android:layout_height="wrap_content">

        <LinearLayout android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:orientation="vertical">

            <TextView android:id="@+id/setup_txt" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="Setup - Step 1 of 3"
                android:textColor="@color/top_header_txt_color" android:textSize="20dp"
                android:padding="8dp" android:gravity="center_horizontal" />

            <TextView android:id="@+id/txt_header" android:layout_width="fill_parent"
                android:layout_height="40dp" android:text="AutoReply:"
                android:textColor="@color/top_header_txt_color" android:textSize="14dp"
                android:textStyle="bold" android:padding="10dp"
                android:layout_below="@+id/setup_txt" />

            <EditText android:id="@+id/edit_message"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:text="Some text here." android:textSize="16dp"
                android:textColor="@color/setting_editmsg_color" android:padding="10dp"
                android:minLines="5" android:maxLines="6" android:layout_below="@+id/txt_header"
                android:gravity="top" android:scrollbars="vertical"
                android:maxLength="132" />

            <ImageView android:id="@+id/image_bottom"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:layout_below="@+id/edit_message" />

        </LinearLayout>
    </ScrollView>

    <RelativeLayout android:id="@+id/scoringContainerView"
        android:layout_width="fill_parent" android:layout_height="50px"
        android:orientation="vertical" android:layout_alignParentBottom="true"
        android:background="#535254">

        <Button android:id="@+id/btn_save" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:layout_alignParentRight="true"
            android:layout_marginTop="7dp" android:layout_marginRight="15dp"
            android:layout_below="@+id/edit_message"
            android:text = "Save" />

        <Button android:id="@+id/btn_cancel" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:layout_marginTop="7dp"
            android:layout_marginRight="10dp" android:layout_below="@+id/edit_message"
            android:layout_toLeftOf="@+id/btn_save" android:text = "Cancel" />

    </RelativeLayout>
</RelativeLayout>
</code>```

I want the bottom 2 buttons should go upward when the softkeyboard comes in picture.

答:
There is another way, without creating own helper classes or functions that calculate the height of the screen. Instead use ViewCompat.setOnApplyWindowInsetsListener.
With the listener you can check if the keyboard is open and set the bottom padding based on the keyboard height.

```<code>// the root view of your webview, e.g FrameLayout or LinearLayout
    rootView = view.findViewById(R.id.whatever);

    ViewCompat.setOnApplyWindowInsetsListener(rootView, (webView, insets) -> {

        // checks if keyboard is visible, the Type.ime() stands for Input Method
        boolean isKeyboardVisible = insets.isVisible(WindowInsetsCompat.Type.ime());

        // get the keyboard height and use the height as bottom padding for your view
        int bottomKeyboardPadding = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom;

        if (isKeyboardVisible) { webView.setPadding(0, 0, 0, bottomKeyboardPadding); }
        else { webView.setPadding(0, 0, 0, 0); }

        return insets;
    });
</code>```

Body:
I have researched a lot to adjust the layout when softkeyboard is active and I have successfully implemented it but the problem comes when I use android:theme="@android:style/Theme.NoTitleBar.Fullscreen" this in my activity tag in manifest file.

For this I have used android:windowSoftInputMode="adjustPan|adjustResize|stateHidden" with different options but no luck.

After that I implemented FullScreen programmatically and tried various layout to work with FullScreen but all in vain.

I referred these links and have looked many posts here related to this issue:

http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

http://davidwparker.com/2011/08/30/android-how-to-float-a-row-above-keyboard/

Here is xml code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/masterContainerView"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#ffffff">

    <ScrollView android:id="@+id/parentScrollView"
        android:layout_width="fill_parent" android:layout_height="wrap_content">

        <LinearLayout android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:orientation="vertical">

            <TextView android:id="@+id/setup_txt" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="Setup - Step 1 of 3"
                android:textColor="@color/top_header_txt_color" android:textSize="20dp"
                android:padding="8dp" android:gravity="center_horizontal" />

            <TextView android:id="@+id/txt_header" android:layout_width="fill_parent"
                android:layout_height="40dp" android:text="AutoReply:"
                android:textColor="@color/top_header_txt_color" android:textSize="14dp"
                android:textStyle="bold" android:padding="10dp"
                android:layout_below="@+id/setup_txt" />

            <EditText android:id="@+id/edit_message"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:text="Some text here." android:textSize="16dp"
                android:textColor="@color/setting_editmsg_color" android:padding="10dp"
                android:minLines="5" android:maxLines="6" android:layout_below="@+id/txt_header"
                android:gravity="top" android:scrollbars="vertical"
                android:maxLength="132" />

            <ImageView android:id="@+id/image_bottom"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:layout_below="@+id/edit_message" />

        </LinearLayout>
    </ScrollView>

    <RelativeLayout android:id="@+id/scoringContainerView"
        android:layout_width="fill_parent" android:layout_height="50px"
        android:orientation="vertical" android:layout_alignParentBottom="true"
        android:background="#535254">

        <Button android:id="@+id/btn_save" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:layout_alignParentRight="true"
            android:layout_marginTop="7dp" android:layout_marginRight="15dp"
            android:layout_below="@+id/edit_message"
            android:text = "Save" />

        <Button android:id="@+id/btn_cancel" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:layout_marginTop="7dp"
            android:layout_marginRight="10dp" android:layout_below="@+id/edit_message"
            android:layout_toLeftOf="@+id/btn_save" android:text = "Cancel" />

    </RelativeLayout>
</RelativeLayout>

I want the bottom 2 buttons should go upward when the softkeyboard comes in picture.

Body:
There is another way, without creating own helper classes or functions that calculate the height of the screen. Instead use ViewCompat.setOnApplyWindowInsetsListener.
With the listener you can check if the keyboard is open and set the bottom padding based on the keyboard height.

// the root view of your webview, e.g FrameLayout or LinearLayout
    rootView = view.findViewById(R.id.whatever);

    ViewCompat.setOnApplyWindowInsetsListener(rootView, (webView, insets) -> {

        // checks if keyboard is visible, the Type.ime() stands for Input Method
        boolean isKeyboardVisible = insets.isVisible(WindowInsetsCompat.Type.ime());

        // get the keyboard height and use the height as bottom padding for your view
        int bottomKeyboardPadding = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom;

        if (isKeyboardVisible) { webView.setPadding(0, 0, 0, bottomKeyboardPadding); }
        else { webView.setPadding(0, 0, 0, 0); }

        return insets;
    });


问:
Use data from CoreData in label
world! I work in SwiftUI, I want to use data from CoreData in label.

Use likedDBE.isLiked instead of cellViewModel.isLiked. How can this be implemented?

```<code>Button(action: {
    let likedDBE = LikedDBE(context: self.managedObjectContext)
    likedDBE.name = cellViewModel.card.name
    likedDBE.price = cellViewModel.card.price
    likedDBE.isLiked = cellViewModel.isLiked
    do{
        try self.managedObjectContext.save()
    }catch {
        print(error)
    }
}, label: {
    Image(systemName: cellViewModel.isLiked ? "heart.fill" : "heart") //In this place
        .frame(width: 22, height: 22)
        .foregroundColor(cellViewModel.isLiked ? .red : .black) //And in this place

})
</code>```

Thank you all in advance!

答:
you cannot use likedDBE.isLiked in the Button label part, because it is only available in the Button action part. So

move the likedDBE outside the Button action, for example:

```<code>// somewhere appropriate in your code and accessible to the button
var likedDBE = LikedDBE(context: self.managedObjectContext)
likedDBE.name = cellViewModel.card.name
likedDBE.price = cellViewModel.card.price
likedDBE.isLiked = cellViewModel.isLiked

// just keep the saving in the button action.
Button(action: {
    do{
        try self.managedObjectContext.save() // <--- here keep this
    }catch {
        print(error)
    }
}, label: {
    Image(systemName: likedDBE.isLiked ? "heart.fill" : "heart")   // <--- here can use likedDBE
        .frame(width: 22, height: 22)
        .foregroundColor(likedDBE.isLiked ? .red : .black)   // <--- here can use likedDBE
})
</code>```

Title: Use data from CoreData in label

Body:
world! I work in SwiftUI, I want to use data from CoreData in label.

Use likedDBE.isLiked instead of cellViewModel.isLiked. How can this be implemented?

Button(action: {
    let likedDBE = LikedDBE(context: self.managedObjectContext)
    likedDBE.name = cellViewModel.card.name
    likedDBE.price = cellViewModel.card.price
    likedDBE.isLiked = cellViewModel.isLiked
    do{
        try self.managedObjectContext.save()
    }catch {
        print(error)
    }
}, label: {
    Image(systemName: cellViewModel.isLiked ? "heart.fill" : "heart") //In this place
        .frame(width: 22, height: 22)
        .foregroundColor(cellViewModel.isLiked ? .red : .black) //And in this place

})

Thank you all in advance!

Body:
you cannot use likedDBE.isLiked in the Button label part, because it is only available in the Button action part. So

move the likedDBE outside the Button action, for example:

// somewhere appropriate in your code and accessible to the button
var likedDBE = LikedDBE(context: self.managedObjectContext)
likedDBE.name = cellViewModel.card.name
likedDBE.price = cellViewModel.card.price
likedDBE.isLiked = cellViewModel.isLiked

// just keep the saving in the button action.
Button(action: {
    do{
        try self.managedObjectContext.save() // <--- here keep this
    }catch {
        print(error)
    }
}, label: {
    Image(systemName: likedDBE.isLiked ? "heart.fill" : "heart")   // <--- here can use likedDBE
        .frame(width: 22, height: 22)
        .foregroundColor(likedDBE.isLiked ? .red : .black)   // <--- here can use likedDBE
})


问:
How to get relative path in Integration Testing in c#

Problem

I am trying to test my importing service in which I have to provide file which is save in the same solution but different folder and also there are bunch of project in it too and this folder is out of the projects. I want this path to be absolute path how can I do this?

I am doing in this way

```<code>string filePath = Path.GetFullPath(@"E:\Development\Project\Misc Artifacts\ImportFileSamples\city.txt");
</code>```

答:
you can use this to find the relative path.</p>
```<code>var relativePath = Path.GetRelativePath(
@"C:\X\API\APITest.Tests\IntegrationTest\ServiceLayerTests"
@"C:\X\API\API.Test.Tests\Images\)";
</code>```

Body:
Problem

I am trying to test my importing service in which I have to provide file which is save in the same solution but different folder and also there are bunch of project in it too and this folder is out of the projects. I want this path to be absolute path how can I do this?

I am doing in this way

string filePath = Path.GetFullPath(@"E:\Development\Project\Misc Artifacts\ImportFileSamples\city.txt");

Body:
you can use this to find the relative path.

var relativePath = Path.GetRelativePath(
@"C:\X\API\APITest.Tests\IntegrationTest\ServiceLayerTests"
@"C:\X\API\API.Test.Tests\Images\)";


问:
How to get metadata of an existing document in a sharepoint library (in vba or vbs)
I have a document in a sharepoint library, say http://myserver/mysite/mylib/mydoc1.pdf, how can I access metadata properties of the document mydoc1.pdf?</p>

答: You have to use your term data store, have the information entered at the site collection level and grab it from all your libraries.