Polymer custom element naming convention feature/bug - polymer

In polymer documentation they said
By specification, the custom element's name must contain a dash
(-).
So I make a custom element with name custom-element. Generally, everyone do that. But suddenly I got a doubt that can we have a dash at the ends?
Then I tried with customelement- and -customelement.
I wondered that having dash(-) at right side end is working. But having dash(-) at left side end is not working.
Is this a feature or a bug?

It's not a bug. It's working as expected.
According to the spec your element need to have a dash in its name (e.g <my-tabs>). That way you're forced to add a namespace which avoids conflicts with existing elements. A valid custom element name is a sequence of characters name that meets all of the following requirements
[a-z] (PCENChar)* '-' (PCENChar)*
where PCENChar:=
"-" | "." | [0-9] | "_" | [a-z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
ref: https://www.w3.org/TR/custom-elements/#prod-potentialcustomelementname
Hope this helps :)

Related

How can I avoid the horizontal scrollbar in a ReST table?

I have this table in ReST markup:
+---------------------------+-----------------------------------------------------------------+
| Option Line Kind | Distinguishing Characteristic |
+===========================+=================================================================+
| **Reference** | The option name is called a (node) reference, if the value\ |
| | of an option is a predefined keyword for the current node\ |
| | class. Because the option's value is a keyword, it can not\ |
| | be an interpolated value. |
+---------------------------+-----------------------------------------------------------------+
| **Option** | The option uses a defined option name valid for the current\ |
| | node class. The value can be a fixed or interpolated string. |
+---------------------------+-----------------------------------------------------------------+
| **User Defined Variable** | Otherwise an option line is a user defined variable. It can\ |
| | have fixed or interpolated string values. |
+---------------------------+-----------------------------------------------------------------+
Sphinx (ReadTheDocs theme) generates a horizontal scrollbar instead of breaking the content in column 2. The result is this mess:
What do I need to change in ReST (or the RTFD theme??) to let it break the text?
Edit:
The answer from #aflp91 results in this table:
Add a _static/custom.css file with
.wy-table-responsive table td {
white-space: normal;
}
Don't forget to declare it into conf.py:
def setup(app):
app.add_stylesheet('custom.css')
Works in my test…
You can use CSS property for table:
Overflow-x : hidden;
overflow-y : hidden;

Search Replace in MySQL: remove directory structure but keep filename

I am changing directory structures in a Drupal installation and need to remove all path data except the file name itself.
So the basic structure is:
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
| entity_type | bundle | deleted | entity_id | revision_id | language | delta | field_filename_value | field_filename_format |
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
The filename is stored in field_filename_value. Here's a sample record:
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
| entity_type | bundle | deleted | entity_id | revision_id | language | delta | field_filename_value | field_filename_format |
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
| node | presentation | 0 | 11 | 11 | und | 0 | /really long path name/with lots of words/167 Clarence Ashley - Coo Coo Bird.mp3 | NULL |
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
That ridiculous filename value needs to be changed from:
/really long path name/with lots of words/167 Clarence Ashley - Coo Coo Bird.mp3
To this:
167 Clarence Ashley - Coo Coo Bird.mp3
Setting aside the bad practice of using spaces in file/directory names, how would you correct this? Is it possible using MySQL features alone?
As an added challenge, some files may be more than 2 directories deep.
Use substring_index
select substring_index('http://www.example.com/dev/archive/examples/test.htm','/',-1)
(both above are fully from
MySQL String Last Index Of
How you would use it is easy, but just to explain, you select the last index of the / and then do another substring function to cut off anything to the left of it

get first 3 alphanumeric characters (only numbers or letters)

I have a table which holds a field, title, I need to get first 3 alphanumeric characters of each title. Some of the values of title have ",',\t,\n, or whitespace prepended - this should be ignored.
+--------+-----------------------------------------+---------------------+
| id | title | desired output |
+--------+-----------------------------------------+---------------------+
| 1 | "abcd" | abc |
| 2 | 'lostworld | los |
| 3 | \tsonof | son |
| 4 | 12amrt | 12a |
+--------+-----------------------------------------+---------------------+
desired output is the output I am looking for. If anyone can suggest generic query which can handle all cases that would be great.
Looking for solution using MySQL only.
Your best bet is to use a regex user-defined function.
The built-in regexp functions only support matching; not string replacing like you want here

Is the at-sign (#) a valid HTML/XML tag character?

I'm doing some HTML stripping using regular expressions (yes, I know, never parse HTML with regexes, but I'm just stripping it, and I also unfortunately cannot use any external libraries). I'm using a regex from the Regular Expressions Cookbook, and it has worked great, except I just ran into this problem:
In the string Bob Saget <bobs#aol.com>, my regex is matching the email as a tag.
So my question is, is the # sign a valid XML or HTML tag character? (I'm not asking whether or not it is valid within an attribute; I know that it is) If it is not, I will be able to successfully exclude it in my regex.
I'm not sure where to look this up. I looked here and I think that says that in XML, the at-sign is not allowed in a tag; however, I would appreciate some concrete proof.
After another look at the XML Specification:
A tag consists of:
'<' Name (S Attribute)* S? '>'
A Name consists of:
NameStartChar (NameChar)*
A NameStartChar consists of:
":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
A NameChar consists of:
NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
The # sign is U+0040
So the # sign is not valid in a NameChar or a NameStartChar, and thus not valid in a Name.

what is the use of a "PRE" tag in (X)HTML

what is the use of a "PRE" tag in (X)HTML
It's for displaying data/code/art where you want all your spaces and newlines to be displayed as is, and want your columns to line up. So you can do stuff like this:
+-----+------------------+--------+------------+
| id | session_key | length | expires |
+-----+------------------+--------+------------+
| 263 | SNoCeBJsZkUegA7F | 86400 | 1257401198 |
| 264 | UoVm3SZRmPHnac4V | 86400 | 1257405561 |
| 262 | bjkIOWBhI1qxcrWr | 86400 | 1257401189 |
+-----+------------------+--------+------------+
without "pre" or "code" or some such, this looks like this:
+-----+------------------+--------+------------+
| id | session_key | length | expires |
+-----+------------------+--------+------------+
| 263 | SNoCeBJsZkUegA7F | 86400 | 1257401198 |
| 264 | UoVm3SZRmPHnac4V | 86400 | 1257405561 |
| 262 | bjkIOWBhI1qxcrWr | 86400 | 1257401189 |
+-----+------------------+--------+------------+
It is used to demonstrate pre-formatted text, where new-line breaks are relevant. For instance, ascii art ;-) or program code. Well, for program code the CODE element is better.
The PRE element represents a character cell block of text and is suitable for text that has been formatted for a monospaced font.
The PRE tag may be used with the optional WIDTH attribute. The WIDTH attribute specifies the maximum number of characters for a line and allows the HTML user agent to select a suitable font and indentation.
Hypertext Markup Language - 2.0 specs from W3C
Have you ever looked an article posted in code project site ? If you didn't take a look at it this http://www.codeproject.com/KB/game/Hangman_game.aspx. From the article the yellow section or the one with collapse and expand code snippet are pre taged. It helps to preserve the data the way it is written or presented as it is without distorted.