I'm looking for a way to pass a variable (normal string) from a linked template back up to my main template.
I want to use something like: (in linked template)
"outputs": {
"installStringNodes": {
"type": "string",
"value": "[variables('installString').value]"
}
}
And then i want to call this variable into my main template. But i can't seem to crack how.
"variables":{
"installStringFromNodeResources": {
"value": "[??('node-resources')??.outputs.installStringNodes.value]"
},
}
There's a 'sharing state in resource manager templates' doc with the usage of reference() but apparently that can't be used in variables as it gives me an error while trying to deploy.
Seems to me there should be an easy solution for this but i haven't been able to see it yet..
In the main template, the variable should be:
"installStringFromNodeResources": {
"value": "[reference('node-resources').outputs.installStringNodes.value]"
}
Follow this walk through sharing state between templates
Related
In my Dasha.ai code, I want to send dynamic variables to phrasemap.json. How can I send dynamic data to phrasemap if possible?
To dynamic phrase you should will do:
In file "main.dsl" in context section create new variable (as example - "your_variable_phrase")
context
{
input your_variable_phrase: string;
}
and then Dasha will say variable phrases for 2 ways:
First.
Use command "sayText" - to say something without phrasemap file.
In section "do"
#sayText($your_variable_phrase)
Second. Use phrasemap.
In the main.dsl in section "do"
#say("greeting",
{
your_variable_phrase: $your_variable_phrase
}
);
In phrasemap file:
"greeting": {
"first": [
{
"text": "Hello "},
{ "id": "your_variable_phrase", "type": "dynamic" }
],
Azure Function with a complex (List of objects) configuration type is working locally (with that complex type in local.settings.json) but fails to read / create list of objects in Azure (with that complex type in Azure Function configuration settings). I'm looking for the recommended / optimal way to support that across both platforms / methods of access.
This works great in my local.settings.json where I use the configuration builder and pull data out like
var myList = config.GetSection("ConfigurationList").Get<List<MyType>>();
however this doesn't seem to work in Azure Functions?? Now I think that is because in local.settings.json it is a json file and looks like
"ConfigurationList" : [ { "Name": "A", "Value": 2 }, { "Name": "B", "Value": 3 }]
while in Azure Functions it is a setting "ConfigurationList" with the value
[ { "Name": "A", "Value": 2 }, { "Name": "B", "Value": 3 }]
(so there isn't really a "section" in Azure Functions?)
It seems like the "easy" solution to this is to just change the .json to be a quoted string and deserialize the string (and then it would work the same in both places); but that doesn't seem like it would be the "best" (or "recommended" solution)
i.e. something like
"ConfigurationList" : "[ { \"Name\": \"A\", \"Value\": 2 }, { \"Name\": \"B\", \"Value\": 3 }]"
var myList = (List<MyType>)JsonConvert.DeserializeObject(config["ConfigurationList"], typeof(List<MyType>));
Which isn't the worst; but makes the json a bit "not as nice" and doesn't "flow" across the two platforms ... if it is what I have to do, fine; but hoping for a more standard approach / recommendation
As I metioned in the comment, on local you can process local.settings.json as a json file, but when on azure, the value in configuration settings is environment variable. There is no section, it just string.
Please notice that only string values are allowed, and that anything nested will break. Learn how to use nest settings on azure web app(azure functon is based on azure app service sandbox, so it is the same.):
https://learn.microsoft.com/en-us/archive/blogs/waws/asp-net-core-settings-for-azure-app-service
For example, if this is the json structure:
{
"Parent": {
"ChildOne": "C1 from secrets.json",
"ChildTwo": "C2 from secrets.json"
}
}
Then in web app, you should save it like this:
(source: windows.net)
Not sure if you are looking something like this , it seems a list but if it is a simple JObject like
"ConfigurationList" : {
"Name": "A",
"Value": 2
}
Then you can declare ConfigurationList:Name , ConfigurationList:Value in the configuration settings of function app
In MATLAB, it is possible to define code suggestions and completions as explained in the documentation page titled "Customize Code Suggestions and Completions".
The snippets given therein, e.g.
{
"_schemaVersion": "1.0.0",
"anotherFunc":
{
"inputs":
[
{"name":"input1", "kind":"required", "type":["numeric"]},
{"name":"input2", "kind":"required", "type":["numeric"]}
]
}
}
show how we can control the predictions of functions found (presumably) in separate files in the same folder as functionSignatures.json.
Suppose I have a method called myMethod which resides in a class called myClass. Creating a JSON as above with "myMethod" instead of "anotherFunc" didn't seem to have an effect.
My question is - how can we define completions for class methods using this technique?
After some trial and error, it appears that the prediction/completion logic expects to see syntax like:
"myClass.myMethod"
In other words, this should work:
{
"_schemaVersion": "1.0.0",
"myClass.myMethod":
{
"inputs":
[
...
]
}
}
The problem is that in my app we have a data structure like this:
{
"adults": {
"jagger_mick_dateOfBirth": {
"name": "Mick"
"lastName": "Jagger",
"more atributes": ""
},
"jolie_angelina_dateOfBirth": : {
"name": "Angelina"
"lastName": "Jolie",
"more atributes": ""
}
},
"children": {
"osbourne_ozzy_dateOfBirth": : {
"name": "Ozzy"
"lastName": "Osbourne",
"more atributes": ""
}
}
}
As you can see, for each Adult & Children, we use a dynamic attribute to identify each object. BUT inside is the same object.
Right now I am in the process to generate JSON Schemas (v4) for this data structure.
My problem is i cannot find a property to evaluate dynamic attributes, althought the object is the same, just the key is different.
I know that it is bad coding, but it is possible to generate a JSON Schema (v4) to validate a dynamic attribute (key) ?
Thanks in advance.
P.D.
If you are wondering why we use this approach, is because we can access directly to the object, instead of search for it.
If your dynamic object attributes can be described with a regular expression, you can use patternProperties keyword.
is there any way to configure DocPad to generate pages starting from a json array saved in external file (or inline string) instead of from a collection of files?
To clarify, for show posts details I fetch from a JSON file, see below.
instead of this:
<% for post in #getCollection("html").findAll({ relativeOutDirPath: 'posts' }).toJSON(): %>
I use this:
<% for post in JSON.parse #include("posts.json"): %>
Ok. Now I would to generate the post pages directly from this JSON and not creating a page for each post like in the example..
For example I would to create page with url /posts/{urlname}.html when {urlname} exist in JSON like this:
[
{ "id": "1", "urlname": "prod1", "metadata": { "title": "val1" } },
{ "id": "2", "metadata": null },
{ "id": "3", "urlname": "prod3", "metadata": { "title": "val1b", "prop2": "val2b" } }
]
I would to generate /posts/prod1.html and /posts/prod2.html page with metadata those in metadata properties..
Thank's for the replies.. ;)
PS Great work!!!!!!!
Currently there is no official way to inject data into the DocPad in memory database besides having it parsed from the file system on the src directory (the way we are all use to). HOWEVER, this feature (called importers) is the next big todo for DocPad, you can find the task issue here.
For the meantime, you could include the JSON inside your template data, which is suitable for content listings, but not suitable for providing individual documents for each entry.