How to allow quotation mark in jquery input mask - jquery-inputmask

How to allow the double quote in query input mask validator
remarks:{
alias: "Regex",
regex: "^[a-zA-Z0-9-.#()&-,?"//]*$",
repeat:14
},
If i add the " (quotation mark) in the reges or validator, it does not allow and throws the error.

use \ to escape a special character .. just try it
regex: "^[a-zA-Z0-9-.#()&-,?\"]*$"

Related

Pact exact match of a field within an array

I am writing a pact test for a request that filters out the response data by a certain field, hense I would like to create a matcher that would match an array of objects with an exact match on that field.
I tried doing the following two aproaches:
body: eachLike({
color: 'red',
name: like('any'),
}),
body: eachLike({
color: extractPayload('red'),
name: like('any'),
}),
Bot both of them produce the same result:
"matchingRules": {
"$.body": {
"min": 1
},
"$.body[*].*": {
"match": "type"
},
"$.body[*].name": {
"match": "type"
}
}
It seems to me that having "$.body[*].*": {"match": "type"} in there negates the exact matching for the color field. Am I wrong in that assumption, or is there a correct approach that would resolve this issue?
Yes, the issue is that the type matching is cascading and is not being reset.
The equal matcher (V3 only) will reset the matching rule for this context.
It's available in the latest beta: https://github.com/pact-foundation/pact-js/tree/feat/v3.0.0#using-the-v3-matching-rules
To work it in v2, I would use the regex that matches a single string value here.

Creating an Item in a Board using an Http request/cURL

Hi I have this cURL request that I have been trying and failing to get it right, it gives me a 500 Error (Internal Error)
Please see my curl request below:
curl --location --request POST "https://api.monday.com/v2" --header "Authorization: XXXXX" --header "Content-Type: application/json" --data-raw "{\"query\":\"mutation { create_item (board_id: 1622487816,group_id: \"emailed_items\", item_name: \"Test from Curl\") { id } }\"}" -v
I get back an empty object as a response but on the response header I see a 500 error message
Make sure your quotes are nested and escaped properly.
Your code:
"{\"query\":\"mutation { create_item (board_id: 1622487816,group_id: \"emailed_items\", item_name: \"Test from Curl\") { id } }\"}"
You are right to begin with a double quote and you are right to escape the first set of quotes within those quotes.
However, when you get further in the query, "emailed_items" also needs to be escaped, but since you are already in a set of quotes, you actually need three backslashes.
Corrected code:
"{\"query\":\"mutation { create_item (board_id: 1622487816,group_id: \\\"emailed_items\\\", item_name: \\\"Test from Curl\\\") { id } }\"}"
Make use of the npm package for monday.com queries. One such package is monday-sdk-js
Assigning parameters could be confusing thus make use of this package which takes query as a parameter and makes things easy.

Can I use wildcards in appname when creating a rule

Can I use "*" in application name. Something like:
{ rule = { name = "Appname*" },
The code uses Lua's string.match, so the patterns that are explained at http://lua-users.org/wiki/PatternsTutorial can be used. For your case that should be "Appname.*", if I'm reading this correctly.

Symfony 2 - When and why does a route parameter get automatically converted?

I have this route:
pfs_platform_home:
path: /{page}/{reset}
defaults: { _controller: PFSPlatformBundle:Advert:index, page: 1, reset: true }
requirements:
page: \d*
reset: true|false
If I use a link without specifying anything for reset, the router uses the default value and in my indexAction, the reset parameter is automatically converted to Boolean true.
i.e.:
<li>Inicio</li>
But when I do that, this time $reset appears as a string 'false' in my indexAction, not a Boolean:
{{ p }}
What am I missing?
URL paths and parameters are always strings. If you have an URL like
http://example.com/page/true?foo=2&bar=false
the server cannot know that the true should be interpreted as boolean, while foo is supposed to be an integer and bar is supposed to be boolean, too.
If you want to process URL parameters, always pass and treat them as strings.
Later, you can validate them (e.g. is_numeric will tell you if a string represents a number) or transform them to other types.
What you're also experiencing here is YAML's handling of unquoted strings:
Strings may generally be left unquoted, if they don't contain a character that has a meaning in YAML.
But: true in YAML is boolean true. Therefore, your default reset: true is indeed a boolean value. Declare it as reset: "true" and it should work. The reset: true|false should be fine, IMO (didn't test it, but this is treated as a regex, so it should be interpreted as string.)
You have already set the defaults for your params:
pfs_platform_home:
path: /{page}/{reset}
defaults: { _controller: PFSPlatformBundle:Advert:index, page: 1, reset: true }
requirements:
page: \d*
reset: true|false
Check out defaults: line it says if you do not supplu page it will be 1 and if you do not supply value for reset it will default to true.

Edit property of a child using REST Api

I have a dataset uploaded in following form:
SomeKey
-> Alphabet
-Emp1: "{ 'Fname' : 'Bob', 'Lname' : 'Sob' }"
-Emp2: "{ 'Fname' : 'Tom', 'Lname' : 'Mot }"
Now using Rest API, I want to edit Fname and Lname of employee with key Emp1 to Fred and Dref, and Fname and Lname of employee with key Emp2 to Kent and Tenk in one single call. Is this possible? If yes, how?
If you would like to update a single employee, you can do so with a PUT REST API call like this:
curl -X PUT -d <data> https://some.url.com/SomeKey/Employees/Emp1/.json
If would like to update multiple employees using a single REST API call, you can do so with a PATCH REST call like this:
curl -X PUT -d '{"Emp1":<data1>,"Emp2":<data2>"}' \
https://some.url.com/SomeKey/Employees/.json
Additional details about the REST API are available here:
https://www.firebase.com/docs/rest-api.html

Resources