5. reStructuredText Markup¶
Chinese proverb
Making full preparation will not delay your job but quicken the process. – old Chinese proverb
5.1. reStructuredText Primer¶
I would refer the reader to [Sphinx2019] and [Georg2018] for more details.
5.1.1. Sections¶
Sections are identified through their titles, which are marked up with adornment: “underlines” below the title text, or underlines and matching “overlines” above the title. More details can be found at: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections
reStructuredText:
===============
Section Title
===============
Subsection Title
++++++++++++++++
Subsubection Title
------------------
5.1.2. Paragraphs¶
The paragraph is the most basic block in a reST document. Paragraphs are simply chunks of text separated by one or more blank lines. As in Python, indentation is significant in reST, so all lines of the same paragraph must be left-aligned to the same level of indentation. More details can be found at: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#paragraphs
- General Paragraphs
reStructuredText:
This is the first demo paragraph. The blank line above
the first line is required; The blank line below the last
line is required.
This is the second demo paragraph. The blank line above
the first line is required; The blank line below the last
line is required.
Syntax diagram:
+------------------------------+
| paragraph |
| |
+------------------------------+
+------------------------------+
| paragraph |
| |
+------------------------------+
Result:
This is the first demo paragraph. The blank line above the first line is required; The blank line below the last line is required.
This is the second demo paragraph. The blank line above the first line is required; The blank line below the last line is required.
- Bullet Lists Paragraphs
reStructuredText:
- This is the first bullet list item. The blank line above the
first list item is required; blank lines between list items
(such as below this paragraph) are optional.
- This is the first paragraph in the second item in the list.
This is the second paragraph in the second item in the list.
The blank line above this paragraph is required. The left edge
of this paragraph lines up with the paragraph above, both
indented relative to the bullet.
- This is a sublist. The bullet lines up with the left edge of
the text blocks above. A sublist is a new list so requires a
blank line above and below.
- This is a sublist. The bullet lines up with the left edge of
the text blocks above. A sublist is a new list so requires a
blank line above and below.
- This is the third item of the main list.
This paragraph is not part of the list.
Syntax diagram:
+------+-----------------------+
| "- " | list item |
+------| (body elements)+ |
+-----------------------+
Result:
This is the first bullet list item. The blank line above the first list item is required; blank lines between list items (such as below this paragraph) are optional.
This is the first paragraph in the second item in the list.
This is the second paragraph in the second item in the list. The blank line above this paragraph is required. The left edge of this paragraph lines up with the paragraph above, both indented relative to the bullet.
- This is a sublist. The bullet lines up with the left edge of the text blocks above. A sublist is a new list so requires a blank line above and below.
- This is a sublist. The bullet lines up with the left edge of the text blocks above. A sublist is a new list so requires a blank line above and below.
This is the third item of the main list.
This paragraph is not part of the list.
- Bullet Lists Paragraphs
reStructuredText:
1. This is the first bullet list item. The blank line above the
first list item is required; blank lines between list items
(such as below this paragraph) are optional.
2. This is the first paragraph in the second item in the list.
This is the second paragraph in the second item in the list.
The blank line above this paragraph is required. The left edge
of this paragraph lines up with the paragraph above, both
indented relative to the bullet.
a. This is a sublist. The bullet lines up with the left edge of
the text blocks above. A sublist is a new list so requires a
blank line above and below.
b. This is a sublist. The bullet lines up with the left edge of
the text blocks above. A sublist is a new list so requires a
blank line above and below.
3. This is the third item of the main list.
Result:
This is the first bullet list item. The blank line above the first list item is required; blank lines between list items (such as below this paragraph) are optional.
This is the first paragraph in the second item in the list.
This is the second paragraph in the second item in the list. The blank line above this paragraph is required. The left edge of this paragraph lines up with the paragraph above, both indented relative to the bullet.
- This is a sublist. The bullet lines up with the left edge of
- the text blocks above. A sublist is a new list so requires a blank line above and below.
- This is a sublist. The bullet lines up with the left edge of
- the text blocks above. A sublist is a new list so requires a blank line above and below.
This is the third item of the main list.
Syntax diagram:
+-------+----------------------+
| "1. " | list item |
+-------| (body elements)+ |
+----------------------+
Result:
This is the first bullet list item. The blank line above the first list item is required; blank lines between list items (such as below this paragraph) are optional.
This is the first paragraph in the second item in the list.
This is the second paragraph in the second item in the list. The blank line above this paragraph is required. The left edge of this paragraph lines up with the paragraph above, both indented relative to the bullet.
- This is a sublist. The bullet lines up with the left edge of the text blocks above. A sublist is a new list so requires a blank line above and below.
- This is a sublist. The bullet lines up with the left edge of the text blocks above. A sublist is a new list so requires a blank line above and below.
This is the third item of the main list.
Blocked Paragraphs
- Line Blocks
reStructuredText:
Take it away, Eric the Orchestra Leader!
| A one, two, a one two three four
|
| Half a bee, philosophically,
| must, *ipso facto*, half not be.
| But half the bee has got to be,
| *vis a vis* its entity. D'you see?
|
| But can a bee be said to be
| or not to be an entire bee,
| when half the bee is not a bee,
| due to some ancient injury?
|
| Singing...
Syntax diagram:
+------+-----------------------+
| "| " | line |
+------| continuation line |
+-----------------------+
Result:
Take it away, Eric the Orchestra Leader!
A one, two, a one two three fourHalf a bee, philosophically,must, ipso facto, half not be.But half the bee has got to be,vis a vis its entity. D’you see?But can a bee be said to beor not to be an entire bee,when half the bee is not a bee,due to some ancient injury?Singing…
- Doctest Blocks
reStructuredText:
This is an ordinary paragraph.
>>> print 'this is a Doctest block'
this is a Doctest block
The following is a literal block::
>>> This is not recognized as a doctest block by
reStructuredText. It *will* be recognized by the doctest
module, though!
Result:
This is an ordinary paragraph.
>>> print 'this is a Doctest block'
this is a Doctest block
The following is a literal block:
>>> This is not recognized as a doctest block by
reStructuredText. It *will* be recognized by the doctest
module, though!
- Field Lists
reStructuredText:
:Date: 2001-08-16
:Version: 1
:Authors: - Me
- Myself
- I
:Indentation: Since the field marker may be quite long, the second
and subsequent lines of the field body do not have to line up
with the first line, but they must be indented relative to the
field name marker, and they must line up with each other.
:Parameter i: integer
Result:
| Date: | 2001-08-16 |
|---|---|
| Version: | 1 |
| Authors: |
|
| Indentation: | Since the field marker may be quite long, the second and subsequent lines of the field body do not have to line up with the first line, but they must be indented relative to the field name marker, and they must line up with each other. |
| Parameter i: | integer |
5.1.3. Table¶
More details can be found at: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
- Grid Tables
reStructuredText:
+------------------------+------------+----------+----------+
| Header row, column 1 | Header 2 | Header 3 | Header 4 |
| (header rows optional) | | | |
+========================+============+==========+==========+
| body row 1, column 1 | column 2 | column 3 | column 4 |
+------------------------+------------+----------+----------+
| body row 2 | Cells may span columns. |
+------------------------+------------+---------------------+
| body row 3 | Cells may | - Table cells |
+------------------------+ span rows. | - contain |
| body row 4 | | - body elements. |
+------------------------+------------+---------------------+
Result:
| Header row, column 1 (header rows optional) | Header 2 | Header 3 | Header 4 |
|---|---|---|---|
| body row 1, column 1 | column 2 | column 3 | column 4 |
| body row 2 | Cells may span columns. | ||
| body row 3 | Cells may span rows. |
|
|
| body row 4 |
- Simple Tables
reStructuredText:
===== ===== =======
A B A and B
===== ===== =======
False False False
True False False
False True False
True True True
===== ===== =======
Result:
| A | B | A and B |
|---|---|---|
| False | False | False |
| True | False | False |
| False | True | False |
| True | True | True |
reStructuredText:
===== =====
col 1 col 2
===== =====
1 Second column of row 1.
2 Second column of row 2.
Second line of paragraph.
3 - Second column of row 3.
- Second item in bullet
list (row 3, column 2).
\ Row 4; column 1 will be empty.
===== =====
Result:
| col 1 | col 2 |
|---|---|
| 1 | Second column of row 1. |
| 2 | Second column of row 2. Second line of paragraph. |
| 3 |
|
| Row 4; column 1 will be empty. |
- CSV Tables
reStructuredText:
.. csv-table:: Frozen Delights!
:header: "Treat", "Quantity", "Description"
:widths: 15, 10, 30
"Albatross", 2.99, "On a stick!"
"Crunchy Frog", 1.49, "If we took the bones out, it wouldn't be
crunchy, now would it?"
"Gannet Ripple", 1.99, "On a stick!"
| Treat | Quantity | Description |
|---|---|---|
| Albatross | 2.99 | On a stick! |
| Crunchy Frog | 1.49 | If we took the bones out, it wouldn’t be crunchy, now would it? |
| Gannet Ripple | 1.99 | On a stick! |
- List Tables
reStructuredText:
.. list-table:: Frozen Delights!
:widths: 15 10 30
:header-rows: 1
* - Treat
- Quantity
- Description
* - Albatross
- 2.99
- On a stick!
* - Crunchy Frog
- 1.49
- If we took the bones out, it wouldn't be
crunchy, now would it?
* - Gannet Ripple
- 1.99
- On a stick!
| Treat | Quantity | Description |
|---|---|---|
| Albatross | 2.99 | On a stick! |
| Crunchy Frog | 1.49 | If we took the bones out, it wouldn’t be crunchy, now would it? |
| Gannet Ripple | 1.99 | On a stick! |
5.1.4. Images and Figures¶
There are two image directives: imag
and figure
. More details can be found at: http://docutils.sourceforge.net/docs/ref/rst/directives.html#image.
- Simple import
reStructuredText:
.. image:: images/boxp.png
reStructuredText:
.. figure:: images/avg_rating_mon.png
:scale: 50 %
:alt: map to buried treasure
This is the caption of the figure (a simple paragraph).
- Complex import
reStructuredText:
.. figure:: images/boxp.png
:height: 400 px
:width: 800 px
:scale: 50 %
:alt: alternate text
:align: right
This is the caption of the figure (a simple paragraph).
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
.. figure:: images/boxp.png
:height: 400 px
:width: 800 px
:scale: 50 %
:alt: alternate text
:align: center
This is the caption of the figure (a simple paragraph).
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
.. figure:: images/boxp.png
:height: 400 px
:width: 800 px
:scale: 50 %
:alt: alternate text
:align: left
This is the caption of the figure (a simple paragraph).
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Result:
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures Images and Figures
- Figures in table
reStructuredText:
+------------------------------+-----------------------+
| Figures | Description |
+==============================+=======================+
| .. figure:: images/corr.png | Figure 1: test |
| :scale: 20 % | |
+------------------------------+-----------------------+
| .. image:: images/corr.png | Figure 2: test |
| :scale: 20 % | |
+------------------------------+-----------------------+
| .. image:: images/corr.png | Figure 3: test |
| :scale: 20 % | |
+------------------------------+-----------------------+
Result:
5.1.5. Math¶
The math role marks its content as mathematical notation (inline formula). More details can be found at: http://www.sphinx-doc.org/es/stable/ext/math.html.
The input language for mathematics is LaTeX markup. I will not do a LaTex tutorial as here.
- Inline formula
reStructuredText:
The area of a circle is :math:`A_\text{c} = (\pi/4) d^2`.
RFesult:
The area of a circle is .
- Equations
reStructuredText:
.. math::
:label: eq_lin_cost_func
\min _{\beta\in \mathbb {R} ^{p}}{\frac {1}{n}}\|{\hat {X}}\beta-{\hat {Y}}\|^{2}
The equation :eq:`eq_lin_cost_func` is the cost function for linear regression.
Result:
(1)¶
The equation (1) is the cost function for linear regression.
- User defined symbol and equation
Add your definitions to the latex_elements['preamble']
and imgmath_latex_preamble
, then you can apply your own notations for symbol and equtions.
my definitions for symbol and equation:
'\\def\\B{{\\bf \\mathcal B}}\n'+ \
'\\def\\euler{\ e^{i\pi} + 1 = 0}\n'
reStructuredText:
The is a test for the user defined math symbol: :math:`\B`.
The is a test for the user defined math equation:
.. math::
\euler
The is a test for the user defined math symbol: .
The is a test for the user defined math equation:
- More examples
reStructuredText:
.. math::
f(x)
=
\Biggl \lbrace
{
0,\text{ if }
{ x >0}
\atop
1 \text{ otherwise }
}
.. math::
(a + b)^2 &= (a + b)(a + b) \\
&= a^2 + 2ab + b^2
.. math::
:nowrap:
\begin{eqnarray}
y & = & ax^2 + bx + c \nonumber\\
f(x) & = & x^2 + 2xy + y^2\nonumber
\end{eqnarray}
.. math:: e^{i\pi} + 1 = 0
:label: euler
Result:
(2)¶
5.1.6. Source Codes¶
- Source code block
reStructuredText:
.. code-block:: python
'''
This is a source Python code demo for Sphinx.
@date: Apr 25, 2016
@author: Wenqiang Feng
'''
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas.tools.plotting import scatter_matrix
from docutils.parsers.rst.directives import path
if __name__ == '__main__':
print("This is a source Python code demo for Sphinx.")
Result:
'''
This is a source Python code demo for Sphinx.
@date: Apr 25, 2016
@author: Wenqiang Feng
'''
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas.tools.plotting import scatter_matrix
from docutils.parsers.rst.directives import path
if __name__ == '__main__':
print("This is a source Python code demo for Sphinx.")
reStructuredText:
.. code-block:: r
'''
This is a source R code demo for Sphinx.
@date: Apr 25, 2016
@author: Wenqiang Feng
'''
library(reshape2)
library(ggplot2)
# import data
d <- melt(diamonds[,-c(2:4)])
# plot histogram
ggplot(d,aes(x = value)) +
facet_wrap(~variable,scales = "free_x") +
geom_histogram()
print("This is a source R code demo for Sphinx.")
'''
This is a source R code demo for Sphinx.
@date: Apr 25, 2016
@author: Wenqiang Feng
'''
library(reshape2)
library(ggplot2)
# import data
d <- melt(diamonds[,-c(2:4)])
# plot histogram
ggplot(d,aes(x = value)) +
facet_wrap(~variable,scales = "free_x") +
geom_histogram()
print("This is a source R code demo for Sphinx.")
- Source code import
- Python Source code
reStructuredText:
.. literalinclude:: code/sourceCodePy.py
:language: python
Result:
'''
This is a source Python code demo for Sphinx.
@date: Apr 25, 2016
@author: Wenqiang Feng
'''
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas.tools.plotting import scatter_matrix
from docutils.parsers.rst.directives import path
if __name__ == '__main__':
print("This is a source Python code demo for Sphinx.")
- R Source code
reStructuredText:
.. literalinclude:: code/sourceCodeR.R
:language: r
Result:
'''
This is a source R code demo for Sphinx.
@date: Apr 25, 2016
@author: Wenqiang Feng
'''
library(reshape2)
library(ggplot2)
# import data
d <- melt(diamonds[,-c(2:4)])
# plot histogram
ggplot(d,aes(x = value)) +
facet_wrap(~variable,scales = "free_x") +
geom_histogram()
print("This is a source R code demo for Sphinx.")
5.1.7. Reference¶
- Paper reference
reStructuredText:
.. [Ref] Book or article reference, URL or whatever.
Lorem ipsum [Ref]_ dolor sit amet.
Result:
| [Ref] | Book or article reference, URL or whatever. |
Lorem ipsum [Ref] dolor sit amet.
I would refer the reader to [Sphinx2019] for more details.
- Equation reference
reStructuredText:
.. math::
:label: eq_condition
f(x)
=
\Biggl \lbrace
{
0,\text{ if }
{ x >0}
\atop
1 \text{ otherwise }
}
The Equation :eq:`eq_condition` is the definition of :math:`f(x)`.
Result:
(3)¶
The Equation (3) is the definition of .
- Figure reference
reStructuredText:
.. _fig_hist_demo:
.. figure:: images/avg_rating_mon.png
:scale: 50 %
:alt: map to buried treasure
The histogram of the gouped dataset
The Figure. :ref:`fig_hist_demo` is the histogram of the gouped dataset.
Result:
The Figure. The histogram of the gouped dataset is the histogram of the gouped dataset.
- Table reference
reStructuredText:
.. _table_demo:
.. table:: The general table demo
+------------------------+------------+----------+----------+
| Header row, column 1 | Header 2 | Header 3 | Header 4 |
| (header rows optional) | | | |
+========================+============+==========+==========+
| body row 1, column 1 | column 2 | column 3 | column 4 |
+------------------------+------------+----------+----------+
| body row 2 | Cells may span columns. |
+------------------------+------------+---------------------+
| body row 3 | Cells may | - Table cells |
+------------------------+ span rows. | - contain |
| body row 4 | | - body elements. |
+------------------------+------------+---------------------+
Please see the above Table. :ref:`table_demo`.
Result:
| Header row, column 1 (header rows optional) | Header 2 | Header 3 | Header 4 |
|---|---|---|---|
| body row 1, column 1 | column 2 | column 3 | column 4 |
| body row 2 | Cells may span columns. | ||
| body row 3 | Cells may span rows. |
|
|
| body row 4 |
Please see the above Table. The general table demo.
- Footnotes
reStructuredText:
Lorem ipsum [#f1]_ dolor sit amet ... [#f2]_
.. rubric:: Footnotes
.. [#f1] Text of the first footnote.
.. [#f2] Text of the second footnote.
Result:
Lorem ipsum [1] dolor sit amet … [2]
Footnotes
| [1] | Text of the first footnote. |
| [2] | Text of the second footnote. |
- Hyperlinks
- General hyperlink
reStructuredText:
You are more than welcome to visit my personal webpage: `Feng Website`_.
.. _Feng Website: http://web.utk.edu/~wfeng1/
Result:
You are more than welcome to visit my personal webpage: Feng Website.
- Embeded Youtube link:
reStructuredText:
.. raw:: html
<iframe width="700" height="315"
src="https://www.youtube.com/embed/mrEee4bhc7Y"
frameborder="0" allowfullscreen></iframe>
Result:
Warning
You have to use the hyperlink: https://www.youtube.com/embed/
+ name
.
5.2. Roles¶
A role or “custom interpreted text role” is an inline piece of explicit markup. It signifies that that the enclosed text should be interpreted in a specific way. Sphinx uses this to provide semantic markup and cross-referencing of identifiers, as described in the appropriate section. More details can be found at: http://docutils.sourceforge.net/docs/ref/rst/roles.html#customization
5.2.1. Standard Roles¶
- Line markup
reStructuredText:
* emphasis – equivalent of *emphasis*
* strong – equivalent of **strong**
* literal – equivalent of ``literal``
* subscript – H\ :sub:`2`\ O
* superscript – E = mc\ :sup:`2`
* title-reference – for titles of books, periodicals, and other materials
Result:
- emphasis – equivalent of emphasis
- strong – equivalent of strong
- literal – equivalent of
literal
- subscript – H2O
- superscript – E = mc2
- title-reference – for titles of books, periodicals, and other materials
5.2.2. Specialized Roles¶
- raw
reStructuredText:
.. raw:: html
<iframe width="700" height="315"
src="https://www.youtube.com/embed/2Mg8QD0F1dQ"
frameborder="0" allowfullscreen></iframe>
Result:
reStructuredText:
.. role:: raw-html(raw)
:format: html
If there just *has* to be a line break here,
:raw-html:`<br />`
it can be accomplished with a "raw"-derived role.
But the line block syntax should be considered first.
Result:
If there just has to be a line break here,
it can be accomplished with a “raw”-derived role.
But the line block syntax should be considered first.
- replace
reStructuredText:
.. |sphx| replace:: Sphinx
.. |reST| replace:: reStructuredText
|reST| is awesome!
Sphinx and reStructuredText are awesome!
5.3. Directives¶
A directive is a generic block of explicit markup. Along with roles, it is one of the extension mechanisms of reST, and Sphinx makes heavy use of it.
5.3.1. Admonitions¶
Admonitions: attention
, caution
, danger
, error
, hint
, important
, note
, tip
, warning
- attention
reStructuredText:
.. attention::
You neen to pay attention at here!
Result:
Attention
You neen to pay attention at here!
- caution
reStructuredText:
.. caution::
This is a caution alert!
Restlut:
Caution
This is a caution alert!
- important
reStructuredText:
.. important::
This is important!
Result:
Important
This is important!
- User defined admonition
reStructuredText:
.. admonition:: User defined name
You can make up your own admonition too.
Result:
User defined name
You can make up your own admonition too.
- seealso
reStructuredText:
.. seealso::
The authoritative `reStructuredText User Documentation
<http://docutils.sourceforge.net/rst.html>`_. The "ref" links in this
document link to the description of the individual constructs in the reST
reference.
Result:
See also
The authoritative reStructuredText User Documentation. The “ref” links in this document link to the description of the individual constructs in the reST reference.
See more details at Admonitions.
5.3.3. Options¶
reStructuredText:
.. content-tabs::
.. tab-container:: ex1
:title: Example 1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum
.. tab-container:: ex2
:title: Example 2
Sed ut perspiciatis, unde omnis iste natus error sit voluptatem
accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae
ab illo inventore veritatis et quasi architecto beatae vitae dicta
sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit,
aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos,
qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui
dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed
quia non numquam eius modi tempora incidunt, ut labore et dolore magnam
aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum
exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex
ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in
ea voluptate velit esse, quam nihil molestiae consequatur, vel illum,
qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et
accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium
voluptatum deleniti atque corrupti, quos dolores et quas molestias
excepturi sint, obcaecati cupiditate non provident, similique sunt in
culpa, qui officia deserunt mollitia animi, id est laborum et dolorum
fuga. Et harum quidem rerum facilis est et expedita distinctio.  Temporibus autem
quibusdam et aut officiis debitis aut rerum necessitatibus saepe
eveniet, ut et voluptates repudiandae sint et molestiae non recusandae.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis
voluptatibus maiores alias consequatur aut perferendis doloribus
asperiores repellat.
Example 1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
Example 2
Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.  Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
reStructuredText:
.. content-tabs::
.. tab-container:: python
:title: Python
.. rubric:: Description for Python
.. tab-container:: php
:title: PHP
.. rubric:: Description for PHP
Python
Description for Python
PHP
Description for PHP
reStructuredText:
.. container:: content-tabs right-col
.. tab-container:: python
:title: Python
.. rubric:: import library
.. code-block:: python
import xgboost as xgb
.. rubric:: Example request
.. code-block:: python
bst = xgb.train(param, dtrain, num_round, evallist)
.. tab-container:: r
:title: r
.. rubric:: import library
.. code-block:: r
require(xgboost)
.. rubric:: Example request
.. code-block:: r
bstSparse <- xgboost(data = train$data, label = train$label, max.depth = 2, eta = 1)
Python
Import library
import xgboost as xgb
Train model
bst = xgb.train(param, dtrain, num_round, evallist)
r
Import library
require(xgboost)
Train model
bstSparse <- xgboost(data = train$data, label = train$label, max.depth = 2, eta = 1)


|
Drake
|
A dictionary that maps between LCM channel names and translators that convert between LCM message objects and VectorBase objects. More...
#include <drake/systems/lcm/lcm_translator_dictionary.h>
Public Member Functions | |
| LcmTranslatorDictionary () | |
| The constructor. More... | |
| void | AddEntry (const std::string &channel_name, std::unique_ptr< const LcmAndVectorBaseTranslator > translator) |
| Adds a translator this dictionary. More... | |
| bool | HasTranslator (const std::string &channel_name) const |
Returns true if and only if a translator for channel_name exists in the dictionary. More... | |
| const LcmAndVectorBaseTranslator & | GetTranslator (const std::string &channel_name) const |
| Returns a reference to the translator to use with the specified channel. More... | |
Does not allow copy, move, or assignment | |
| LcmTranslatorDictionary (const LcmTranslatorDictionary &)=delete | |
| LcmTranslatorDictionary & | operator= (const LcmTranslatorDictionary &)=delete |
| LcmTranslatorDictionary (LcmTranslatorDictionary &&)=delete | |
| LcmTranslatorDictionary & | operator= (LcmTranslatorDictionary &&)=delete |
A dictionary that maps between LCM channel names and translators that convert between LCM message objects and VectorBase objects.
All translators contained within the dictionary are guaranteed to remain in existence throughout the lifespan of this object.
|
delete |
|
delete |
|
inline |
The constructor.
The dictionary is initially empty.
| void AddEntry | ( | const std::string & | channel_name, |
| std::unique_ptr< const LcmAndVectorBaseTranslator > | translator | ||
| ) |
Adds a translator this dictionary.
| [in] | channel_name | The name of the LCM channel. Messages sent on and received from this channel are assumed to be compatible with translator . |
| [in] | translator | A pointer to the translator to use with the LCM channel. |
| std::runtime_error | If a translator for the channel_name is already in the dictionary. |
| const LcmAndVectorBaseTranslator & GetTranslator | ( | const std::string & | channel_name | ) | const |
Returns a reference to the translator to use with the specified channel.
This reference is guaranteed to remain valid for the lifetime of this dictionary.
| std::runtime_error | if a translator for channel_name does not exist in this dictionary. |
| bool HasTranslator | ( | const std::string & | channel_name | ) | const |
Returns true if and only if a translator for channel_name
exists in the dictionary.
|
delete |
|
delete |


The log4net release builds are built using NAnt. Log4net can also be built using Visual Studio .NET 2002, 2003, or 2005.
To build a release build of log4net you will need to create a strong name key file. See the Strong Name section below.
Visual Studio .NET 2002, 2003 and 2005 are supported build platforms for log4net.
The log4net distribution includes a solution and project file for Visual Studio .NET 2002. Open the log4net.sln from the src directory in the distribution.
The log4net project requires only the following references:
Open the Visual Studio .NET 2002 solution file as above. Visual Studio will convert the solution and project files to Visual Studio .NET 2003 format.
After converting the log4net project you must change the
Conditional Compilation Constants specified for the
log4net project. Open the project properties dialog and
select the Configuration Properties/Build sheet.
Replace the
The log4net project file is not suitable for building log4net for the .NET Compact Framework. To build for the Compact Framework you must create a new C# project for Smart Devices. Configure the project as a library project. Add all the C# files from the src directory in the distribution.
Open the Visual Studio .NET 2002 solution file as above. Visual Studio will convert the solution and project files to Visual Studio .NET 2003 format.
After converting the log4net project you must change the
Conditional compilation symbols specified for the
log4net project. Open the project properties page and
select the Build sheet.
Replace the
In addition the log4net project requires the following new references:
The log4net project file is not suitable for building log4net for the .NET Compact Framework. To build for the Compact Framework you must create a new C# project for Smart Devices. Configure the project as a library project. Add all the C# files from the src directory in the distribution.
The log4net distribution is built using the NAnt tool. A recent NAnt version 0.85 nightly build is required to build log4net, this is available from nant.sourceforge.net.
To support building log4net for the SSCLI framework the NAnt configuration files need to be updated to specify the SSCLI framework directory.
To build log4net from the command line, change directory to the root of the log4net distribution, ensure that the nant executable is in the PATH, and then run the following command:
nant -buildfile:log4net.build compile-all
This command will build log4net for all the supported frameworks that are available on the current machine. To list all the build targets that are available run the following command:
nant -buildfile:log4net.build -projecthelp
Under windows the build.cmd can be used to script the nant build. This can be called from a different directory and will locate the correct log4net.build file to use. For example:
build.cmd compile-all
In order to build the Release builds of log4net a Strong Name key is required.
Use the sn.exe tool in the .NET Framework SDK to generate a strong name key pair.
sn -k log4net.snk
The log4net.snk file should be placed in the root of the log4net distribution, in the same folder as the log4net.build file.
NDoc 1.3 is used to build the log4net SDK documentation. NDoc is available from ndoc.sourceforge.net.
The log4net HTML documentation is built using Velocity. The source are XML files in the xdocs/src directory. Building the documentation requires Java, Ant, and Velocity. Run ant from within the xdocs directory.


Instructions
In this experiment, you will read a passage of text. Your job is to remember the passage as well as you can, because you will be asked some questions about it afterwards.
In this experiment, you will read a passage of text. Your job is to remember the passage as well as you can, because you will be asked some questions about it afterwards.


Anilist
Anilist
Write a Review
Write a Review
menu
Anilist Reccomends
Find What To Watch Next
Select Up To 3 Genres Below
Choose Genre 1 ...
Action
Adventure
Sports
N/A
Materialize Select
Choose Genre 2 ...
Comedy
Fantasy
Demons
N/A
Materialize Select
Choose Genre 3 ...
Horror
Magic
Martial Arts
N/A


Behaviour-Driven Development for better software products
31 May 2021We need to minimize friction due to misunderstandings between software development and software specification teams, proposing an innovative approach for software specification. This one should facilitate the common understanding and encourage each stakeholder’s accountability, product person, software engineer, test engineer, in the quality of the delivered increments.
Structure
- The first part sets the current context with the traditional approach based on the usual agile tools and roles, illustrating some issues and suggesting remedies.
- The second part outlines Behaviour-Driven Development (BDD) as a recognised software crafting technique that can address the issues listed.
- The third part explains the concrete implementation of this technique.
- The fourth part provides immediately usable material for trying it out.
Your feedback
Enjoy your reading and please spend a little more time once you have finished to give me your feedback on this article.
A discussion about this article can also take place here.
Context
Traditional approach
Backlog building
The product owner listens to customer needs, he owns and manages a product backlog composed of features that extend the current product capabilities or current system behaviour.
Features understanding
The product owner explains the expected system behaviour to software and test engineers; they try to align their mental representation with the product owner’s one challenging him with their perspective during backlog grooming or feature kick-off sessions.
Software delivery
Every delivered functional increment is verified by the test engineer; he checks the completeness and the correctness, and with the best effort, the absence of regression. Anomalies are returned to the development team for the next delivery.
Some weaknesses and remedies
Anomalies
Anomalies due to misalignments or lack of quality in the realisation can cause time-consuming ping-pong loops.
Could an innovative approach that re-establishes a contractual element encourage greater accountability of each stakeholder for the quality of delivery?
Cost of regression tests
The testing activity usually focuses on checking newly added features and regressions. Regression testing activity is time-consuming and should be automatized, or unfortunately, may be shortened to well-selected tests.
Could we innovate on the tester’s activity by automating it and giving him more impact upstream?
Loss of trust
Anomalies, regressions, misalignments can have a bad impact on the already established trust towards the product itself, outside or even inside the product team.
Could a collaborative approach that promotes shared accountability, transparency and regular feedback during implementation build trust?
Tunnel effect
The absence of testable delivery for a couple of time means less feedback, hence less opportunity to react to any misalignment.
Could the division of a feature into several deliverables containing one or more scenarios facilitate deliveries and thus feedback possibilities?
Lack of documentation
What does the system solve? What are the features? What are the nominal and edge scenarios? What about testing evidence?
Agile software development manifesto aims to privilege working software over comprehensive documentation. Therefore, the sources of documentation about what the developed system solves are production code, test code and mental and often distributed knowledge. Consequently, more pressure is put on well-crafted code. In addition, narrative sources of documentation can still be valuable for setting the context, but they are usually written at a high level and may no longer be aligned with the behaviour of the completed system.
Could a collaborative approach restore a lightweight, human-readable digital artefact that contractually formalises common understanding and be a source of living documentation that provides features and testing evidence?
BDD
Behaviour-Driven Development (BDD) is a software development technique with the main promise to facilitate shared understanding and optimise software deliveries’ functional quality.
Secure software development
This technique helps to develop securely the right thing, which is the expected system behaviour, and without causing functional regression.
Contract-driven
This technique proposes a context for collaborative specification which aims to establish shared understanding of the expected system behaviour, and formalising this latter as a readable contractual and executable specification on which acceptance tests can be defined.
Domain-driven
The issued specification artefact uses a natural language based on the domain language which is naturally understandable by every stakeholder: product person, software and test engineers.
Documentation-driven
This artefact written with Gherkin syntax explains the system behaviour based on examples grouped in scenarios that describe the system use cases and the business rules.
Here is an example that uses a generic scenario to describe the behaviour of a calculation function; the Examples section defines the input and output values:
Rule: The stress amplitude is the ratio between shock values of two stress driver shocks.
Scenario Outline: Return expected stress amplitude for compatible shock types
Given a stress shock
| driver-key | shock-type | shock-value |
| <driver-key> | <shock-type> | <shock-value> |
And another stress shock
| driver-key | shock-type | shock-value |
| <driver-key> | <ref-shock-type> | <ref-shock-value> |
When calculating amplitude
Then the returned amplitude is <amplitude>
Examples:
| driver-key | shock-type | shock-value | ref-shock-type | ref-shock-value | amplitude |
| Equity-USA | RELATIVE | 0.15 | RELATIVE | 0.10 | 1.5 |
| Equity-USA | RELATIVE | 0.25 | RELATIVE | 0.10 | 2.5 |
| Equity-USA | RELATIVE | -0.15 | RELATIVE | 0.10 | -1.5 |
| Equity-USA | ABSOLUTE | 3 | ABSOLUTE | 2 | 1.5 |
| Equity-USA | ABSOLUTE | 2 | ABSOLUTE | 3 | 0.6667 |
| Equity-USA | ABSOLUTE | 2 | RELATIVE | 0.10 | - |
| Equity-USA | RELATIVE | 0.15 | ABSOLUTE | 2 | - |
| Equity-USA | RELATIVE | 0.15 | RELATIVE | 0 | - |
| Equity-USA | ABSOLUTE | 2 | ABSOLUTE | 0 | - |
More BDD scenarios: Blueprint API (Kotlin),
Test-driven
Coupled with Acceptance Test-Driven Development (ATDD), an outside-in software development technique, the software engineer automates the test cases and can be driven to the completeness, correctness, and the absence of functional regression when developing a feature increment.
BDD was originally named in 2003 by Dan North as a response to test-driven development (TDD), including acceptance test or customer test-driven development practices as found in extreme programming.
BDD in practice
Specification by example activity facilitates a common understanding of expected behaviour based on examples. It applies to a large set of use cases of any domain: calculation, aggregation, orchestration, eventing, management, workflow.
- Specification by example activity is done during Example Mapping sessions.
- Formalisation of expected system behaviour is done with acceptance scenarios expressed with domain language and formalized with Gherkin syntax.
- It requires practice; finding good wording have to be learned by doing; efficient wording can be easily understood, can be validated, and can be automatized.
- Automatization means the development of automatized acceptance tests enabled by using glue code.
- Development of production code is then driven by existing acceptance tests (ATDD).
Three amigos
The conversations in the Specification by Example activity are the result of the interaction of three actors with different perspectives, brought together for the same purpose: Product person or domain expert, software engineer, and test engineer.
The Product person should be the product owner; the Domain expert (business analyst, domain architect, or business owner) can be a substitute of the Product person; the Customer can be an optional stakeholder.
Example mapping
An Example mapping session facilitates structured conversations between the three amigos.
It allows identifying user stories, open questions, business rules, and examples.
Feature, story, business rule, scenario, example
- One feature is explained by one or more scenarios grouped in stories.
- One story usually groups one or more scenarios and represents a feature increment with business value.
- One business rule is usually supported by one or more scenarios or examples.
- One scenario is supported by one or more examples.
- One scenario by nominal case.
- One scenario by edge case.
- One scenario by negative or error case.
Scenarios writing
Writing scenarios helps to build up the common ubiquitous language in a way that everyone can understand and validate.
As it requires some experience and a particular way of thinking, it is recommended to let this activity to the test engineer or the software engineer. Feedback by the Product person can be done once they have drafted the Gherkin specification.
A scenario is composed of a set of preconditions about the initial state or context, then a set of actions (usually one), then a set of assertions (or postconditions) about the final state or context.
Feature: To be able to manage a set of existing clients in a persistent way
Background:
Given a following set of existing clients
| model-id | id | name | internal | prospect | owners | tags | creation-date |
| 1 | ce751f30-217a-422c-b81b-8f75df4917b6 | client1 | true | false | x | key1:a | 2020-10-10T12:00:00 |
| 2 | 29e364b9-f5ef-43d9-9f30-e07a30b73e01 | client2 | true | true | - | - | 2020-10-09T12:00:00 |
Rule: An existing client is a persisted resource in the system.
Scenario: Add a new client to the existing clients
Given a following set of client attributes
| name | prospect | owners | tags |
| test | true | owner1 | key:test,key1:a |
And the next identifier is afd9ce9f-ee0e-4547-8c77-3cc43ec85dbc
And the next timestamp is 2020-10-11T12:00:00
When registering the new client
Then the response status is CREATED
And the attributes of the returned client are the following
| id | name | prospect | owners | tags | creation-date |
| afd9ce9f-ee0e-4547-8c77-3cc43ec85dbc | test | true | owner1 | key:test,key1:a | 2020-10-11T12:00:00 |
And the returned client is added to the set of existing clients
And no export of the configuration has been triggered
And a Slack notification has been sent
More BDD scenarios: Blueprint API (Kotlin),
Scenarios validation
Every scenario has to be validated by every stakeholder or amigo, that it describes an expected facet of the system behaviour. As a result, shared understanding is materialized into a digital set of acceptance scenarios that establish a contract between all stakeholders.
These acceptance scenarios are the foundation of an executable specification and the building blocks for the definition of acceptance tests.
Acceptance testing
Acceptance tests support high-level functional testing which includes testing of new feature increment and regression testing.
This activity is usually done by a test engineer of a quality insurance team to validate a delivered feature increment before its deployment to production.
Non-functional requirements could be tested by specific acceptance tests.
ATDD
ATDD is a test-driven development technique based on acceptance tests used by the software engineer for driving its development to the expected system behaviour.
Given an acceptance scenario, a failing acceptance test is written first, then the software engineer writes the minimal production code to make it pass. This action is repeated with a next acceptance scenario, coupled with a refactoring phase applied to both test and production code, to take care of well-crafted code and design.
This cycle executed at the feature level contains an inner TDD cycle performed at the component level, this technique is named Outside-in TDD.
BDD and ATDD
ATDD is used with BDD to automate acceptance scenarios: one scenario gives one acceptance test.
BDD glue code, test code, and production code
- Test code implements acceptance tests and interacts with the production code.
- BDD glue code implements the mapping of BDD steps writen in natural language into test code.
- BDD steps are mapped by BDD glue code into test code writen in a given technology.
- BDD framework (Cucumber, Behave) traverses the steps and automatizes the execution of the test code.
@Given("a stress shock") // glue code
fun oneShock(shock: List<TestShock>) { // glue code
// test code: fixture
ctx.put("one-stress-shock", shock.first())
}
@Given("another stress shock") // glue code
fun anotherShock(shock: List<TestShock>) { // glue code
// test code: fixture
ctx.put("other-stress-shock", shock.first())
}
@When("calculating amplitude") // glue code
fun calculateAmplitude() { // glue code
// test code: action
val one: TestShock = ctx.byId("one-stress-shock")
val other: TestShock = ctx.byId("other-stress-shock")
runCatching {
AmplitudeComputer().compute(one.toShock(), other.toShock()) // production code
}.getOrNull()
?.let { ctx.put("result-amplitude", it) }
}
@Then("the returned amplitude is {word}") // glue code
fun returnedAmplitudeValueIs(expected: String) { // glue code
// test code: assertion
val resultAmplitude: Double? = ctx.byIdOpt("result-amplitude")
val expectedAmplitude = expected.toNullable()?.toDouble()
if (resultAmplitude != null)
assertThat(resultAmplitude).isCloseTo(expectedAmplitude, offset(0.001))
else
assertThat(expectedAmplitude).isNull()
}
BDD with acceptance test, scope
Well-written BDD scenarios are done using domain language which is naturally high-level so that one scenario could be automated for targetting either a user interacting with a frontend application, or a web API, or a component that supports application logic or domain logic. A specific glue code developed for each target enables this decoupling.
Examples:
BDD with acceptance test vs xUnit tests
Acceptance tests are high-level integration tests defined at feature-level. Supported by the natural language and the Gherkin syntax, their self-documentation is accessible to every stakeholder and emphasizes the implemented and tested behaviour with its preconditions and postconditions. Acceptance tests usually cover functional requirements, and could check non-functional ones as well. Smoke tests can be supported by a subset of acceptance tests.
xUnit tests, due to their technical aspect, do not connect every stakeholder, hence do not provide evidence of which functional requirements are implemented and tested.
BDD and agility
Agile ideology influences methodologies for iterative development of small increments, enabling quick feedback and adapt.
Delivering the most valuable scenarios inside one or more stories has a natural priority, then further valuable set of scenarios can be delivered in other increments.
Scenarios are developed against single acceptance tests which can be executed by a continuous integration tool. This tooling can be configured to monitor which scenarios have been delivered and which ones are still under development. This promotes transparency and enables feedback, early reaction, and prediction towards the deadline.
Living documentation
Living documentation is made possible based on BDD-driven specification with tooling provided by Serenity-BDD.
Evidence of system well-being
-
With Serenity-BDD test execution reports tooling, proof of evidence can be provided to auditors that all requirements covered by the system in place are supported by documented and continuous acceptance tests. It supports Java technology only.
-
With Allure test execution reports tooling, more evidence can be provided to auditors that testing is done in-depth, even at the lower levels of the test pyramid i.e component integration testing and component unit testing, and uniformly for a couple of technologies (Python/Go/Java/Kotlin).
Summary
Outcomes
- Common understanding of expected system behaviour expressed in a domain-oriented ubiquitous language.
- Enhanced probability that the implemented thing is the right one.
- Human-readable, contractual and executable specification directly useable by every actor of the development team.
- Scenario-based, use-case-driven and domain-driven documentation of system behaviour.
- Scenario-based organization and survey of feature development.
- Innovation brought to the tester role, the test engineer can now have a significant impact on the development.
Costs
- Time: to attend, organize and facilitate Example mapping meetings
- Time: to learn one new technique
- Time: to learn how to write BDD-scenarios
- Time: to setup a BDD-framework
- Time: to craft reusable glue code and test code
- Time + Money: to maintain Gherkin phrasing, glue code and test code
This technique should reveal itself as a sustainable investment in product quality.
BDD material
Technical setup
Ready to use blueprints are available as BDD starters for some technology stack:
- Kotlin BDD blueprint (Cucumber)


Presentation
Boosting Privacy Online: Anonymous Credentials in the Browser
Powerpoint
Click
here
to download Powerpoint file.
Transcript
Click
here
to download presentation outline.


Comcast Reunites E.T., Elliott For the Holidays
by Stephanie MlotIn the spirit of the holidays, Comcast has reunited two old friends to hawk its Xfinity cable, internet, and home phone services.

In a longform commercial that debuted during Thursday’s Macy’s Thanksgiving Day Parade (on Comcast’s NBC), everyone’s favorite extra-terrestrial returns to visit Elliott.
But the boy (Henry Thomas) has grown into a man (still Henry Thomas), with a family of his own (including two children who look suspiciously like a young Thomas and Drew Barrymore).
“The audience is going to get everything they want out of a sequel without the messy bits that could destroy the beauty of the original and the special place it has in people’s minds and hearts,” Thomas said in a statement provided by Comcast and published by Variety.
E.T.—the film and character—is no stranger to product placement. I still get a craving for Reece’s Pieces every time I see the big-eyed alien. But he’s an unexpected addition to a festive ad. (Especially considering we’re still a few years away from the movie’s ruby anniversary.)
A compressed version of the commercial aired on TV this week; the full, four-minute-long version can be seen online (above).
Watch as E.T. catches up on life with Elliott’s family, who show him how to surf the web with Comcast’s Xfinity and use an Xfinity TV remote to conjure up holiday movies.
In return, he takes Elliott 2.0 and his sister on a magical bicycle ride through the sky—one of many throwbacks to the original film.
“Our goal is to show how Xfinity and Sky technology connects family, friends, and loved ones, which is so important during the holidays,” PEter Intermaggio, senior vice president for marketing communications at Comcast Cable, said in a statement reported by Variety.
“The classic friendship between E.T. and Elliott resonates around the world,” he continued. “And their story became a very meaningful way to bring our company’s consumer technology to life.”
Steven Spielberg may not have top billing for this sort-of sequel. But the filmmaker, according to Variety, gave his blessing to Comcast, and was consulted throughout the project.
Keep an eye out for the heartwarming ad, set to run in the U.S. through Jan. 5; Comcast will air Sky-related variants in Germany, Italy, and the U.K.
The conglomerate will also feature the original 1982 flick on its SYFY network and across the Xfinity TV platform. Xfinity X1 customers can simply say, “E.T. phone home” into their voice remote to find the movie and unlock more extra-terrestrial content.
More on Geek.com:


A Stencila Document data model
Extends Document
Imports HTML into a Stencila Document
Extends HTMLImporter
Convert HTML into a Stencila Document
This method must be provided when extending HTMLImporter
(any)
Method override to provide a default for
importing HTML elements not matched by converters
(any)
(any)
Exports a Stencila Document to HTML
Extends HTMLExporter
Export a Stencila Document to HTML
(any)
The Stencila Document Editor
Extends AbstractEditor
Render this editor
(any)
A "configurator" for a document.
Uses the Substance package mechanism to reduce repetition.
See substance.Configurator
for inherited methods
used by DocumentHTMLImporter
, DocumentEditor
etc
Extends Configurator
Abstract base class for a Stencila execution context
Defines the Stencila Context
API. The same methods (names and arguments) will be
implemented for all contexts regardless of implementation language. Semantics should be
consistent, but may need to differ, among implmentations.
This class should be extended for JavaScript implementations. All methods return a Promise.
Run code within the context's global scope
object
:
A Promise resolving to object with any
errors
and
output
// You can also assign global variables which are available in subsequent calls,
context.call('foo = "bar"\n\n') // { errors: {}, output: null }
context.call('foo') // { errors: {}, output: { type: 'str', format: 'text', value: 'bar' } }
Execute code within a local function scope
(string)
Code to call
(object)
An object with a data pack for each argument
(object)
Any execution options
object
:
A Promise resolving to object with any
errors
and
output
// Return statement must be used to return an output value
context.call('return 6*7') // { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
context.call('let x = 6\nreturn x*7') // { errors: {}, output: { type: 'int', format: 'text', value: '42' } }
// You can specify inputs (that are local to that call),
context.call('return Math.PI*radius', {radius:{type:'flt', format:'text', value: '21.4'}}) // { errors: {}, output: { type: 'flt', format: 'text', value: '67.23008278682157' } }
context.call('return radius') // { errors: { '1': 'ReferenceError: radius is not defined' }, output: null }
Call a function
(string)
Function name e.g. 'sum'
(array)
An array of unnamed arguments
(namedArgs)
An object of named arguments
(object)
Any execution options
(any)
array<string>
:
A Promise resolving to an object with any
errors
(an object with line numbers as keys) and
outputs
(
a data package)
A HTTP client for a remote Context
Implements the Context
API by remote procedure calls (RPC) to a remote
context (e.g. a RContext
running in a different process)
Extends Context
Does the context support a language?
(any)
Run code
(any)
Call code
(any)
(any)
Does the context provide a function?
(any)
Call a function
(any)
(any)
(any)
(any)
Get the dependencies for a piece of code
(any)
Complete a piece of code
(any)
A Javascript context
Implements the Stencila Context
API. All methods return a Promise.
Extends Context
Does the context support a programming language?
(any)
Run JavaScript code
(any
= in
)
(any
= t
)
Call JavaScript code
(any
=
)
(any
= t
)
(any
=
)
Get the dependencies for a piece of code
(any)
Does the context provide a function?
(any)
Call a function
(any)
(any
= d
)
(any
= t
)
(any
= ce
)
Each Stencila process has a single instance of the Host
class which
orchestrates instances of other classes.
Instances managed by this host
Peer manifests which detail the capabilities of each of this host's peers
Get this host's peers
Register a peer
Peers may have several URLs (listed in the manifest's urls
property; e.g. http://, ws://).
The URL used to register a peer is a unique identier used by this host and is
usually the URL that the peer was discoved on.
Discover peers
Currently, this method just does a port scan on the localhost to find peers. More sophisticated peer discovery mechanisms for remote peers will be implemented later.
Unfortunately if a port is not open then you'll get a console error like
GET http://<IP_ADDRESS>:2040/ net::ERR_CONNECTION_REFUSED
. In Chrome, this can
not be avoided programatically (see http://stackoverflow.com/a/43056626/4625911).
The easiest approach is silence these errors in Chrome is to check the
'Hide network' checkbox in the console filter.
Set the interval
parameter to trigger ongoing discovery.
(number?= s.)
The interval (seconds) between discovery attempts
Make a HTTP request
A simple wrapper around XMLHttpRequest
with certain conventions for
our RPC API:
(string)
Request method (a.k.a. verb)
(string)
Requested URL
(object)
Data to POST or PUT
Promise
:
Convert a Markdown document to a Stencila Document as HTML
string
:
HTML string
Export Markdown content from a Stencila Document as HTML
(object | string)
:
Markdown content
Is a file name to be converted using this converter?
(string)
Name of file
boolean
:
Is the file name matched?
Create linkReference
for inputs with no default value
so they don't get ignored
function
:
Transformer
Transform Pandoc style bracketed spans to MDAST type: 'html' nodes
function
:
Transformer
Convert bracketed spans from MDAST to Markdown
function
:
Transformer
Cleans up Markdown created by rehypeBracketedSpansToMarkdown
object
:
Visitors
Transform to and to
function
:
Vistor function
Transform to and to
function
:
Vistor function
Transform HTML codeblocks to Stencila cells
Transforms HTML codeblocks i.e.

into Stencila cells
i.e.

function
:
Transformer
Transform Stencila cells to HTML codeblocks
Transforms Stencila cells i.e.

into HTML codeblocks
i.e.

function
:
Transformer
A macro for creating and modifying headings
Uses Markdown style headers: hashes followed by one of more spaces
at the beginning of a line indicate a heading with level
equal
to the number of hashes e.g.
When detected on a paragraph will change to a heading. When detected on a heading will change the level of the heading to match the number of hashes.
Extends BlockNodeMacro
Perform the macro action when matched
(any)
(any)
(any)
Create an object with the data for the new node
Should be overidden by derived classes.
Analagous to the method with the same name
in packages/inline-node/InsertInlineNodeCommand
.
(any)
The default context for new external cells. This value is updated whenever a user changes the context for a cell
A Component
for editing a node's source
code
attribute.
This is based on ideas here:
Extends Component
When there is a change in the editor, convert the change into a Substance change
(any)
When the node's code property changes, update the editor (if this wasn't the source of the update) by translating the Substance change into an Ace change
(any)
(any)
A module for rendering of math
uses KaTeX for rendering
uses ASCIIMathTeXImg.js
for converting ASCIIMath to TeX
in the future may use MathJax as a fallback to any things that KaTex does not handle (see http://www.intmath.com/blog/mathematics/katex-with-asciimathml-input-and-mathjax-fallback-9456)
Translate between math markup languages
(string)
The markup
(string)
The source language ( default 'asciimath')
(string)
The target language ( default 'tex')
string
:
Markup translated to the target language
Render math markup into HTML
(string)
The source markup
(string)
The language ('tex' (default) or 'asciimath') of the source
(string)
The display mode ('inline' (default) or 'block')
string
:
Rendered math HTML
Render a Vega specification
(string)
The Vega specification
(any)
For a full list of HTML5 input types see https://developer.mozilla.org/en/docs/Web/HTML/Element/input
Extends InlineInputNode
Get the type code for a value
Exposes the internal type
function so that uses can inspect the
type of a function call or expression
(whatever)
Value you want a type for
string
:
Type of value
Create an array of objects from a table
([type])
[
description
]
[type]
:
[
description
]
A factory function for creating multiple dispatch functions (aka. "multifuncs")
Multifuncs are used in Mini to reduce the number of functions names and associated concepts while maintaining the flexibility to operate on different data types. Wikipedia describes the usefulness of multiple dispatch, particularly in functional languages:
"Function names are usually selected so as to be descriptive of the function's purpose. It is sometimes desirable to give several functions the same name, often because they perform conceptually similar tasks, but operate on different types of input data. In such cases, the name reference at the function call site is not sufficient for identifying the block of code to be executed. Instead, the number and type of the arguments to the function call are also used to select among several function implementations."
See https://en.wikipedia.org/wiki/Multiple_dispatch. Multiple dispatch functions are also known as "multimethods" but we use "multifuncs" instead to avoid introducing another term into the Mini vocabulary.
This function is a convenience for function implementers
(string)
Name of function, used for dispatch error reporting
(integer)
Number of arguments to dispatch upon
(function)
A default function
function
:
The multifunc
Create a table from an array
(any)
Create a table from an object
(any)
Generate random numbers from a probability distribution
This function delegates to random functions for specific distributions
e.g. random_normal
, random_poisson
. The default distribution is the uniform
with parameters min = 0 and max = 1.
(number)
Sample size. Defaults to 1
(string)
Name of distribution
(...[type])
Parameters of the probability distribution (e.e. mean and standard deviation)
[type]
:
[
description
]
random()
0.3784768
random(4)
[0.9282889, 0.1122377, 0.2396080, 0.9305602]
//
random(4, 'normal', 11.3, 2.4)
// Same as...
random_normal(4, 11.3, 2.4)
data = { type: 'table', data: { weight: [85, 46], sex: ['M', 'F'] } }
data | filter('weight<85 and sex==="M"')
(any)
(any)
Apply a theme to a plot specification object
See https://vega.github.io/vega-lite/docs/config.html for themeing options. At time of writing, the docs were out of date with respect to the alpha release so you may need to check https://github.com/vega/vega-lite/blob/master/src/config.ts
(any)
object
:
A
vegalite
object with theme applied
Get the value of a querystring parameter
String
:
The param value
(any)
Get the long form of a component address
(string)
The address to lengthen
string
:
The long form of the address
long('+document')
'new://document'
long('gh:stencila/stencila/README.md')
'gh://stencila/stencila/README.md'
long('./report/intro.md')
'file:///current/directory/report/intro.md'
long('stats/t-test.md')
'lib://stats/t-test.md'
long()
'id://fa4cf2c5cff5b576990feb96f25c98e6111990c873010855a53bcba979583836'
Get the short form of a component address
This method is the inverse of long()
. It shortens an address tp
a smaller, more aeshetically pleasing form, that is useful in URLs
an other places.
(string)
The address to shorten
string
:
The short form of the address
short('new://document')
'+document'
short('file:///some/directory/my-doc.md')
'file:/some/directory/my-doc.md'
short()
'*fa4cf2c5cff5b576990feb96f25c98e6111990c873010855a53bcba979583836'
(any)
Imports/exports a document from/to JSON
This is only here to provide naming consistency with
DocumentHTMLImporter
and DocumentHTMLImporter
(i.e. to have
a JSONCoverter
that is explicitly for Stencila Documents)
Match all elements
Caution! If this is not the last converter in the configurator then this will probably match everything in the HTML document.
Used by DocumentHTMLImporter.defaultConverter
but given that
matching everything, it may not be necessary because we never get there!
Apply HTML sanitization rules for Default
nodes
(any)


Each train has its own destination which marked by the solid circle with same color.
Click the green rectangles to switch branches.


St Helen Bay is a large bay in the Western Cape, is about 80nm north of Cape Town and is about 35nm north of Saldanha Bay. The Sandy Bay harbour is round Shelly Point and faces east.
Eight miles further to the east, is the Berg River which leads to the sheltered Port Owen and is probably the best spot on the South African coast to spend the winter months. It makes an ideal departure port from SA..
Location 32°44.5'S, 18°01.2' E.
Port Owen is not a Port of Entry, clearance must be done at Cape Town.
Last updated April 2015.
Sandy Point Harbour is open to the east but provides a sheltered anchorage in winds from other directions. There is good holding in sand just south of the fish factory.
If more protection is required, the marina at Port Owen offeres complete shelter. There is a bar at the river entrance which breaks in strong NW winds. It is advisable to enter about half tide as LAT is only 1.5m. The marina is just over 1.5 miles from the river entrance.
There is a "holding jetty" on the port side shore at the river entrance and is clearly marked. For visiting yachts wanting to proceed further up-river and into the Marina it is advisable to contact the Marina office. Yachts doing this trip must just follow the line of centre channel marker buoys to the Marina entrance.
The Port Owen Yacht Club welcomes visiting and cruising yachts.
There is a boatyard here with a crane for up to 10 tons. They can provide general repair services, antifouling etc. and long term storage.
Last updated April 2016.


Promises in AngularJS
- Integration with digest cycle
- Testing
In short: necessity to call $rootScope.$digest(), same as in a situation when an event comes from outside of angular.
- Deferred
In other words: builder for promises.
Note: Deprecated in pure JS. obsolete API: Promise.defer() Polyfil and documentation can be found
here
- Unwrapping promises: legacy issue
First versions of AngularJS (<1.2.x) unwrapped promises into values in html templates.
- Notify (external example)
Misconception: it does not call itself after each then, it can be called only by deferred or in constructor
- All, race
Other useful method: allSettled -waits until all promises will be settled (either resolved or rejected) and puts result or error codes in array.
Notice: It will also work in the same way in Pure JS (Author's whim to implement it in AngularJS :P -good usage of $timeout)
Bibliography:
$q API


Allbarber built a comedic empire by creating shareable video- and photo-based content that makes people laugh. Nearing their fifteenth anniversary, they were expanding into mobile and daily products for users and, with that, identified the need for a brand refresh and more complete brand system.
The result of their branding process was a realization of what the brand should be: something that honors the Allbarber personality while exploring a refined design style drawing inspiration from three historic styles (Art Nouveau, Modernism, and Contemporary). The new iteration includes but is not limited to a logo and wordmark refresh, primary and secondary typography, ascribed color palette, and exploration of other secondary brand elements that create a look that supports the brand throughout, and without the need for a dominating, omnipresent logo.
AaBbCcDdEeFfGgHhIiJj
AaBbCcDdEeFfGgHhIiJj


Hibernate is a powerful, ultra-high performance object/relational persistence and query service for Java. Hibernate lets you develop persistent objects following common Java idiom - including association, inheritance, polymorphism, composition and the Java collections framework. Extremely fine-grained, richly typed object models are possible. Hibernate 2.1 features support for plugin cache providers and is designed to integrate with distributed caches (2.1 also implements more aggressive use of the cache). net.sf.hibernate.cache.CacheProvider is the extension point for user-defined cache integration. Hibernate 2.1.1 or higher is required. hibernate.cache.provider_classOSCache and Hibernate 2.1 integrate though OSCacheProvider.
To enable OSCache in Hibernate's configuration, add the following line to hibernate.cfg.xml: hibernate.cfg.xml <property name="hibernate.cache.provider_class">my.patched.provider.package.OSCacheProvider</property> The default refresh period is CacheEntry.INDEFINITE_EXPIRY. The first time a cacheable query is done, the cache has no effect on speed. On the second and successive queries, the cache will be populated and available to be hit.
Cache Region ConfigurationTo modify the refresh period, CRON expression, add the region configuration to your oscache.properties file, as demonstrated below: [region].refresh.period = 4000 [region].cron = * * 31 Feb * # The maximum cache capacity can only be set per region if you use the # net.sf.hibernate.cache.OSCacheProvider distributed with Hibernate. [region].capacity = 5000 # The patched version distributed with OSCache only allows a single cache.capacity setting and saves memory. The com.mypackage.domain.Customer is Hibernate's internal cache region, which defaults to the classname, and which can be altered by setting Hibernate's configuration property hibernate.cache.region_prefix . Source Code |


--- layout: default title: "404: Page not found" permalink: 404.html ---
Sorry, I may have broken something, if you clicked a link and it took you here could you let me know?
Otherwise, here's a link to go home.


Chambray truffaut vice polaroid enamel pin. Skateboard flexitarian locavore waistcoat gochujang, affogato normcore tote bag pork belly lyft sartorial shaman. Jean shorts kinfolk freegan 8-bit slow-carb health goth tacos hexagon pug shabby chic distillery ramps. Pour-over crucifix cray, meggings venmo blog actually semiotics gluten-free cold-pressed godard 90's beard umami roof party. Brunch tumeric retro helvetica, blue bottle VHS skateboard. Four loko distillery kale chips, organic la croix tumeric banh mi cronut plaid raclette gastropub gochujang shoreditch.


upload is not available
{{file.name}}
uploaded,
open it
in new tab
{{file.progress || 0}}%
({{file.timeLeft}} seconds left)


About Jhon Doe
Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium alias, aliquid deserunt dolorum eligendi facilis illo officiis quam recusandae reiciendis saepe similique temporibus? Commodi cumque exercitationem hic ipsa ipsam nemo!
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy.
Contrary to popular belief, Lorem Ipsum is not simply random text.  Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium alias, aliquid deserunt dolorum eligendi facilis illo officiis quam recusandae reiciendis saepe similique temporibus? Commodi cumque exercitationem hic ipsa ipsam nemo!
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque at magna ut ante eleifend eleifend.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque at magna ut ante eleifend eleifend.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque at magna ut ante eleifend eleifend.


About this site:
I started my journey on 3D printing at early 2019 with a cheap delta printer.
From then on, I was again and agina amazed by the aboutdant support and resources released from the 3D printing communities around the world.
Many people generously shared their genius designs for free on platforms like Thingiverse.com.
Since I'm lucky enough to have both 3D modeling and programming capabilities, the OPENjscad became very attractive to me.
The jscad does not require any software installation and significantly reduces the internet traffic needed to transfer one design since each design is contained in a small script file.
I wish to show its severly undervalued power to the 3D printing communities and maybe I can make something even more awesome to happen in the future.
If you appreciate my works or have any suggestions, please contact me at<EMAIL_ADDRESS>Your supprot will encourage me to make more designs and imporve this site!
Donate through paypal.me
my work done so far


If you want to go through the 12-steps and need some guidance look no further. You can find an available sponsor here that will take you through the steps.
Are you experienced at taking other people through the 12-steps and want to find more people to help? Register here and select "Looking to take other people through the steps."
 Create your own modules for taking others through step-work. Share your experience, strengh, and hope with others by making learning modules to help others go through the steps.


Back to main page
IP:
Port:
Use secure connection :
Status:
Disconnected
Select a display mode:
Oldest Object
Newest Object
All Objects
Video Output :
Size :
Offset :
Center
Fit to fusion output
Fit to window size
Custom size


The authority exercised by a regional government over those
who live in the region
The extent to which a regional government is autonomous
rather than deconcentrated
The authority exercised by a regional government or its
representatives in the country as a whole


Blacksmith of the Wind Rooney:
Oh! You'll be more then adequate.
 They can be found here in the Forge of the Gods.
[Quest _901_HowLavasaurusesAreMade blacksmith_rooney_q901_03.htm|Say that you will get them for him]


This extension allows you to test snippets in the documentation in a natural way. It works by collecting specially-marked up code blocks and running them as doctest tests.
Within one document, test code is partitioned in groups, where each group consists of:
When building the docs with the doctest builder, groups are collected for each document and run one after the other, first executing setup code blocks, then the test blocks in the order they appear in the file.
There are two kinds of test blocks:
The doctest extension provides four directives. The group argument is interpreted as follows: if it is empty, the block is assigned to the group named default. If it is *, the block is assigned to all groups (including the default group). Otherwise, it must be a comma-separated list of group names.
A doctest-style code block. You can use standard doctest flags for controlling how actual output is compared with what you give as output. By default, these options are enabled: ELLIPSIS (allowing you to put ellipses in the expected output that match anything in the actual output), IGNORE_EXCEPTION_DETAIL (not comparing tracebacks), DONT_ACCEPT_TRUE_FOR_1 (by default, doctest accepts “True” in the output where “1” is given – this is a relic of pre-Python 2.2 times).
This directive supports two options:
Note that like with standard doctests, you have to use <BLANKLINE> to signal a blank line in the expected output. The <BLANKLINE> is removed when building presentation output (HTML, LaTeX etc.).
Also, you can give inline doctest options, like in doctest:
>>> datetime.date.now() # doctest: +SKIP
datetime.date(2008, 1, 1)
They will be respected when the test is run, but stripped from presentation output.
A code block for a code-output-style test.
This directive supports one option:
The corresponding output for the last testcode block.
This directive supports two options:
Example:
.. testoutput::
:hide:
:options: -ELLIPSIS, +NORMALIZE_WHITESPACE
Output text.
The following is an example for the usage of the directives. The test via doctest and the test via testcode and testoutput are completely equivalent.
The parrot module
=================
.. testsetup:: *
import parrot
The parrot module is a module about parrots.
Doctest example:
.. doctest::
>>> parrot.voom(3000)
This parrot wouldn't voom if you put 3000 volts through it!
Test-Output example:
.. testcode::
parrot.voom(3000)
This would output:
.. testoutput::
This parrot wouldn't voom if you put 3000 volts through it!
There are also these config values for customizing the doctest extension:
If this is a nonempty string (the default is 'default'), standard reST doctest blocks will be tested too. They will be assigned to the group name given.
reST doctest blocks are simply doctests put into a paragraph of their own, like so:
Some documentation text.
>>> print 1
1
Some more documentation text.
(Note that no special :: is needed to introduce the block; docutils recognizes it from the leading >>>. Also, no additional indentation is necessary, though it doesn’t hurt.)
If this value is left at its default value, the above snippet is interpreted by the doctest builder exactly like the following:
Some documentation text.
.. doctest::
>>> print 1
1
Some more documentation text.
This feature makes it easy for you to test doctests in docstrings included with the autodoc extension without marking them up with a special directive.
Note though that you can’t have blank lines in reST doctest blocks. They will be interpreted as one block ending and another one starting. Also, removal of <BLANKLINE> and # doctest: options only works in doctest blocks.


Question
Topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering.
A topological ordering is possible if and only if the graph has no directed cycles, that is, if it is a directed acyclic graph (DAG).
Analysis
Canonical application of toposort is to schedule tasks with dependency (project management etc.) It’s also used for computing formulas, logic synthesis, order of compilation (‘make’ command) and data serialization.
Solution
The usual algorithms have linear run-time, i.e. O(V + E).
First step is to find a list of “start nodes” which have no incoming edges. Then insert them into a set S and delete it. At least one such node must exist in an directed acyclic graph. From a university lecture.
From Wiki:
L ← Empty list that will contain the sorted elements
S ← Set of all nodes with no incoming edges
while S is non-empty do
remove a node n from S
add n to tail of L
for each node m with an edge e from n to m do
remove edge e from the graph
if m has no other incoming edges then
insert m into S
if graph has edges then
return error (graph has at least one cycle)
else
return L (a topologically sorted order)
If the graph is a DAG, a solution will be contained in the list L (the solution is not necessarily unique). Otherwise, the graph must have at least one cycle and therefore a topological sorting is impossible.
Code
The solution comes from here.
public class Graph {
private int vertices;
private Set<Node> nodes = new HashSet<Node>();
public Graph(int vertices) {
this.vertices = vertices;
}
public void addVertex(Node node) {
this.nodes.add(node);
}
public Set<Node> topologicalSort() {
Queue<Node> q = new LinkedList<Node>();
Set<Node> topoSort = new LinkedHashSet<Node>();
int vertexProcessesCtr = 0;
for (Node m : this.nodes) {
vertexProcessesCtr = addToQueue(m, topoSort, vertexProcessesCtr, q);
}
while (!q.isEmpty()) {
Node m = q.poll();
for (Node child : m.getAdjacenctNode()) {
int indeq = child.getInDegree() - 1;
child.setInDegree(indeq);
vertexProcessesCtr = addToQueue(child, topoSort,
vertexProcessesCtr, q);
}
}
if (vertexProcessesCtr > this.vertices) {
System.out.println();
}
return topoSort;
}
private int addToQueue(Node node, Set<Node> topoSort, int vertexProcess,
Queue<Node> q) {
if (node.getInDegree() == 0) {
q.add(node);
topoSort.add(node);
return vertexProcess + 1;
}
return vertexProcess;
}
public static void main(String[] args) {
Graph g = new Graph(8);
Node TEN = new Node("10");
Node ELEVEN = new Node("11");
Node TWO = new Node("2");
Node THREE = new Node("3");
Node FIVE = new Node("5");
Node SEVEN = new Node("7");
Node EIGHT = new Node("8");
Node NINE = new Node("9");
SEVEN.AdjacenctNode.add(ELEVEN);
ELEVEN.inDegree++;
SEVEN.AdjacenctNode.add(EIGHT);
EIGHT.inDegree++;
FIVE.AdjacenctNode.add(ELEVEN);
ELEVEN.inDegree++;
THREE.AdjacenctNode.add(EIGHT);
EIGHT.inDegree++;
THREE.AdjacenctNode.add(TEN);
TEN.inDegree++;
ELEVEN.AdjacenctNode.add(TEN);
TEN.inDegree++;
ELEVEN.AdjacenctNode.add(TWO);
TWO.inDegree++;
ELEVEN.AdjacenctNode.add(NINE);
NINE.inDegree++;
EIGHT.AdjacenctNode.add(NINE);
NINE.inDegree++;
g.nodes.add(TWO);
g.nodes.add(THREE);
g.nodes.add(FIVE);
g.nodes.add(SEVEN);
g.nodes.add(EIGHT);
g.nodes.add(NINE);
System.out.println("Now calling the topologial sorts");
Set<Node> result = g.topologicalSort();
for (Node node : result) {
System.out.println(node.data + " ");
}
}
}
class Node {
public String data;
public int dist;
public int inDegree;
LinkedList<Node> AdjacenctNode = new LinkedList<Node>();
public void addAdjNode(final Node Child) {
AdjacenctNode.add(Child);
Child.inDegree++;
}
public Node(String data) {
super();
this.data = data;
}
public int getInDegree() {
return inDegree;
}
public void setInDegree(int inDegree) {
this.inDegree = inDegree;
}
public LinkedList<Node> getAdjacenctNode() {
return AdjacenctNode;
}
}


Module: PVImpactGreenButton::Aggregator
- Extended by:
- Validation
- Defined in:
- lib/pvimpact/greenbutton/aggregator.rb
Overview
This module provides method to aggregate interval readings in a UsagePoint according to given aggregation type.
Class Method Summary (collapse)
-
+ (Object) aggregate(usage_point, aggregation_type = nil)
Aggregates interval readings in a UsagePoint according to given aggregation type.
Methods included from Validation
validate_aggregation_type, validate_required, validate_string, validate_time, validate_time_range
Class Method Details
+ (Object) aggregate(usage_point, aggregation_type = nil)
Aggregates interval readings in a UsagePoint according to given aggregation type.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/pvimpact/greenbutton/aggregator.rb', line 20 def self.aggregate(usage_point, aggregation_type = nil) validate_required(usage_point, 'usage_point') validate_aggregation_type(aggregation_type, 'aggregation_type') if aggregation_type # No further aggregation is required return usage_point if !aggregation_type || aggregation_type == AggregationType::DEFAULT # Iterate through all MeterReading's of the UsagePoint usage_point.meter_readings.each do |meter_reading| # Raise error if time_attribute isn't supported raise PVImpactGreenButton::AggregationError unless meter_reading.meter_reading_type.time_attribute.between?(0, 77) interval_length = meter_reading.meter_reading_type.aggregation_type == 0 ? meter_reading.meter_reading_type.interval_length : meter_reading.meter_reading_type.aggregation_type # (Validation)Iterate through all IntervalBlock's of the MeterReading meter_reading.interval_blocks.each do |interval_block| # Iterate through all IntervalReading's of the IntervalBlock interval_block.interval_readings.each do |interval_reading| # Validate missing/zero/NaN value/cost and mark as is_missing if needed interval_reading.value = nil if interval_reading.value == 0 interval_reading.cost = nil if interval_reading.cost == 0 interval_reading.is_missing = true if !interval_reading.value || !interval_reading.cost end end # Perform aggregation only if current interval length does not match aggregation type next unless interval_length != aggregation_type meter_reading.meter_reading_type.aggregation_type = aggregation_type begin if aggregation_type < interval_length # target interval is less than current interval length, divide current interval readings meter_reading.interval_blocks.each do |interval_block| interval_readings = [].push(*interval_block.interval_readings) interval_block.interval_readings = [] interval_readings.each do |interval_reading| start_time = interval_reading.start_time avg_value = interval_reading.is_missing ? nil : interval_reading.value.to_f / interval_length avg_cost = interval_reading.is_missing ? nil : interval_reading.cost.to_f / interval_length (1..interval_length / aggregation_type).each do # Create new IntervalReading end_time = (start_time + aggregation_type).utc interval_block.interval_readings << IntervalReading.new( { :aggregation_type => aggregation_type, :cost => avg_cost == nil ? avg_cost : avg_cost * aggregation_type, :value => avg_value == nil ? avg_value : avg_value * aggregation_type, :start_time => start_time, :end_time => end_time, :is_missing => interval_reading.is_missing } ) start_time = end_time end reminder = interval_length % aggregation_type interval_block.interval_readings << IntervalReading.new( { :aggregation_type => aggregation_type, :cost => avg_cost == nil ? avg_cost : avg_cost * reminder, :value => avg_value == nil ? avg_value : avg_value * reminder, :start_time => start_time, :end_time => (start_time + reminder).utc, :is_missing => interval_reading.is_missing } ) if reminder > 0 end end else # target interval is greater than current interval length, aggregate current interval readings meter_reading.interval_blocks.each do |interval_block| start_time = nil total_value = 0 total_cost = 0 total_duration = 0 interval_readings = [].push(*interval_block.interval_readings) interval_block.interval_readings = [] # Iterate through all IntervalReading's of the IntervalBlock interval_readings.each do |interval_reading| start_time = interval_reading.start_time unless start_time # A new IntervalReading should be created if total_duration + interval_length >= aggregation_type # Accumulate part of the reading ratio = (aggregation_type - total_duration).to_f / interval_length total_value += ratio * interval_reading.value if interval_reading.value total_cost += ratio * interval_reading.cost if interval_reading.cost end_time = (start_time + aggregation_type).utc # Create new IntervalReading interval_block.interval_readings << IntervalReading.new( { :aggregation_type => aggregation_type, :cost => total_cost, :value => total_value, :start_time => start_time, :end_time => end_time } ) # Reset accumulating variables total_value = (1 - ratio) * interval_reading.value if interval_reading.value total_cost = (1 - ratio) * interval_reading.cost if interval_reading.cost total_duration = (1 - ratio) * interval_length start_time = end_time else # Continue accumulating total_value += interval_reading.value if interval_reading.value total_cost += interval_reading.cost if interval_reading.cost total_duration += interval_length end end # We may have still accumulated readings not added interval_block.interval_readings << IntervalReading.new( { :aggregation_type => aggregation_type, :cost => total_cost, :value => total_value, :start_time => start_time, :end_time => (start_time + total_duration).utc } ) if total_duration > 0 end end rescue => e LOGGER.fatal(e.backtrace) raise PVImpactGreenButton::AggregationError, e. end end usage_point end |


--- layout: base title: ryan bonick :: bikes permalink: /bikes.html categories: bikes ---
Bikes are great!
Cycling is super duper healthy and also really fun.
And they're better for the environment than a car!
Right now I have 5 bikes! That's a lot but I love them all.


$#ck_styles#$
Neural network
co-design dashboard
$#template_top#$
$#template_middle#$ $#template_middle_finish#$
Dashboard is powered by
Collective Knowledge
$#template_end#$


 Heck fluffer ruff big ol pupper much ruin diet, shibe ruff wow very biscit, much ruin diet extremely cuuuuuute borking doggo. Sub woofer tungg wow very biscit dat tungg tho, smol borking doggo with a long snoot for pats. Doggorino heckin good boys puggo maximum borkdrive heckin good boys and girls, porgo smol borking doggo with a long snoot for pats length boy.
Wow such tempt floofs yapper very taste wow puggo shibe corgo floofs, fluffer floofs mlem most angery pupper I have ever seen boofers. Wow very biscit ruff pupperino doggo he made many woofs heckin doge, clouds stop it fren long water shoob smol. Boofers smol borking doggo with a long snoot for pats smol h*ck much ruin diet maximum borkdrive, very taste wow doggorino borkf waggy wags. Fluffer pupperino shoob, vvv. pupper shoober.  Pupperino he made many woofs stop it fren heckin, porgo floofs.


HOME
(current)
FEATURES
PRODUCTS
CONTACT US
BUNTING
BUSINESS CARD
JERSEY
BANNER
WEBSITE
JERSEY
LANYARD
PRODUCTS
JERSEY
BUSINESS CARD
LANYARD
X-BANNER
WEBSITE DESIGN
BANNER/POSTER DESIGN
CONTACT US
Send