| Home | Libraries | People | FAQ | More |
The Perl regular expression syntax is based on that used by the programming
language Perl . Perl regular expressions are the default behavior in Boost.Regex
or you can pass the flag perl
to the basic_regex
constructor, for example:
Perl正则表达式语法基于编程语言Perl的使用。Perl正则表达式是Boost.Regex的默认行为，
或者你可以将标记 perl
传入 basic_regex
的构造，例如：
// e1 is a case sensitive Perl regular expression: // since Perl is the default option there's no need to explicitly specify the syntax used here: boost::regex e1(my_expression); // e2 a case insensitive Perl regular expression: boost::regex e2(my_expression, boost::regex::perl|boost::regex::icase);
In Perl regular expressions, all characters match themselves except for the
following special characters:
在Perl正则表达式中，除了下面的特殊字符外，所有的字符都匹配自己：
.[{()\*+?|^$
The single character '.' when used outside of a character set will match
any single character except:
单字符'.'在字符集之外使用时可以匹配任意单字符，除了：
match_not_dot_null
is passed to the matching
algorithms.match_not_dot_null
被传入匹配算法中时。
match_not_dot_newline
is passed to the matching
algorithms.match_not_dot_newline
被传入匹配算法中时。
A '^' character shall match the start of a line.
'^'字符会匹配行的起始。
A '$' character shall match the end of a line.
'$'字符会匹配行的终止。
A section beginning (
and ending )
acts as a marked sub-expression. Whatever matched the sub-expression is split
out in a separate field by the matching algorithms. Marked sub-expressions
can also repeated, or referred to by a back-reference.
开始的 (
和终止的 )
之间的部分是被标记的子表达式。匹配算法会将子表达式匹配的部分分离成独立的部分。
标记子表达式也可以被重复，或后向引用。
A marked sub-expression is useful to lexically group part of a regular expression,
but has the side-effect of spitting out an extra field in the result. As
an alternative you can lexically group part of a regular expression, without
generating a marked sub-expression by using (?:
and )
, for example (?:ab)+
will repeat ab
without splitting out any separate sub-expressions.
标记子表达式对于正则表达式中的成组文字部分是非常有用的，但将结果分组是有副作用的。
作为选择，可以通过 (?:
和 )
产生文字分组，但不产生标记子表达式，例如 (?:ab)+
会重复 ab
但并不分隔出单独的子表达式。
Any atom (a single character, a marked sub-expression, or a character class)
can be repeated with the *
, +
, ?
,
and {}
operators.
任意原子(单个字符，一个标记子表达式或一个字符组)可以通过
*
, +
, ?
和 {}
操作符重复。
The *
operator will match the preceding atom zero or more
times, for example the expression a*b
will match any of
the following:
*
操作符会匹配前面的原子零次或多次，例如表达式
a*b
可以匹配下面的：
b ab aaaaaaaab
The +
operator will match the preceding atom one or more
times, for example the expression a+b
will match any of
the following:
+
操作符会匹配前面的原子一次或多次，
例如表达式 a+b
可以匹配下面的：
ab aaaaaaaab
But will not match:
但不会匹配：
b
The ?
operator will match the preceding atom zero or one
times, for example the expression ca?b will match any of the following:
?
操作符会匹配前面的原子零次或一次，
例如表达式 ca?b
会匹配下面的：
cb cab
But will not match:
但不会匹配：
caab
An atom can also be repeated with a bounded repeat:
原子同样可以被重复有界次数：
a{n}
Matches 'a' repeated exactly n times.
a{n}
匹配'a'重复n次。
a{n,}
Matches 'a' repeated n or more times.
a{n,}
匹配'a'重复n次或更多次。
a{n, m}
Matches 'a' repeated between n and m times inclusive.
a{n, m}
匹配'a'重复n次到m次之间。
For example:
例如：
^a{2,3}$
Will match either of:
会匹配如下：
aa aaa
But neither of:
但不会匹配：
a aaaa
It is an error to use a repeat operator, if the preceding construct can not
be repeated, for example:
如果前面的结构不能被重复，那么使用重复操作符是一个错误，例如：
a(*)
Will raise an error, as there is nothing for the *
operator
to be applied to.
但报告一个错误，因为 *
操作符没有可以应用的对象。
The normal repeat operators are "greedy", that is to say they will
consume as much input as possible. There are non-greedy versions available
that will consume as little input as possible while still producing a match.
通常的重复是"贪婪的"，也说明说它们会消耗尽可能多的输入。同样存在非贪婪版本，生成匹配时会消耗尽可能少的输入。
*?
Matches the previous atom zero or more times, while
consuming as little input as possible.
*?
匹配前面的原子零次或多次，但尽可能少地消耗输入。
+?
Matches the previous atom one or more times, while
consuming as little input as possible.
+?
匹配前面的原子一次或多次，但尽可能少地消耗输入。
??
Matches the previous atom zero or one times, while
consuming as little input as possible.
??
匹配前面的原子零次或一次，但尽可能少地消耗输入。
{n,}?
Matches the previous atom n or more times, while
consuming as little input as possible.
{n,}?
匹配前面的原子n次或更多次，但尽可能少地消耗输入。
{n,m}?
Matches the previous atom between n and m times,
while consuming as little input as possible.
{n,m}?
匹配前面的原子n次到m次，但尽可能少地消耗输入。
By default when a repeated patten does not match then the engine will backtrack
until a match is found. However, this behaviour can sometime be undesireable
so there are also "pocessive" repeats: these match as much as possible
and do not then allow backtracking if the rest of the expression fails to
match.
缺省情况下，当一个重复模式不能被匹配时，引擎将回溯直至找到一个匹配。但是，有时候这种行为不是用户所期望的，
因此还有一种"pocessive"重复：它尽可能多地进行匹配且当剩下的表达式不能匹配时不允许进行回溯。
*+
Matches the previous atom zero or more times, while
giving nothing back.
*+
匹配前一个原子零次或多次，但不退回。
++
Matches the previous atom one or more times, while
giving nothing back.
++
匹配前一个原子一次或多次，但不退回。
?+
Matches the previous atom zero or one times, while
giving nothing back.
?+
匹配前一个原子零次或一次，但不退回。
{n,}+
Matches the previous atom n or more times, while
giving nothing back.
{n,}+
匹配前一个原子n次或多次，但不退回。
{n,m}+
Matches the previous atom between n and m times,
while giving nothing back.
{n,m}+
匹配前一个原子n至m次，但不退回。
An escape character followed by a digit n, where n
is in the range 1-9, matches the same string that was matched by sub-expression
n. For example the expression:
一个转义字符跟着一个数字
n/，/n 的范围是1-9，匹配被子表达式 n
匹配的相同字符串。例如表达式：
^(a*).*\1$
Will match the string:
匹配字符串：
aaabbaaa
But not the string:
但不匹配：
aaabba
You can also use the \g escape for the same function, for example:
你也可以用 \g 转义符达到相同功效，例如：
|
Escape 转义符 |
Meaning 意义 |
|---|---|
|
|
Match whatever matched sub-expression 1 |
|
|
Match whatever matched sub-expression 1: this form allows for safer
parsing of the expression in cases like |
|
|
Match whatever matched the last opened sub-expression |
|
|
Match whatever matched the last but one opened sub-expression |
|
|
Match whatever matched the sub-expression named "one" |
Finally the \k escape can be used to refer to named subexpressions, for example
\k<two>
will match whatever matched the subexpression
named "two".
最后，\k 转义符可用于引用命名子表达式，例如
\k<two>
将匹配名为 "two" 的子表达式的内容。
The |
operator will match either of its arguments, so
for example: abc|def
will match either "abc"
or "def".
|
操作符匹配它的参数之一，
例如：abc|def
会匹配 "abc" 或 "def"。
Parenthesis can be used to group alternations, for example: ab(d|ef)
will match either of "abd" or "abef".
括号可以用来对选择进行分组，例如：ab(d|ef)
会匹配 "abd" 或 "abef"。
Empty alternatives are not allowed (these are almost always a mistake), but
if you really want an empty alternative use (?:)
as a
placeholder, for example:
空的选择是不允许的(这通常都是错误)，但如果你真的需要一个空的选择，可以使用
(?:)
作为占位符，例如：
|abc
is not a valid expression, but
|abc
不是有效的表达式，但
(?:)|abc
is and is equivalent, also the expression:
(?:)|abc
是有效的表达式，并且与以下表达式：
(?:abc)??
has exactly the same effect.
(?:abc)??
有完全相同的作用
A character set is a bracket-expression starting with [
and ending with ]
, it defines a set of characters, and
matches any single character that is a member of that set.
字符集是一个以
[
开始，以 ]
结束的方括号表达式，它定义了一个字符的集合，匹配集合中的任意单个字符。
A bracket expression may contain any combination of the following:
方括号表达式可以包含下面的组合：
For example [abc]
, will match any of the characters 'a',
'b', or 'c'.
例如 [abc]
可以匹配 'a'、'b'
或 'c'。
For example [a-c]
will match any single character in the
range 'a' to 'c'. By default, for Perl regular expressions, a character x
is within the range y to z, if the code point of the character lies within
the codepoints of the endpoints of the range. Alternatively, if you set the
collate
flag when constructing the regular expression, then ranges are locale
sensitive.
例如 [a-c]
可以匹配'a'到'c'范围内的任意单个字符。对于缺省的Perl正则表达式，
如果字符x的编码点在范围两端字符y和z的编码点之间，就称字符x在范围y到z的中间。
另外，如果在构造正则表达式时设置了 collate
标记， 那范围就是locale相关的。
If the bracket-expression begins with the ^ character, then it matches the
complement of the characters it contains, for example [^a-c]
matches any character that is not in the range a-c
.
如果方括号表达式以 ^ 字符开始，那么它匹配包含字符的补集，例如
[^a-c]
匹配不在 a-c
范围内的任意字符。
An expression of the form [[:name:]]
matches the named
character class "name", for example [[:lower:]]
matches any lower case character. See character
class names.
形如 [[:name:]]
的表达式匹配命名字符类"name"，例如
[[:lower:]]
任意小写字符。 参见 字符类名称。
An expression of the form [[.col.]]
matches the collating
element col. A collating element is any single character,
or any sequence of characters that collates as a single unit. Collating elements
may also be used as the end point of a range, for example: [[.ae.]-c]
matches the character sequence "ae", plus any single character
in the range "ae"-c, assuming that "ae" is treated as
a single collating element in the current locale.
形如 [[.col.]]
的表达式匹配对照元素 /col/。对照元素是任意的单个字符，或对应于某个单个单元的字符序列。
对照还可以用作范围的端点，例如 [[.ae.]-c]
匹配字符序列"ae"，和任意的单个字符在范围"ae"到c之间，
其中"ae"被当前locale处理为单个对照元素。
As an extension, a collating element may also be specified via it's symbolic name, for example:
作为扩展，对照元素可以通过其 符号名
指定，例如：
[[.NUL.]]
matches a \0
character.
匹配一个 \0
字符。
An expression of the form [[=col=]]
, matches any character
or collating element whose primary sort key is the same as that for collating
element col, as with collating elements the name col
may be a symbolic name.
A primary sort key is one that ignores case, accentation, or locale-specific
tailorings; so for example [[=a=]]
matches
any of the characters: a, À, Á, Â, Ã, Ä, Å, A, à, á, â, ã, ä and å. Unfortunately implementation
of this is reliant on the platform's collation and localisation support;
this feature can not be relied upon to work portably across all platforms,
or even all locales on one platform.
形如 [[=col=]]
的表达式匹配主排序关键字等同于对照元素 col
的任意字符或对照元素，其中名字为 col
的对照元素可以是一个 符号名。主排序关键字忽略大小写、重音或特定区域(locale)的裁剪(tailorings)；
所以如 [[=a=]]
匹配下面的字符：a, À, Á, Â, Ã, Ä, Å,
A, à, á, â, ã, ä 和 å。 不幸的是这个实现依赖于平台的对照(collation)和地区(localization)支持；
这个特性并不能很好地可移植工作于所有的平台，甚至一个平台上的所有区域(locale)。
All the escape sequences that match a single character, or a single character
class are permitted within a character class definition. For example [\[\]]
would match either of [
or ]
while [\W\d]
would match any character that is either a "digit", or
is not a "word" character.
任意匹配单个字符或单个字符类的转义序列都可以定义在字符类中。
例如[\[\]]
可以匹配 [
或 ]
，而 [\W\d]
可以匹配任何不是"数字"/或不是/"单词"的字符。
All of the above can be combined in one character set declaration, for example:
[[:digit:]a-c[.NUL.]]
.
所有上面的都可以在一个字符类声明中被组合，例如
[[:digit:]a-c[.NUL.]]
。
Any special character preceded by an escape shall match itself.
任意特殊字符前面加转义符都匹配自己。
The following escape sequences are all synonyms for single characters:
下面的转义序列都和单个字符同义：
|
Escape 转义符 |
Character 字符 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
An ASCII escape sequence - the character whose code point is X
% 32 |
|
|
A hexadecimal escape sequence - matches the single character whose
code point is 0xdd. |
|
|
A hexadecimal escape sequence - matches the single character whose
code point is 0xdddd. |
|
|
An octal escape sequence - matches the single character whose code
point is 0ddd. |
|
|
Matches the single character which has the symbolic
name name. For example |
Any escaped character x, if x is
the name of a character class shall match any character that is a member
of that class, and any escaped character X, if x
is the name of a character class, shall match any character not in that class.
任意被转义的字符 x/，如果 /x 是一个字符类的名称，会匹配这个字符类成员的任意字符。
任意被转义的字符 X, 如果 x
是一个字符类的名称，则会匹配不在这个类中的任意字符。

下面表格中的字符属性名称都等价于 在字符类中使用的名字。
|
Form 形式 |
Description 说明 |
Equivalent character set form 等价的字符集形式 |
|---|---|---|
|
|
Matches any character that has the property X. |
|
|
|
Matches any character that has the property Name. |
|
|
|
Matches any character that does not have the property X. |
|
|
|
Matches any character that does not have the property Name. |
|
For example \pd
matches any "digit" character,
as does \p{digit}
.
例如 \pd
匹配任意的"数字"字符，和 \p{digit}
作用是一样的。
The following escape sequences match the boundaries of words:
下面的转义序列匹配单词的边界：
\<
Matches the start of a word.
\<
匹配单词的起点。
\>
Matches the end of a word.
\>
匹配单词的终点。
\b
Matches a word boundary (the start or end of a word).
\b
匹配单词的边界(起点或终点)。
\B
Matches only when not at a word boundary.
\B
只有不在单词边界时才匹配。
The following match only at buffer boundaries: a "buffer" in this
context is the whole of the input text that is being matched against (note
that ^ and $ may match embedded newlines within the text).
下面的转义序列匹配缓冲区边界：这里的"缓冲区"指用于匹配的全部输入文本(注意，^和$可以用于匹配文本中的行)。
\` Matches at the start of a buffer only.
\` 匹配缓冲区的起点。
\' Matches at the end of a buffer only.
\' 匹配缓冲区的终点
\A Matches at the start of a buffer only (the same as \\\`
).
\A 匹配缓冲区的起点(同 \\\`
一样)。
\z Matches at the end of a buffer only (the same as \\'
).
\z 匹配缓冲区的终点(同 \\'
一样)。
\Z Matches a zero-width assertion consisting of an optional sequence of newlines
at the end of a buffer: equivalent to the regular expression (?=\v*\z)
.
Note that this is subtly different from Perl which behaves as if matching
(?=\n?\z)
. \Z 匹配一个零长度的断言，包括缓冲区结尾处可能存在的空行：等价于正则表达式
(?=\v*\z)
。注意，这与 Perl 中匹配 (?=\n?\z)
的行为有一些微妙的不同。
The sequence \G
matches only at the end of the last match
found, or at the start of the text being matched if no previous match was
found. This escape useful if you're iterating over the matches contained
within a text, and you want each subsequence match to start where the last
one ended.
序列 \G
只在上次匹配结尾或匹配文本的起点(如果前面没有匹配)。
当你要迭代文本中所有的匹配，并且每个子序列都从上一次结束时开始匹配的话，这个转义是很有用的。
The escape sequence \Q
begins a "quoted sequence":
all the subsequent characters are treated as literals, until either the end
of the regular expression or \E is found. For example the expression: \Q\*+\Ea+
would match either of:
转义序列 \Q
开始一个"被引用序列"：所有后面的字符都被当作字面对待，除非正则表达式结束或碰到
\E。 例如，表达式：\Q\*+\Ea+
可以匹配如下：
\*+a \*+aaa
\C
Matches a single code point: in Boost regex this has
exactly the same effect as a "." operator.
\C
匹配一个单一的码表：在 Boost.Regex 中这和"."操作符的作用是完全相同的。
\X
Matches a combining character sequence: that is any
non-combining character followed by a sequence of zero or more combining
characters.
\X
匹配一个组合字符序列：任意非组合字符跟上一个零或多个组合字符的序列。
The escape sequence \R
matches any line ending character
sequence, specifically it is identical to the expression (?>\x0D\x0A?|[\x0A-\x0C\x85\x{2028}\x{2029}])
.
转义序列 \R
匹配任何行末符序列，特别地，它等同于表达式
(?>\x0D\x0A?|[\x0A-\x0C\x85\x{2028}\x{2029}])
.
\K
Resets the start location of $0 to the current text
position: in other words everything to the left of \K is "kept back"
and does not form part of the regular expression match. $` is updated accordingly.
\K
将$0的开始位置重置为当前文本位置：换言之，\K
左边的所有东西被"退回"且不作为该正则表达式的匹配部分。
$` 也被相应更新。
For example foo\Kbar
matched against the text "foobar"
would return the match "bar" for $0 and "foo" for $`.
This can be used to simulate variable width lookbehind assertions.
例如，foo\Kbar
用于匹配文本 "foobar"
时，将对 $0 返回匹配 "bar"，对 $` 返回 "foo"。
这可以被用于模拟可变宽度的后向环视断言。
Any other escape sequence matches the character that is escaped, for example
\@ matches a literal '@'.
其它转义序列匹配被转义的字符，例如
\@匹配 '@'。
Perl-specific extensions to the regular expression syntax all start with
(?
.
Perl扩展的正则表达式语法都以 (?
开始。
You can create a named subexpression using:
你可以如下创建一个命名子表达式：
(?<NAME>expression)
Which can be then be refered to by the name NAME. Alternatively
you can delimit the name using 'NAME' as in:
然后，该表达式即可通过名字
NAME 来引用。或者你也可以用 'NAME' 来分隔该名字，如：
(?'NAME'expression)
These named subexpressions can be refered to in a backreference using either
\g{NAME}
or \k<NAME>
and can
also be refered to by name in a Perl
format string for search and replace operations, or in the match_results
member functions.
这些命名子表达式可以用 \g{NAME}
或 \k<NAME>
来后向引用，也可以在一个 Perl
格式化串或在 match_results
成员函数中通过名字来引用以进行搜索和替换的操作。
(?# ... )
is treated as a comment, it's contents are ignored.
(?# ... )
作为注释，里面的内容被忽略。
(?imsx-imsx ... )
alters which of the perl modifiers are
in effect within the pattern, changes take effect from the point that the
block is first seen and extend to any enclosing )
. Letters
before a '-' turn that perl modifier on, letters afterward, turn it off.
(?imsx-imsx ... )
改变在模式中perl修饰符是否起作用，从块第一次被遇到的点开始起作用，直到遇到结束
=)=。 '-' 之前的字母打开perl修饰符，后面的字母关闭。
(?imsx-imsx:pattern)
applies the specified modifiers to
pattern only.
(?imsx-imsx:pattern)
只将特定的修饰符应用于指定的模式。
(?:pattern)
lexically groups pattern, without generating
an additional sub-expression.
(?:pattern)
进行字面分组，但不产生额外的子表达式。
(?|pattern)
resets the subexpression count at the start
of each "|" alternative within pattern.
(?|pattern)
在 pattern 内的每个
"|" 选择符开始重置子表达式计数。
The sub-expression count following this construct is that of whichever branch
had the largest number of sub-expressions. This construct is useful when
you want to capture one of a number of alternative matches in a single sub-expression
index.
该结构之后的子表达式计数由具有最大子表达式数量的分支决定。当你想用单个子表达式索引捕获多个可选匹配之一的时候，可使用该结构。
In the following example the index of each sub-expression is shown below
the expression:
在以下例子中，每个子表达式的索引在表达式之下给出：
# before ---------------branch-reset----------- after / ( a ) (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x # 1 2 2 3 2 3 4
(?=pattern)
consumes zero characters, only if pattern
matches.
(?=pattern)
当模式匹配时成功，但不消耗字符。
(?!pattern)
consumes zero characters, only if pattern
does not match.
(?!pattern)
当模式不匹配时成功，但不消耗字符。
Lookahead is typically used to create the logical AND of two regular expressions,
for example if a password must contain a lower case letter, an upper case
letter, a punctuation symbol, and be at least 6 characters long, then the
expression:
前向匹配的典型用法是创建两个正则表达式的逻辑与，例如一个密码必须包含一个小写字符，
一个大写字符，一个标点符号，长度至少6个字符，那么表达式是：
(?=.*[[:lower:]])(?=.*[[:upper:]])(?=.*[[:punct:]]).{6,}
could be used to validate the password.
能被用来验证密码。
(?<=pattern)
consumes zero characters, only if pattern
could be matched against the characters preceding the current position (pattern
must be of fixed length).
(?<=pattern)
只有当模式能够被当前位置之前的字符匹配时才成功(模式必须是固定长度)，但并不消耗字符。
(?<!pattern)
consumes zero characters, only if pattern
could not be matched against the characters preceding the current position
(pattern must be of fixed length).
(?<!pattern)
只有当模式不能够被当前位置之前的字符匹配时才成功(模式必须是固定长度)，但并不消耗字符。
(?>pattern)
pattern is matched
independently of the surrounding patterns, the expression will never backtrack
into pattern. Independent sub-expressions are typically
used to improve performance; only the best possible match for pattern will
be considered, if this doesn't allow the expression as a whole to match then
no match is found at all.
(?>pattern)
pattern
独立于外围模式地被匹配，表达式决不会被回溯到 pattern
中。 独立子表达式通常用于改善性能；只有最好可能的匹配才会被考虑，如果表达式不能作为整体被匹配，那就没有匹配。
(?N) (?-N) (?+N)
(?R) (?0)
(?R)
and (?0)
recurse to the start
of the entire pattern.
(?R)
and (?0)
递归至整个模板的开始。
(?N)
executes sub-expression N
recursively, for example (?2)
will recurse to sub-expression
2.
(?N)
重复执行子表达式/N/，例如
(?2)
将递归至子表达式2。
(?-N)
and (?+N)
are relative recursions, so for example (?-1)
recurses
to the last sub-expression to be declared, and (?+1)
recurses
to the next sub-expression to be declared.
(?-N)
和 (?+N)
是相对递归，因此如
(?-1)
将递归至被声明的最后一个子表达式，而
(?+1)
则递归至被声明的下一个子表达式。
(?(condition)yes-pattern|no-pattern)
attempts to match
yes-pattern if the condition is
true, otherwise attempts to match no-pattern.
(?(condition)yes-pattern|no-pattern)
当 condition
成立时试图匹配 /yes-pattern/，否则试图匹配 /no-pattern/。
(?(condition)yes-pattern)
attempts to match yes-pattern
if the condition is true, otherwise fails.
(?(condition)yes-pattern)
当 condition 成立时试图匹配 /yes-pattern/，否则直接失败。
condition may be either: a forward lookahead assert,
the index of a marked sub-expression (the condition becomes true if the sub-expression
has been matched), or an index of a recursion (the condition become true
if we are executing directly inside the specified recursion).
condition
可以是一个前向匹配断言， 或者是一个标记子表达式序号(当子表达式匹配时条件为真)，
或是一个递归的索引(当我们在指定递归中直接执行时条件为真)。
Here is a summary of the possible predicates:
以下是可能的谓词：
(?(?=assert)yes-pattern|no-pattern)
Executes yes-pattern
if the forward look-ahead assert matches, otherwise executes no-pattern.(?(?=assert)yes-pattern|no-pattern)
如果前向匹配成功则执行
/yes-pattern/，否则执行 /no-pattern/。
(?(?!assert)yes-pattern|no-pattern)
Executes yes-pattern
if the forward look-ahead assert does not match, otherwise executes
no-pattern.(?(?!assert)yes-pattern|no-pattern)
如果前向匹配不成功则执行 /yes-pattern/，否则执行 /no-pattern/。
(?(R)yes-pattern|no-pattern)
Executes yes-pattern
if we are executing inside a recursion, otherwise executes no-pattern.(?(R)yes-pattern|no-pattern)
如果是在某个递归的内部执行，则执行
/yes-pattern/，否则执行 /no-pattern/。
(?(RN)yes-pattern|no-pattern)
Executes yes-pattern if we are executing inside
a recursion to sub-expression N, otherwise executes
no-pattern.(?(RN)yes-pattern|no-pattern)
如果是在某个到子表达式/N/的递归内部执行，则执行
/yes-pattern/，否则执行 /no-pattern/。
(?(DEFINE)never-exectuted-pattern)
Defines a block
of code that is never executed and matches no characters: this is usually
used to define one or more named sub-expressions which are refered to
from elsewhere in the pattern.(?(DEFINE)never-exectuted-pattern)
定义一个从不执行也不匹配任何字符的代码块： 通常用于定义一个或多个从模板其它地方引用的命名子表达式。
The order of precedence for of operators is as follows:
操作符优先级如下：
[==]
[::] [..]
[==]
[::] [..]
\
\
[]
[]
()
()
* + ? {m,n}
* + ? {m,n}
If you view the regular expression as a directed (possibly cyclic) graph,
then the best match found is the first match found by a depth-first-search
performed on that graph, while matching the input text.
如果你将正则表达式当作有向(可能循环)图，那么最优匹配就是在匹配输入文本过程中按照深度优先搜索找到的第一个匹配。
Alternatively:
或者说：
The best match found is the leftmost
match, with individual elements matched as follows;
或者说最优匹配就是当单个元素如下匹配时找到的
最左匹配。
|
Construct 结构 |
What gets matched 被匹配的 |
|---|---|
|
|
Locates the best match for AtomA that has
a following match for AtomB. |
|
|
If Expresion1 can be matched then returns
that match, otherwise attempts to match Expression2. |
|
|
Matches S repeated exactly N times. |
|
|
Matches S repeated between N and M times, and as many times as
possible. |
|
|
Matches S repeated between N and M times, and as few times as possible. |
|
|
The same as |
|
|
The same as |
|
|
Matches the best match for S, and only that. |
|
|
Matches only the best match for S (this is
only visible if there are capturing parenthesis within S). |
|
|
Considers only whether a match for S exists or not. |
|
|
If condition is true, then only yes-pattern is considered, otherwise
only no-pattern is considered. |
The options
normal
, ECMAScript
, JavaScript
and JScript
are all synonyms for perl
.
选项
=normal=，=ECMAScript=，JavaScript
和 JScript
都是 perl
的同义词。
There are a variety
of flags that may be combined with the perl
option
when constructing the regular expression, in particular note that the newline_alt
option alters the syntax, while the collate
, nosubs
and icase
options modify how the case and locale sensitivity
are to be applied.
构造正则表达式时有 一系列标签
可以和 perl
选项组合使用， 尤其注意的是
newline_alt
选项更改语法，而 =collate=、nosubs
和 icase
选项影响大小写和locale敏感内容如何被应用。
The perl smix
modifiers can either be applied using a
(?smix-smix)
prefix to the regular expression, or with
one of the regex-compile
time flags no_mod_m
, mod_x
, mod_s
,
and no_mod_s
.
perl的 smix
修饰符可以通过往正则表达式中添加 (?smix-smix)
前缀，或使用 regex编译时标签
nno_mod_m
, mod_x
, mod_s
和 no_mod_s
之一。


{{ site.description | default: site.github.project_tagline }}
Steven Saus injects people with radioactivity for his day job, but only to serve the forces of good.Mostly.


Chautala Urges MHRD To Include Climate Change & Sustainability Classes In Schools
by Prachi MankaniGeneral News
Dushyant Chautala urged the Union Minister of HRD, Dr Ramesh Pokhriyal Nishank to include climate change sustainability as subjects in the education curriculum
Written By Prachi Mankani | Mumbai | Updated On: November 17, 2019 11:20 IST
Global climate change has already had observable effects on the environment. Haryana Deputy Chief Minister Dushyant Chautala urged the Union Minister of Human Resource Development, Dr Ramesh Pokhriyal Nishank to include climate change and sustainability as subjects in the education curriculum. Taking to Twitter, Chautala released a press note stating the major challenges being faced by the developed countries and how it impacts the health of every citizen.
"Keeping in view the fact that climate change is one of the major challenges being faced by developing countries including us, which has severe impact on the health of every citizen, therefore climate change and sustainability classes as a pan of curriculum in education policy should be introduced throughout the country," a press note by Chautala on Saturday read.
Further citing the example of Venice, he stated that Italy has become the first country to have 'Climate Change and sustainability Classes' compulsory in school to explore the possibility to combat the problem. He also raised concern over the issue of the increasing pollution in the national capital region (NCR) region "which had converted the whole region as gas chamber" (sic), in the letter written to the Union Minister.
READ: Radio channel soon to inform farmers about climate change
READ: Piyush Goyal: India will lead the world in combating poverty, climate change, terrorism
Venice hit by second-worst high tide
The city of Venice was hit by the second-highest tide recorded on November 12. The historic basilica and many of the city's square and alleyways have reportedly been flooded and are underwater. According to international media reports Saint Mark's Square was submerged by more than one meter of water and the adjacent Saint Mark's Basilica was flooded for the sixth time in 1,200 years. However, no damage to the Church was reported.


Over 175 million professionals use LinkedIn to exchange information, ideas and opportunities
- Stay informed about your contacts and industry
- Find the people & knowledge you need to achieve your goals
- Control your professional identity online
Join LinkedIn Today
Search for someone by name:
- First Name
- Last Name


--- layout: post title: iMacwear SPARTA M7 Smart Watch Review date: 2016-01-31 11:50:00.000000000 +08:00 permalink: imacwear-sparta-m7-smart-watch-review/ header-img: "assets/m7/m7-bg.jpg" subtitle: "I had bought this product on September 2015 and I'm making this review after 4 months of thorough usage." categories: - gadget - smartwatch ---
Its been almost 4 months since I bought this item on Chinavasion. The total price of it is around $126.
| Product cost: | $126.69 |
| Shipping cost: | $14.46 |
| Total cost: | $141.15 |
After a couple of weeks, I had received the item and started using it.
The touch and overall experience of the device is snappy, it doesn't lags even if you are using heavy apps like Facebook and Twitter.
The feel of the material is also solid metal, it is not like some cheap plastic that is very light. It feels very rigid even the straps. The rubber material is very strong and cannot be easily worn out.
The sound it is making when playing Youtube videos is unbelievable, many of my friends can't believe it is capable of producing that kind of volume despite its small size.
The common issue with the device of course is, typing. Not only the keyboard is really really hard to get used to, but the problem is, when the keyboard starts to appear, it is occupying the entire screen, making it hard to see the letters you are typing.
The fact that you have to open the back metal plate just to insert/remove memory card is a big inconvinience.
One of the annoying things about it is, the small screws can easily get loose-thread making it hard to actually remove the metal cover. So once you had inserted your SIM card/memory card inside, be sure that you don't plan to remove it very soon, since it is very very hard to remove again. In my case, the metal cover suffered several dents just because I had accidentally scratched it with the screw driver.
One of the problems with the device is, the "thin and crispy" paint coating it have. It can be easily scratched when you are moving your arm through items inside your bag. This resulted into the above appearance on which all the coating on the edges was all scratched off.
The same is true for the top, the small edges along the touch screen is easily scrathed producing that look. Here is the back of the metal plate cover, all the small screws is all gone, only one is actually left, but as you can see, it doesn't fall off still since even w/o the screws on it, it is very hard to open.
The most annoying thing about it, is the charger. It is not ordinary charger since its like a clamp on which you have to put the watch inside it and seal it on to make contact with the bottom of the watch.
The problem is the mechanism on how the watch actually locks in the watch on the cap. There is two small notches that slides in to the main body of the charger, the problem is if one of those two is damaged, the charger cannot press the watch inside anymore. You have to somewhat use some rubber band or something to make a better grip to the charger.
You cannot usually see if the watch is charging specially when it got battery drained (no physical LED power indicator on both watch and charger), so with loose charger contact and battery drained watch, you cannot charge it for example while inside a car, it has to be still since it can't tolerate too much movement.
M7 Sparta is worth the price, but probably the size itself makes it really hard to have some serious use-case. I can say though that it is really more usefull compared to Samsung Gear or Apple Watch, since it can host its own SIM and thus can faciliate communication even if you don't have a phone. Overall, it is still good to have for emergencies and driving, but will not be a complete replacement for your smartphone.


Online compile¶
samples/0_Intro/pzcAdd_online_compile is the example of online compilation.
A online compilation is a method of passing OpenCL kernel code as a character string to a function at run time and constructing a program object.
The following code is important part of this sample code (L.79-82).
1 2 3 4 | // Create Program.
// Online compile on target device with pzc source code.
auto program = cl::Program(context, kernel_src_pzc_add, nullptr);
program.build(devices, nullptr, nullptr, nullptr);
|
kernel_src_pzc_add
is code as a string type.- The
program build()
builds the code ofkernel_src_pzc_add
at run time.


[gecode-users] Constraint store
Christian Schulte
cschulte at kth.se
Tue Apr 29 15:54:38 CEST 2014
Hi,
Gecode is a terrible choice for a cc-inspired language. Please go back to
predecessors of Gecode such as Oz and AKL, there you will find how you can
implement ask and tell efficiently. A (somewhat dated starting point) is:
http://mozart.github.io/publications/
Cheers
Christian
--
Christian Schulte, Professor of Computer Science, KTH,
www.ict.kth.se/~cschulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Pierre Talbot
Sent: Tuesday, April 29, 2014 3:49 PM
To: users at gecode.org
Subject: [gecode-users] Constraint store
Hi,
I develop a compiler for a formal concurrent language called 'ntcc'.
This language introduces a constraint store that we can manipulate with two
operations:
* Ask(c): ask the store d if c is entailed by d.
* Tell(c): Entail the constraint c in the store.
I'd like to use Gecode to implement it but I didn't find anything related to
the notion of store. A technique, probably inefficient, would be to copy the
store each time we want to ask something, add the constraint in and search
for the first solution (if it exists). Also, we are not interested by the
solution but only by the existence of a solution.
If you have any leads on previous works or implementations of such a store
using (or implemented in) Gecode, I'd be grateful.
Regards,
Pierre Talbot (IRCAM)
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the users
mailing list


16th February
1am - 6am
Main Hall, SJCET Palai
As part of promoting the entrepreneurship culture among students, the St. Joseph's College of Engineering and Technology, Palai( SJCET PALAI), in association with Startup Village and the Kerala Government, has decided to set up a Startup Boot Camp at the college. The Startup Boot Camp is a novel project envisaged by the Kerala Government for creating a student network at the grassroots level to promote the entrepreneurship culture among students, and to familiarise them with the process of running business.
As part of promoting the entrepreneurship culture among students, the St. Joseph's College of Engineering and Technology, Palai( SJCET PALAI), in association with Startup Village and the Kerala Government, has decided to set up a Startup Boot Camp at the college. The Startup Boot Camp is a novel project envisaged by the Kerala Government for creating a student network at the grassroots level to promote the entrepreneurship culture among students, and to familiarise them with the process of running business.


This part is inside a .container class.
The .container class provides a responsive fixed width container.
Animal
WhipPET


Ocean [aj61], ocean, in Crystal Sea ------------------------------------------------------------------------ 1: The Savvy Aardvark [ha5r], ship, 2 hulls, 1 rowing port, 6 sails, 1: 33% damaged, departed for Ocean [aj62]. Routes leaving Ocean: North, to Ocean [ai61], 6 days East, to Ocean [aj62], 6 days South, swamp, to Mosquito Fens [ak61], Imperia, 2 days West, to Ocean [aj60], The Inner Sea, 6 days


The naming system of the Akan people is as distinct as that which elders in Togo (the Ewe people), the Ga people, Benin (the Fon people), and the African diaspora pass on to toddlers. Other forms of traditional naming include middle names, which can refer to order of birth as part of the caste of siblings, twin status, or could be an inherited maiden name.
The Akan people use the Kwa language group’s system of timekeeping, which is based on a six-day week, with the seventh day inclusive. In Ashanti homes Sunday-born males and females are named Kwasi or Kwesi and Akosua respectively. Monday-born are Kwadwo or Kojo, Adjoa or Adwoa (meaning ‘associated with peace’); Tuesday-born are Kwabena or Kobi, Abena (meaning ‘associated with the ocean’); Wednesday-born Kwaku or Kweku, Akua (meaning ‘associated with spider/Ananse’); Thursday-born Yaw, Yaa (meaning ‘associated with the earth’); Friday-born Kofi, Afia or Afua (meaning ‘associated with fertility’); and Saturday-born Kwame, Ama (meaning ‘associated with God’).
Most Ghanaians have at least one name from this system. Ghana‘s first president, Kwame Nkrumah, was born on a Saturday, while the seventh Secretary-General of the United Nations, Kofi Atta Annan, was so named for being born on a Friday. The 25-year-old popular Ghanaian-British fashion model Adwoa Caitlin Maria Aboah is Monday-born.


Data directory
This directory contains a few files that yacuws can provide to the client.
./IMAG1976.jpg


|
Mini51 BSP
V3.02.002
The Board Support Package for Mini51 Series
|
#include <Mini51Series.h>
Data Fields | |
| __IO uint32_t | CMPCR [2] |
| __IO uint32_t | CMPSR |
| __IO uint32_t | CMPRVCR |
@addtogroup ACMP Analog Comparator Controller(ACMP) Memory Mapped Structure for ACMP Controller
Definition at line 156 of file Mini51Series.h.
| ACMP_T::CMPCR |
| Bits | Field | Descriptions |
| [0] | ACMPEN | Analog Comparator Enable Control
0 = Analog Comparator Disabled. 1 = Analog Comparator Enabled. Note: Analog comparator output needs to wait 2 us stable time after this bit is set. |
| [1] | ACMPIE | Analog Comparator 0 Interrupt Enable Control
0 = Interrupt function Disabled. 1 = Interrupt function Enabled. |
| [2] | HYSEN | Analog Comparator Hysteresis Enable Control
0 = Hysteresis function Disabled. 1 = Hysteresis function Enabled. |
| [4] | NEGSEL | Analog Comparator Negative Input Selection
0 = The source of the negative comparator input is from CPN pin. 1 = The source of the negative comparator input is from internal band-gap voltage or comparator reference voltage. |
| [8] | RISING | Analog Comparator Rising Edge Trigger Enable Control
0 = Analog comparator rising edge trigger Disabled. 1 = Analog comparator rising edge trigger PWM or Timer Enabled. Note: The bit is only effective while analog comparator triggers PWM or Timer. |
| [9] | FALLING | Analog Comparator Falling Edge Trigger Enable Control
0 = Analog comparator falling edge trigger Disabled. 1 = Analog comparator falling edge trigger PWM or Timer Enabled. Note: The bit is only effective while analog comparator triggers PWM or Timer. |
| [30:29] | CPPSEL | Analog Comparator Positive Input Selection
|
Definition at line 313 of file Mini51Series.h.
| ACMP_T::CMPRVCR |
| Bits | Field | Descriptions |
| [3:0] | CRVS | Comparator Reference Voltage Setting
Comparator reference voltage = AVDD * (1 / 6 + CRVS[3:0] / 24). |
| [7] | OUT_SEL | CRV Module Output Selection
0 = Band-gap voltage. 1 = Internal comparator reference voltage. |
Definition at line 315 of file Mini51Series.h.
| ACMP_T::CMPSR |
| Bits | Field | Descriptions |
| [0] | ACMPF0 | Analog Comparator 0 Flag
This bit is set by hardware whenever the comparator 0 output changes state. This will generate an interrupt if ACMPIE(ACMP_CR0[1]) = 1. 0 = Analog comparator 0 output does not change. 1 = Analog comparator 0 output changed. Note: Software can write 1 to clear this bit to 0. |
| [1] | ACMPF1 | Analog Comparator 1 Flag
This bit is set by hardware whenever the comparator 1 output changes state. This will generate an interrupt if ACMPIE(ACMP_CR1[1]) = 1. 0 = Analog comparator 1 output does not change. 1 = Analog comparator 1 output changed. Note: Software can write 1 to clear this bit to 0. |
| [2] | ACMPO0 | Analog Comparator 0 Output
Synchronized to the APB clock to allow reading by software. Cleared when the comparator 0 is disabled ACMPEN(ACMP_CR0[0]) = 0. 0 = Analog comparator 0 outputs 0. 1 = Analog comparator 0 outputs 1. |
| [3] | ACMPO1 | Analog Comparator 1 Output
Synchronized to the APB clock to allow reading by software. Cleared when the comparator 1 is disabled ACMPEN(ACMP_CR1[0]) = 0. 0 = Analog comparator 1 outputs 0. 1 = Analog comparator 1 outputs 1. |
Definition at line 314 of file Mini51Series.h.


Python for Everybody
Chapter 11
Exercise 11.1
""" Exercise 11.1: Write a simple program to simulate the operation of the grep command on Unix. Ask the user to enter a regular expression and count the number of lines that matched the regular expression: $ python grep.py Enter a regular expression: ^Author mbox.txt had 1798 lines that matched ^Author $ python grep.py Enter a regular expression: ^X- mbox.txt had 14368 lines that matched ^X- $ python grep.py Enter a regular expression: java$ mbox.txt had 4218 lines that matched java$ Python for Everybody: Exploring Data Using Python 3 by Charles R. Severance Solution by Jamison Lahman, June 4, 2017 """ import re count = 0 # Initialize variables input_exp = input('Enter a regular expression: ') reg_exp = str(input_exp) # Regular Expressions are strings fname = 'mbox.txt' fhand = open(fname) for line in fhand: line = line.rstrip() # Only counts if something was found if re.findall(reg_exp, line) != []: count += 1 print(fname + ' had ' + str(count) + ' lines that matched ' + reg_exp)
Exercise 11.2
""" Exercise 11.2: Write a program to look for lines of the form 'New Revision: 39771' and extract the number from each of the lines using a regular expression and the findall() method. Compute the average of the numbers and print out the average. Enter file:mbox.txt 38549.7949721 Enter file:mbox-short.txt 39756.9259259 Python for Everybody: Exploring Data Using Python 3 by Charles R. Severance Solution by Jamison Lahman, June 4, 2017 """ import re rev = [] fname = input('Enter file: ') try: fhand = open(fname) except FileNotFoundError: print('File cannot be opened: ', fname) exit() for line in fhand: line = line.rstrip() rev_temp = re.findall('^New Revision: ([0-9.]+)', line) if not rev_temp: for val in rev_temp: val = float(val) # Convert the strings to floats rev = rev + [val] # Concats new values rev_sum = sum(rev) count = float(len(rev)) rev_ave = rev_sum / count print(rev_ave)


brandname.com
Our business has a compelling story to tell
We deliver superior market insight and business solutions


Normal polygons are polygons with all sides and angles equal. Are formed by triangles, normally isosceles.
For example 6px
triangles connected together form a regular polygon. Normal polygons are characterized by the number of edges or sides.
Normal polygons are characterized by the number of edges or sides. For example 6px triangles connected together form a regular polygon.


--- layout: video meta_teaser: teaser: "" categories: - robotics iframe: "" video: embedURL: "https://www.youtube.com/embed/M7phONgF-MQ" contentURL: "https://www.youtube.com/watch?v=M7phONgF-MQ" thumbnailUrl: "http://img.youtube.com/vi/M7phONgF-MQ/maxresdefault.jpg" title: Shooting Hoops tags: [Think] section: team personhours: 132 rollcall: [Max] ---
We recently went to the Nolan qualifier, and to help convince other teams to bring us into their alliances, we demonstrated the power of our lift mechanism by taking a video of it freeclimbing on a nearby basketball hoop. Evidently it was quite effective - we managed to convince the number 1 team to make us their first team pick.


[gecode-users] Compiling in Mac OS X: .dmg Vs makefile
Guido Tack
tack at ps.uni-sb.de
Mon Oct 20 14:25:34 CEST 2008
Mauricio Toro wrote:
> I am going to check the information about the Mac frameworks.
> However, it seams better to link Gecode statically to my software.
> How can I do this?
Configure gecode with --enable-static --disable-shared, and then link
as usual. I think it currently doesn't work to give both --enable-
shared and --enable-static at the same time. You should make sure
that your program actually links the static libs (install them
somewhere different from the shared libs, or use the -static switch
when linking your program).
Cheers,
Guido
More information about the gecode-users
mailing list


doobie
.
enum
jdbctype
Related Doc:
package enum
object
jdbctype
Source
jdbctype.scala
Linear Supertypes
AnyRef
,
Any
Ordering
Grouped
Alphabetic
By Inheritance
Inherited
jdbctype
AnyRef
Any
Hide All
Show All
Visibility
Public
All
Type Members
sealed abstract
class
JdbcType
extends
Product
with
Serializable
Value Members
final
def
!=
(
arg0:
Any
)
:
Boolean
Definition Classes
AnyRef → Any
final
def
##
()
:
Int
Definition Classes
AnyRef → Any
final
def
==
(
arg0:
Any
)
:
Boolean
Definition Classes
AnyRef → Any
object
Array
extends
JdbcType
with
Product
with
Serializable
object
BigInt
extends
JdbcType
with
Product
with
Serializable
object
Binary
extends
JdbcType
with
Product
with
Serializable
object
Bit
extends
JdbcType
with
Product
with
Serializable
object
Blob
extends
JdbcType
with
Product
with
Serializable
object
Boolean
extends
JdbcType
with
Product
with
Serializable
object
Char
extends
JdbcType
with
Product
with
Serializable
object
Clob
extends
JdbcType
with
Product
with
Serializable
object
DataLink
extends
JdbcType
with
Product
with
Serializable
object
Date
extends
JdbcType
with
Product
with
Serializable
object
Decimal
extends
JdbcType
with
Product
with
Serializable
object
Distinct
extends
JdbcType
with
Product
with
Serializable
object
Double
extends
JdbcType
with
Product
with
Serializable
object
Float
extends
JdbcType
with
Product
with
Serializable
object
Integer
extends
JdbcType
with
Product
with
Serializable
object
JavaObject
extends
JdbcType
with
Product
with
Serializable
object
JdbcType
extends
Serializable
object
LongVarBinary
extends
JdbcType
with
Product
with
Serializable
object
LongVarChar
extends
JdbcType
with
Product
with
Serializable
object
LongnVarChar
extends
JdbcType
with
Product
with
Serializable
object
MsSqlDateTimeOffset
extends
JdbcType
with
Product
with
Serializable
object
MsSqlVariant
extends
JdbcType
with
Product
with
Serializable
object
NChar
extends
JdbcType
with
Product
with
Serializable
object
NClob
extends
JdbcType
with
Product
with
Serializable
object
NVarChar
extends
JdbcType
with
Product
with
Serializable
object
Null
extends
JdbcType
with
Product
with
Serializable
object
Numeric
extends
JdbcType
with
Product
with
Serializable
object
Other
extends
JdbcType
with
Product
with
Serializable
object
Real
extends
JdbcType
with
Product
with
Serializable
object
Ref
extends
JdbcType
with
Product
with
Serializable
object
RowId
extends
JdbcType
with
Product
with
Serializable
object
SmallInt
extends
JdbcType
with
Product
with
Serializable
object
SqlXml
extends
JdbcType
with
Product
with
Serializable
object
Struct
extends
JdbcType
with
Product
with
Serializable
object
Time
extends
JdbcType
with
Product
with
Serializable
object
Timestamp
extends
JdbcType
with
Product
with
Serializable
object
TinyInt
extends
JdbcType
with
Product
with
Serializable
object
VarBinary
extends
JdbcType
with
Product
with
Serializable
object
VarChar
extends
JdbcType
with
Product
with
Serializable
final
def
asInstanceOf
[
T0
]
:
T0
Definition Classes
Any
def
clone
()
:
AnyRef
Attributes
protected[
java.lang
]
Definition Classes
AnyRef
Annotations
@throws
(
...
)
final
def
eq
(
arg0:
AnyRef
)
:
Boolean
Definition Classes
AnyRef
def
equals
(
arg0:
Any
)
:
Boolean
Definition Classes
AnyRef → Any
def
finalize
()
:
Unit
Attributes
protected[
java.lang
]
Definition Classes
AnyRef
Annotations
@throws
(
classOf[java.lang.Throwable]
)
final
def
getClass
()
:
Class
[_]
Definition Classes
AnyRef → Any
def
hashCode
()
:
Int
Definition Classes
AnyRef → Any
final
def
isInstanceOf
[
T0
]
:
Boolean
Definition Classes
Any
final
def
ne
(
arg0:
AnyRef
)
:
Boolean
Definition Classes
AnyRef
final
def
notify
()
:
Unit
Definition Classes
AnyRef
final
def
notifyAll
()
:
Unit
Definition Classes
AnyRef
final
def
synchronized
[
T0
]
(
arg0: ⇒
T0
)
:
T0
Definition Classes
AnyRef
def
toString
()
:
String
Definition Classes
AnyRef → Any
final
def
wait
()
:
Unit
Definition Classes
AnyRef
Annotations
@throws
(
...
)
final
def
wait
(
arg0:
Long
,
arg1:
Int
)
:
Unit
Definition Classes
AnyRef
Annotations
@throws
(
...
)
final
def
wait
(
arg0:
Long
)
:
Unit
Definition Classes
AnyRef
Annotations
@throws
(
...
)
Inherited from
AnyRef
Inherited from
Any
Implementation
Values
Values (MS-SQL Specific)
Ungrouped


--- layout: default title: Swipe - Ads nav_order: 10 has_children: true permalink: /docs/swipe-ads ---
Behold
The greatest ads of all time meticulously recreated in beautiful HTML and CSS.


You have 1 minute to put the tiles into numeric order. Pikachu will swap places with the selected tile. To win the game all the tiles must be in order with Pikachu in the first space. To begin the game select a difficulty mode.
You took too long.
Congratulations! You Won!


--- layout: home title: The Inquiring Reader author: Jon Duelfer description: Reviews and articles on writing that help us understand the intriguing world we live in. keywords: Books, Novels, Reviews, Literature ---
You can find many more recommended short stories at thecommonsapp.com
You can find many more recommended articles at thecommonsapp.com


This is the course website for IS590 Data Visualization in Spring 2019 (Online)
This week we talked a bit about iterative design, then the final project, and ended with discussion about the Idyll framework.
A video of this process (with errors & explaination) for Macs can be found right here.
A video of this process (with errors & explaination) for Windows 10 can be found right here (and see notes at the end of this section).
npm install -g idyll
idyll create
npm install --save<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>npm install --save idyll-vega-lite
idyll
Notes for Windows install:
This week our objectives will be to (1) think about how we construct visualizations based on our audiences, (2) discuss the final project, (3) start working on publishing some visualizations with Idyll, (4) have a brief introduction to the concept of scientific visualization.
We introduce Idyll this week and continue on with more Idyll next week.
Long form Idyll install instructions more Macs/Unix/Linux:
npm: npm install -g idyll
(the -g is to install globally - you probably need root access. If you don’t have root access, then leave out the -g and make a note of where idyll installs. When I say “idyll” you will have to provide the entire path like /Users/jillnaiman1/MYINSTALLLOCATION/idyll
)idyll create
(select a directory and post name)idyll
to build and runnpm install --save idyll-vega-lite
you will probably get some errors about dependencies not being installed
npm install --save<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>(or what ever packages you are missing)
npm install --save idyll-vega-lite
and you should have less errorsnpm install --save<EMAIL_ADDRESS>react-dom@^16.0.0


Fishing Guild Member:
In the Outlaw Forest, if you hunt
Tarlk Basilisks, Hunter Gargoyles, Ol Mahum Warriors, Ol Mahum Witch Doctors, or Ol Mahum Transcenders
, you can get the sweet aromatic fluid the water spirits love.
Back


My name is
Okungbaye Ajibola
I am a Trade Finance Specialist and an Aspiring Frontend Developer
I enjoy building responsive websites and imitating design protoypes.
My Experience
2018 - Present
Standard Bank
Trade Finance Specialist
Tasked with providing guidance on Trade Related Transactions
May 2021 - July 2021
Virtual CTI
Marketing Intern
Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi obcaecati ex sed unde, nemo totam.
Skillset
Contact Me
<EMAIL_ADDRESS>(+234)9017627337
Lagos, Nigeria


1. Introduction
This section is non-normative.
This specification defines how the system clipboard is exposed to web applications.
There are two general APIs described in this specification:
-
Clipboard Event API - This API provides a way to hook into the common clipboard operations of cutting, copying and pasting so that web application can adjust the clipboard data as required.
-
Async Clipboard API - This API provides direct access to read and write the clipboard data. Since this is considered to be a powerful feature, access to this API is controlled by a permission.
2. Use Cases
This section is non-normative.
2.1. Changing Default Clipboard Operations
There are many scenarios where it is desireable to change the default clipboard operations (cut/copy/paste). Here are a few examples:
- Metadata When copying text from a repository of documents, it can be useful for the copied text to include metadata about the source of the copied content.
- Rich content editing When copying text which contains hyperlinks or other structure, it is often useful to be able to reformat the content to preserve important information.
- Graphics with built-in semantics In order to make web applications which allow the manipulation of rich text, or of graphic content such as [SVG11], it is useful to provide a mechanism that allows for copying more than just the rendered content.
- Mathematical information With content such as mathematics, simply copying rendered text and pasting it into another application generally leads to most of the semantics being lost. MathML often needs to be transformed to be copied as plain text, for example to make sure "to the power of" is shown with the caret "^" sign in a formula plain-text input. The XML source could also be placed in the clipboard with the appropriate transformation occurring at paste time.
2.2. Remote Clipboard Synchronization
For web applications that communicate with remote devices (e.g., remote access or remote shell applications), there is often a need for the clipboard data to be kept in sync between the two devices.
One important aspect of this use case is that it requires access to the clipboard in the absense of a user gesture or interaction.
write()
the data to the local clipboard. read()
from the clipboard
whenever it is updated, and then send the new clipboard data to the remote device. 2.3. Trigger Clipboard Actions
Applications that provide an alternate interface to a user agent sometimes need to be able to trigger clipboard actions in the user agent.
As an example, consider a screen reader application that provides a more accessible interface to a standard web browser. While the reader can display content and allow the user to interact with it, actions like clipboard copy need to occur in the underlying browser to ensure that the clipboard content is set correctly (with any metadata added by the browser during copy).
3. Terminology
The term editable context means any element that is either an editing host, a textarea element, or an input element with its type attribute set to any of "text", "search", "tel", "url", "email", "password" or "number".
4. Model
The platform provides a system clipboard.
The system clipboard has a list of clipboard items that are collectively called the system clipboard data.
-
For the § 6 Clipboard Event API, the system clipboard data is exposed as a
DataTransfer
object that mirrors the contents of the clipboard. -
For the § 7 Asynchronous Clipboard API, the system clipboard data is exposed as a sequence of
ClipboardItem
objects that mirrors the contents of the clipboard.
5. Clipboard Events
5.1. Clipboard event interfaces
The ClipboardEvent interface extends the Event
interface.
dictionary :
ClipboardEventInit EventInit {DataTransfer ?=
clipboardData null ; };
- clipboardData
-
A
DataTransfer
object to hold data and meta data related to the event.
[Constructor (DOMString type ,optional ClipboardEventInit eventInitDict = {}),Exposed =Window ]interface :
ClipboardEvent Event {readonly attribute DataTransfer ?; };
clipboardData
- clipboardData
-
The clipboardData attribute is an instance of the
DataTransfer
interface which lets a script read and manipulate values on the system clipboard during user-initiated copy, cut and paste operations. The associated drag data store is a live but filtered view of the system clipboard, exposing mandatory data types the implementation knows the script can safely access. For synthetic events, the drag data store contains the data added by the script that created the event.The clipboardData object’s
items
andfiles
properties enable processing of multi-part or non-textual data from the clipboard.
The interface can be used to construct events. An example is given below:
var pasteEvent = new ClipboardEvent('paste'); pasteEvent.clipboardData.items.add('My string', 'text/plain'); document.dispatchEvent(pasteEvent);
Note: Synthetic clipboard events will not actually modify the clipboard or the document. In other words, while the script above will fire a paste event, the data will not be pasted into the document.
5.2. Clipboard events
5.2.1. The clipboardchange event
The clipboardchange event fires whenever the contents of the system clipboard are changed. These changes could be due to any of the following (non-exhaustive):
-
User-initiated cut or copy actions
-
Scripts that use the § 7 Asynchronous Clipboard API to write to the clipboard
-
Actions that update the clipboard outside the user agent
If the clipboard contents are changed outside the user agent, then the clipboardchange event MUST fire when the user agent regains focus.
Since synthetic cut and copy events do not update the system clipboard, they will not trigger a "clipboardchange" event.
5.2.2. The copy event
When the user initiates a copy action, the user agent fires a clipboard event named copy.
If the event is not canceled, the currently selected data will be copied to the system clipboard. The current document selection is not affected.
The copy event bubbles, is cancelable, and is composed.
See § 8.1 The copy action for a detailed description of the processing model for this event.
A synthetic copy event can be manually constructed and dispatched, but it will not affect the contents of the system clipboard.
5.2.3. The cut event
When the user initiates a cut action, the user agent fires a clipboard event named cut.
In an editable context, if the event is not canceled the action will place the currently selected data on the system clipboard and remove the selection from the document. The cut event fires before the selected data is removed. When the cut operation is completed, the selection is collapsed.
In a non-editable context, the clipboardData
will
be an empty list. Note that the cut event will still be fired
in this case.
The cut event bubbles, is cancelable, and is composed.
See § 8.2 The cut action for a detailed description of the processing model for this event.
A synthetic cut event can be manually constructed and dispatched, but it will not affect the contents of the document or of the system clipboard.
5.2.4. The paste event
When a user initiates a paste action, the user agent fires a clipboard event named paste. The event fires before any clipboard data is inserted into the document.
If the cursor is in an editable context, the paste action will insert clipboard data in the most suitable format (if any) supported for the given context.
The paste action has no effect in a non-editable context, but the paste event fires regardless.
The paste event bubbles, is cancelable, and is composed.
See § 8.3 The paste action for a detailed description of the processing model for this event.
A synthetic paste event can be manually constructed and dispatched, but it will not affect the contents of the document.
5.3. Integration with other scripts and events
5.3.1. Event handlers that are allowed to modify the clipboard
Event handlers may write to the clipboard if any of the following is true:
-
The action which triggers the event is invoked from the user-agent’s own user interface, e.g. from a "Copy" menu entry or shortcut key.
-
The action which triggers the event is invoked from a scripting thread which is allowed to show a popup.
The implementation may allow other trusted event types to modify the clipboard if the implementation authors believe that those event types are likely to express user intention. The implementation may also support configuration that trusts specific sites or apps to modify the clipboard regardless of the origin of the scripting thread.
Synthetic cut and copy events must not modify data on the system clipboard.
5.3.2. Event handlers that are allowed to read from clipboard
Event handlers may read data from the system clipboard if either of the following is true
-
The action that triggers the event is invoked from the user-agent’s own user interface, e.g. a "Paste" menu entry or shortcut key.
-
The script that triggers the action is running on a site which through an implementation-dependant mechanism is given permission to read data from the clipboard.
-
The action that triggers the event is triggered in an app with permissions to read the clipboard.
Synthetic paste events must not give a script access to data on the real system clipboard.
5.3.3. Integration with rich text editing APIs
If an implementation supports ways to execute clipboard commands through
scripting, for example by calling the document.execCommand()
method with the commands "cut",
"copy" and "paste", the implementation must trigger the
corresponding action, which again will dispatch the associated clipboard
event.
These are the steps to follow when triggering copy, cut or paste actions through a scripting API:
-
Execute the corresponding action synchronously.
-
Use the action’s return value as the return value for the API call.
Note: Copy and cut commands triggered through a scripting API will only affect the contents of the real clipboard if the event is dispatched from an event that is trusted and triggered by the user, or if the implementation is configured to allow this. Paste commands triggered through a scripting API will only fire paste events and give access to clipboard contents if the implementation is configured to allow this. How implementations can be configured to allow read or write access to the clipboard is outside the scope of this specification.
5.3.4. Interaction with other events
If the clipboard operation is triggered by keyboard input, the implementation must fire the corresponding event that initiates the clipboard operation. The event is asynchronous but must be dispatched before keyup events for the relevant keys.
The cut and paste actions may cause the implementation to dispatch other supported events, such as textInput, input, change, validation events, DOMCharacterDataModified and DOMNodeRemoved / DOMNodeInserted. Any such events are queued up to fire after processing of the cut/paste event is finished.
The implementation must not dispatch other input-related events like textInput, input, change, and validation events in response to the copy operation.
5.3.5. Event listeners that modify selection or focus
If the event listener modifies the selection or focusable area, the clipboard action must be completed on the modified selection.
6. Clipboard Event API
The Clipboard Event API allows you to override the default cut, copy and paste behavior of the user agent.
Access to the clipboard is performed using the standard DataTransfer
methods to mutate the items
on a ClipboardEvent
's clipboardData
attribute.
One consequence of this is that these clipboard APIs can only
access clipboard data in the context of a ClipboardEvent
handler.
Note: If you need to access the clipboard outside of a clipboard event handler, see § 7 Asynchronous Clipboard API.
Note: The Clipboard Event APIs are synchronous, so they are limited in what they can do. Actions which are potentially blocking (like asking for permission or transcoding a image) are not supported by these APIs. See § 7 Asynchronous Clipboard API for a more powerful API that can support blocking or other time-consuming actions.
6.1. Overriding the copy event
To override the default copy event behavior, a copy event
handler must be added and this event handler must call preventDefault()
to cancel the event.
Canceling the event is required in order for the system clipboard to be
updated with the data in clipboardData
.
If the ClipboardEvent
is not canceled, then the data from the
current document selection will be copied instead.
// Overwrite what is being copied to the clipboard. document.addEventListener('copy', function(e) { // e.clipboardData is initially empty, but we can set it to the // data that we want copied onto the clipboard. e.clipboardData.setData('text/plain', 'Hello, world!'); e.clipboardData.setData('text/html', 'Hello, world!'); // This is necessary to prevent the current document selection from // being written to the clipboard. e.preventDefault(); });
6.2. Overriding the cut event
To override the default cut event behavior, a cut event
handler must be added and this event handler must call preventDefault()
to cancel the event.
Canceling the event is required in order for the system clipboard to be
updated with the data in clipboardData
.
If the ClipboardEvent
is not canceled, then the data from the
current document selection will be copied instead.
Note that canceling the cut event will also prevent the document from being updated (i.e., the current selection will not be removed). The event handler will need to manually update the document to remove the currently selected text.
// Overwrite what is copied to the clipboard. document.addEventListener('cut', function(e) { // e.clipboardData is initially empty, but we can set it to the // data that we want copied onto the clipboard as part of the cut. // Write the data that we want copied onto the clipboard. e.clipboardData.setData('text/plain', 'Hello, world!'); e.clipboardData.setData('text/html', 'Hello, world!'); // Since we will be canceling the cut operation, we need to manually // update the document to remove the currently selected text. deleteCurrentDocumentSelection(); // This is necessary to prevent the document selection from being // written to the clipboard. e.preventDefault(); });
6.3. Overriding the paste event
To override the default paste event behavior, a paste event
handler must be added and this event handler must call preventDefault()
to cancel the event.
Canceling the event is required so that the user agent does not update the document with data from the system clipboard.
Note that canceling the paste event will also prevent the document from being updated (i.e., nothing will be pasted into the document). The event handler will need to manually paste the data into the document.
Also note that, when pasting, the drag data store mode flag is read-only, hence calling setData()
from a paste event handler will not modify the data that is
inserted, and not modify the data on the clipboard.
// Overwrite what is being pasted onto the clipboard. document.addEventListener('paste', function(e) { // e.clipboardData contains the data that is about to be pasted. if (e.clipboardData.types.indexOf('text/html') > -1) { var oldData = e.clipboardData.getData('text/html'); var newData = 'Ha Ha! ' + oldData; // Since we are canceling the paste operation, we need to manually // paste the data into the document. pasteClipboardData(newData); // This is necessary to prevent the default paste action. e.preventDefault(); } });
6.4. Mandatory data types
The implementation must recognise the native OS clipboard format description
for the following data types, to be able to populate the DataTransferItemList
with the correct description for paste events, and
set the correct data format on the OS clipboard in response to copy and cut
events.
6.4.1. Reading from the clipboard
These data types must be exposed by paste events if a corresponding native type exists on the clipboard:
-
text/plain
-
text/uri-list
-
text/csv
-
text/css
-
text/html
-
application/xhtml+xml
-
image/png
-
image/jpg, image/jpeg
-
image/gif
-
image/svg+xml
-
application/xml, text/xml
-
application/javascript
-
application/json
-
application/octet-stream
6.4.2. Writing to the clipboard
These data types must be placed on the clipboard with a corresponding
native type description if added to a DataTransfer
object during copy and cut events.
-
text/plain
-
text/uri-list
-
text/csv
-
text/html
-
image/svg+xml
-
application/xml, text/xml
-
application/json
Warning! The data types that untrusted scripts are allowed to write to the clipboard are limited as a security precaution. Untrusted scripts can attempt to exploit security vulnerabilities in local software by placing data known to trigger those vulnerabilities on the clipboard.
7. Asynchronous Clipboard API
7.1. Navigator Interface
partial interface Navigator { [SecureContext ,SameObject ]readonly attribute Clipboard ; };
clipboard
7.2. Clipboard Interface
typedef sequence <ClipboardItem >; [
ClipboardItems SecureContext ,Exposed =Window ]interface :
Clipboard EventTarget {Promise <ClipboardItems >read ();Promise <DOMString >readText ();Promise <void >write (ClipboardItems );
data Promise <void >writeText (DOMString ); };
data typedef (DOMString or Blob );
ClipboardItemDataType typedef Promise <ClipboardItemDataType >;
ClipboardItemData callback =
ClipboardItemDelayedCallback ClipboardItemData (); [Constructor (record <DOMString ,ClipboardItemData >items ,optional ClipboardItemOptions options = {}),Exposed =Window ]interface {
ClipboardItem static ClipboardItem (
createDelayed record <DOMString ,ClipboardItemDelayedCallback >,
items optional ClipboardItemOptions = {});
options readonly attribute PresentationStyle ;
presentationStyle readonly attribute long long ;
lastModified readonly attribute boolean ;
delayed readonly attribute FrozenArray <DOMString >;
types Promise <Blob >(
getType DOMString ); };
type enum {
PresentationStyle ,
"unspecified" ,
"inline" };
"attachment" dictionary {
ClipboardItemOptions PresentationStyle = "unspecified"; };
presentationStyle
7.2.1. read()
Theread()
method must run these steps:
-
Let p be a new Promise.
-
Run the following steps in parallel:
-
Let r be the result of running check clipboard read permission in parallel
-
If r is not "granted", then reject p with a "NotAllowedError" DOMException
-
Let data be a copy of the system clipboard data represented as a sequence of
ClipboardItem
s. -
Resolve p with data.
-
-
Return p.
const items = await navigator.clipboard.read(); const textBlob = await items[0].getType("text/plain"); const text = await (new Response(textBlob)).text();
7.2.2. readText()
ThereadText()
method must run these steps:
-
Let p be a new Promise.
-
Run the following steps in parallel:
-
Let r be the result of running check clipboard read permission in parallel
-
If r is not "granted", then reject p with a "NotAllowedError" DOMException
-
Let data be a copy of the system clipboard data.
-
Let textData be an empty string.
-
If data contains a "text/plain" item textItem, then:
-
Set textData to be a copy of textItem’s string data
-
-
Resolve p with textData.
-
-
Return p.
navigator.clipboard.readText().then(function(data) { console.log(“Your string: ”, data); });
7.2.3. write(data)
Thewrite(data)
method must run these steps:
-
Let p be a new Promise.
-
Run the following steps in parallel:
-
Let r be the result of running check clipboard write permission in parallel
-
If r is not "granted", then reject p with a "NotAllowedError" DOMException
-
Let cleanItemList be an empty sequence<
Blob
>. -
For each
Blob
item in data:-
Let cleanItem be a sanitized copy of item.
-
If unable to create a sanitized copy, then reject p.
-
Add cleanItem to cleanItemList.
-
-
Replace the system clipboard data with cleanItemList.
-
Resolve p.
-
-
Return p.
var data = new Blob(["Text data"], {type : "text/plain"}); navigator.clipboard.write(data).then(function() { console.log(“Copied to clipboard successfully!”); }, function() { console.error(“Unable to write to clipboard. :-(”); });
7.2.4. writeText(data)
ThewriteText(data)
method must run these steps:
-
Let p be a new Promise.
-
Run the following steps in parallel:
-
Let r be the result of running check clipboard write permission in parallel
-
If r is not "granted", then reject p with a "NotAllowedError" DOMException
-
Let newItemList be an empty sequence<
ClipboardItem
>. -
Let textBlob be a new
Blob
created with: type attribute set to text/plain;charset=utf-8, and blobParts set to a sequence containing the string data. -
Let newItem be a new
ClipboardItem
created with a single representation: type attribute set to text/plain8, and data set to textBlob. -
Add newItem to newItemList.
-
Replace the system clipboard data with newItemList.
-
Resolve p.
-
-
Return p.
await navigator.clipboard.writeText("Howdy, partner!");
8. Clipboard Actions
This section defines clipboard actions and the processing model for event dispatch.
Each clipboard action has two flags called script-triggered and script-may-access-clipboard.
The script-triggered flag is set if the action runs because
of a script, for example a document.execCommand()
call.
Future scripting APIs that interact with the clipboard should also use
these actions, and the script-triggered flag must be set
accordingly.
The script-may-access-clipboard flag is set as follows:
-
If action is copy or cut and the script thread is allowed to modify the clipboard, then
-
Set the action’s script-may-access-clipboard flag
-
-
If action is paste and the script thread is allowed to read from clipboard, then
-
Set the action’s script-may-access-clipboard flag.
-
8.1. The copy action
The copy action consists of the following steps:
-
If the script-triggered flag is set, then
-
If the script-may-access-clipboard flag is unset, then
-
Return false from the copy action, terminate this algorithm
-
-
-
Fire a clipboard event named copy
-
If the event was not canceled, then
-
Copy the selected contents, if any, to the clipboard. Implementations should create alternate text/html and text/plain clipboard formats when content in a web page is selected.
-
-
Else, if the event was canceled, then
-
Call the write content to the clipboard algorithm, passing on the
DataTransferItemList
list items, a clear-was-called flag and a types-to-clear list.
-
-
Return true from the copy action
8.2. The cut action
The cut action consists of the following steps:
-
If the script-triggered flag is set, then
-
If the script-may-access-clipboard flag is unset, then
-
Return false from the cut action, terminate this algorithm
-
-
-
Fire a clipboard event named cut
-
If the event was not canceled, then
-
If there is a selection in an editable context where cutting is enabled, then
-
Copy the selected contents, if any, to the clipboard. Implementations should create alternate text/html and text/plain clipboard formats when content in a web page is selected.
-
Remove the contents of the selection from the document and collapse the selection.
-
Queue tasks to fire any events that should fire due to the modification, see § 5.3 Integration with other scripts and events for details.
-
-
Else, if there is no selection or the context is not editable, then
-
Return false
-
-
-
Else, if the event was canceled, then
-
Call the write content to the clipboard algorithm, passing on the
DataTransferItemList
list items, a clear-was-called flag and a types-to-clear list.
-
-
Return true from the cut action
8.3. The paste action
For the paste action, the script-may-access-clipboard flag depends on an implementation-specific permission mechanism for determining what sites or apps may read from the clipboard. When a paste action is triggered by a script, the implementation must not make clipboard contents available without the user’s permission. If the permission has not already been granted, the permission prompt must include the hostname of the document associated with the script thread.
The paste action consists of the following steps:
-
If the script-triggered flag is set, then
-
If script-may-access-clipboard is unset, then
-
Return false from the paste action, terminate this algorithm
-
-
-
Fire a clipboard event named paste
-
If the event was not canceled, then
-
If there is a selection or cursor in an editable context where pasting is enabled, then
-
Insert the most suitable content found on the clipboard, if any, into the context.
-
Queue tasks to fire any events that should fire due to the modification, see § 5.3 Integration with other scripts and events for details.
-
-
Else
-
Return false
-
-
-
Else, if the event was canceled
-
Return false
-
-
Return true from the action
9. Permissions API Integration
The [permissions] API provides a uniform way for websites to access powerful features like the clipboard. It allows websites to request permissions from users and query which permissions they have.
For the clipboard, two separate permissions are defined: "clipboard-read"
and "clipboard-write"
Note: Clipboard permissions currently only apply to the Async Clipboard API. Future versions of this specification may be updated to apply this permission to other Clipboard interactions.
These clipboard permissions are powerful features permission-related algorithms and types are defined as follows:
- permission descriptor type
-
dictionary
:ClipboardPermissionDescriptor PermissionDescriptor {boolean
=allowWithoutGesture false ; };There are 4 clipboard permissions:
-
{ name: "clipboard-read", allowWithoutGesture: false }
-
{ name: "clipboard-read", allowWithoutGesture: true }
-
{ name: "clipboard-write", allowWithoutGesture: false }
-
{ name: "clipboard-write", allowWithoutGesture: true }
With the following relationships:
-
{ "clipboard-read" + true }
is stronger than{ "clipboard-read" + false }
-
{ "clipboard-write" + true }
is stronger than{ "clipboard-write" + false }
Note: "clipboard-read" and "clipboard-write" are two separate permissions with no inherent strength relationship. However, user agents MAY choose to impose such a strength ordering on these permissions, for example by making the "clipboard-read" permission act stronger than the "clipboard-write" permission. Doing this would effectively turn the "clipboad-read" permission into a way to provide full read/write access to the clipboard since granting (or denying) "clipboard-read" would also grant (deny) "clipboard-write" access.
While user agents MUST support the
ClipboardPermissionDescriptor
as described in this specification, they, of course, retain complete control over the default settings and how (or if) they are exposed to the user.A user agent that wants to have separate user-settable read and write controls over the clipboad and always require a user gesture would handle each descriptor as follows:A user agent that wants to automatically grant "write" access (with a gesture), but have a single user-settable permission that controls full gesture-less access would define "clipboard-read" as being stronger than "clipboard-write" and then handle each descriptor as follows:-
{ "clipboard-read" + false }
is inherited from{ "clipboard-read" + true }
-
{ "clipboard-read" + true }
is exposed for user control -
{ "clipboard-write" + false }
is inherited from{ "clipboard-write" + true }
-
{ "clipboard-write" + true }
is granted by default, but may be overridden by{ "clipboard-read" + true }
because "read" is stronger than "write".
9.1. Clipboard read permission
9.1.1. check clipboard read permission
-
Let readWithoutGesture be the permission state of the
{ name: "clipboard-read", allowWithoutGesture: true }
permission. -
Let hasGesture be true if the current script is not running as a result of direct user action, false otherwise.
-
If readWithoutGesture is granted, then return true.
-
If hasGesture then,
-
Let systemPaste be true if the current script is running as a result of user interaction with a "Paste" element created by the user agent or operating system.
-
If systemPaste is true, then return true.
-
Return the result of request permission to use the
{ name: "clipboard-read", allowWithoutGesture: false }
permission.Note: User agents may choose to request a stronger permission that will implicitly update this permission.
-
-
Return the result of request permission to use the
{ name: "clipboard-read", allowWithoutGesture: true }
permission.
9.2. Clipboard write permission
9.2.1. check clipboard write permission
-
Let writeWithoutGesture be the permission state of the
{ name: "clipboard-write", allowWithoutGesture: true }
permission. -
Let hasGesture be true if the current script is not running as a result of direct user action, false otherwise.
-
If writeWithoutGesture is granted, then return true.
-
If hasGesture then,
-
Let systemCopy be true if the current script is running as a result of user interaction with a "cut" or "copy" element created by the user agent or operating system.
-
If systemCopy is true, then return true.
-
Return the result of request permission to use the
{ name: "clipboard-write", allowWithoutGesture: false }
permission.Note: User agents may choose to request a stronger permission that will implicitly update this permission.
-
-
Return the result of request permission to use the
{ name: "clipboard-write", allowWithoutGesture: true }
permission.
10. Security Considerations
Enabling authors to change what is copied by a user, or to make an automated copy of something that was never selected and allowing unrestricted calls to paste information can raise various security concerns.
Some example scenarios include:
-
A user selects a link and copies it, but a different link is copied to the clipboard. The effect of this can range from an unexpected result on pasting to an attempted "phishing" attack.
-
(Self-XSS) Shell commands or executable script can be placed in the clipboard with the intent that the user will run the pasted content.
-
An image that is specially crafted to exploit bugs in the core OS image handling code can be written to the clipboard.
10.1. Pasting HTML and multi-part data
This section is non-normative.
There are certain security risks associated with pasting formatted or multi-part data.
-
The user might paste hidden data without realising it is there. This may happen if, for example, the markup includes <input type="hidden"> tags or HTML comments. Such hidden data might contain sensitive information.
-
The user might paste malicious JavaScript into a trusted page.
-
The implementation might grant scripts access to local files the user did not intend to expose.
To determine what policies to use, the factors we consider are:
-
The origin of the data being pasted
-
The origin of data sub-parts such as referenced images
-
The origin of the running script
This is an overview of the scenarios and the possible security policies:
Origin of data Origin of script Rules Originates from online source Same as data Do not sanitize HTML. Do not access any local files. Different origin Optionally sanitize content. Do not access any local files. Originates from local application Any Do not sanitize HTML. Grant access to local files Some implementations mitigate the risks associated with pasting rich text by stripping potentially malicious content such as SCRIPT elements and javascript: links by default when pasting rich text, but allow a paste event handler to retrieve and process the original, un-sanitized data.
10.2. General security policies
The implementation must not download referenced online resources, or expose their contents in the
files
list orDataTransferItemList
.If the data on the clipboard is not from a local application, the implementation must not give access to any referenced local files. For example, if the data contains  but the data’s origin is an online resource, the implementation must not add an entry for example.jpg to the clipboardData.items list.
10.3. Transcoding images
To prevent malicious image data from being placed on the clipboard, the image data may be transcoded to produce a safe version of the image.
10.4. Nuisance considerations
Scripts may use the
DataTransfer
API to annoy and confuse users by altering the data on the system clipboard from copy and cut events. This specification does not attempt to prevent such nuisances, though implementations may add additional restrictions.Implementations must handle scripts that try to place excessive amounts of data on the clipboard gracefully.
11. Privacy Considerations
Because these APIs provide access to the user’s clipboard data, there are serious privacy concerns due to the possibility that the clipboard will contain personally-identifiable information (PII) like names, addresses, or passwords.
In general, user agents must ensure that untrusted scripts do not get uncontrolled access to a user’s clipboard data through these APIs.
11.1. Privacy and the Clipboard Event API
The Clipboard Event API allows scripts running in the context of a clipboard event handler to access a copy of the system clipboard and potentially modify the data being written to the clipboard.
User agents should be aware of the following requirements with regards to securing the data accessed by the Clipboard Event API:
-
Objects implementing the
DataTransfer
interface to return clipboard data must not be available outside the ClipboardEvent event handler that the data is provided to. -
If a script stores a reference to an object implementing the
DataTransfer
interface to use from outside the ClipboardEvent event handler, all methods must be no-ops when called outside the expected context. -
Implementations must not let scripts create synthetic clipboard events to get access to real clipboard data (unless the user has configured it to do so).
Even though the Clipboard Event API is not covered by the Clipboard permission, user agents may choose to provide a method for the user to disable this API or to configure which sites are allowed to access it.
11.2. Privacy and the Asychronous Clipboard API
The Asynchronous Clipboard API is a powerful feature because it can allow access to the clipboard data from any script (access is not restricted to Clipboard Event handlers) and data can be accessed in the absence of a user provided gesture.
To help prevent abuse, this API must not be available unless the script is executing in the context of the currently focused document.
11.2.1. Privacy and Clipboard Permission
The Clipboard Permission gates access to this API, but user agents get to choose the permission defaults and which of these permission settings can be set by the user. For example, a user agent may choose to only allow access to the Asynchronous Clipboard API when a user gesture is present and always deny script requests for access without a gesture.
User agents may opt to have this permission automatically expire sometime after the user grants permission, for example, by having the permission expire:
-
After a set time from when the permission was first granted
-
After a set time from the user’s last visit to a site
-
When the user navigates away from the page
11.3. Other Privacy Concerns
If the user agent allows clipboard data to be read using
document.execCommand("paste")
then the user agent must ensure that the user has explicitly allowed that access to take place.12. Acknowledgements
This section is non-normative
The editors would like to acknowledge the contributions of the former editors who helped shepherd this specification through various meetings and mailing-list discussions to bring it to its current state.
-
Hallvord R. M. Steen
The editors would also like to acknowledge their intellectual debt to the documentation of Data Transfer functionalities from Microsoft [MICROSOFT-CLIP-OP] and earlier drafts of the [HTML5] specification. We are also grateful for the draft "safe copy and paste" from Paul Libbrecht (this draft is no longer available on the Web).
And finally, we would like to acknowledge the contributions made by the following:
Adam Barth, Shawn Carnell, Daniel Cheng, Daniel Dardailler, Domenic Denicola, Al Gilman, James Graham, James Greene, Ian Hickson, Darwin Huang, Lachlan Hunt, Philip Jägenstedt, Anne van Kesteren, Marijn Kruisselbrink, Aaron Leventhal, Jim Ley, Paul Libbrecht, "Martijn", Glenn Maynard, Chris Mills, ms2ger, Ryosuke Niwa, Robert O’Callahan, Dave Poehlman, "ROBO Design", Janina Sajka, Rich Schwerdtfeger, Jonas Sicking, Maciej Stachowiak, Mihai Sucan, Dmitry Titov, Ojan Vafai, Tarquin Wilton-Jones, Tom Wlodkowski, and Boris Zbarsky.
Appendix A: Algorithms
write content to the clipboard
- Input
-
items, a
DataTransferItemList
list of items to writeclear-was-called, a boolean
types-to-clear, a list
- Output
-
None
-
If the items list is not empty, then
-
Clear the clipboard
-
For each part in the list,
-
If data type is text/plain, then
-
Ensure encoding is correct per OS and locale conventions
-
Normalize line endings according to platform conventions
-
Place text on clipboard with the appropriate OS clipboard format description
-
-
Else, if data is of a type listed in the mandatory data types list, then
-
Place part on clipboard with the appropriate OS clipboard format description
-
-
Else
-
This is left to the implementation...
It’s not good to leave things up to the implementation. What should happen here?
Note: Due to limitations in the implementation of operating system clipboards, scripts should not assume that custom formats will be available to other applications on the system. For example, there is a limit to how many custom clipboard formats can be registered in Microsoft Windows. While it is possible to use any string for setData()’s type argument, sticking to the mandatory data types is strongly recommended.
-
-
-
-
Else, the items list is empty. Follow these steps to determine whether to clear the clipboard:
-
If the list of items is empty and the clear-was-called flag is true, then
-
If the types-to-clear list is empty, then
-
Clear the clipboard
-
-
Else
-
-
fire a clipboard event
- Input
-
e, the
ClipboardEvent
to fire - Output
-
None
-
Let clear-was-called be false
-
Let types-to-clear be an empty list
-
Let clipboard-event-data be a new
DataTransfer
object with an emptyitems
list. -
Let clipboard-entry be the sequence number of the current clipboard content, or null if the OS clipboard does not support sequence numbers
-
Let trusted be true if the event is generated by the user agent, false otherwise
-
Let target be set as follows:
-
If the context is editable, then
-
Set target to be the element that contains the start of the visible selection or cursor in document order, or the body element if there is no visible selection or cursor.
-
-
Else, if the context is not editable, then
-
Set target to the focused node, or the body element if no node has focus.
-
-
-
Process the event as follows:
-
If e is "paste", then
-
Set the clipboard-event-data’s internal drag data store mode flag to read-only.
-
If trusted is true, or the implementation is configured to give script-generated events read access to the OS clipboard
-
For each clipboard-part on the OS clipboard, carry out these steps:
-
If clipboard-part contains plain text, then
-
Ensure the text is in the encoding the scripting engine uses internally
-
Let new-data be a new
DataTransferItem
with drag data item kind set to string and drag data item type string set to text/plain. -
Set new-data’s data to the plain text.
-
Add new-data to clipboard-event-data’s
items
-
-
If clipboard-part represents file references, then for each file reference:
-
Determine MIME type of referenced file
-
Let new-data be a new
DataTransferItem
with drag data item kind set to file and drag data item type string set to the corresponding MIME type, orapplication/octet-stream
if the file’s type is unknown. -
Set new-data’s data to the file reference data.
-
Add new-data to clipboard-event-data’s
items
-
-
If clipboard-part contains HTML- or XHTML-formatted text, according to the operating system’s convention for describing such clipboard formats, then
-
If the implementation supports pasting HTML, then the implementation must process the markup by calling process an html paste event with clipboard-part and clipboard-event-data.
-
-
If clipboard-part contains data in another supported binary or text-based format (see mandatory data types), then
-
Determine the MIME type of the data
-
Let new-data be a new
DataTransferItem
with drag data item kind set to file, drag data item type string set to the corresponding MIME type -
Set new-data’s data to be the binary or text-based data.
-
Add new-data to clipboard-event-data’s
items
-
-
-
-
Update clipboard-event-data’s
files
property to match entries in clipboard-event-data’sitems
. -
Update clipboard-event-data’s
types
property to match entries in clipboard-event-data’sitems
.
-
-
If e is "copy" or "cut", then
-
Set the associated
DataTransfer
object’s internal drag data store mode flag to read/write
-
-
-
Set e’s
clipboardData
to clipboard-event-data. -
Set e’s
isTrusted
to trusted. -
Set e’s
composed
to true. -
Dispatch the event e which bubbles and is cancelable, and which uses the
ClipboardEvent
interface, at target.Implementation requirements for access to data during event dispatch are defined in [HTML]. Some additional clipboard event-specific processing rules are given below:
Why here? Why not in the HTML spec?
-
If a script calls clearData() or
clear()
and theDataTransfer
object’s internal drag data store mode flag is read/write, then-
Set the clear-was-called flag to true. If an argument is given, add the argument to the types-to-clear list.
-
-
If a script calls setData() or modifies items and the clear-was-called flag is true, then
-
If the types-to-clear list is empty, then
-
Set the clear-was-called flag to false, then
-
-
Else, if setData()’s
type
argument or the new item’s drag data item type string is found in the types-to-clear list, then-
Remove it from the list. If the list is now empty, set the clear-was-called flag to false.
-
-
-
If a script calls getData() or accesses items in the
DataTransferItemList
and clipboard-entry is set, then-
Check that the clipboard data’s sequence number matches clipboard-entry. If the clipboard no longer contains the same entry, set the
DataTransferItemList
object’s internal drag data store mode to protected.
-
Warning! A malicious script listening to a paste event may set up a never-ending loop in order to read what the user places on the clipboard in the future. On platforms where a clipboard sequence number is not available, other limitations should be implemented.
-
process an HTML paste event
- Input
-
clipboard-part, the clipboard part to process
clipboard-event-data, the
DataTransfer
object for this event - Output
-
None
-
Let new-data be a new
DataTransferItem
with drag data item kind set to Plain Unicode string, drag data item type string set to text/html or application/xhtml+xml accordingly. -
Extract the markup from clipboard-part and use the relevant parser to construct a DOM tree.
-
If the markup’s source URL is known, then resolve all relative URLs in HREF and SRC attributes using the source URL as base URL, and set the respective attributes to the resolved absolute URL.
-
If the markup’s origin is from a local application, then check whether there are references to local files and/or other parts of the OS clipboard’s contents. If such references are found, references to sub-parts must be replaced by content-id references using the cid: URL scheme [RFC2392]. To do so, process each attribute referencing a local file or clipboard part according to the following steps:
Are these steps necessary? Do we know about native (platform) clipboard implementations that support multiple parts with internal references?
This feature is at risk because it’s unclear whether it is required, and because it’s hard to test in a cross-platform way.
-
If clipboard-event-data’s
items
already contains an entry for the referenced file or clipboard part, then-
Set itemNumber to the index of the existing entry.
-
-
Else,
-
Let new-file-data be a new
DataTransferItem
with drag data item kind set to "file", and drag data item type string set to the MIME type of the file or clipboard part if known, orapplication/octet-stream
if the file’s type is unknown. -
Let file-info be a new
File
object withname
set to the name part of the HTML attribute contents, andlastModified
set to the timestamp of the referenced file or 0 if the entry references a clipboard part. -
Set new-file-data’s internal
File
object to file-info. -
Add new-file-data to clipboard-event-data’s
items
and let itemNumber be the index of this entry in theDataTransferItemList
.
-
-
Update the DOM attribute that referenced the local file or clipboard part to contain the string 'cid:' followed by itemNumber.
-
-
Serialize the processed DOM and update new-data with the resulting HTML code.
-
Add new-data to clipboard-event-data’s
items
.
-


ITMD 465 - Lab 2 - DOM Manipulation
Larry Jiao -<EMAIL_ADDRESS>Body Text:
Quantity:
Color:
Red
Green
Blue
Run Lab
Reset Lab
Results


public interface IButtonModel
extends java.io.Serializable
| Modifier and Type | Method and Description |
|---|---|
boolean |
consumePress()
Buttons store internally if they've been pressed.
|
boolean |
isEnabled() |
boolean |
isPressed() |
boolean |
isRollover() |
boolean |
isSelected() |
boolean |
isToggle() |
void |
setEnabled(boolean e)
Enables or disables the button.
|
void |
setPressed(boolean pressed)
Sets the 'pressed' flag.
|
void |
setRollover(boolean rollover)
Sets the 'rollover' flag.
|
void |
setSelected(boolean s)
Changes the selected state for this button.
|
void |
setToggle(boolean t)
Changes if this button functions as a regular button or a toggle button (stays selected when pressed).
|
boolean consumePress()
boolean isRollover()
true
if the mouse is hovering over this button.void setRollover(boolean rollover)
isRollover()
boolean isPressed()
true
if this button is currently being pressed.void setPressed(boolean pressed)
isPressed()
boolean isEnabled()
true
if this button is enabled.void setEnabled(boolean e)
boolean isSelected()
true
if setSelected(boolean)
has been used to manually set the selected state,
or if this button is a toggle button and is currently toggled (pressed).void setSelected(boolean s)
boolean isToggle()
true
if this button is a toggle button.void setToggle(boolean t)


I'm terribly sorry, but the page you requested was eaten by a dragon.
If you continue to have problems with pesky dragons, please do contact us.
You probably want to go back to the hall where it is warm and safe, and leave me to finish my bath...


Alleged Fraud: Mompha remanded in prison custody
by Ifeanyi NgeremPopular internet celebrity and suspected Internet fraudster, Ismaila Mustapha, popularly known as Mompha, has pleaded not guilty to a N33 billion money laundering charge leveled against him by the Economic and Financial Crimes Commission (EFCC).
He was arraigned by the EFCC on Monday on 14-count charge at the Federal High Court in Ikoyi, Lagos, Southwest Nigeria.
According to reports, Mompha pleaded not guilty to 14-count charge bordering on the offences.
Justice Mohammad Liman remanded him in prison custody and adjourned till Friday for hearing of his bail application and commencement of trial.
EFCC had arrested Mompha for alleged internet fraud and money laundering recently at the Nnamdi Azikiwe International Airport in Abuja.
The anti-graft agency made the disclosure in a series of tweets titled: “Alleged Internet fraud, Money Laundering: EFCC Arrests Ismaila Mustapha, a.k.a Mompha.
Following the declaration in his arraignment, Mompha had on Thursday dragged EFCC before a High Court in Lagos State
Mompha instituted a fundamental rights enforcement suit against EFCC for detaining him beyond the constitutionally stipulated days without charging him to court.
In the suit filed by his lawyers, Gboyega Oyewole (SAN), Ademola Adefolaju, Kolawole Salami and four others, the businessman is demanding the sum of N5m as damages from the anti-graft agency.
The self-acclaimed Bureau-De-Change operator also sought a court order directing the EFCC to release him unconditionally forthwith from its custody.
Mompha is seeking an order of perpetual injunction restraining EFCC or any person whatsoever acting for or on behalf of the agency from arresting and detaining him in relation to the subject of the suit without recourse to due process of law.