问:
Create VPS in GCP via Terraform module using count
getting stuck with problem.
Need a terraform expert help. I want to create VPS in GCP with count using module. How to correct create and attach google_compute_address and google_compute_disk to each VPS with different names
Any help, please

Module code:

```<code>resource "google_compute_instance" "vps" {
  count               = var.server_count
  name                = var.server_count > 1 ? "${var.server_name}-${count.index}" : var.server_name
  description         = var.server_description
  machine_type        = var.server_type
  zone                = var.server_datacenter
  deletion_protection = var.server_delete_protection
  labels              = var.server_labels
  metadata            = var.server_metadata
  tags                = var.server_tags

  boot_disk {
    auto_delete = false
    initialize_params {
      size   = var.boot_volume_size
      type   = var.boot_volume_type
      image  = var.boot_volume_image
      labels = var.boot_volume_labels
    }
  }
  dynamic "attached_disk" {
    for_each = var.volumes
    content {
      source = attached_disk.value["volume_name"]
    }
  }

  dynamic "network_interface" {
    for_each = var.server_network
    content {
      subnetwork = network_interface.value["subnetwork_name"]
      network_ip = network_interface.value["subnetwork_ip"]
      dynamic "access_config" {
        for_each = network_interface.value.nat_ip ? [1] : []
        content {
          nat_ip = google_compute_address.static_ip.address
        }
      }
    }
  }
}

resource "google_compute_disk" "volume" {
  for_each = var.volumes
  name     = each.value["volume_name"]
  type     = each.value["volume_type"]
  size     = each.value["volume_size"]
  zone     = var.server_datacenter
  labels   = each.value["volume_labels"]
}

resource "google_compute_address" "static_ip" {
  count  = var.server_count
  name   = var.server_count > 1 ? "${var.server_name}-${count.index}" : var.server_name
  region = var.server_region
}
</code>```

Using example:

```<code>module "vps-test" {
  source             = "../module"
  credentials_file   = "../../../../main/vault/prod/.tf/terraform-bb-prod-ground.json"
  server_count       = 2
  server_name        = "example-vps"
  server_description = "simple vps for module testing"
  server_type        = "e2-small"
  server_region      = "europe-west4"
  server_datacenter  = "europe-west4-c"
  server_labels = {
    project     = "terraform"
    environment = "test"
  }
  server_metadata = {
    groups = "parent_group.child_group"
  }
  boot_volume_image = "debian-cloud/debian-11"
  boot_volume_size  = 30
  boot_volume_labels = {
    environment = "production"
    project     = "v3"
    type        = "system"
  }
  server_tags              = ["postgres", "production", "disable-gce-firewall"]
  server_delete_protection = true
  server_network = {
    common_network = {
      subnetwork_name = "${data.terraform_remote_state.network.outputs.subnetwork_vpc_production_common_name}"
      subnetwork_ip   = ""
      nat_ip          = true
    } # },
    # custom_network = {
    #   subnetwork_name = (data.terraform_remote_state.network.outputs.subnetwork_vpc_production_k8s_name)
    #   subnetwork_ip   = ""
    #   nat_ip          = false
    # }
  }
  volumes = {
    volume_data1 = {
      volume_name = "v3-postgres-saga-import-test-storage"
      volume_size = "40"
      volume_type = "pd-ssd"
      volume_labels = {
        environment = "production"
        project     = "v3"
        type        = "storage"
      }
    },
    volume_data2 = {
      volume_name = "volume-vpstest2"
      volume_size = "20"
      volume_type = "pd-ssd"
      volume_labels = {
        environment = "production"
        project     = "v2"
        type        = "storage"
      }
    }
  }
}
</code>```

Now error is: Because google_compute_address.static_ip has "count" set, its attributes must be accessed on specific instances And i know, error with same disk name will come

Body:
getting stuck with problem.
Need a terraform expert help. I want to create VPS in GCP with count using module. How to correct create and attach google_compute_address and google_compute_disk to each VPS with different names
Any help, please

Module code:

resource "google_compute_instance" "vps" {
  count               = var.server_count
  name                = var.server_count > 1 ? "${var.server_name}-${count.index}" : var.server_name
  description         = var.server_description
  machine_type        = var.server_type
  zone                = var.server_datacenter
  deletion_protection = var.server_delete_protection
  labels              = var.server_labels
  metadata            = var.server_metadata
  tags                = var.server_tags

  boot_disk {
    auto_delete = false
    initialize_params {
      size   = var.boot_volume_size
      type   = var.boot_volume_type
      image  = var.boot_volume_image
      labels = var.boot_volume_labels
    }
  }
  dynamic "attached_disk" {
    for_each = var.volumes
    content {
      source = attached_disk.value["volume_name"]
    }
  }

  dynamic "network_interface" {
    for_each = var.server_network
    content {
      subnetwork = network_interface.value["subnetwork_name"]
      network_ip = network_interface.value["subnetwork_ip"]
      dynamic "access_config" {
        for_each = network_interface.value.nat_ip ? [1] : []
        content {
          nat_ip = google_compute_address.static_ip.address
        }
      }
    }
  }
}

resource "google_compute_disk" "volume" {
  for_each = var.volumes
  name     = each.value["volume_name"]
  type     = each.value["volume_type"]
  size     = each.value["volume_size"]
  zone     = var.server_datacenter
  labels   = each.value["volume_labels"]
}

resource "google_compute_address" "static_ip" {
  count  = var.server_count
  name   = var.server_count > 1 ? "${var.server_name}-${count.index}" : var.server_name
  region = var.server_region
}

Using example:

module "vps-test" {
  source             = "../module"
  credentials_file   = "../../../../main/vault/prod/.tf/terraform-bb-prod-ground.json"
  server_count       = 2
  server_name        = "example-vps"
  server_description = "simple vps for module testing"
  server_type        = "e2-small"
  server_region      = "europe-west4"
  server_datacenter  = "europe-west4-c"
  server_labels = {
    project     = "terraform"
    environment = "test"
  }
  server_metadata = {
    groups = "parent_group.child_group"
  }
  boot_volume_image = "debian-cloud/debian-11"
  boot_volume_size  = 30
  boot_volume_labels = {
    environment = "production"
    project     = "v3"
    type        = "system"
  }
  server_tags              = ["postgres", "production", "disable-gce-firewall"]
  server_delete_protection = true
  server_network = {
    common_network = {
      subnetwork_name = "${data.terraform_remote_state.network.outputs.subnetwork_vpc_production_common_name}"
      subnetwork_ip   = ""
      nat_ip          = true
    } # },
    # custom_network = {
    #   subnetwork_name = (data.terraform_remote_state.network.outputs.subnetwork_vpc_production_k8s_name)
    #   subnetwork_ip   = ""
    #   nat_ip          = false
    # }
  }
  volumes = {
    volume_data1 = {
      volume_name = "v3-postgres-saga-import-test-storage"
      volume_size = "40"
      volume_type = "pd-ssd"
      volume_labels = {
        environment = "production"
        project     = "v3"
        type        = "storage"
      }
    },
    volume_data2 = {
      volume_name = "volume-vpstest2"
      volume_size = "20"
      volume_type = "pd-ssd"
      volume_labels = {
        environment = "production"
        project     = "v2"
        type        = "storage"
      }
    }
  }
}

Now error is: Because google_compute_address.static_ip has "count" set, its attributes must be accessed on specific instances And i know, error with same disk name will come


来源: stackexchange

问:
Sequential LSTM Model - The dimensions of y_predicted is different from y_trained
I am running an LSTM model on a simple stock market data.

When training the data, the y_train values are a simple array of floats64 of size (985,). But upon using the lstm.predict(X_test), the y_predicted values are of size array of float32 (246,2,1).

Basically, it is giving me two predictions per input X_test value. Ideally I would expect the output to be an array (246,)

Please help, here is the code:

```<code>def lstm_split(data,n_steps):
    X,y=[],[]
    for i in range(len(stock_data)-n_steps+1):
        X.append(data[i:i+n_steps,:-1])
        y.append(data[i+n_steps-1,-1])

    return np.array(X),np.array(y)

stock_data_ft = X_ft
X1,y1 = lstm_split(stock_data_ft.values,n_steps=2)

train_split=0.8
split_idx = int(np.ceil(len(X1)*train_split))
date_index = stock_data_ft.index

X_train, X_test = X1[:split_idx] , X1[split_idx:]
y_train,y_test = y1[:split_idx] , y1[split_idx:]
X_train_date, X_test_date = date_index[:split_idx], date_index[split_idx:]

print(X1.shape , X_train.shape, X_test.shape, y_test.shape)

print(X_train)

lstm = Sequential()
lstm.add(LSTM(32,input_shape=(X_train.shape[1],X_train.shape[2]),activation='relu',return_sequences=True))
lstm.add(Dense(1))
lstm.compile(loss='mean_squared_error',optimizer='adam')
lstm.summary()

history = lstm.fit(X_train,y_train,epochs=100,batch_size=4,verbose=2,shuffle=False)

y_pred = lstm.predict(X_test)
</code>```

I tried to get predicted values from the model.

y_pred = lstm.predict(X_test)

Was expecting output of array (246,) but instead got an output size array of float32 (246,2,1).

Some additional clarifications:
X_train.shape[1] is 2 and X_train.shape[2] is 3. These indicate the dimensions of the input features.

Basically the X values in training data is an array of dimension (985,2,3).

Some samples below:

[[ 1.53055021, 1.52204214, 1.53825887], [ 1.5526797 , 1.56142366, 1.56073994]],

[[ 1.5526797 , 1.56142366, 1.56073994], [ 1.58880785, 1.59418392, 1.6166433 ]]]

ContentLicense: CC BY-SA 4.0

Body:
I am running an LSTM model on a simple stock market data.

When training the data, the y_train values are a simple array of floats64 of size (985,). But upon using the lstm.predict(X_test), the y_predicted values are of size array of float32 (246,2,1).

Basically, it is giving me two predictions per input X_test value. Ideally I would expect the output to be an array (246,)

Please help, here is the code:

def lstm_split(data,n_steps):
    X,y=[],[]
    for i in range(len(stock_data)-n_steps+1):
        X.append(data[i:i+n_steps,:-1])
        y.append(data[i+n_steps-1,-1])

    return np.array(X),np.array(y)

stock_data_ft = X_ft
X1,y1 = lstm_split(stock_data_ft.values,n_steps=2)

train_split=0.8
split_idx = int(np.ceil(len(X1)*train_split))
date_index = stock_data_ft.index

X_train, X_test = X1[:split_idx] , X1[split_idx:]
y_train,y_test = y1[:split_idx] , y1[split_idx:]
X_train_date, X_test_date = date_index[:split_idx], date_index[split_idx:]

print(X1.shape , X_train.shape, X_test.shape, y_test.shape)

print(X_train)

lstm = Sequential()
lstm.add(LSTM(32,input_shape=(X_train.shape[1],X_train.shape[2]),activation='relu',return_sequences=True))
lstm.add(Dense(1))
lstm.compile(loss='mean_squared_error',optimizer='adam')
lstm.summary()

history = lstm.fit(X_train,y_train,epochs=100,batch_size=4,verbose=2,shuffle=False)

y_pred = lstm.predict(X_test)

I tried to get predicted values from the model.

y_pred = lstm.predict(X_test)

Was expecting output of array (246,) but instead got an output size array of float32 (246,2,1).

Some additional clarifications:
X_train.shape[1] is 2 and X_train.shape[2] is 3. These indicate the dimensions of the input features.

Basically the X values in training data is an array of dimension (985,2,3).

Some samples below:

[[ 1.53055021, 1.52204214, 1.53825887], [ 1.5526797 , 1.56142366, 1.56073994]],

[[ 1.5526797 , 1.56142366, 1.56073994], [ 1.58880785, 1.59418392, 1.6166433 ]]]


问:
I need to split values in a column into its own column with the text relating to it underneath in SQL
I have a table below that is output all the field names in one row with the text next to it:

enter image description here

but i need to look like this:

enter image description here

Any help would be appreciated.

I have tried a few different ways to get the data to look like the above with no joy.


问:
react native displaying items within 2KM
I have a large database of items and they each have a location field which stores their longitude and latitude . I only want to display the items within 2KM to the users location .
Since my database is huge , creating an array by mapping through each database item and use getDistance from geolib is not very efficient . Is there any other way i can do this effectively .

Thanks any help will be appreciated


问:
Convert array of objects with paths strings into nested array
I have to convert an array of objects containing paths into a hierarchy tree list. The paths looks like this: "1/3/2", where 1 is the parent of 3, 3 is the parent of 2 and so on. The depth of the hierarchy and number of children is unlimited, meaning it could look like this: "1/3/2/2/33/33/444/1" or this: "2/".

The array I have right now looks likes this:

```<code>[
      {
          id: 1,
          path: "1",
      },
      {
        id: 2,
        path: "1/1/1",
      },
      {
        id: 3,
        path: "1/1",
      },
      {
        id: 4,
        path: "1/1/2",
      },
      {
        id: 5,
        path: "2/1",
      },
      {
        id: 6,
        path: "2/2",
      },
      {
        id: 7,
          path: "2/",
      }
  ]
</code>```

And I need it to look like this:

```<code>[
        {
          id: 1,
          path: "1/",
          children: [
            {
              id: 3,
              path: "1/1",
              children: [
                {
                  id: 2,
                  path: "1/1/1",
                },
                {
                  id: 4,
                  path: "1/1/2",
                }
              ]
            }
          ]
        },
        {
          id: 7,
          path: "2/",
          children: [
            {
              id: 5,
              path: "2/1",
            },
            {
              id: 6,
              path: "2/2",
            },
          ]
        }
      ]
</code>```

I am trying hard to come up with a good solution to solve this but I could really need som help

Body:
I have to convert an array of objects containing paths into a hierarchy tree list. The paths looks like this: "1/3/2", where 1 is the parent of 3, 3 is the parent of 2 and so on. The depth of the hierarchy and number of children is unlimited, meaning it could look like this: "1/3/2/2/33/33/444/1" or this: "2/".

The array I have right now looks likes this:

[
      {
          id: 1,
          path: "1",
      },
      {
        id: 2,
        path: "1/1/1",
      },
      {
        id: 3,
        path: "1/1",
      },
      {
        id: 4,
        path: "1/1/2",
      },
      {
        id: 5,
        path: "2/1",
      },
      {
        id: 6,
        path: "2/2",
      },
      {
        id: 7,
          path: "2/",
      }
  ]

And I need it to look like this:

[
        {
          id: 1,
          path: "1/",
          children: [
            {
              id: 3,
              path: "1/1",
              children: [
                {
                  id: 2,
                  path: "1/1/1",
                },
                {
                  id: 4,
                  path: "1/1/2",
                }
              ]
            }
          ]
        },
        {
          id: 7,
          path: "2/",
          children: [
            {
              id: 5,
              path: "2/1",
            },
            {
              id: 6,
              path: "2/2",
            },
          ]
        }
      ]

I am trying hard to come up with a good solution to solve this but I could really need som help


问:
Save Excel file on Android device using .NET MAUI Blazor
Note: I am not an app developer and if what I am about to say doesn't make sense, please guide me.

I have developed a cross-platform (Windows and Android) app using .NET MAUI Blazor. Previously, I used TableToExcel.js library to save files in a Blazor WASM app.

I am using the same code and library in my current MAUI Blazor app.

The problem is that it worked fine for the Windows app but doesn't do anything on Android.

function exportReportToExcel(id, fileName, columns = null) {
    fileName += ".xlsx";

    let table = document.getElementById(id);

    TableToExcel.convert(table, {
        name: fileName,
        sheet: {
            name: 'Sheet 1'
        }
    });
}
```

I am calling this method using JSInterop and it downloads a file in Windows but not on Android.

Confession: before trying this I have an idea that it won't work as the browser and (desktop or android) apps are completely different, but I thought to give it a try when I first tried it on the windows app and it worked so I was hoping that it might work on android as well but unfortunately.

Note: if I publish the same code as blazor WASM same code works, but not working for MAUI android app.

Body:
Note: I am not an app developer and if what I am about to say doesn't make sense, please guide me.

I have developed a cross-platform (Windows and Android) app using .NET MAUI Blazor. Previously, I used TableToExcel.js library to save files in a Blazor WASM app.

I am using the same code and library in my current MAUI Blazor app.

The problem is that it worked fine for the Windows app but doesn't do anything on Android.

function exportReportToExcel(id, fileName, columns = null) {
    fileName += ".xlsx";

    let table = document.getElementById(id);

    TableToExcel.convert(table, {
        name: fileName,
        sheet: {
            name: 'Sheet 1'
        }
    });
}

I am calling this method using JSInterop and it downloads a file in Windows but not on Android.

Confession: before trying this I have an idea that it won't work as the browser and (desktop or android) apps are completely different, but I thought to give it a try when I first tried it on the windows app and it worked so I was hoping that it might work on android as well but unfortunately.

Note: if I publish the same code as blazor WASM same code works, but not working for MAUI android app.


问:
How to update default classic theme in docusaurus to avoid appending icon to external links?
I have searched the documentation but cannot seem to find how to change the style of external links in the docusaurus classic-theme. Is this possible?

Inspecting the block element in Firefox shows that all external links in navbar and footer are appended with an icon.

```<code>##a.navbar__link.navbar__item > .iconExternalLink_node_modules-\@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module
</code>```

How do I change the default behaviour of the classic-theme to avoid appending the external link icon?

Body:
I have searched the documentation but cannot seem to find how to change the style of external links in the docusaurus classic-theme. Is this possible?

Inspecting the block element in Firefox shows that all external links in navbar and footer are appended with an icon.

##a.navbar__link.navbar__item > .iconExternalLink_node_modules-\@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module

How do I change the default behaviour of the classic-theme to avoid appending the external link icon?


问:
how to convert triplets to RDF triplets?
I was able to get a set of triplets from the following text: "Christian Drosten works in Germany. Christian Drosten likes to work for Google."

```<code>{'relation': 'country of citizenship', 'head_span': {'text': 'Christian Drosten', 'id': 'Q1079331'}, 'tail_span': {'text': 'Germany', 'id': 'Q183'}}
471a35571b66cc8e1e3415e27f7086505310efc6: {'relation': 'employer', 'head_span': {'text': 'Christian Drosten', 'id': 'Q1079331'}, 'tail_span': {'text': 'Google', 'id': 'Q9366'}}
</code>```

now I am looking how to convert these triplets to RDF triplets and add them to a knowledge graph.

Can someone give me a suggestion on the steps to do? and if there are any frameworks that can do the job?

Body:
I was able to get a set of triplets from the following text: "Christian Drosten works in Germany. Christian Drosten likes to work for Google."

{'relation': 'country of citizenship', 'head_span': {'text': 'Christian Drosten', 'id': 'Q1079331'}, 'tail_span': {'text': 'Germany', 'id': 'Q183'}}
471a35571b66cc8e1e3415e27f7086505310efc6: {'relation': 'employer', 'head_span': {'text': 'Christian Drosten', 'id': 'Q1079331'}, 'tail_span': {'text': 'Google', 'id': 'Q9366'}}

now I am looking how to convert these triplets to RDF triplets and add them to a knowledge graph.

Can someone give me a suggestion on the steps to do? and if there are any frameworks that can do the job?


问:
How to prevent parallel row read on database level with Spring Data JPA
I've tried to implement exclusive read access to some Entity (DB table row). The intention was to force any other reader to wait with row read until previous transaction is over.

I've used @Lock(PESSIMISTIC_WRITE) from Spring Data JPA. Here is my example Entity & repository. I'm testing it with SQL Server 2022 and Hibernate 5.6

    @Entity
    class Product(
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        var id: Long? = null,

        var code: String,
    )

    interface ProductRepository : JpaRepository<Product?, Long?> {
        @Lock(PESSIMISTIC_WRITE)
        fun findByCode(code: String): Product

        fun getByCode(code: String): Product
    }
```

It works as expected when:

first thread reads a row using findByCode and waits before transaction is closed

second thread tries to read the same row using findByCode -> read is blocked (no exception - it just has to wait)

It does not work in case the second thread reads data using getByCode method, which is not annotated.
I understand it like this: second thread cannot acquire another lock on the same row but nothing stops him from just reading the row (ignoring the lock of the first thread).

How could I prevent any other database user from reading my row when I am working with it?

Body:
I've tried to implement exclusive read access to some Entity (DB table row). The intention was to force any other reader to wait with row read until previous transaction is over.

I've used @Lock(PESSIMISTIC_WRITE) from Spring Data JPA. Here is my example Entity & repository. I'm testing it with SQL Server 2022 and Hibernate 5.6

    @Entity
    class Product(
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        var id: Long? = null,

        var code: String,
    )

    interface ProductRepository : JpaRepository<Product?, Long?> {
        @Lock(PESSIMISTIC_WRITE)
        fun findByCode(code: String): Product

        fun getByCode(code: String): Product
    }

It works as expected when:

first thread reads a row using findByCode and waits before transaction is closed

second thread tries to read the same row using findByCode -> read is blocked (no exception - it just has to wait)

It does not work in case the second thread reads data using getByCode method, which is not annotated.
I understand it like this: second thread cannot acquire another lock on the same row but nothing stops him from just reading the row (ignoring the lock of the first thread).

How could I prevent any other database user from reading my row when I am working with it?


问:
Decoding warning messages in SPACY3
I have basically 2 problems. I am using SPACY to train a model and trying to evaluate the same.
When I take the train/test data I am being thrown error:

```<code>    UserWarning: [W030] Some entities could not be aligned in the text "Results of 16S rRNA gene sequence comparisons reve..." with entities "[(67, 72, 'type_strain'), (142, 159, 'organism'), ...". Use `spacy.training.offsets_to_biluo_tags(nlp.make_doc(text), entities)` to check the alignment. Misaligned entities ('-') will be ignored during training.
</code>```

The string in question is:

```<code>    ("Results of 16S rRNA gene sequence comparisons revealed that strain ACD12T shared the highest degree of 16S rRNA gene sequence similarity with Actinomadura sputi DSM 45233T (98.3 %) and Actinomadura hallensis DSM 45043T (97.8 %).",{"entities": [(67, 72, 'type_strain'), (142, 159, 'organism'), (161, 170, 'strain_number'), (185, 206, 'organism'), (208, 217, 'strain_number')]})
</code>```

So my first question is how do I store the warnings in a log file?
And second, I am unable to troubleshoot this particular warning as it turns out of a training set of 3000 sentences this warning afflicts almost half.

Any pointers would be appreciated.

Thanks

Title: Decoding warning messages in SPACY3

Body:
I have basically 2 problems. I am using SPACY to train a model and trying to evaluate the same.
When I take the train/test data I am being thrown error:

    UserWarning: [W030] Some entities could not be aligned in the text "Results of 16S rRNA gene sequence comparisons reve..." with entities "[(67, 72, 'type_strain'), (142, 159, 'organism'), ...". Use `spacy.training.offsets_to_biluo_tags(nlp.make_doc(text), entities)` to check the alignment. Misaligned entities ('-') will be ignored during training.

The string in question is:

    ("Results of 16S rRNA gene sequence comparisons revealed that strain ACD12T shared the highest degree of 16S rRNA gene sequence similarity with Actinomadura sputi DSM 45233T (98.3 %) and Actinomadura hallensis DSM 45043T (97.8 %).",{"entities": [(67, 72, 'type_strain'), (142, 159, 'organism'), (161, 170, 'strain_number'), (185, 206, 'organism'), (208, 217, 'strain_number')]})

So my first question is how do I store the warnings in a log file?
And second, I am unable to troubleshoot this particular warning as it turns out of a training set of 3000 sentences this warning afflicts almost half.

Any pointers would be appreciated.

Thanks


问:
In k8s container run the jenkins and inside the container having issue "found cycle in plugin dependencies: Plugin:jackson2-api -> Plugin:jersey2-api
I upgraded the helm chart from 3.10.8 to 4.2.20 and the Jenkins app from 2.319.2-lts to 2.375.1 (do not change the plugin version in /var/jenkins_home/plugins after the upgrade).
jenkins container having this issue

#reactOnCycle: found cycle in plugin dependencies: (root=Plugin:jackson2-api, deactivating all involved) Plugin:jackson2-api -> Plugin:jersey2-api -> Plugin:jackson2-api
Failed to load: Credentials Plugin (credentials 1214.v1de940103927)

Update required: Configuration as Code Plugin (configuration-as-code 1.55.1) to be updated to 1559.v38a_b_2e3b_6b_b_7 or higher

Update required: Structs Plugin (structs 308.v852b473a2b8c) to be updated to 324.va_f5d6774f3a_d or higher

can you guys guide me how to resolue the jenkins plugin issue

jenkins plugin version not change the presistance volume /var/jenkins_home/plugins


问:
how can I change all cached query data from only a user_id RTK QUERY
I have a problem.

I fetch data with 2 parameters.

user_id and movie_channel

so a user has multiple movie channels like 1,2 or 3.

I fetch now a query with this params:

user_id: 1, movie_channel: 1

obj:

```<code>return {
   user: {
     user_id: 1,
     username: 'assa',
     is_follow: false
   },
   movie_channel: 1,
   movies: []
}
</code>```

then I get a list of movies from this channel and you get users information.

So anyone select now movie_channel 2, then I fetch again and get the obj with different movies.

in the header he can follow a person. (he is current now in movie channel 2)

he can now change the movie_channel to 1 and then I get the cached data. But now user is not followed because he followed in the channel 2. the cache shows the old obj.

how can I change all cached data where only the param is user_id ?

```<code>

    useGetProfileData: builder.query<IProfilePageData, { user_id: number; movie_channel?: number; }>({
      query: (data) => ({
        url: '/profile_data',
        method: 'POST',
        body: data
      }),
    }),

    followUser: builder.mutation<void, { user_id: number; follower_id: number; movie_channel?: number; }>({
      query: (data) => ({
        url: '/follow_user',
        method: 'POST',
        body: data
      }),
      async onQueryStarted({ user_id, follower_id, movie_channel }, { dispatch, queryFulfilled }){

        const patchResult = dispatch(
          ProfileApi.util.updateQueryData('useGetProfileData', { user_id, movie_channel  }, (draft) => {
            return {
              ...draft,
              user: {
                ...draft.user,
                is_follow: !draft.user.is_follow
              }
            }
          })
        );

        try {
          await queryFulfilled;
        } catch {
          patchResult.undo();
        }
      }
    }),
</code>```

Body:
I have a problem.

I fetch data with 2 parameters.

user_id and movie_channel

so a user has multiple movie channels like 1,2 or 3.

I fetch now a query with this params:

user_id: 1, movie_channel: 1

obj:

return {
   user: {
     user_id: 1,
     username: 'assa',
     is_follow: false
   },
   movie_channel: 1,
   movies: []
}

then I get a list of movies from this channel and you get users information.

So anyone select now movie_channel 2, then I fetch again and get the obj with different movies.

in the header he can follow a person. (he is current now in movie channel 2)

he can now change the movie_channel to 1 and then I get the cached data. But now user is not followed because he followed in the channel 2. the cache shows the old obj.

how can I change all cached data where only the param is user_id ?

    useGetProfileData: builder.query<IProfilePageData, { user_id: number; movie_channel?: number; }>({
      query: (data) => ({
        url: '/profile_data',
        method: 'POST',
        body: data
      }),
    }),

    followUser: builder.mutation<void, { user_id: number; follower_id: number; movie_channel?: number; }>({
      query: (data) => ({
        url: '/follow_user',
        method: 'POST',
        body: data
      }),
      async onQueryStarted({ user_id, follower_id, movie_channel }, { dispatch, queryFulfilled }){

        const patchResult = dispatch(
          ProfileApi.util.updateQueryData('useGetProfileData', { user_id, movie_channel  }, (draft) => {
            return {
              ...draft,
              user: {
                ...draft.user,
                is_follow: !draft.user.is_follow
              }
            }
          })
        );

        try {
          await queryFulfilled;
        } catch {
          patchResult.undo();
        }
      }
    }),


问:
MLE for disease dynamics model
I posted another question about this code here  Maximum Likelihood Method for an ageing SIR model
I solved that problem but have encountered another. Here is my code

```<code>    # ---- set initial conditions ----
M_inits     <- P[1]
Sv0_inits   <- P[2] - 0.000049*P[2] - 0.5*P[2] - 0.000012*P[2] - 0.20*P[2] - 0.20*P[2]
Sv_inits    <- P_new[-1]-0.000049*P_new[2:100] - 0.5*P[2:100] - 0.000012*P_new[2:100] - 0.20*P_new[2:100] - 0.20*P_new[2:100]
Iv0_inits   <- 0.000049*P[2]
Iv_inits    <- 0.000049*P_new[2:100]
Sz0_inits   <- 0.5*P[2]-0.000012*P[2]
Sz_inits    <- 0.5*P[2:100]-0.000012*P_new[2:100]
Iz0_inits   <- 0.000012*P[2]
Iz_inits    <- 0.000012*P_new[2:100]
Rz0_inits   <- 0.40*P[2]
Rz_inits    <- 0.40*P_new[2:100]
B10_inits   <- 0
B1_inits    <- 0*P_new[2:100]
VInc0_inits <- 0
VInc_inits  <- c(rep(0,99))
ZInc0_inits <- 0
ZInc_inits  <- c(rep(0,99))

inits_all <- c(M=M_inits, Sv0=Sv0_inits, Sv=Sv_inits,
           Iv0=Iv0_inits,Iv=Iv_inits,
           Sz0 = Sz0_inits,Sz=Sz_inits,
           Iz0=Iz0_inits,Iz=Iz_inits,
           Rz0=Rz0_inits,Rz=Rz_inits,
           B10=B10_inits, B1=B1_inits,
           VInc0=VInc0_inits, VInc=VInc_inits,
           ZInc0=ZInc0_inits, ZInc=ZInc_inits)

T0 <- 0
maxtime <- 1

# ---- Maximum likelihood estimation function for closed SIR model ----
mle.sir <- function(b) {
  beta <- c(rep(0.4,100))

  gamma <-  1/7                  #Recovery rate for varicella - needs to be 7 days
  sigma <- 1/28                  #Recovery rate for zoster - needs to be 28 days
  zeta  <- 0.124              #Scaling of FOI from zoster to varicella
  wb    <- 1/912
  C <- read.csv("/Users/laurenadams/Documents/gitrepo/Varicella/Input CSV/Contact Matrix.csv")
  C <- as.matrix(C)
  T0 <- 0
  maxTime <- 10
  results <- lsoda(inits_all,seq(T0,maxTime,1),varicella_fun_novax,parms=c(beta,C,R,gamma,sigma,zeta,wb,mort,ageing))

  Y <- as.numeric(results[10,])
  Y <- as.numeric(Y[603:702])
  Y <- Y*100000
  Y <- round(Y)
  nll <- -sum(dpois(x=var.data$rounded, lambda=Y, log=TRUE))
  return(nll)
  #return(results)
}

# initial - Initial estimates of beta and gamma
initial <- list(b=beta)
# fit0 - preliminary fit of model to data using the initial estimates
fit0 <- mle2(mle.sir, start=initial, fixed=list(C, R, sigma, zeta, wb, mort, ageing))
</code>```

At this point I get the following error code...
Error in validObject(.Object) :
invalid class “mle2” object: invalid object for slot "fullcoef" in class "mle2": got class "NULL", should be or extend class "numeric"

I tried to define the fullcoef term as follows

```<code>fit0 <- mle2(mle.sir, start=initial, fixed=list(C, R, sigma, zeta, wb, mort, ageing),   fullcoef=list(beta, C, R, sigma, zeta, wb, mort, ageing)
</code>```

But it still doesn't work.

Title: MLE for disease dynamics model

Body:
I posted another question about this code here  Maximum Likelihood Method for an ageing SIR model
I solved that problem but have encountered another. Here is my code

    # ---- set initial conditions ----
M_inits     <- P[1]
Sv0_inits   <- P[2] - 0.000049*P[2] - 0.5*P[2] - 0.000012*P[2] - 0.20*P[2] - 0.20*P[2]
Sv_inits    <- P_new[-1]-0.000049*P_new[2:100] - 0.5*P[2:100] - 0.000012*P_new[2:100] - 0.20*P_new[2:100] - 0.20*P_new[2:100]
Iv0_inits   <- 0.000049*P[2]
Iv_inits    <- 0.000049*P_new[2:100]
Sz0_inits   <- 0.5*P[2]-0.000012*P[2]
Sz_inits    <- 0.5*P[2:100]-0.000012*P_new[2:100]
Iz0_inits   <- 0.000012*P[2]
Iz_inits    <- 0.000012*P_new[2:100]
Rz0_inits   <- 0.40*P[2]
Rz_inits    <- 0.40*P_new[2:100]
B10_inits   <- 0
B1_inits    <- 0*P_new[2:100]
VInc0_inits <- 0
VInc_inits  <- c(rep(0,99))
ZInc0_inits <- 0
ZInc_inits  <- c(rep(0,99))

inits_all <- c(M=M_inits, Sv0=Sv0_inits, Sv=Sv_inits,
           Iv0=Iv0_inits,Iv=Iv_inits,
           Sz0 = Sz0_inits,Sz=Sz_inits,
           Iz0=Iz0_inits,Iz=Iz_inits,
           Rz0=Rz0_inits,Rz=Rz_inits,
           B10=B10_inits, B1=B1_inits,
           VInc0=VInc0_inits, VInc=VInc_inits,
           ZInc0=ZInc0_inits, ZInc=ZInc_inits)

T0 <- 0
maxtime <- 1

# ---- Maximum likelihood estimation function for closed SIR model ----
mle.sir <- function(b) {
  beta <- c(rep(0.4,100))

  gamma <-  1/7                  #Recovery rate for varicella - needs to be 7 days
  sigma <- 1/28                  #Recovery rate for zoster - needs to be 28 days
  zeta  <- 0.124              #Scaling of FOI from zoster to varicella
  wb    <- 1/912
  C <- read.csv("/Users/laurenadams/Documents/gitrepo/Varicella/Input CSV/Contact Matrix.csv")
  C <- as.matrix(C)
  T0 <- 0
  maxTime <- 10
  results <- lsoda(inits_all,seq(T0,maxTime,1),varicella_fun_novax,parms=c(beta,C,R,gamma,sigma,zeta,wb,mort,ageing))

  Y <- as.numeric(results[10,])
  Y <- as.numeric(Y[603:702])
  Y <- Y*100000
  Y <- round(Y)
  nll <- -sum(dpois(x=var.data$rounded, lambda=Y, log=TRUE))
  return(nll)
  #return(results)
}

# initial - Initial estimates of beta and gamma
initial <- list(b=beta)
# fit0 - preliminary fit of model to data using the initial estimates
fit0 <- mle2(mle.sir, start=initial, fixed=list(C, R, sigma, zeta, wb, mort, ageing))

At this point I get the following error code...
Error in validObject(.Object) :
invalid class “mle2” object: invalid object for slot "fullcoef" in class "mle2": got class "NULL", should be or extend class "numeric"

I tried to define the fullcoef term as follows

fit0 <- mle2(mle.sir, start=initial, fixed=list(C, R, sigma, zeta, wb, mort, ageing),   fullcoef=list(beta, C, R, sigma, zeta, wb, mort, ageing)

But it still doesn't work.


问:
Checkbox, when checked dissapears after refresh and never saved to the DB
My checkbox is marking a noteid but whenever page is refreshed the checkbox vanishes. Also it's never saved to the database for some reason. Any ideas?

Part of the relevant code. ( full code in comments)

```<code><div className="Data-flex" key={data.noteId}> <div className="NoteID" style={{ flex: 1 }}> {data.noteId} </div> <Checkbox style={{ flex: 1 }} onChange={handleStatus}
</code>```

Function Below!

```<code>const [Status2, setStatus2] = useState(false);
const handleStatus = (event, data) => {
console.log("Marking todo ... Data : ", data);
setStatus2(true);
  };
</code>```

Body:
My checkbox is marking a noteid but whenever page is refreshed the checkbox vanishes. Also it's never saved to the database for some reason. Any ideas?

Part of the relevant code. ( full code in comments)

 {data.noteId}
 <Checkbox style={{ flex: 1 }} onChange={handleStatus}

Function Below!

const [Status2, setStatus2] = useState(false);
const handleStatus = (event, data) => {
console.log("Marking todo ... Data : ", data);
setStatus2(true);
  };


问:
How to import data into a PowerApps for Teams table lookup column?
I have a table established in PowerApps for Teams. It has a lookup column referring to another table and functions. I have external data that I wish to populate this table with. When using the Dataflow created by the Import function offered by the UI, I cannot put data into this one column. The column is not available for import. All the other data does get pushed into the table as desired. Even one of the Choice columns receives its data.

How would I enable this lookup column to show up and receive data? The solutions I have found have been for the full PowerApps suite for which I don't have a license. They used alternative keys, but I cannot find a means to enable alternate keys in this stripped down version.

I have used data from an excel file both in OneDrive and external.
I have used the data from a SharePoint list to find the same result.
I have attempted to use and Alternate key in the receiving table, but it doesn't seem to be an option for the PowerApps for Teams.
I have formatted the data to be imported to match the lookup options for the receiving table.


问:
Implementing 1:N as N:M in EF Core 6
I have an application where the domain has several parent entities each to which a list of Comments are linked in a master-detail fashion.
Instead of having a Comment table for each parent entity's comments, I have opted to have a single Comment table with links to the parent entities.
The reason for this choice is as follows:

As the application expands with more parent entities, I don't need to add a Comment table for each of them

In order to implement a search where the user can search through comments, it is likely to simply search through a single table (likely will use Lucene)

This is illustrated below

Happy to change my mind re this design choice

The link between the parent entity and Comment acts like a many-many relationship. The domain objects are defined as:

```<code> public class Customer
  {
    public Customer(string name)
    {
      Name = name;
    }
    protected Customer()
    {}

    public long Id { get; set; }
    public string Name { get; set; }

    public virtual ICollection<Comment> Comments { get; }

    public void AddComment(Comment comment)
    {
      Comments.Add(comment);
    }
  }

  public class CustomerComment
  {
    public long Id { get; set; }
    public long CustomerId { get; private set; }
    public long CommentId { get; private set; }
  }

  public class Comment
  {
    public Comment(long createdByUserId, DateTime createdOnDtm, string content)
    {
      CreatedByUserId = createdByUserId;
      CreatedOnDtm = createdOnDtm;
      Content = content;
    }

    protected Comment()
    {}

    public long Id { get; private set; }
    public long CreatedByUserId { get; init; }
    public DateTime CreatedOnDtm { get; init; }
    public string Content { get; init; }
    public virtual ICollection<Customer> Customers { get; private set; }
    //public virtual ICollection<Supplier> Suppliers { get; private set; }
    //public virtual ICollection<Other> Others { get; private set; }
  }
</code>```

However when setting up the EF Core model, it seems I have to have the Customers/Suppliers/Others parent entity collections in the Comment domain object
because the relationship looks like a N:M in the relational model even though it is 1:N in the domain model.
This is what the fluent model definition looks like:

```<code>  modelBuilder.Entity<Customer>()
    .HasMany(p => p.Comments)
    .WithMany(t => t.Customers)
    .UsingEntity<CustomerComment>(
      j => j.HasOne<Comment>().WithMany().HasForeignKey(p => p.CommentId),
      j => j.HasOne<Customer>().WithMany().HasForeignKey(p => p.CustomerId));

  modelBuilder.Entity<Customer>()
    .Navigation(p => p.Comments)
    .UsePropertyAccessMode(PropertyAccessMode.Property);

  modelBuilder.Entity<CustomerComment>()
    .HasKey(x => x.Id);
</code>```

I cannot declare the join type CustomerComment if the Comment does not have the Customers collection. It basically means that my Comment domain object gets 'polluted' with all the possible parent entities
so that EF can understand the link table.
Or is there a way around this?

Title: Implementing 1:N as N:M in EF Core 6

Body:
I have an application where the domain has several parent entities each to which a list of Comments are linked in a master-detail fashion.
Instead of having a Comment table for each parent entity's comments, I have opted to have a single Comment table with links to the parent entities.
The reason for this choice is as follows:

As the application expands with more parent entities, I don't need to add a Comment table for each of them

In order to implement a search where the user can search through comments, it is likely to simply search through a single table (likely will use Lucene)

This is illustrated below

Happy to change my mind re this design choice

The link between the parent entity and Comment acts like a many-many relationship. The domain objects are defined as:

 public class Customer
  {
    public Customer(string name)
    {
      Name = name;
    }
    protected Customer()
    {}

    public long Id { get; set; }
    public string Name { get; set; }

    public virtual ICollection<Comment> Comments { get; }

    public void AddComment(Comment comment)
    {
      Comments.Add(comment);
    }
  }

  public class CustomerComment
  {
    public long Id { get; set; }
    public long CustomerId { get; private set; }
    public long CommentId { get; private set; }
  }

  public class Comment
  {
    public Comment(long createdByUserId, DateTime createdOnDtm, string content)
    {
      CreatedByUserId = createdByUserId;
      CreatedOnDtm = createdOnDtm;
      Content = content;
    }

    protected Comment()
    {}

    public long Id { get; private set; }
    public long CreatedByUserId { get; init; }
    public DateTime CreatedOnDtm { get; init; }
    public string Content { get; init; }
    public virtual ICollection<Customer> Customers { get; private set; }
    //public virtual ICollection<Supplier> Suppliers { get; private set; }
    //public virtual ICollection<Other> Others { get; private set; }
  }

However when setting up the EF Core model, it seems I have to have the Customers/Suppliers/Others parent entity collections in the Comment domain object
because the relationship looks like a N:M in the relational model even though it is 1:N in the domain model.
This is what the fluent model definition looks like:

  modelBuilder.Entity<Customer>()
    .HasMany(p => p.Comments)
    .WithMany(t => t.Customers)
    .UsingEntity<CustomerComment>(
      j => j.HasOne<Comment>().WithMany().HasForeignKey(p => p.CommentId),
      j => j.HasOne<Customer>().WithMany().HasForeignKey(p => p.CustomerId));

  modelBuilder.Entity<Customer>()
    .Navigation(p => p.Comments)
    .UsePropertyAccessMode(PropertyAccessMode.Property);

  modelBuilder.Entity<CustomerComment>()
    .HasKey(x => x.Id);

I cannot declare the join type CustomerComment if the Comment does not have the Customers collection. It basically means that my Comment domain object gets 'polluted' with all the possible parent entities
so that EF can understand the link table.
Or is there a way around this?


问:
ReduceLRonPlateau keeps decreasing LR across multiple models
I'm using ReduceLROnPlateau for multiple experiments, but I'm getting lower and lower initial learning rate for each conjsecutive modewl run.

from tensorflow.keras.callbacks import ReduceLROnPlateau

for model in models:
    reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.2, patience=10)
    model.fit(dataset, epochs=10, validation_data=val_dataset, callbacks=reduce_lr)
```
<p>The learning rate on the output log looks as follows:</p>
```Model #1
  Epoch 1  ... lr: 0.01
  ...
  Epoch 21 ... lr: 0.005

Model #2
  Epoch 1  ... lr: 0.005
  ...
  Epoch 25 ... lr: 0.001
```

and so on. (don't look at the numbers I've siplified the output)

How do I tell the model or to the callback to start from the same learning rate each time?

Body:
I'm using ReduceLROnPlateau for multiple experiments, but I'm getting lower and lower initial learning rate for each conjsecutive modewl run.

from tensorflow.keras.callbacks import ReduceLROnPlateau

for model in models:
    reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.2, patience=10)
    model.fit(dataset, epochs=10, validation_data=val_dataset, callbacks=reduce_lr)

The learning rate on the output log looks as follows:

Model #1
  Epoch 1  ... lr: 0.01
  ...
  Epoch 21 ... lr: 0.005

Model #2
  Epoch 1  ... lr: 0.005
  ...
  Epoch 25 ... lr: 0.001

and so on. (don't look at the numbers I've siplified the output)

How do I tell the model or to the callback to start from the same learning rate each time?


问:
how to find the creator of the IAM access key in aws?
I want to create a lambda function(python) that will list the newly created access keys and who created it.

I tried to find the access key creation using cloud trail. but couldn't find the event name.


问:
selenium js webdriver - connect to active browser session (A browser previously opened by Selenium)
i am using selenium-webdriver package to making a bot, every time i run my code, the webdriver starts a new session and open a new chrome window, i don't want it, i want to my selenium connect to currently active session, for example selenium opend a page with sesssion_id = '5cdfff6e4dfd7e5551795d365db289b2' i want to get this session to my selenium web driver to connect again to that page.

const { Builder, By, Key, util, Browser, until, WebDriver, Session, Capabilities } = require("selenium-webdriver");

let session = new Session('5cdfff6e4dfd7e5551795d365db289b2', Capabilities.chrome())
this.driver = new WebDriver(session)
```
<p>at the end i want to have sometiong like this:</p>
<pre class="lang-js prettyprint-override"><code>thenableWebDriverProxy {
  session_: Promise {
    Session {
      id_: 'e3223ea6f94679f8dbb92a6d89780191',
      caps_: [Capabilities]
    }
  },
  executor_: Executor {
    customCommands_: Map(13) {
      'launchApp' => [Object],
      'getNetworkConditions' => [Object],
      'setNetworkConditions' => [Object],
      'deleteNetworkConditions' => [Object],
      'sendDevToolsCommand' => [Object],
      'sendAndGetDevToolsCommand' => [Object],
      'setPermission' => [Object],
      'getCastSinks' => [Object],
      'setCastSinkToUse' => [Object],
      'startDesktopMirroring' => [Object],
      'setCastTabMirroring' => [Object],
      'getCastIssueMessage' => [Object],
      'stopCasting' => [Object]
    },
    log_: Logger {
      name_: 'webdriver.http.Executor',
      level_: null,
      parent_: [Logger],
      handlers_: null
    },
  },
  fileDetector_: null,
  onQuit_: [Function: onQuit],
  authenticatorId_: null,
  then: [Function: bound then],
  catch: [Function: bound catch]
}
</code>```

i got this when i log form this:

this.driver = new Builder()
            .setChromeOptions(chromeOptions)
            .forBrowser(Browser.CHROME)
            .build()

console.log(this.driver)
```

Body:
i am using selenium-webdriver package to making a bot, every time i run my code, the webdriver starts a new session and open a new chrome window, i don't want it, i want to my selenium connect to currently active session, for example selenium opend a page with sesssion_id = '5cdfff6e4dfd7e5551795d365db289b2' i want to get this session to my selenium web driver to connect again to that page.

const { Builder, By, Key, util, Browser, until, WebDriver, Session, Capabilities } = require("selenium-webdriver");

let session = new Session('5cdfff6e4dfd7e5551795d365db289b2', Capabilities.chrome())
this.driver = new WebDriver(session)

at the end i want to have sometiong like this:

thenableWebDriverProxy {
  session_: Promise {
    Session {
      id_: 'e3223ea6f94679f8dbb92a6d89780191',
      caps_: [Capabilities]
    }
  },
  executor_: Executor {
    customCommands_: Map(13) {
      'launchApp' => [Object],
      'getNetworkConditions' => [Object],
      'setNetworkConditions' => [Object],
      'deleteNetworkConditions' => [Object],
      'sendDevToolsCommand' => [Object],
      'sendAndGetDevToolsCommand' => [Object],
      'setPermission' => [Object],
      'getCastSinks' => [Object],
      'setCastSinkToUse' => [Object],
      'startDesktopMirroring' => [Object],
      'setCastTabMirroring' => [Object],
      'getCastIssueMessage' => [Object],
      'stopCasting' => [Object]
    },
    log_: Logger {
      name_: 'webdriver.http.Executor',
      level_: null,
      parent_: [Logger],
      handlers_: null
    },
  },
  fileDetector_: null,
  onQuit_: [Function: onQuit],
  authenticatorId_: null,
  then: [Function: bound then],
  catch: [Function: bound catch]
}

i got this when i log form this:

this.driver = new Builder()
            .setChromeOptions(chromeOptions)
            .forBrowser(Browser.CHROME)
            .build()

console.log(this.driver)


问:
Availability of WebSocket servers (specifically on AWS RDS)
So, I've created a MySQL database on AWS RDS, and written a client desktop application in a .NET application that uses Sockets to authenticate with, connect to, and manipulate the database, using the endpoint ("xxxxxx.rds.amazon.com") and username/password.  This works great.

I was trying to see if I could accomplish something similar in client javascript.  It seems like the analogous API it offers is WebSockets, which I am familiarizing myself with.  However, it seems to me (mostly from the absence of how-to's on the web) that that endpoint ("xxxxxx.rds.amazon.com") is accessible via Sockets, but not via WebSockets -- and that there is not an alternate route to my MySQL database for WebSockets.  Is this correct?

It makes sense that these are two different types of servers, but generally speaking internet resources are served out to Sockets, but not WebSockets?  If that is true, they are not as analogous as I originally thought; is WebSockets mostly good for communicating between WebSockets clients and servers that I create?  Or can it be used to access good stuff already existing on the internet, as Sockets can be?

(Note: this isn't asking for opinions on the best way to do this, I'm just confirming my impression of the specific way these technologies are used.)

Thank you.


问:
How to add a new device with the fakemodem.sys in the main()?
I try to create a software virtual COM-port without the com0com or other apps. I try to use a fakemodem example. The DriverEntry function is:

```<code>NTSTATUS DriverEntry(
           IN PDRIVER_OBJECT  DriverObject,
           IN PUNICODE_STRING RegistryPath
           )
{
    NTSTATUS            status = STATUS_SUCCESS;
    WDF_DRIVER_CONFIG   config;
    KdPrint(("Fakemode Function Driver Sample - Driver Framework Edition.\n"));
    KdPrint(("Built %s %s\n", __DATE__, __TIME__));
    WDF_DRIVER_CONFIG_INIT( &config, FmEvtDeviceAdd );
    status = WdfDriverCreate(
                            DriverObject,
                            RegistryPath,
                            WDF_NO_OBJECT_ATTRIBUTES,
                            &config,          // Driver Config Info
                            WDF_NO_HANDLE
                            );
    if (!NT_SUCCESS(status)) {
        KdPrint( ("WdfDriverCreate failed with status 0x%x\n", status));
    }
    return status;
}
</code>```

How can I use the fakemodem driver from the main() function of my user-space application? How to add a new device with the fakemodem.sys in the main() ?

Body:
I try to create a software virtual COM-port without the com0com or other apps. I try to use a fakemodem example. The DriverEntry function is:

NTSTATUS DriverEntry(
           IN PDRIVER_OBJECT  DriverObject,
           IN PUNICODE_STRING RegistryPath
           )
{
    NTSTATUS            status = STATUS_SUCCESS;
    WDF_DRIVER_CONFIG   config;
    KdPrint(("Fakemode Function Driver Sample - Driver Framework Edition.\n"));
    KdPrint(("Built %s %s\n", __DATE__, __TIME__));
    WDF_DRIVER_CONFIG_INIT( &config, FmEvtDeviceAdd );
    status = WdfDriverCreate(
                            DriverObject,
                            RegistryPath,
                            WDF_NO_OBJECT_ATTRIBUTES,
                            &config,          // Driver Config Info
                            WDF_NO_HANDLE
                            );
    if (!NT_SUCCESS(status)) {
        KdPrint( ("WdfDriverCreate failed with status 0x%x\n", status));
    }
    return status;
}

How can I use the fakemodem driver from the main() function of my user-space application? How to add a new device with the fakemodem.sys in the main() ?


问:
How to install mysqlclient python package?
I now learn django. On database learn mysql. But dont install mysqlclient. Initially get Microsoft C++ 14.0 or greater than required error. I solve this. I install build tools. But now get another error:

```<code>running build_ext
      building 'MySQLdb._mysql' extension
      creating build\temp.win32-cpython-38
      creating build\temp.win32-cpython-38\Release
      creating build\temp.win32-cpython-38\Release\MySQLdb
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL
/DNDEBUG /MD -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 "-IC:\Program Files (x86)\MariaDB\MariaDB Connector C\include\mariadb"
"-IC:\Program Files (x86)\MariaDB\MariaDB Connector C\include" -IC:\Users\Feruz\.virtualenvs\storefront-GD3EPR4W\include
-Ic:\users\feruz\appdata\local\programs\python\python38-32\include -Ic:\users\feruz\appdata\local\programs\python\python38-32\Include
"-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files
(x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program
Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt"
/TcMySQLdb/_mysql.c /Fobuild\temp.win32-cpython-38\Release\MySQLdb/_mysql.obj
      _mysql.c
      MySQLdb/_mysql.c(29): fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«озҐЁҐ: mysql.h: No such file or directory,
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x86\\cl.exe'
failed with exit code 2

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mysqlclient

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
[0m
Installation Failed
</code>```

How to solve this? Please help me. I use windows

Body:
I now learn django. On database learn mysql. But dont install mysqlclient. Initially get Microsoft C++ 14.0 or greater than required error. I solve this. I install build tools. But now get another error:

running build_ext
      building 'MySQLdb._mysql' extension
      creating build\temp.win32-cpython-38
      creating build\temp.win32-cpython-38\Release
      creating build\temp.win32-cpython-38\Release\MySQLdb
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL
/DNDEBUG /MD -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 "-IC:\Program Files (x86)\MariaDB\MariaDB Connector C\include\mariadb"
"-IC:\Program Files (x86)\MariaDB\MariaDB Connector C\include" -IC:\Users\Feruz\.virtualenvs\storefront-GD3EPR4W\include
-Ic:\users\feruz\appdata\local\programs\python\python38-32\include -Ic:\users\feruz\appdata\local\programs\python\python38-32\Include
"-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.34.31933\ATLMFC\include" "-IC:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files
(x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program
Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt"
/TcMySQLdb/_mysql.c /Fobuild\temp.win32-cpython-38\Release\MySQLdb/_mysql.obj
      _mysql.c
      MySQLdb/_mysql.c(29): fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«озҐЁҐ: mysql.h: No such file or directory,
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x86\\cl.exe'
failed with exit code 2

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mysqlclient

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
[0m
Installation Failed

How to solve this? Please help me. I use windows


问:
Prolog Problems with inquiries
I'm doing inquiries in Prolog, this is the answer.

X
Y

brasil
chile

argentina
uruguay

uruguay
argentina

chile
brasil

But I need the answer to be

X
Y

brasil
chile

uruguay
argentina

This is the code.

```<code>limitrofes(X,Y):-
    limita_con(X,Y)
    ; limita_con(Y,X).

translimitrofes(X,Y) :-
    limitrofes(X,Z),
    limitrofes(Z,Y),
    dif(X,Y).
</code>```

and this is the inquiries

```<code>?- translimitrofes(X,Y).
</code>```

Thank you

Title: Prolog Problems with inquiries

Body:
I'm doing inquiries in Prolog, this is the answer.

X
Y

brasil
chile

argentina
uruguay

uruguay
argentina

chile
brasil

But I need the answer to be

X
Y

brasil
chile

uruguay
argentina

This is the code.

limitrofes(X,Y):-
    limita_con(X,Y)
    ; limita_con(Y,X).

translimitrofes(X,Y) :-
    limitrofes(X,Z),
    limitrofes(Z,Y),
    dif(X,Y).

and this is the inquiries

?- translimitrofes(X,Y).

Thank you


问:
Nested System.import in Javascript
I am struggling with Javascript and System.import

I have the following and further Methods inside

```<code>System.import("frm/core").then(function(core) {
    core.companionScript("something", function ($element, options) {
    "use strict";
</code>```

Now I need to integrate another import System.import("frm/mod/messages") containing a method addMessages

I tried the following

```<code>System.import("frm/core").then(function(core) {
    System.import("frm/mod/messages").then(function() {

    core.companionScript("something", function ($element, options) {
    "use strict";
</code>```

further down in the existing code I try to invoke the addMessage but It does not work at all.
It always fails with an error that the method ist not present.

This is what I try to do in side an existing function

```<code>                 function doSomething(password){
                 ……
                     if(condition) {
                         addMEssages("p1", "p2", {errors : ["errKEy"]});
                               }
                  ……
                 }
</code>```

Title: Nested System.import in Javascript

Body:
I am struggling with Javascript and System.import

I have the following and further Methods inside

System.import("frm/core").then(function(core) {
    core.companionScript("something", function ($element, options) {
    "use strict";

Now I need to integrate another import System.import("frm/mod/messages") containing a method addMessages

I tried the following

System.import("frm/core").then(function(core) {
    System.import("frm/mod/messages").then(function() {

    core.companionScript("something", function ($element, options) {
    "use strict";

further down in the existing code I try to invoke the addMessage but It does not work at all.
It always fails with an error that the method ist not present.

This is what I try to do in side an existing function

                 function doSomething(password){
                 ……
                     if(condition) {
                         addMEssages("p1", "p2", {errors : ["errKEy"]});
                               }
                  ……
                 }


问:
Facing problems when I try to deploy drf + angular to digitalocean droplet
I am trying to deploy my django + angular application to a digitalocean droplet. Here is all the relevant information:

File structure:

home/
USER_NAME/
projectdir/
env/
test_project/
several_django_apps/...

```<code>    dist/
      frontend/
        assets/
          images/...
        index.html
        favicon.ico
        some_relevant_js_files.js

    test_project/
      __init__.py
      asgi.py
      urls.py
      settings.py
      wsgi.py
</code>```

In the above structure, the dist folder has a frontend folder which contains the angular build data. When I try to access my domain, I get a 500 Internal Server error. Now, here is my nginx configuration:

```<code>server {
        listen 80;
        server_name IP_ADDRESS www.DOMAIN_NAME DOMAIN_NAME;
        location = /favicon.ico { access_log off; log_not_found off; }
        location /api/ {
                include proxy_params;
                proxy_pass http://unix:/run/gunicorn.sock;
        }
        location / {
                root /home/USER_NAME/projectdir/test_project/dist/frontend;
                try_files /index.html $uri $uri/;
        }
}
</code>```

When I run sudo tail -f /var/log/nginx/error.log, I get the following errors:

[crit] 2446#2446: *9 stat() "/home/USER_NAME/projectdir/test_project/dist/frontend/index.html" failed (13: Permission denied)
[crit] 2446#2446: *9 stat() "/home/USER_NAME/projectdir/test_project/dist/frontend///////////" failed (13: Permission denied)
[error] 2446#2446: 2446#2446: *9 rewrite or internal redirection cycle while internally redirecting to "////////////"

I am extremely new to all of this stuff so I apologize for any silly errors on my end. If you require any other information please let me know. Thanks!

I also tried increasing the memory of my droplet if that were an issue. But even that did not help

Body:
I am trying to deploy my django + angular application to a digitalocean droplet. Here is all the relevant information:

File structure:

home/
USER_NAME/
projectdir/
env/
test_project/
several_django_apps/...

    dist/
      frontend/
        assets/
          images/...
        index.html
        favicon.ico
        some_relevant_js_files.js

    test_project/
      __init__.py
      asgi.py
      urls.py
      settings.py
      wsgi.py

In the above structure, the dist folder has a frontend folder which contains the angular build data. When I try to access my domain, I get a 500 Internal Server error. Now, here is my nginx configuration:

server {
        listen 80;
        server_name IP_ADDRESS www.DOMAIN_NAME DOMAIN_NAME;
        location = /favicon.ico { access_log off; log_not_found off; }
        location /api/ {
                include proxy_params;
                proxy_pass http://unix:/run/gunicorn.sock;
        }
        location / {
                root /home/USER_NAME/projectdir/test_project/dist/frontend;
                try_files /index.html $uri $uri/;
        }
}

When I run sudo tail -f /var/log/nginx/error.log, I get the following errors:

[crit] 2446#2446: *9 stat() "/home/USER_NAME/projectdir/test_project/dist/frontend/index.html" failed (13: Permission denied)
[crit] 2446#2446: *9 stat() "/home/USER_NAME/projectdir/test_project/dist/frontend///////////" failed (13: Permission denied)
[error] 2446#2446: 2446#2446: *9 rewrite or internal redirection cycle while internally redirecting to "////////////"

I am extremely new to all of this stuff so I apologize for any silly errors on my end. If you require any other information please let me know. Thanks!

I also tried increasing the memory of my droplet if that were an issue. But even that did not help


问:
Accessing local configuration files from the browser
I need to access parameters that is related to the specific machine on which the web app is running.
The app is a browser app run on company premises and not intended for everyone to use.

Parameters that need to be stored locally are Terminal number, scanner specific decoding and many others.

There will be an install procedure on each machine and Application folder created in which the parameter files would reside.

The app is JavaScript and node and MongoDb

What type of files would you recommend?
Typical INI
Json
XML

Norm

I have not tried anything at the moment as it is in analysis stage.


问:
Multiprocessing.Pool not speeding up overall computation
I try to do a hyperparameters search for a Deep Reinforcement Learning algorithm using Pytorch.

I have a list of hyperparameters hyperparams_list to try and a function test_hyperparams() that creates and test my RL model corresponding to the given hyperparams.
I have a 16 cores machine and a GPU so I would like to do this using multiprocessing and Cuda.
This is what I tried to do so:

```<code>from multiprocessing import Pool

def test_hyperparams(hyperparams):
    # initialize RL model with hyperparams as input
    # train RL algo while logging results

hyperparams_list = [hyperparams0, ...,hyperparamsN]
with Pool(num_cores) as p:
    infos = p.map(test_hyperparams, hyperparams_list)
</code>```

Running this code, I noticed that it actually did not speed up my hyperparameters search, since each training was taking 16 times longer than before.

Yet, by typing the commands top and nvidia-smi in the terminal, I could see that each of the 16 processes was taking the expected amount of GPU memory and was running on multiple cores.

Body:
I try to do a hyperparameters search for a Deep Reinforcement Learning algorithm using Pytorch.

I have a list of hyperparameters hyperparams_list to try and a function test_hyperparams() that creates and test my RL model corresponding to the given hyperparams.
I have a 16 cores machine and a GPU so I would like to do this using multiprocessing and Cuda.
This is what I tried to do so:

from multiprocessing import Pool

def test_hyperparams(hyperparams):
    # initialize RL model with hyperparams as input
    # train RL algo while logging results

hyperparams_list = [hyperparams0, ...,hyperparamsN]
with Pool(num_cores) as p:
    infos = p.map(test_hyperparams, hyperparams_list)

Running this code, I noticed that it actually did not speed up my hyperparameters search, since each training was taking 16 times longer than before.

Yet, by typing the commands top and nvidia-smi in the terminal, I could see that each of the 16 processes was taking the expected amount of GPU memory and was running on multiple cores.


问:
cordova purchase finish() not fired
I am using the latest version of the cordova purchase plugin (by j3k0).

I have a problem, the finish() even never gets called. But Only on Android.

Does anyone have this problem too? I must add that the pop up to pay is called, I can make the payment, and I get an 'Ok' answer. So it must mean the purchase was saved, but the finished() event never fires.

Thank you for your help!

This is my code.

```<code>  this.CdvPurchase.store
            .when()
            .productUpdated(product => {
                this.logObjet('when productUpdated:product', product);
            })
            .approved(transaction => {
                this.logObjet('when approved:transaction', transaction);

                transaction.finish();
                const produitVerification = this.CdvPurchase.store.get(this.valeurEnvoi.app, plateformeStore);
                const transactionVerification = this.CdvPurchase.store.findInLocalReceipts(produitVerification);
                this.logObjet('when approved:produitVerification', produitVerification);
                this.logObjet('when approved:transactionVerification', transactionVerification);

                // transaction.verify();
            })
            .verified(receipt => {
                 this.logObjet('when verified:receipt', receipt);
                 receipt.finish();
                 // this.enregistrerPaiementMobile(informationsTransaction);
             }).finished(receipt => {
                this.logObjet('when finished:receipt', receipt);
                const produitVerification = this.CdvPurchase.store.get(this.valeurEnvoi.app, plateformeStore);
                const transactionVerification = this.CdvPurchase.store.findInLocalReceipts(produitVerification);
                this.logObjet('when finished:produitVerification', produitVerification);
                this.logObjet('when finished:transactionVerification', transactionVerification);
                // this.enregistrerPaiementMobile(informationsTransaction);
            });

        this.CdvPurchase.store.register([
            {
                id: this.valeurEnvoi.app,
                platform: plateformeStore,
                type: typeProduit,
            },
        ]);

        this.CdvPurchase.store.ready(() => {
            const produit = this.CdvPurchase.store.get(this.valeurEnvoi.app, plateformeStore);

            this.logObjet('when ready:store.get:produit', produit, 'offers');

            if (produit.canPurchase) {
                this.CdvPurchase.store.order(produit.getOffer());
            }

        });

        this.CdvPurchase.store.initialize([
            plateformeStore,
        ]);
</code>```

Title: cordova purchase finish() not fired

Body:
I am using the latest version of the cordova purchase plugin (by j3k0).

I have a problem, the finish() even never gets called. But Only on Android.

Does anyone have this problem too? I must add that the pop up to pay is called, I can make the payment, and I get an 'Ok' answer. So it must mean the purchase was saved, but the finished() event never fires.

Thank you for your help!

This is my code.

  this.CdvPurchase.store
            .when()
            .productUpdated(product => {
                this.logObjet('when productUpdated:product', product);
            })
            .approved(transaction => {
                this.logObjet('when approved:transaction', transaction);

                transaction.finish();
                const produitVerification = this.CdvPurchase.store.get(this.valeurEnvoi.app, plateformeStore);
                const transactionVerification = this.CdvPurchase.store.findInLocalReceipts(produitVerification);
                this.logObjet('when approved:produitVerification', produitVerification);
                this.logObjet('when approved:transactionVerification', transactionVerification);

                // transaction.verify();
            })
            .verified(receipt => {
                 this.logObjet('when verified:receipt', receipt);
                 receipt.finish();
                 // this.enregistrerPaiementMobile(informationsTransaction);
             }).finished(receipt => {
                this.logObjet('when finished:receipt', receipt);
                const produitVerification = this.CdvPurchase.store.get(this.valeurEnvoi.app, plateformeStore);
                const transactionVerification = this.CdvPurchase.store.findInLocalReceipts(produitVerification);
                this.logObjet('when finished:produitVerification', produitVerification);
                this.logObjet('when finished:transactionVerification', transactionVerification);
                // this.enregistrerPaiementMobile(informationsTransaction);
            });

        this.CdvPurchase.store.register([
            {
                id: this.valeurEnvoi.app,
                platform: plateformeStore,
                type: typeProduit,
            },
        ]);

        this.CdvPurchase.store.ready(() => {
            const produit = this.CdvPurchase.store.get(this.valeurEnvoi.app, plateformeStore);

            this.logObjet('when ready:store.get:produit', produit, 'offers');

            if (produit.canPurchase) {
                this.CdvPurchase.store.order(produit.getOffer());
            }

        });

        this.CdvPurchase.store.initialize([
            plateformeStore,
        ]);


问:
Converting a public key in string format to cryptokey in SubtleCrypto
I'm trying to use crypto module in js and subtleCrypto to encode a string with a public key. I want to give the public key as a string but my code in subtle crypto throws error that "parameter 2 is not of type 'CryptoKey'. here's my code:</p>
```<code>const handleEncodeClick = () => {
 const crypto = window.crypto.subtle;
 crypto.encrypt({name: "RSA-OAEP"}, publicKey, new TextEncoder().encode(myMsg))
  .then(encrypted => {
   setEncoded(new Uint8Array(encrypted));
  })
  .catch(err => {
   console.log(err);
  });
 };
</code>```

Body:
I'm trying to use crypto module in js and subtleCrypto to encode a string with a public key. I want to give the public key as a string but my code in subtle crypto throws error that "parameter 2 is not of type 'CryptoKey'. here's my code:

const handleEncodeClick = () => {
 const crypto = window.crypto.subtle;
 crypto.encrypt({name: "RSA-OAEP"}, publicKey, new TextEncoder().encode(myMsg))
  .then(encrypted => {
   setEncoded(new Uint8Array(encrypted));
  })
  .catch(err => {
   console.log(err);
  });
 };


问:
Copy build artifacts to Azure Blob Storage
I am using the Azure File Copy tasks in DevOps to copy the artifacts from Git to a Blob storage that sits under my subscription:

However the Azure File Copy tasks never completes. The task continues to run. I'm wondering if it's because of permission issue where my subscription can't write to the Blob storage. Is there something I'm doing wrong?

```<code>steps:
- task: AzureFileCopy@5
  displayName: 'AzureBlob File Copy'
  inputs:
    SourcePath: '$(System.DefaultWorkingDirectory)/_ADF-MRSG-Tide-Continuous-Integration-Build/ArmTemplates'
    azureSubscription: 'BDAP-PRD-PIPELINE-CONN (xxxxxxxx)'
    Destination: AzureBlob
    storage: mrsgtideprdwedev
    ContainerName: 'azure-artifacts'
</code>```

EDIT
Log information:

```<code>2023-01-12T17:01:15.4423974Z ##[section]Starting: AzureBlob File Copy
2023-01-12T17:01:15.4550000Z ==============================================================================
2023-01-12T17:01:15.4550253Z Task         : Azure file copy
2023-01-12T17:01:15.4550388Z Description  : Copy files to Azure Blob Storage or virtual machines
2023-01-12T17:01:15.4550590Z Version      : 5.210.1
2023-01-12T17:01:15.4550713Z Author       : Microsoft Corporation
2023-01-12T17:01:15.4550863Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2023-01-12T17:01:15.4551268Z ==============================================================================
2023-01-12T17:01:20.7123632Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Accounts\2.10.4\Az.Accounts.psd1 -Global
2023-01-12T17:01:22.8437792Z ##[warning]Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide
2023-01-12T17:01:31.6898708Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
2023-01-12T17:01:32.5179394Z ##[command]Clear-AzContext -Scope Process
2023-01-12T17:01:32.5180271Z ##[command]Connect-AzAccount -ServicePrincipal -Tenant xxx -Credential System.Management.Automation.PSCredential -Environment AzureCloud @processScope
2023-01-12T17:01:35.1239900Z ##[command] Set-AzContext -SubscriptionId xxx -TenantId xxx
2023-01-12T17:01:36.0411697Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Resources\6.3.1\Az.Resources.psd1 -Global
2023-01-12T17:01:39.1422423Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Storage\5.0.0\Az.Storage.psd1 -Global
2023-01-12T17:01:41.0099745Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Compute\5.0.0\Az.Compute.psd1 -Global
2023-01-12T17:01:44.7529810Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Network\5.0.0\Az.Network.psd1 -Global
2023-01-12T17:01:45.5713749Z ##[warning]The names of some imported commands from the module 'Microsoft.Azure.PowerShell.Cmdlets.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
2023-01-12T17:01:45.8587032Z ##[warning]The names of some imported commands from the module 'Az.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
2023-01-12T17:11:24.8085548Z ##[command]Disconnect-AzAccount -Scope Process -ErrorAction Stop
2023-01-12T17:11:24.8364623Z ##[command]Clear-AzContext -Scope Process -ErrorAction Stop
2023-01-12T17:11:24.9976554Z ##[error]This request is not authorized to perform this operation.
RequestId:0e6ffe85-601e-0047-3da8-2639da000000
Time:2023-01-12T17:11:24.5146395Z
Status: 403 (This request is not authorized to perform this operation.)
ErrorCode: AuthorizationFailure

Content:
<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthorizationFailure</Code><Message>This request is not authorized to perform this operation.
RequestId:0e6ffe85-601e-0047-3da8-2639da000000
Time:2023-01-12T17:11:24.5146395Z</Message></Error>

Headers:
x-ms-request-id: 0e6ffe85-601e-0047-3da8-2639da000000
x-ms-client-request-id: 069ac45e-6638-4d55-9ece-39522ed6f5c5
x-ms-error-code: AuthorizationFailure
Content-Length: 246
Content-Type: application/xml
Date: Thu, 12 Jan 2023 17:11:24 GMT
Server: Microsoft-HTTPAPI/2.0

2023-01-12T17:11:25.0733282Z ##[section]Finishing: AzureBlob File Copy
</code>```

Body:
I am using the Azure File Copy tasks in DevOps to copy the artifacts from Git to a Blob storage that sits under my subscription:

However the Azure File Copy tasks never completes. The task continues to run. I'm wondering if it's because of permission issue where my subscription can't write to the Blob storage. Is there something I'm doing wrong?

steps:
- task: AzureFileCopy@5
  displayName: 'AzureBlob File Copy'
  inputs:
    SourcePath: '$(System.DefaultWorkingDirectory)/_ADF-MRSG-Tide-Continuous-Integration-Build/ArmTemplates'
    azureSubscription: 'BDAP-PRD-PIPELINE-CONN (xxxxxxxx)'
    Destination: AzureBlob
    storage: mrsgtideprdwedev
    ContainerName: 'azure-artifacts'

EDIT
Log information:

2023-01-12T17:01:15.4423974Z ##[section]Starting: AzureBlob File Copy
2023-01-12T17:01:15.4550000Z ==============================================================================
2023-01-12T17:01:15.4550253Z Task         : Azure file copy
2023-01-12T17:01:15.4550388Z Description  : Copy files to Azure Blob Storage or virtual machines
2023-01-12T17:01:15.4550590Z Version      : 5.210.1
2023-01-12T17:01:15.4550713Z Author       : Microsoft Corporation
2023-01-12T17:01:15.4550863Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2023-01-12T17:01:15.4551268Z ==============================================================================
2023-01-12T17:01:20.7123632Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Accounts\2.10.4\Az.Accounts.psd1 -Global
2023-01-12T17:01:22.8437792Z ##[warning]Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide
2023-01-12T17:01:31.6898708Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
2023-01-12T17:01:32.5179394Z ##[command]Clear-AzContext -Scope Process
2023-01-12T17:01:32.5180271Z ##[command]Connect-AzAccount -ServicePrincipal -Tenant xxx -Credential System.Management.Automation.PSCredential -Environment AzureCloud @processScope
2023-01-12T17:01:35.1239900Z ##[command] Set-AzContext -SubscriptionId xxx -TenantId xxx
2023-01-12T17:01:36.0411697Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Resources\6.3.1\Az.Resources.psd1 -Global
2023-01-12T17:01:39.1422423Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Storage\5.0.0\Az.Storage.psd1 -Global
2023-01-12T17:01:41.0099745Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Compute\5.0.0\Az.Compute.psd1 -Global
2023-01-12T17:01:44.7529810Z ##[command]Import-Module -Name C:\Modules\az_9.0.1\Az.Network\5.0.0\Az.Network.psd1 -Global
2023-01-12T17:01:45.5713749Z ##[warning]The names of some imported commands from the module 'Microsoft.Azure.PowerShell.Cmdlets.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
2023-01-12T17:01:45.8587032Z ##[warning]The names of some imported commands from the module 'Az.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
2023-01-12T17:11:24.8085548Z ##[command]Disconnect-AzAccount -Scope Process -ErrorAction Stop
2023-01-12T17:11:24.8364623Z ##[command]Clear-AzContext -Scope Process -ErrorAction Stop
2023-01-12T17:11:24.9976554Z ##[error]This request is not authorized to perform this operation.
RequestId:0e6ffe85-601e-0047-3da8-2639da000000
Time:2023-01-12T17:11:24.5146395Z
Status: 403 (This request is not authorized to perform this operation.)
ErrorCode: AuthorizationFailure

Content:
<?xml version="1.0" encoding="utf-8"?><Error>AuthorizationFailure<Message>This request is not authorized to perform this operation.
RequestId:0e6ffe85-601e-0047-3da8-2639da000000
Time:2023-01-12T17:11:24.5146395Z</Message></Error>

Headers:
x-ms-request-id: 0e6ffe85-601e-0047-3da8-2639da000000
x-ms-client-request-id: 069ac45e-6638-4d55-9ece-39522ed6f5c5
x-ms-error-code: AuthorizationFailure
Content-Length: 246
Content-Type: application/xml
Date: Thu, 12 Jan 2023 17:11:24 GMT
Server: Microsoft-HTTPAPI/2.0

2023-01-12T17:11:25.0733282Z ##[section]Finishing: AzureBlob File Copy


问:
How to launch an app with server link in python
I am trying to launch a mobile app with a server link in python,  I am using a tool called airtest that connects to my phone from the computer, I have done this in the past, but do not have access to the old code as an example, it was somehow done with something along the line of Shell([server-link])

Its just one line that I need, it was something like $shell("[server-link]")


问:
RestTemplate: Getting location header in success case, mapping to DTO in 400 case
I use the following code to get the location that is returned by a call that i make:

```<code>URI location;
try {
   location = restTemplate.postForLocation(uri, requestEntity);
} catch (HttpClientErrorException | HttpServerErrorException exception) {

}
</code>```

This works fine in the success case. But now in the error case, but only if the status code indicates a client error, I'd like to parse the body of the error that contains some JSON into a DTO. I could do that manually using a JSONMapper for instance, but isn't there a more elegant way to do that?

Body:
I use the following code to get the location that is returned by a call that i make:

URI location;
try {
   location = restTemplate.postForLocation(uri, requestEntity);
} catch (HttpClientErrorException | HttpServerErrorException exception) {

}

This works fine in the success case. But now in the error case, but only if the status code indicates a client error, I'd like to parse the body of the error that contains some JSON into a DTO. I could do that manually using a JSONMapper for instance, but isn't there a more elegant way to do that?


问:
How to use Azure Custom Commands API with react native (expo)
I am trying to get Azure Speech Services Custom Commands to work with react native. I am unable to find examples in javascript that use Custom Commands. Has anyone created an application that I can refer to? I found the following resources but they do not show how to use Custom Commands specifically.

https://github.com/microsoft/cognitive-services-sdk-react-native-example/tree/main/ExampleTSProject

This one has JS code but does not show how to use microphone to send audio to the API.

https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-custom-commands-setup-speech-sdk

This one has example in C# for which I wrote JS equivalent code which does not work.

This is my code right now, I am able to record audio using expo-av but don't know how to convert it to audio stream and pass it to SDK.

import 'react-native-get-random-values';
import { useState, useEffect } from 'react';
import { Audio } from 'expo-av';
import { StyleSheet, Button, View } from 'react-native';
import * as SpeechSDK from 'microsoft-cognitiveservices-speech-sdk';

const APPLICATION_ID = '6e3b5880-918e-11ed-a04e-cf28b0773cf7';
const SPEECH_KEY = '51ecddfd91564074b3cb2cee2f9e4f52';
const SPEECH_RESOURCE_REGION = 'centralindia'

export default function App() {

  const [recording, setRecording] = useState();
  const [dialogueServiceConnector, setDialogueServiceConnector] = useState();
  const [lastRecordedSound, setLastRecordedSound] = useState();

  function initializeDialogueServiceConnector() {
    const commandsConfig = new SpeechSDK.CustomCommandsConfig.fromSubscription(APPLICATION_ID, SPEECH_KEY, SPEECH_RESOURCE_REGION);
    const connector = new SpeechSDK.DialogServiceConnector(commandsConfig);
    connector.activityReceived = (sender, arg) => {
      console.log(`Activity received, activity=${arg.activity}`);
      let buff = [];
      arg.audioStream.read(buff);
      console.log(`Buffer: ${buff}`);
    }
    connector.canceled = (sender, arg) => {
      console.log(`Cancelled, reason=${arg.reason}`);
      if (arg.reason === SpeechSDK.CancellationReason.Error) {
        console.log(`Error: code=${arg.errorCode}, details=${arg.errorDetails}`);
      }
    }
    connector.recognizing = (sender, arg) => {
      console.log(`Recognizing! in-progress text=${arg.result.text}`);
    }
    connector.recognized = (sender, arg) => {
      console.log(`Final speech-to-text result: ${arg.result.text}`);
    }
    connector.sessionStarted = (sender, arg) => {
      console.log(`Now listening! session started, id=${arg.sessionId}`);
    }
    connector.sessionStopped = (sender, arg) => {
      console.log(`Listening complete. session ended, id=${arg.sessionId}`);
    }
    setDialogueServiceConnector(connector);
    console.log("initialized");
  }

  useEffect(() => {
    initializeDialogueServiceConnector();
  }, [])

  async function playSound() {
    if (lastRecordedSound) {
      await lastRecordedSound.playAsync()
    }
  }

  async function startRecording() {
    /*
    console.log(dialogueServiceConnector)
    dialogueServiceConnector.listenOnceAsync(() => {
      console.log("Recording complete")
    });
    setRecording(true);
    */
    try {
      await Audio.requestPermissionsAsync();
      await Audio.setAudioModeAsync({
        allowsRecordingIOS: true,
        playsInSilentModeIOS: true,
      });
      const { recording } = await Audio.Recording.createAsync(
        Audio.RecordingOptionsPresets.HIGH_QUALITY
      );
      setRecording(recording);
    } catch (err) {
      console.error('Failed to start recording', err);
    }
  }

  async function stopRecording() {
    /*
    setRecording(false);
    */
    await recording.stopAndUnloadAsync();
    await Audio.setAudioModeAsync({
      allowsRecordingIOS: false,
      playsInSilentModeIOS: true,
    });
    const { sound } = await recording.createNewLoadedSoundAsync();
    setLastRecordedSound(sound)
  }

  return (
    <View style={styles.container}>
      <Button
        title={recording ? 'Stop Recording' : 'Start Recording'}
        onPress={recording ? stopRecording : startRecording}
      />
      <Button
        title='Play recording'
        onPress={playSound}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
```


问:
Apache Nifi Fails to start
I am trying to install and start apache Nifi in order to access the browser UI on my Windows system.

When I download and extract the latest version of NiFi, after running the run-nifi bat file I get the following error:

2023-01-12 11:20:51,597 INFO [main] org.apache.nifi.bootstrap.Command Generating Self-Signed Certificate: Expires on 2023-03-13
2023-01-12 11:20:53,772 INFO [main] org.apache.nifi.bootstrap.Command Generated Self-Signed Certificate SHA-256: 5E63D14A2D5640344E58C1EB5C005F9753734DF7657D08D200A66B6CE8F0AF33
2023-01-12 11:20:53,787 INFO [main] org.apache.nifi.bootstrap.Command Starting Apache NiFi...
2023-01-12 11:20:53,787 INFO [main] org.apache.nifi.bootstrap.Command Working Directory: C:\NIFI-1~1.0
2023-01-12 11:20:53,787 INFO [main] org.apache.nifi.bootstrap.Command Command: C:\Program Files\Java\zulu8.46.0.19-ca-jdk8.0.252-win_x64\bin\java.exe -classpath C:\NIFI-1~1.0.\conf;C:\NIFI-1~1.0.\lib\javax.servlet-api-3.1.0.jar;C:\NIFI-1~1.0.\lib\jcl-over-slf4j-1.7.36.jar;C:\NIFI-1~1.0.\lib\jetty-schemas-5.2.jar;C:\NIFI-1~1.0.\lib\jul-to-slf4j-1.7.36.jar;C:\NIFI-1~1.0.\lib\log4j-over-slf4j-1.7.36.jar;C:\NIFI-1~1.0.\lib\logback-classic-1.2.11.jar;C:\NIFI-1~1.0.\lib\logback-core-1.2.11.jar;C:\NIFI-1~1.0.\lib\nifi-api-1.18.0.jar;C:\NIFI-1~1.0.\lib\nifi-framework-api-1.18.0.jar;C:\NIFI-1~1.0.\lib\nifi-nar-utils-1.18.0.jar;C:\NIFI-1~1.0.\lib\nifi-properties-1.18.0.jar;C:\NIFI-1~1.0.\lib\nifi-property-utils-1.18.0.jar;C:\NIFI-1~1.0.\lib\nifi-runtime-1.18.0.jar;C:\NIFI-1~1.0.\lib\nifi-server-api-1.18.0.jar;C:\NIFI-1~1.0.\lib\nifi-stateless-api-1.18.0.jar;C:\NIFI-1~1.0.\lib\nifi-stateless-bootstrap-1.18.0.jar;C:\NIFI-1~1.0.\lib\slf4j-api-1.7.36.jar -Dorg.apache.jasper.compiler.disablejsr199=true -Xmx512m -Xms512m -Dcurator-log-only-first-connection-issue-as-error-level=true -Djavax.security.auth.useSubjectCredsOnly=true -Djava.security.egd=file:/dev/urandom -Dzookeeper.admin.enableServer=false -Dsun.net.http.allowRestrictedHeaders=true -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Djava.protocol.handler.pkgs=sun.net.www.protocol -Dnifi.properties.file.path=C:\NIFI-1~1.0.\conf\nifi.properties -Dnifi.bootstrap.listen.port=49551 -Dapp=NiFi -Dorg.apache.nifi.bootstrap.config.log.dir=C:\NIFI-1~1.0\bin..\logs org.apache.nifi.NiFi
2023-01-12 11:20:53,787 INFO [main] org.apache.nifi.bootstrap.Command Failed to determine Process ID from [java.lang.ProcessImpl]: java.lang.Process.pid()
2023-01-12 11:20:53,787 WARN [main] org.apache.nifi.bootstrap.Command Launched Apache NiFi but could not determined the Process ID

I am currently running java zulu8.46.0.19-ca-jdk8.0.252-win_x64

Here is the download I used:
https://www.apache.org/dyn/closer.lua?path=/nifi/1.19.1/nifi-1.19.1-bin.zip

Any help would be appreciated

Title: Apache Nifi Fails to start


问:
How to get gql return type of resolver from within resolver?
EDIT: Maybe a simpler question - Is there any way of accessing __typename in a resolver? like this php question https://github.com/webonyx/graphql-php/discussions/1087

I am trying to prevent manually defining the type arg of fieldWasRequested below. Can I reliably get this string from within the resolver? This would be the same as the resolvers __typename value. I found a way that kinda gets close but is ultimately too brittle.

I am using parseResolveInfo from graphql-parse-resolve-info to check if a field was requested in a resolver. In order to do this, I need to access the type name of the resolver. Currently I am manually setting this and getting the name by looking at the graphql schema file.

```<code>import { parseResolveInfo } from 'graphql-parse-resolve-info'

export const fieldWasRequested = (field: string, type: string, info: GraphQLResolveInfo) => {
  const parsedInfo = parseResolveInfo(info)
  const fields = parsedInfo?.fieldsByTypeName?.[type] ?? {}

  return field in fields
}

export const thing1: Resolvers['thing1'] = async (parent, args, ctx, info): Promise<Thing1[]> => {
  const fieldWasRequested = fieldWasRequested('field1', 'Thing1', info)
  // continued ...
}
</code>```

I see there is info.returnType, which is this GraphQLOutputType. This is a unioin of many types, all of which seem to have a toString method.

Logging info.returnType.toString() returns [Thing1]. This is an array of Thing1. But for other resolvers it could be Thing2, [Thing3!]!, etc. It's just not feasible to parse from this. Is there a better way?

Body:
EDIT: Maybe a simpler question - Is there any way of accessing __typename in a resolver? like this php question https://github.com/webonyx/graphql-php/discussions/1087

I am trying to prevent manually defining the type arg of fieldWasRequested below. Can I reliably get this string from within the resolver? This would be the same as the resolvers __typename value. I found a way that kinda gets close but is ultimately too brittle.

I am using parseResolveInfo from graphql-parse-resolve-info to check if a field was requested in a resolver. In order to do this, I need to access the type name of the resolver. Currently I am manually setting this and getting the name by looking at the graphql schema file.

import { parseResolveInfo } from 'graphql-parse-resolve-info'

export const fieldWasRequested = (field: string, type: string, info: GraphQLResolveInfo) => {
  const parsedInfo = parseResolveInfo(info)
  const fields = parsedInfo?.fieldsByTypeName?.[type] ?? {}

  return field in fields
}

export const thing1: Resolvers['thing1'] = async (parent, args, ctx, info): Promise<Thing1[]> => {
  const fieldWasRequested = fieldWasRequested('field1', 'Thing1', info)
  // continued ...
}

I see there is info.returnType, which is this GraphQLOutputType. This is a unioin of many types, all of which seem to have a toString method.

Logging info.returnType.toString() returns [Thing1]. This is an array of Thing1. But for other resolvers it could be Thing2, [Thing3!]!, etc. It's just not feasible to parse from this. Is there a better way?


问:
Multiple SQL Schemas in one SAS Library (Schemas with common Table names)
I want to create a SAS library with ODBC engine that is on the level of a SQL database and not schema.
So,I have to have multiple sql server schemas in a sas library. An additional problem to it is, that the schemas have common table names (also table with identical names) but different contents and I would like to have all tables (also union) in the SAS library.
I am currently using the following approach:

```<code>libname schemaA odbc
               schema="schemaA"
               noprompt="....";
libname schemaB odbc
               schema="schemaB"
               noprompt="....";
libname sql_database (schemaA schemaB);
</code>```

But it has still the problem with the common table names.
Is there a way to solve the problem?
PROC DATASETS with CHANGE is not an option, as I may not change table names on the SQL server. I am aware of the solution making the copies of the SQL Tables (e.g. using proc import instead of libname & odbc engine) in SAS, but would like to know if there is a way to have "live" data in a sas library from miltiple SQL schemas (with common table names).

```<code>libname schemaA odbc
               schema="schemaA"
               noprompt="....";
libname schemaB odbc
               schema="schemaB"
               noprompt="....";
libname sql_database (schemaA schemaB);
</code>```

Body:
I want to create a SAS library with ODBC engine that is on the level of a SQL database and not schema.
So,I have to have multiple sql server schemas in a sas library. An additional problem to it is, that the schemas have common table names (also table with identical names) but different contents and I would like to have all tables (also union) in the SAS library.
I am currently using the following approach:

libname schemaA odbc
               schema="schemaA"
               noprompt="....";
libname schemaB odbc
               schema="schemaB"
               noprompt="....";
libname sql_database (schemaA schemaB);

But it has still the problem with the common table names.
Is there a way to solve the problem?
PROC DATASETS with CHANGE is not an option, as I may not change table names on the SQL server. I am aware of the solution making the copies of the SQL Tables (e.g. using proc import instead of libname & odbc engine) in SAS, but would like to know if there is a way to have "live" data in a sas library from miltiple SQL schemas (with common table names).

libname schemaA odbc
               schema="schemaA"
               noprompt="....";
libname schemaB odbc
               schema="schemaB"
               noprompt="....";
libname sql_database (schemaA schemaB);