What is a "slug"? - encoding

I am attempting to upload some emoticons to a particular site. The mandatory fields are:
Shortcut:
Image:
Category:
Suggested Category:
For the image, I just choose it from my file. Category fields are explanatory. I was trying to enter a web url as the "shortcut", and get this error:
"Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens"
I need to know what a "slug" is and how to create/get one.

A slug is a human-readable portion of a URL, which identifies it to the viewer. Here is the explanation from the Wikis:
Some systems define a slug as the part of a URL which identifies a page using human-readable keywords.
For example, the slug for this post is: "what-is-a-slug".
They are probably asking for a description, such as "a-description-of-my-awesome-new-emoticon" or "confused-face".

This is an internal identifier that will be used in url's.
For example http://url.com/category-slug/my-post

Related

Can't get handlebars to work with dynamic templates

I am very stuck. Tried everything I could think of to solve this issue, but I feel as though it is just something wrong with my JSON. When I build a dynamic template, I'd like to insert some variables for the send. As you can see in the example, simply just adding the first name in the handlebars. However, when I send tests using postman, I can not for the life of me get the first_name to display. I've tried so many different options in the JSON and nothing seems to work. Here is where I am currently at, omitting the first_name obviously. Any help on how to format this I would very much appreciate it.
{
"from": {"email":"example#example.com"},
"template_id":"ID HERE"
"personalizations": [
{
"to": [
{
"email":"recipient#gmail.com"
}
]
}
]
}
I tried 100 different variations of the request.
Twilio developer evangelist here.
I think that using that JSON is mainly for when you're using the API to send an email with a template. You then provide the JSON data as dynamic_template_data and it is populated in the email template.
first_name is a reserved field and substitution tag which lets you use any reserved or custom field data you've added to Marketing Campaigns to dynamically generate unique content for each recipient of your email. One common example is adding a recipient's first name to the body (or even the subject line) of your email.
The data that populates your Substitution Tags will come from the information you have stored about each contact.
You can work with substitution tags with the code editor or design editor.
Let me know if this helps at all!

What is the proper schema for JSON-LD telephone number with extension?

I'm trying to find the proper schema for telephones with extensions, but I can't find anything related to this problem through Google searches or schema.org.
In HTML, I'm using , to trigger the extension on cellphones and Skype, but I've also seen p used to "pause" between numbers when dialing. Which is the best route in regards to proper JSON-LD schema?
No extension used:
{
"#type": "Organization",
"telephone": "+18665554985"
}
Style 1 using p:
{
"#type": "Organization",
"telephone": "+18665554985p100"
}
Style 2 using ,:
{
"#type": "Organization",
"telephone": "+18665554985,100"
}
The telephone property has Text as expected value. If a specific format should be used, it would be noted in the property’s description, but that’s not the case for telephone.¹
So you can use whichever format you want.
Which format would make sense? I would go with the same format you display for your users (which would ideally be the recommended format according to a convention/standard relevant for the targeted users). This is the natural choice when using Microdata or RDFa to mark it up, and there is no reason to go a different route for JSON-LD. This would also help in cases where a consumer simply displays your value of the telephone property: it will be in the appropriate format for your users.
¹ There was some discussion about this in the issue Make the telephone property more structured (not just Text). I would expect that the expected range will, at some point, include URL values, so that tel URIs can be used (which of course have a specified format).

What is the difference between PSCredentialUIOptions.Default and PSCredentialUIOptions.ValidateUserNameSyntax?

One of the overloads in PowerShell for the $Host.UI.PromptForCredential method has an options parameter, which is a bitwise combination of PSCredentialUIOptions values.
Looking at MSDN for PSCredentialUIOptions I find the enum values include:
Default : Validates the user name, but not its existence or
correctness.
and
ValidateUserNameSyntax : Validates the syntax of the user name, but
not its existence or correctness.
What exactly do these descriptions mean?
For Default, when it validates the user name, does it mean it just checks the user has entered something, anything, in the User Name field of the PSCredentials dialog?
And for ValidateUserNameSyntax, how does it validate the syntax of the user name? By checking for illegal characters in the entered text?
I've tried Googling for more information but all links just lead back to the MSDN page or the identical TechNet page.
Not only does ValidateUserNameSyntax check for illegal characters, but it also validates the format of the username against the allowedCredentialTypes you supply to PromptForCredential():
$PromptCaption = "Creds plz!"
$PromptMessage = "Please input your domain credentials"
$CredentialType = [System.Management.Automation.PSCredentialTypes]::Domain
$ValidateOption = [System.Management.Automation.PSCredentialUIOptions]::ValidateUserNameSyntax
$Host.UI.PromptForCredential($PromptCaption,$PromptMessage,"","",$CredentialType,$ValidateOption)

Cannot use REST comments in Swagger

I have downloaded swagger ui and experimenting it locally. It works fine in scenarios like "path", "body" , and "query" . But most of my use cases use rest comments.
i.e /resourcePath/;tags
URI to retrieve the tags of a specific resource.
When I try this the the UI gets jumbled when adding the semi colon and malformed the sorted UI and cannot go beyond this.
So is this a known limitation ? Is there a workaround to accomplish this target ?
Appreciate any input to this..
Swagger is expecting you to specify path params in curly-brackets like {tags} and query params as comma-delimited, such as id=1,2,3,4. Some frameworks use semi-colons as delimiters but swagger likes commas.
Can you describe more what you're looking to do, with a more concrete example? Per design, comments on the api belong in the description and notes fields for operations, please see swagger-core wiki for details.
The Swagger codegen project has a validator which can be used to verify that your spec is properly formatted.

How to filter and validate user input in Zend Framework

on my website I have a comment section. I want to filter and validate the input before I store it in my database. If there are any invalid chars in the input the user gets the notice that his input is invalid.
My question, which chars are not allowed? e.g. I want to avoid sql injections
Tags are not allowed. How do I check that?
If you are using Zend_Db and parameterised queries (i.e.: $adapter->insert($tableName, array('param' => 'value'))) then it will automagically escape everything for you.
If however you want to further validate the user input, have a look at Zend_Validate and Zend_Filter
Also, if by "tags" you mean HTML tags, I wouldn't do anything to those on input but do make sure you properly escape / strip them on output (have a look at htmlspecialchars())
If you want to display an error message if the input contains HTML tags, and assuming $comment is the comment body, you could try:
if(strip_tags($comment) !== $comment) {
// It seems it contained some html tags
}