How to modify default variable values in planet scale? - vitess

I need to increase innodb_lock_wait_timeout in planetscale DB, but this command doesn't help:
set global innodb_lock_wait_timeout=600;
It still shows default value.

Related

Terraform data dynamically using variables

I was wondering if it's possible to grab different data dynamically based on variables like so
data.terraform_remote_state.vm.outputs.vm_***var.vmname***
Or something similar? i dont have the option to redesign the outputs currently, and this would greatly lower the chance of making failure upon creating new terraform deployments
thanks!
There are Input Variables available in Terraform. These variables allow you to define inputs expected at the time of terraform apply. The values may be entered via an interactive terminal or provided in a .tfvars file.
variable "vmname" {
type = string
description = "The name of the virtual machine."
}
Then you can use them by expansion:
"data.terraform_remote_state.vm.outputs.vm_${var.vmname}"
For additional reference, see https://www.terraform.io/docs/language/values/variables.html

A code to destroy the value of a variable in livecode

I have a question , I noticed that when I use a variable to count the score of clicks of different objects . The value of the score that uses variable whether it was a global or a local variable maintain its value of the score that has reached and continues to count from that point even when I close and re-open the app and I reset the variable value to 0 with code (put 0 into _gScorePlayer ) for example when a user reaches score 15 and closes the app , next time the score continues from 15 and so on
I am a beginner in livecode
Thanks fro your continues help and support guys :)
you can use the put command to clear the variable and the delete command to remove it from memory.
check the LiveCode dictionary
delete variable
Example
delete local tVar [1]
By default, declaring variables is optional in LiveCode.* Persistence of variable values is determined by whether the variable is declared outside of a handler or not. When a variable is only declared or used inside a handler, the variable is always temporary and its value is only valid while the handler is running.
The value of variables declared as local or global outside of a handler will persist between instances of the handler being run. However, the value of such variables will not persist between launches of LiveCode. That is if you quit LiveCode and launch it again, the values of the declared variables will be lost. However, if you only close the stack without quitting LiveCode, the stack remains in memory (by default) and the values of declared variables remain intact.
If you want to ensure that the variable is reset when the stack is reopened, do this for declared globals in the stack script:
global gScorePlayer
on openStack
put empty into gScorePlayer
# OR
put 0 into gScorePlayer
end open stack
To initialize local variables you do something similar in the script where the variable is used. For example, if you are using a local variable in a card script, you can do this in the card script:
local sMyLocalVar
on openCard
put empty into sMyLocalVar # or put 0 into sMyLocalVar
end openCard
*See the explicitVariables property in the Dictionary for more information about declaring variables.
The way I use to clean the content of a variable is:
delete variable VariableName

Issue setting up a save path with integer variables and strings in kdb+

I am basically trying to save to data/${EPOCH_TIME}:
begin_unix_time: "J"$first system "date +%s"
\t:1 save `data/"string"$"begin_unix_time"
I am expecting it to save to data/1578377178
You do not need to cast first system "date +%s" to a long in this case, since you want to attach one string to another. Instead you can use
begin_unix_time:first system "date +%s"
to store the string of numbers:
q)begin_unix_time
"1578377547"
q)`$"data/",begin_unix_time
`data/1578377547
Here you use the comma , to join one string to another, then using cast `$ to convert the string to a symbol.
The keyword save is saving global data to a file. Given your filepath, it looks like youre trying to save down a global variable named 1578377547, and kdb can not handle variable names being purely numbers.
You might want to try saving a variable named a1578377547 instead, for example. This would change the above line to
q)`$"data/a",begin_unix_time
`data/a1578377547
and your save would work correctly, given that the global variable a1578377547 exists. Because you are sourcing the date down to the second from linux directly in the line you are saving a variable down to, this will likely not work, due to time constantly changing!
Also note that the timer system command will repeat it the execution n times (as in \t:n), meaning that the same variable will save down mutliple times given the second does not change. The time will also likely change for large n and you wont have anything assigned to the global variable you are trying to save should the second change.

How to save value of found document in mongoose as a variable?

Let's say I use findbyID{} to find a specific document in my collection, and this document has the value totalMedals to which I want to add the local variable medalsWonSinceLastUpdate. I would need a function along the lines of totalMedals = previousTotalMedals + medalsWonSinceLastUpdate, which would mean I need to capture the previous totalMedals in a variable. How would this be possible?
I have experimented with an ejs file that contains the value I want to access and then tried to access it through req.body.value, but this throws an error. I can run queries that find the documents, but I run into a brick wall when it comes to taking the variables to a wider scope.

How do I append a string to a bash variable to return the value of another variable?

I am trying to get someone else's bash that sets various variables depending upon where a system comes up (z/VM Disaster Recovery provision). It is written so that it dots in a file containing variables with assigned values like this:
. /tmp/listofvars
IP=${SITE}IP
The value of the variable "$SITE" is set higher in the script, the result should be one of two things, either the value of the variable "$PRIP" for the production IP subnet value held in the variable list or the value of the variable "$DRIP" for the disaster recovery subnet value also held in the variable list that gets dotted in.
What actually happens is that the value of the $SITE variable gets concatenated to the string "IP" so the result is either "PRIP or "DRIP" depending on where I run the script. What I want is for the value of the $PRIP or $DRIP rather than the value of $SITE with the string 'IP' concatenated to it.
You can use variable reference as:
echo "${!IP}"
# will print value of $PRIP if $IP=PRIP

Resources