Would ( intValue ( "." intValue )? ) be read as 1.9 ?? Also, how to add attribute to Heat Template - mesos

Is this a regEx?
As per Mesos' documentation:
scalar : floatValue
floatValue : ( intValue ( "." intValue )? ) | ...
Would I read it the same way as I'd read the scalar via the documentation?
I'm trying to figure out how to add attribute to Mesos Cluster nodes, but the sample Heat Template I have has nothing to the tune of 'node attributes' in it, and I'm kind of shooting for the moon here.
As It goes into a HEAT template, would each attribute for a specific node be added into the preferences section? I have been trying to find this answer for days now, and all my attempts seem to fail when I deploy the template.
I have tried adding an attributes section, to no avail:
parameters:
name:
type: string
resources:
# Boot script
boot_script:
etc, etc...
attributes:
server_group:
group_1

Would ( intValue ( “.” intValue )? ) be read as 1.9 ?
Yes
This definition is a formal grammar definiton of a scalar value. You can find similar definition for programming lanugage for example Golang looks like this (from antlr-4 examples)
To read grammar this you need to take a look at whole definition
scalar : floatValue
floatValue : ( intValue ( "." intValue )? ) | ...
intValue : [0-9]+
and flatten it to following regexp (I do not know what ... means):
scalar : [0-9]+(.[0-9]+)?
source
How to add attribute to Heat Template
Not enoutght information to answer this.

Related

Set type for entire const block

I have a custom data type
type Custom string
And a const block
const (
Item1 = "placeholder"
...
Item10 = "placeholder"
)
Is it possible to set the type Custom the every item in the const block, without having to place it in every entry?
Spec: Constant declarations:
ConstDecl = "const" ( ConstSpec | "(" { ConstSpec ";" } ")" ) .
ConstSpec = IdentifierList [ [ Type ] "=" ExpressionList ] .
A constant declaration is a series of constant specifications, where each contains the optional type.
One thing that may be exploited is:
Within a parenthesized const declaration list the expression list may be omitted from any but the first ConstSpec. Such an empty list is equivalent to the textual substitution of the first preceding non-empty expression list and its type if any. Omitting the list of expressions is therefore equivalent to repeating the previous list. The number of identifiers must be equal to the number of expressions in the previous list. Together with the iota constant generator this mechanism permits light-weight declaration of sequential values...
So for example in the below example both Item1 and Item2 will be of type Custom:
const (
Item1 Custom = "v1"
Item2
)
The problem here is that both Item1 and Item2 will have the same "v1" value. This isn't really useful unless you use the iota in the expression.
One way to only specify the type once is to list the identifier before the values:
const (
Item1, Item2 Custom = "v1", "v2"
)
In the example above both Item1 and Item2 will be of type Custom, try it on the Go Playground. The disadvantage here is that the identifier may "get far" from its value, this is less readable than listing them on separate lines:
const (
Item1 Custom = "v1"
Item2 Custom = "v2"
)
Alternatively you may "move the type" to the expression, using a typed constant value:
const (
Item1 = Custom("v1")
Item2 = Custom("v2")
)

GATE - JAPE rule nested ‘contains’ operators - correct syntax

I am getting errors when I try to create ‘Sentence contains’ jape rules with OR operators, i.e when a Sentence contains 1 OR 2 AND 3 OR 4:
(
{
Sentence contains { Annotation1 | Annotation2 },
Sentence contains { Annotation3 | Annotation4 }
}
)
:temp
-->
Can someone please advise on the correct syntax?
There is no such thing like AND operator in LSH jape grammar and we cannot use OR operator inside contextual operators ie; contains and within. Instead you can code like this.
(
({Sentence contains {Annotation1}} | {Sentence contains {Annotation2}})
({Sentence contains {Annotation3}} | {Sentence contains {Annotation4}})
)
:temp
-->

How to get a String's Id or Parent using Auto It

Similar Question Here (Unanswered, because it is not specific enough)
In the original question someone answering it asked for a picture to help them identify how to help.
Here is a picture of the App I am trying to automate.
Ascii To MetaStock Utility 2.0.0.835
Specifically I'm having trouble Reading the bottom bar that says "ready" in the picture. I need to be able to tell when that bar changes to "conversion finished". I'm not sure how to do that and following along with a couple tutorials did not work for me. They were all focused on getting text when you know the Id of the frame already.
Currently My script looks like this (with no attempt to get the string & my local path removed)
Run"C:/PATH/A2MS.exe"
WinWaitActive(Ascii to MetaStock Utility 2.0.0.835)
Send("{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}")
In case want to test your solution or need access to the app to answer my question.
The app may be downloaded for free if you register an account, it is from EODdata.com.
Any help or links to appropriate articles/tutorials are appreciated.
EDIT:
Using WinGetText() shows statusStrip1 and menuStrip1 where the string I want to compare should be. I don't know enough about AutoIT to know what that means.
Edit 2: Detecting whether or not the convert button is enabled would also allow me to shut it down when it is finished, and would be a valid answer to this question. WinGetText() shows c&onvert where the button would be.
Retrieves the text from a standard status bar control.
StatusbarGetText ( "title" [, "text" [, part = 1]] )
Extracts a number of characters from a string.
StringMid ( "string", start [, count = -1] )
Returns a number of characters from the left-hand side of a string.
StringSplit ( "string", "delimiters" [, flag = 0] )
Checks if a string contains a given substring.
StringInStr ( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] )
Returns the string representation of an expression.
StringSplit ( "string", "delimiters" [, flag = 0] )
Checks if a string contains a given substring.
StringInStr ( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]]` )

Warning: preg_match() [function.preg-match]: Unknown modifier '-'

I am working on a Wordpress site and recently I have begun getting this warning:
Warning: preg_match() [function.preg-match]: Unknown modifier '-'
It started when I changed the permalink structure to /%postname%/, which is needed for BuddyPress to function. If use the default permalink structure, the problem goes away.
Here is the code from the wp-includes/class-wp.php where the error is occurring:
if ( preg_match("#^$match#", $request_match, $matches) ||
preg_match("#^$match#", urldecode($request_match), $matches) ) {
this is because - and / are special symbols, you can change this code to:
if ( preg_match("/^".preg_quote($match)."/", $request_match, $matches) ||
preg_match("/^".preg_quote($match)."/", urldecode($request_match), $matches) ) {
but I assume that problem is somewhere deeper, in core logic of wp
Without the $match variable content it is difficult to know what the problem is, but if you obtain this warning, it's because $match contains #- (i.e. the pattern delimiter used and the - character). Then all characters after this # are seen as modifiers.
You can try to change the delimiter (and pray) to ~:
if ( preg_match("~^$match~", $request_match, $matches) ||
preg_match("~^$match~", urldecode($request_match), $matches) ) {
If it doesn't work try other delimiters.

JQgrid - escape ':' in searchoptions (value part)

How to set the values for filter is explained here link text. I have two requirements.
1. the default value needs to be empty. I expect, if defaultValue is not set, the filter is empty, but that is not happening in my case.
2. How to escape ':' in my value. The character ':' and ';' are used to seperate the index and values. But, in my value string it contains a ':' (eg: searchoptions:{value:"1:'Level: 1'"} , where Level: 1 is my first value). How to escape : in the value part. I tried \ , / etc.
thanks.
Edit: Item 1 may be solved if there is no other way. I may set an additional item ALL in the values, and use it default.
You are right, it seems impossible to use any escape character to place ':' inside of value of searchoptions if you define it like a string:
searchoptions:{value:"1:'Level: 1'"}
There is another form of setting of value of searchoptions - object form, which is also described under http://www.trirand.com/jqgridwiki/doku.php?id=wiki:search_config#colmodel_options. For example you can use following syntax
searchoptions:{value:{'1:': 'Level: 1;', ':2:;': 'Level: 2;'}}
It defines a select with the texts "Level: 1;" and "Level: 2;" displayed and the corresponding values "1:" and ":2:;". It works.
I had the same issue and the only option was to use searchoptions object.
However, I had to programmatically build the list so I couldn't use define the objects.
Therefore, I decided to use build the list as an JSON string and then parse it, as shown below:
searchoptions: {
value: $.parseJSON("{" + searchSelectFormat.join(",") + "}"),
sopt: ['eq']
}
where searchSelectFormat is in the format of
'"' + data + '":"' + data + '"';
'"' + item+ '":"' + item+ '"'

Resources