Assign ID to menu items in default language

I’m using the next code in functions.php in order to generate an id for the menu elements with the title of the menu page item.

My site is multilanguage so it changes the id depending on the language you’re browsing on.
This is the code I’m using and what I’m looking for is to assign an unique id for every language generated by the default language title

function custom_nav_menu_item_id($id, $item) {
    $title = sanitize_title_with_dashes($item->title);
    return $title;

add_filter('nav_menu_item_id', 'custom_nav_menu_item_id', 10, 2);

How to assign a db user to multiple databases at once from cPanel?

Inside cPanel, I can create a database and I can assign a specific db user to a specific database.

But what if I have like 100 databases. How can I assign the same user to all of the databases created in my cPanel account?

Assign MySQL user to multiple databases via SSH

I already searched for this but I cannot find what I’m exactly looking for.

Is there an SSH command to assign one user in all databases in my Cpanel account?

I have created like 100+ MySQL db, and 1 user. I would like to assign that 1 user ALL PRIVILEGES to ALL DATABASES in my account.

For example, if my DB username is bryan, and I have multiple databases, how can I assign bryan to all of that databases and granting bryan ALL PRIVILEGE.

Instead of going to cpanel and assigning it one at a time, there should be a faster way, specially if it’s just the same user.

How to assign an Integer to a item in list – Python card game

I am new to python and I have been having some trouble making this card game In between also known as Acey Duecy.
I have made my deck of cards using a list with the code :

deck = ()
for n in range(4):
    for i in range(13):
        all_card = (cardname(i) + " " + suit(n))

After assigning a integer to the item in the list, I would like to remove the 2 cards if they are the same, but since I havent assigned them numbers and they are just strings right now the code does not work. I would also not want to have to assign each 52 cards the value manual since in my game the suits don’t matter thus its just the Ace, two, three etc.

first_card = deck(0)
second_card = deck(1)

if first_card == second_card :
    print(".pop = False")
else :
    print("They are not the same card")
``` – How to assign a sidebar to a WordPress page when none was there before

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

javascript – cannot assign to read-only property of object

#interestingProblem can anybody explain, please 🤔
I had a problem while updating the state as in the first code block, but there was no problem when I updated the state as in the second code block as below.

I had a problem: (cannot assign to read-only property of object quantity)

const newItem = action.payload
newItem.quantity = 1
state.items = (...state.items, newItem)

I had no problem when I wrote the code like this

const newItem = action.payload
state.items = (...state.items, { ...newItem, quantity: 1 })

programming languages – With a list of opcodes for a virtual machine, is it possible to assign a number to every possible program of size n that can be run on that machine?

Say you have some virtual machine with < 100 numbered opcodes that fully specify its behaviour. Is there an easy way to order and enumerate all possible programs of less than n instructions, the result being that a particular number refers to a particular program? Preferably with natural numbers and short programs at the begining.

As this list would be combinatorially large, it would be helpful to assign these numbers without running the programs or loading them into memory.

magento2 – Product attribute create/update using rest api and assign it to attribute set

I am creating product attributes using rest API with the below request body.
End point rest/V1/products/attributes/

  "attribute": {
    "is_wysiwyg_enabled": false,
    "is_html_allowed_on_front": false,
    "used_for_sort_by": false,
    "is_filterable": true,
    "is_filterable_in_search": true,
    "is_used_in_grid": true,
    "is_visible_in_grid": false,
    "is_filterable_in_grid": true,
    "position": 0,
    "apply_to": [],
    "is_searchable": "1",
    "is_visible_in_advanced_search": "1",
    "is_comparable": "1",
    "is_used_for_promo_rules": "0",
    "is_visible_on_front": "0",
    "used_in_product_listing": "1",
    "is_visible": true,
    "scope": "global",
    "attribute_code": "text_api_attribute",
    "frontend_input": "text",
    "entity_type_id": "4",
    "is_required": false,
    "is_user_defined": true,
    "default_frontend_label": "Att Label updated",
    "frontend_labels": null,
    "backend_type": "int",
    "default_value": "",
    "is_unique": "0"

it’s get created successfully but how can I assign this attribute to the attribute set.tried with group: General but its not defined in interface so it throw error.

also there is an error when try to update using PUTmethod rest/V1/products/attributes/rest/V1/products/attributes/

"message": "%1 already exists.",
"parameters": [
    "Attribute with the same code"


untagged – Assign aws_transfer_server with VPC endpoint_type to network load balancer

In our current setup we use a aws_transfer_server with endpoint_type VPC_ENDPOINT. The VPC endpoint is connected to a NLB. This looks like this:

resource "aws_vpc_endpoint" "vpc_endpoint" {
  vpc_id              = var.vpc_id
  vpc_endpoint_type   = "Interface"
  service_name        = "com.amazonaws.${var.region}.transfer.server"
  subnet_ids          = var.subnet_ids
  security_group_ids  = (

resource "aws_transfer_server" "sftp-server" {
  identity_provider_type = "SERVICE_MANAGED"
  endpoint_type          = "VPC_ENDPOINT"

 endpoint_details {
   vpc_endpoint_id =

data "aws_network_interface" "endpoint_nic_0" {
  count = length(var.subnet_ids) > 0 ? 1 : 0
  id    = reverse(sort(aws_vpc_endpoint.vpc_endpoint.network_interface_ids))(0)

resource "aws_alb_target_group_attachment" "target_group_attachment_0" {
  count            = length(var.subnet_ids) > 0 ? 1 : 0
  target_group_arn = aws_lb_target_group.nlb_target_group(0).arn
  target_id        = data.aws_network_interface.endpoint_nic_0(0).private_ip

The target group is connected to the NLB.

Now I would like to move the aws_transfer_server to an endpoint_type VPC as recommended by AWS. For existing setups we would like to retain the NLB as the single point of access, though, because there is an IP whitelisting in place.
I update the existing transfer_server as described below and make the vpc_endpoint creation conditional on the provided endpoint_type.

resource "aws_transfer_server" "sftp-server" {
  identity_provider_type = "SERVICE_MANAGED"
  logging_role           = aws_iam_role.logger.arn
  endpoint_type          = var.endpoint_type

  dynamic "endpoint_details" {
    for_each = var.endpoint_type == "VPC_ENDPOINT" ? (1) : ()
    content {
      vpc_endpoint_id = aws_vpc_endpoint.vpc_endpoint(0).id

  dynamic "endpoint_details" {
    for_each = var.endpoint_type == "VPC" ? (1) : ()
    content {
      subnet_ids = var.subnet_ids
      vpc_id = var.vpc_id

Is there any way I can either provide the intended private IP addresses to the aws_transfer_server by keeping the VPC endpoint or extract the private IP addresses of the aws_transfer_server after its creation to attach it to my target group?
I considered the address_allocation_ids parameter in the endpoint_details, but did not find any examples or additional documentation on how to use them.

My goal is that the aws_transfer_server registers the private IP addresses at the target group that is used by my NLB.

python – Is it possible to assign instance variable value to a class variable?

I am initializing a variable with the constructor __init__, and then I need to use this value (a string) to concatenate to a class variable which is also a string. But it is failing with error NameError: name 'self' is not defined. Example:

class classExample:

   def __init__(self, surname):
      self.surname = surname

   fullName = "John" + self.surname

Is it possible to assign instance variables values to class variables?