How to for_each through a list(objects) in Terraform 0.12

Seem’s like I found what to do. If you pass not the maps of maps but the list of maps you can use such code resource “google_compute_instance” “node” { for_each = {for vm in var.vms: vm.hostname => vm} name = “${each.value.hostname}” machine_type = “custom-${each.value.cpu}-${each.value.ram*1024}” zone = “${var.gcp_zone}” boot_disk { initialize_params { image = “${var.image_name}” size … Read more

Creating an R dataframe row-by-row

You can grow them row by row by appending or using rbind(). That does not mean you should. Dynamically growing structures is one of the least efficient ways to code in R. If you can, allocate your entire data.frame up front: N <- 1e4 # total number of rows to preallocate–possibly an overestimate DF <- … Read more

What are the differences between vector and list data types in R?

Technically lists are vectors, although very few would use that term. “list” is one of several modes, with others being “logical”, “character”, “numeric”, “integer”. What you are calling vectors are “atomic vectors” in strict R parlance: aaa <- vector(“list”, 3) is.list(aaa) #TRUE is.vector(aaa) #TRUE Lists are a “recursive” type (of vector) whereas atomic vectors are … Read more

Is there any haskell function to concatenate list with separator?

Yes, there is: Prelude> import Data.List Prelude Data.List> intercalate ” ” [“is”,”there”,”such”,”a”,”function”,”?”] “is there such a function ?” intersperse is a bit more general: Prelude> import Data.List Prelude Data.List> concat (intersperse ” ” [“is”,”there”,”such”,”a”,”function”,”?”]) “is there such a function ?” Also, for the specific case where you want to join with a space character, there … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)