Transformations Example
The application allows the user to manipulate the rendering of a shape by changing the translation, rotation and scale of QPainter's coordinate system.
The example consists of two classes and a global enum:
- The
RenderArea
class controls the rendering of a given shape. - The
Window
class is the application's main window. - The
Operation
enum describes the various transformation operations available in the application.
First we will take a quick look at the Operation
enum, then we will review the RenderArea
class to see how a shape is rendered. Finally, we will take a look at the Transformations application's features implemented in the Window
class.
Transformation Operations
Normally, the QPainter operates on the associated device's own coordinate system, but it also has good support for coordinate transformations.
The default coordinate system of a paint device has its origin at the top-left corner. The x values increase to the right and the y values increase downwards. You can scale the coordinate system by a given offset using the QPainter::scale() function, you can rotate it clockwise using the QPainter::rotate() function and you can translate it (i.e. adding a given offset to the points) using the QPainter::translate() function. You can also twist the coordinate system around the origin (called shearing) using the QPainter::shear() function.
All the tranformation operations operate on QPainter's tranformation matrix that you can retrieve using the QPainter::worldTransform() function. A matrix transforms a point in the plane to another point. For more information about the transformation matrix, see the Coordinate System and QTransform documentation.
enum Operation { NoTransformation, Translate, Rotate, Scale };
The global Operation
enum is declared in the renderarea.h
file and describes the various transformation operations available in the Transformations application.
RenderArea Class Definition
The RenderArea
class inherits QWidget, and controls the rendering of a given shape.
class RenderArea : public QWidget { Q_OBJECT public: RenderArea(QWidget *parent = 0); void setOperations(const QList<Operation> &operations); void setShape(const QPainterPath &shape); QSize minimumSizeHint() const override; QSize sizeHint() const override; protected: void paintEvent(QPaintEvent *event) override;
We declare two public functions, setOperations()
and setShape()
, to be able to specify the RenderArea
widget's shape and to transform the coordinate system the shape is rendered within.
We reimplement the QWidget's minimumSizeHint() and sizeHint() functions to give the RenderArea
widget a reasonable size within our application, and we reimplement the QWidget::paintEvent() event handler to draw the render area's shape applying the user's transformation choices.
private: void drawCoordinates(QPainter &painter); void drawOutline(QPainter &painter); void drawShape(QPainter &painter); void transformPainter(QPainter &painter); QList<Operation> operations; QPainterPath shape; QRect xBoundingRect; QRect yBoundingRect; };
We also declare several convenience functions to draw the shape, the coordinate system's outline and the coordinates, and to transform the painter according to the chosen transformations.
In addition, the RenderArea
widget keeps a list of the currently applied transformation operations, a reference to its shape, and a couple of convenience variables that we will use when rendering the coordinates.
RenderArea Class Implementation
The RenderArea
widget controls the rendering of a given shape, including the transformations of the coordinate system, by reimplementing the QWidget::paintEvent() event handler. But first we will take a quick look at the constructor and at the functions that provides access to the RenderArea
widget:
RenderArea::RenderArea(QWidget *parent) : QWidget(parent) { QFont newFont = font(); newFont.setPixelSize(12); setFont(newFont); QFontMetrics fontMetrics(newFont); xBoundingRect = fontMetrics.boundingRect(tr("x")); yBoundingRect = fontMetrics.boundingRect(tr("y")); }
In the constructor we pass the parent parameter on to the base class, and customize the font that we will use to render the coordinates. The QWidget::font() function returns the font currently set for the widget. As long as no special font has been set, or after QWidget::setFont() is called, this is either a special font for the widget class, the parent's font or (if this widget is a top level widget) the default application font.
After ensuring that the font's size is 12 points, we extract the rectangles enclosing the coordinate letters, 'x' and 'y', using the QFontMetrics class.
QFontMetrics provides functions to access the individual metrics of the font, its characters, and for strings rendered in the font. The QFontMetrics::boundingRect() function returns the bounding rectangle of the given character relative to the left-most point on the base line.
void RenderArea::setOperations(const QList<Operation> &operations) { this->operations = operations; update(); } void RenderArea::setShape(const QPainterPath &shape) { this->shape = shape; update(); }
In the setShape()
and setOperations()
functions we update the RenderArea
widget by storing the new value or values followed by a call to the QWidget::update() slot which schedules a paint event for processing when Qt returns to the main event loop.
QSize RenderArea::minimumSizeHint() const { return QSize(182, 182); } QSize RenderArea::sizeHint() const { return QSize(232, 232); }
We reimplement the QWidget's minimumSizeHint() and sizeHint() functions to give the RenderArea
widget a reasonable size within our application. The default implementations of these functions returns an invalid size if there is no layout for this widget, and returns the layout's minimum size or preferred size, respectively, otherwise.
void RenderArea::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); painter.fillRect(event->rect(), QBrush(Qt::white)); painter.translate(66, 66);
The paintEvent()
event handler receives the RenderArea
widget's paint events. A paint event is a request to repaint all or part of the widget. It can happen as a result of QWidget::repaint() or QWidget::update(), or because the widget was obscured and has now been uncovered, or for many other reasons.
First we create a QPainter for the RenderArea
widget. The QPainter::Antialiasing render hint indicates that the engine should antialias edges of primitives if possible. Then we erase the area that needs to be repainted using the QPainter::fillRect() function.
We also translate the coordinate system with an constant offset to ensure that the original shape is renderend with a suitable margin.
painter.save(); transformPainter(painter); drawShape(painter); painter.restore();
Before we start to render the shape, we call the QPainter::save() function.
QPainter::save() saves the current painter state (i.e. pushes the state onto a stack) including the current coordinate system. The rationale for saving the painter state is that the following call to the transformPainter()
function will transform the coordinate system depending on the currently chosen transformation operations, and we need a way to get back to the original state to draw the outline.
After transforming the coordinate system, we draw the RenderArea
's shape, and then we restore the painter state using the QPainter::restore() function (i.e. popping the saved state off the stack).
drawOutline(painter);
Then we draw the square outline.
transformPainter(painter); drawCoordinates(painter); }
Since we want the coordinates to correspond with the coordinate system the shape is rendered within, we must make another call to the transformPainter()
function.
The order of the painting operations is essential with respect to the shared pixels. The reason why we don't render the coordinates when the coordinate system already is transformed to render the shape, but instead defer their rendering to the end, is that we want the coordinates to appear on top of the shape and its outline.
There is no need to save the QPainter state this time since drawing the coordinates is the last painting operation.
void RenderArea::drawCoordinates(QPainter &painter) { painter.setPen(Qt::red); painter.drawLine(0, 0, 50, 0); painter.drawLine(48, -2, 50, 0); painter.drawLine(48, 2, 50, 0); painter.drawText(60 - xBoundingRect.width() / 2, 0 + xBoundingRect.height() / 2, tr("x")); painter.drawLine(0, 0, 0, 50); painter.drawLine(-2, 48, 0, 50); painter.drawLine(2, 48, 0, 50); painter.drawText(0 - yBoundingRect.width() / 2, 60 + yBoundingRect.height() / 2, tr("y")); } void RenderArea::drawOutline(QPainter &painter) { painter.setPen(Qt::darkGreen); painter.setPen(Qt::DashLine); painter.setBrush(Qt::NoBrush); painter.drawRect(0, 0, 100, 100); } void RenderArea::drawShape(QPainter &painter) { painter.fillPath(shape, Qt::blue); }
The drawCoordinates()
, drawOutline()
and drawShape()
are convenience functions called from the paintEvent()
event handler. For more information about QPainter's basic drawing operations and how to display basic graphics primitives, see the Basic Drawing example.
void RenderArea::transformPainter(QPainter &painter) { for (int i = 0; i < operations.size(); ++i) { switch (operations[i]) { case Translate: painter.translate(50, 50); break; case Scale: painter.scale(0.75, 0.75); break; case Rotate: painter.rotate(60); break; case NoTransformation: default: ; } } }
The transformPainter()
convenience function is also called from the paintEvent()
event handler, and transforms the given QPainter's coordinate system according to the user's transformation choices.
Window Class Definition
The Window
class is the Transformations application's main window.
The application displays four RenderArea
widgets. The left-most widget renders the shape in QPainter's default coordinate system, the others render the shape with the chosen transformation in addition to all the transformations applied to the RenderArea
widgets to their left.
class Window : public QWidget { Q_OBJECT public: Window(); public slots: void operationChanged(); void shapeSelected(int index);
We declare two public slots to make the application able to respond to user interaction, updating the displayed RenderArea
widgets according to the user's transformation choices.
The operationChanged()
slot updates each of the RenderArea
widgets applying the currently chosen transformation operations, and is called whenever the user changes the selected operations. The shapeSelected()
slot updates the RenderArea
widgets' shapes whenever the user changes the preferred shape.
private: void setupShapes(); enum { NumTransformedAreas = 3 }; RenderArea *originalRenderArea; RenderArea *transformedRenderAreas[NumTransformedAreas]; QComboBox *shapeComboBox; QComboBox *operationComboBoxes[NumTransformedAreas]; QList<QPainterPath> shapes; };
We also declare a private convenience function, setupShapes()
, that is used when constructing the Window
widget, and we declare pointers to the various components of the widget. We choose to keep the available shapes in a QList of QPainterPaths. In addition we declare a private enum counting the number of displayed RenderArea
widgets except the widget that renders the shape in QPainter's default coordinate system.
Window Class Implementation
In the constructor we create and initialize the application's components:
Window::Window() { originalRenderArea = new RenderArea; shapeComboBox = new QComboBox; shapeComboBox->addItem(tr("Clock")); shapeComboBox->addItem(tr("House")); shapeComboBox->addItem(tr("Text")); shapeComboBox->addItem(tr("Truck")); QGridLayout *layout = new QGridLayout; layout->addWidget(originalRenderArea, 0, 0); layout->addWidget(shapeComboBox, 1, 0);
First we create the RenderArea
widget that will render the shape in the default coordinate system. We also create the associated QComboBox that allows the user to choose among four different shapes: A clock, a house, a text and a truck. The shapes themselves are created at the end of the constructor, using the setupShapes()
convenience function.
for (int i = 0; i < NumTransformedAreas; ++i) { transformedRenderAreas[i] = new RenderArea; operationComboBoxes[i] = new QComboBox; operationComboBoxes[i]->addItem(tr("No transformation")); operationComboBoxes[i]->addItem(tr("Rotate by 60\xC2\xB0")); operationComboBoxes[i]->addItem(tr("Scale to 75%")); operationComboBoxes[i]->addItem(tr("Translate by (50, 50)")); connect(operationComboBoxes[i], SIGNAL(activated(int)), this, SLOT(operationChanged())); layout->addWidget(transformedRenderAreas[i], 0, i + 1); layout->addWidget(operationComboBoxes[i], 1, i + 1); }
Then we create the RenderArea
widgets that will render their shapes with coordinate tranformations. By default the applied operation is No Transformation, i.e. the shapes are rendered within the default coordinate system. We create and initialize the associated QComboBoxes with items corresponding to the various transformation operations decribed by the global Operation
enum.
We also connect the QComboBoxes' activated() signal to the operationChanged()
slot to update the application whenever the user changes the selected transformation operations.
setLayout(layout); setupShapes(); shapeSelected(0); setWindowTitle(tr("Transformations")); }
Finally, we set the layout for the application window using the QWidget::setLayout() function, construct the available shapes using the private setupShapes()
convenience function, and make the application show the clock shape on startup using the public shapeSelected()
slot before we set the window title.
void Window::setupShapes() { QPainterPath truck; QPainterPath clock; QPainterPath house; QPainterPath text; ... shapes.append(clock); shapes.append(house); shapes.append(text); shapes.append(truck); connect(shapeComboBox, SIGNAL(activated(int)), this, SLOT(shapeSelected(int))); }
The setupShapes()
function is called from the constructor and create the QPainterPath objects representing the shapes that are used in the application. For construction details, see the window.cpp example file. The shapes are stored in a QList. The QList::append() function inserts the given shape at the end of the list.
We also connect the associated QComboBox's activated() signal to the shapeSelected()
slot to update the application when the user changes the preferred shape.
void Window::operationChanged() { static const Operation operationTable[] = { NoTransformation, Rotate, Scale, Translate }; QList<Operation> operations; for (int i = 0; i < NumTransformedAreas; ++i) { int index = operationComboBoxes[i]->currentIndex(); operations.append(operationTable[index]); transformedRenderAreas[i]->setOperations(operations); } }
The public operationChanged()
slot is called whenever the user changes the selected operations.
We retrieve the chosen transformation operation for each of the transformed RenderArea
widgets by querying the associated QComboBoxes. The transformed RenderArea
widgets are supposed to render the shape with the transformation specified by its associated combobox in addition to all the transformations applied to the RenderArea
widgets to its left. For that reason, for each widget we query, we append the associated operation to a QList of transformations which we apply to the widget before proceeding to the next.
void Window::shapeSelected(int index) { QPainterPath shape = shapes[index]; originalRenderArea->setShape(shape); for (int i = 0; i < NumTransformedAreas; ++i) transformedRenderAreas[i]->setShape(shape); }
The shapeSelected()
slot is called whenever the user changes the preferred shape, updating the RenderArea
widgets using their public setShape()
function.
Summary
The Transformations example shows how transformations influence the way that QPainter renders graphics primitives. Normally, the QPainter operates on the device's own coordinate system, but it also has good support for coordinate transformations. With the Transformations application you can scale, rotate and translate QPainter's coordinate system. The order in which these tranformations are applied is essential for the result.
All the tranformation operations operate on QPainter's tranformation matrix. For more information about the transformation matrix, see the Coordinate System and QTransform documentation.
The Qt reference documentation provides several painting examples. Among these is the Affine Transformations example that shows Qt's ability to perform transformations on painting operations. The example also allows the user to experiment with the various transformation operations.
Files:


Jianan Li, Keisuke Yanagisawa, Yasushi Yoshikawa, Masahito Ohue, Yutaka Akiyama. “Plasma protein binding prediction focusing on residue-level features and circularity of cyclic peptides by deep learning”, Bioinformatics, 38: 1110-1117, 2022/02. DOI: 10.1093/bioinformatics/btab726
2021/10 主著論文が1報公開されました。
Keisuke Yanagisawa. “Virtual Screening Methods with a Protein Tertiary Structure for Drug Discovery”, JSBi Bioinformatics Review, 2: 76-86, 2021/10. DOI: 10.11234/jsbibr.2021.9
Kazuya Isawa, Keisuke Yanagisawa, Masahito Ohue, Yutaka Akiyama. “Antisense oligonucleotide activity analysis based on opening and binding energies to targets”, In Proceedings of the 27th International Conference on Parallel and Distributed Processing Techniques and Applications (PDPTA’21), 2021/07/27.（14ページ、口頭発表）
2021/07 共著論文が1報公開されました。
Masatake Sugita, Satoshi Sugiyama, Takuya Fujie, Yasushi Yoshikawa, Keisuke Yanagisawa, Masahito Ohue, Yutaka Akiyama. “Large-scale membrane permeability prediction of cyclic peptides crossing a lipid bilayer based on enhanced sampling molecular dynamics simulations”, Journal of Chemical Information and Modeling, 61: 3681-3695, 2021/7. DOI: 10.1021/acs.jcim.1c00380
2021年 1月-6月
2021/06 主著論文が1報公開されました。
Keisuke Yanagisawa, Yoshitaka Moriwaki, Tohru Terada, Kentaro Shimizu. “EXPRORER: Rational Cosolvent Set Construction Method for Cosolvent Molecular Dynamics Using Large-Scale Computation”, Journal of Chemical Information and Modeling, 61: 2744-2753, 2021/06. DOI: 10.1021/acs.jcim.1c00134
Keisuke Yanagisawa, Yoshitaka Moriwaki, Tohru Terada, Kentaro Shimizu. “Systematic construction of the cosolvents sets for cosolvent MD (CMD) with the large-scale simulation”, AHeDD2019/IPAB2019 Joint Symposium, 2019/11.
Keisuke Yanagisawa, Yoshitaka Moriwaki, Tohru Terada, Kentaro Shimizu. “Systematic construction of the cosolvents sets for cosolvent MD (CMD) with the large-scale computation”, Chem-Bio Informatics Society(CBI) Annual Meeting 2019, P1-24, 2019/10.
Keisuke Yanagisawa, Yoshitaka Moriwaki, Tohru Terada, Kentaro Shimizu. “Estimation of the probability map (Pmap) similarity of cosolvent MD (CMD) from structural similarities of cosolvents”, The 57th Annual Meeting of The Biophysical Society of Japan, 2019/09.
Takashi Tajimi, Naoki Wakui, Keisuke Yanagisawa, Yasushi Yoshikawa, Masahito Ohue, Yutaka Akiyama: “Computational prediction of plasma protein binding of cyclic peptides from small molecule experimental data using sparse modeling techniques”, The 29th International Conference on Genome Informatics (GIW 2018), 2018/12.
2018/06 Computational Biology and Chemistry誌に論文が採録され、公開されました。
Keisuke Yanagisawa, Shunta Komine, Rikuto Kubota, Masahito Ohue, Yutaka Akiyama: “Optimization of memory use of fragment extension-based protein-ligand docking with an original fast minimum cost flow algorithm”, Computational Biology and Chemistry, 74: 399-406, 2018/06.
[open access]
Keisuke Yanagisawa, Shunta Komine, Rikuto Kubota, Masahito Ohue, Yutaka Akiyama: “Optimization of memory use of fragment extension-based protein-ligand docking with an original fast minimum cost flow algorithm”, The 16th Asia Pacific Bioinformatics Conference (APBC2018), 2018/01.
Takanori Hayashi, Yuri Matsuzaki, Keisuke Yanagisawa, Masahito Ohue, Yutaka Akiyama: “MEGADOCK-Web: an integrated database of high-throughput structure-based protein-protein interaction predictions”, The 16th Asia Pacific Bioinformatics Conference (APBC2018), 2018/01.
Keisuke Yanagisawa, Shunta Komine, Shogo D. Suzuki, Masahito Ohue, Takashi Ishida, Yutaka Akiyama: “ESPRESSO: An ultrafast compound pre-screening method based on compound decomposition”, The 27th International Conference on Genome Informatics (GIW 2016), 2016/10.
Keisuke Yanagisawa, Shunta Komine, Shogo D. Suzuki, Masahito Ohue, Takashi Ishida, Yutaka Akiyama: “ESPRESSO: An ultrafast compound pre-screening method based on compound segmentation”, Informatics in Biology, Medicine and Pharmacology 2016, P65, 2016/09.
Keisuke Yanagisawa, Shunta Komine, Masahito Ohue, Takashi Ishida, Yutaka Akiyama: “Fast pre-filtering for virtual screening based on compound decomposition”, Informatics in Biology, Medicine and Pharmacology 2015, 2015/10.


| UK - Unemployment Rate | |||||||||
|
|
|||||||||
| UK Unemp Rate - MoM (%) | |||||||||
| Release Dt | For Month | Market Expectation | Kshitij Expectation | Previous | Released | Revised | |||
| 13-Dec-17 | Oct-17 | 4.2 | - | 4.3 | 4.3 | - | |||
| 24-Jan-18 | Nov-17 | 4.3 | 4.3 | 4.3 | 4.3 | - | |||
| 21-Feb-18 | Dec-17 | 4.3 | 4.3 | 4.3 | 4.4 | - | |||
| 21-Mar-18 | Jan-18 | - | - | 4.4 | - | - | |||
| Copyright: Kshitij Consultancy Services |


CSW - OGC CSW (Catalog Service for the Web)
Driver short name
CSW
Build dependencies
libcurl
This driver can connect to a OGC CSW service. It supports CSW 2.0.2 protocol. GDAL/OGR must be built with Curl support in order to the CSW driver to be compiled. And the GML driver should be set-up for read support (thus requiring GDAL/OGR to be built with Xerces or Expat support).
It retrieves records with Dublin Core metadata.
Driver capabilities
Supports Georeferencing
This driver supports georeferencing
Dataset name syntax
The minimal syntax to open a CSW datasource is : CSW: and the URL open option, or CSW:http://path/to/CSW/endpoint
Filtering
The driver will forward any spatial filter set with SetSpatialFilter() to the server. It also makes its best effort to do the same for attribute filters set with SetAttributeFilter() when possible (turning OGR SQL language into OGC filter description).
The anytext field can be queried to do a search in any text field. Note that we always return it as null content however in OGR side, to avoid duplicating information.
Issues
Some servers do not respect EPSG axis order, in particular latitude,
longitude order for WGS 84 geodetic coordinates, so it might be needed
to specify the GML_INVERT_AXIS_ORDER_IF_LAT_LONG=NO
configuration option in those cases.
Open options
URL=value: URL to the CSW server endpoint (if not specified in the connection string already)
ELEMENTSETNAME=[brief/summary/full]: Defaults to
full
. Level of details of properties.FULL_EXTENT_RECORDS_AS_NON_SPATIAL=[YES/NO]: Defaults to
NO
. Whether records with (-180,-90,180,90) extent should be considered non-spatial.OUTPUT_SCHEMA=value: Value of outputSchema parameter, in the restricted set supported by the serve. Special value gmd can be used as a shortcut for http://www.isotc211.org/2005/gmd, csw for http://www.opengis.net/cat/csw/2.0.2. When this open option is set, a raw_xml field will be filled with the XML content of each record. Other metadata fields will remain empty.
MAX_RECORDS=value: Defaults to
500
. Maximum number of records to retrieve in a single time. Servers might have a lower accepted value.
Configuration options
The following configuration options are available:
GML_INVERT_AXIS_ORDER_IF_LAT_LONG=[YES/NO]: See CRS support. Equivalent of
INVERT_AXIS_ORDER_IF_LAT_LONG
open option.
Examples
Listing all the records of a CSW server:
ogrinfo -ro -al -noextent CSW:http://catalog.data.gov/csw
Listing all the records of a CSW server with spatial and an attribute filter on a give field:
ogrinfo -ro -al -noextent CSW:http://catalog.data.gov/csw -spat 2 49 2 49 -where "subject LIKE '%mineralogy%'"
Listing all the records of a CSW server that matches a text on any text field:
ogrinfo -ro -al -q CSW:http://catalog.data.gov/csw -spat 2 49 2 49 -where "anytext LIKE '%France%'"
Listing all the records of a CSW server as ISO 19115/19119:
ogrinfo -ro -al -q CSW:http://catalog.data.gov/csw -oo OUTPUT_SCHEMA=gmd


Something about me...I'm just me!
if (sad() == true){ sad().stop(); beAwesome(); }
Code syntax to be happy


Step8: Banking Project - Create a simple GUI program
Objective
In this exercise you will use random access file, GUI Components to manuplate data.
Directions
- Store and retrieve records relating to Customer (Does not consider Accounts of Customer temporarily) in project.
Use the RandomAccessFile class. (You can reference "Case Study: Address Book")
- Program should allow the user to define the data schema of record and to creat new records; display records; delete records; sort records and search records.
- Viewing and manuplating records should be implemented by GUI application.


Here shows the MCU SPI related functions.
◆ setBLE_SpiInit()
| void setBLE_SpiInit |
( |
void |
| ) |
|
This function is used to initial MCU SPI.
- Returns
- none
◆ setBLE_SpiOneByteRx()
| uint8_t setBLE_SpiOneByteRx |
( |
uint8_t |
regAddr | ) |
|
This function is used to read RF 1 byte register.
- Parameters
-
| [in] | regAddr | : register address |
- Returns
- 1 byte RX data.
◆ setBLE_SpiOneByteRxIsr()
| uint8_t setBLE_SpiOneByteRxIsr |
( |
uint8_t |
regAddr | ) |
|
This function is used to read RF 1 byte register or RX_FIFO in ISR.
- Parameters
-
| [in] | regAddr | : register address |
- Returns
- 1 byte RX data.
◆ setBLE_SpiOneByteTx()
| void setBLE_SpiOneByteTx |
( |
uint8_t |
regAddr, |
|
|
uint8_t |
u8SrcData |
|
) |
| |
This function is used to write RF 1 byte register.
- Note
- Not use for writing TX buffer.
- Parameters
-
| [in] | regAddr | : register address |
| [in] | u8SrcData | : data which user attempt to transfer through SPI bus |
- Returns
- none
◆ setBLE_SpiOneByteTxIsr()
| void setBLE_SpiOneByteTxIsr |
( |
uint8_t |
regAddr, |
|
|
uint8_t |
u8SrcData |
|
) |
| |
This function is used to write RF 1 byte register in ISR.
- Note
- Not use for writing TX buffer.
- Parameters
-
| [in] | regAddr | : register address |
| [in] | u8SrcData | : data which user attempt to transfer through SPI bus |
- Returns
- none
◆ setBLE_SpiPDMAInit()
| void setBLE_SpiPDMAInit |
( |
void |
| ) |
|
This function is used to initial MCU SPI PDMA.
- Returns
- none
◆ setBLE_SpiPDMARxIsr()
| void setBLE_SpiPDMARxIsr |
( |
uint8_t |
regAddr, |
|
|
uint32_t |
u32DstAddr, |
|
|
uint32_t |
u32TransCount |
|
) |
| |
This function is used to using SPI PDMA read RF in ISR.
- Attention
- Because of the set-and-forget SPI DMA behavior, user should avoid modification of the source data.
- Parameters
-
| [in] | regAddr | : register address |
| [in] | u8SrcData | : data which user attempt to transfer through SPI bus |
| [in] | u32TransCount | : transfer count |
- Returns
- none
◆ setBLE_SpiPDMATx()
| void setBLE_SpiPDMATx |
( |
uint8_t |
regAddr, |
|
|
uint32_t |
u32SrcAddr, |
|
|
uint32_t |
u32TransCount |
|
) |
| |
This function is used to using SPI PDMA write RF in ISR.
- Attention
- Because of the set-and-forget SPI DMA behavior, user should avoid modification of the source data.
- Parameters
-
| [in] | regAddr | : register address |
| [in] | u8SrcData | : data which user attempt to transfer through SPI bus |
| [in] | u32TransCount | : transfer count |
- Returns
- none
◆ setBLE_SpiPDMAWaitFinish()
| uint32_t setBLE_SpiPDMAWaitFinish |
( |
void |
| ) |
|
This function is used to wait PDMA complete the operation.
- Returns
- SPI PDMA Result success or not.
- Return values
-
◆ setBLE_SpiSSHigh()
| void setBLE_SpiSSHigh |
( |
void |
| ) |
|
This function is used to manual set SPI SS pin to high state immediately.
- Returns
- none
◆ setBLE_SpiSSLow()
| void setBLE_SpiSSLow |
( |
void |
| ) |
|
This function is used to manual set SPI SS pin to low state immediately.
- Returns
- none
◆ setBLE_SpiTwoByteTxIsr()
| void setBLE_SpiTwoByteTxIsr |
( |
uint8_t |
regAddr, |
|
|
uint8_t * |
u8SrcAddr |
|
) |
| |
This function is used to write RF 2 byte register in ISR.
- Parameters
-
| [in] | regAddr | : register address |
| [in] | u8SrcData | : data which user attempt to transfer through SPI bus |
- Returns
- none
◆ setBLE_SpiWaitAndSSHigh()
| void setBLE_SpiWaitAndSSHigh |
( |
void |
| ) |
|
This function is used to manual set SPI SS pin to high state until SPI is not in busy state.
- Note
- If SPI_SS_CONTROL is set to AUTO_SPI_SS then user do not have to wait and manual set SS pin to hight state.
- Returns
- none


2022 FIFA World Cup Qualifiers: 5 talking points as Vietnam, Thailand play out 0-0 draw
by Sarthak SharmaVietnam and Thailand played out their second 0-0 draw of the 2022 FIFA World Cup Asian Qualifiers in the second round, resulting in only a small change in the Group G table. Here are five talking points from the game.
#5 Dang Van Lam keeps Vietnam in the game with penalty save
After a slow start to this match, Thailand gradually grew into the game, and a rather innocuous looking challenge inside the box from a corner saw confusion, before the referee suddenly pointed to the spot for a foul by Doan Van Hau.
Theerathon Bunmathan stepped up to take the penalty for the War Elephants, but a stunning stop by Dang Van Lam ensured the score remained 0-0 at a crucial period.
#4 Vietnam have a goal ruled out for a foul
The referee was once again right among the action just a few minutes after the penalty incident, this time at the other end, as Vietnam appeared to have taken the lead through a towering header.
However, the goal was immediately ruled out for what looked like a debatable bit of contact on Thai goalkeeper Kawin Thamsatchanan.
#3 Thailand should have scored late on
A late flurry from the visitors saw them receive quite a few chances in the last ten minutes of the game, the best of which should have been converted from close range.
First it was Dang Van Lam who once again saved Vietnam, before Doan Van Hau heroically threw in a dive and blocked what seemed to be a sure shot goal. Ekanit Panya of Thailand couldn’t convert from tap in range.
#2 The big guns fail to fire
It may have been billed as Nguyen Quang Hai vs Chanathip Songkrasin, but this Vietnam vs Thailand clash saw very little of the two talismanic players.
Chanathip had a few moments of magic in terms of his touches, but failed to deliver the goods when it mattered most. The same can be said of Quang Hai, who was largely peripheral throughout.
#1 Thailand dumped out of top two places
Vietnam probably did not need a win as much as Thailand did in this one, and a victory for Malaysia in the other Group G game against Indonesia means that they now move into second place.
The War Elephants are now on 8 points from 5 matches, while Malaysia have one point more. UAE could also be a team in the reckoning, though it appears that Vietnam are rather comfortable with 11 points from 5 matches.


Resource Type: evs
- Defined in:
- lib/puppet/type/evs.rb
- Providers:
-
evs
Overview
Manage the configuration of Oracle Solaris Elastic Virtual Switch (EVS)
Properties
-
ensure
(defaults to: present)
The basic property that the resource should be in.
Supported values:- present
- absent
-
l2_type
Define how an EVS will be implemented across machines
Supported values:- vlan
- vxlan
- flat
- ""
-
maxbw
The full duplex bandwidth for the virtual port
-
priority
The relative priority for the virtual port
Supported values:- high
- medium
- low
- ""
-
protection
Enables one or more types of link protection
-
uuid
UUID of the EVS instance
-
vlanid
VXLAN segment ID used to implement the EVS
-
vni
VLAN ID used to implement the EVS
Parameters
-
name (namevar)
The full name for EVS (including the tenant name)


CarPal,
Is a proof-of-concept for a mobility sharing
application that leverages a Distributed Hash Table to allow a community of
people to spontaneously share trip information without the costs of a centralized
structure. The peer-to-peer architecture allows moreover the deployment on
portable devices and opens new scenarios where trips and sharing requests can
be updated in real time.


We believe in the open source community and we, like many other agencies in the industry, depend on open source projects (e.g. jQuery, Apache) to provide the best development solutions for our clients. Our goal is to create a collaborative environment in which our projects can contribute to, as well as benefit from, the development community.
An Angular starter-kit that uses karma, protractor, a clean folder structure, and Gulp integration with robust build config file.
Using ndebug you can easily launch the Google Chrome developer tools to interactively debug your Node.js scripts while they run, providing a very pleasant and extremely producitive debugging workflow.
Under the hood, ndebug leverages the excellent node-inspector which handles all the complexity of connecting the Chrome developer tools to your running Node process. ndebug simply automates the otherwise combersome multi-step process normally required when using node-inspector by itself.
A DIY scaffold for creating UI toolkits.
Following a style guide helps fulfill these requirements. When our code is cohesive it is easier to read and navigate; there is less friction in collaboration and innovation can flourish.
The purpose of our style guides is not to strictly enforce one way of writing code, but rather to provide a mostly agreed-upon approach. A project's developer lead or architect has the freedom to deviate from these standards when appropriate.
Backbone.Rebar extends the Backbone.js library with view transitions, subviews, view mediators, local storage for sync, dynamic route definitions, controllers, and a simple log wrapper. Backbone.Rebar is only 3.13kB minified and gzipped with no other dependencies being added to Backbone.
Hello World for Google Glass built using the Express web application framework for Node.js with MongoDB session support setup for deployment to Heroku.
Generating a wordcloud using D3.js from keyword groupings extracted from a URI using Node.js.
Converting a URL to an image on Heroku with PhantomJS and ExpressJS is surprisingly easy. Just takes a little bit of finesse with Buildpacks on Heroku.


Hello! Welcome to my page where I believe magic can be written under code.
Mr.Shem Mwangi a developer from Ukraine developed this page as a
Akan Name Generator.
Simply, Akan names are derived from Ghanian (🇬🇭) culture.
Frequently in Ghana, children are given their first name as a 'day name' which corresponds to the
day in
the week they were born.
Believe me when I say this is magic 💡.


More games announced for Xbox Game Pass PC, including Halo Reach and Yakuza titles
And Ultimate subscribers are getting more perks
by Rob ThubronSomething to look forward to: Microsoft’s Inside Xbox event is in full swing. One of the many announcements relates to the Xbox Game Pass, which will be receiving more than 50 new games over the next few months.
At the London event, it was revealed that titles including Final Fantasy 7 through to 15, Rage 2, Flight Simulator, and Halo Reach are all coming to the PC version of the subscription service.
Microsoft is also trying to tempt people onto its Xbox Game Pass Ultimate option, which combines the Xbox Game Pass, Xbox Live Gold, and access to the PC library, by offering it for $1 for the first three months.
Additionally, all Game Pass Ultimate subscribers—not just new ones—will, starting from today, get one month of EA access, three months of Discord Nitro, and six months of Spotify premium. The Ultimate tier costs $14.99 per month, while Xbox Game Pass is $9.99 per month.
Seeing the Yakuza and Final Fantasy games coming to the PC service is certainly exciting for fans. I’m also looking forward to Halo Reach (December 3), Wasteland 3, and Ori.
Here’s a list of new and upcoming games and their platforms:
Later in 2020:
- Bleeding Edge (Xbox One and PC)
- Grounded (Xbox One and PC)
- Microsoft Flight Simulator (PC)
- Minecraft Dungeons (Xbox One and PC)
- Ori and the Will of the Wisps (Xbox One and PC)
- Tell Me Why (Xbox One and PC)
- Wasteland 3 (Xbox One and PC)
Available now:
- Age of Wonders: Planetfall (Xbox One, coming soon to PC)
- Lego: The Ninjago Movie (Xbox One)
- Remnant: From the Ashes (Xbox One)
- The Talos Principle (Xbox One and PC)
- Tracks: The Train Set Game (Xbox One and PC)
Arriving this holiday season and throughout 2020:
- Cris Tales (Xbox One and PC)
- Cyber Shadow (Xbox One and PC)
- Darksiders 3 (Xbox One and PC)
- Double Kick Heroes (Xbox One and PC)
- Edge of Eternity (Xbox One and PC)
- Most of the Final Fantasy franchise, for Xbox One and PC, comprising of Final Fantasy 7, 8 Remastered, 9, 10: HD Remastered, 10-2: HD Remastered, 12: The Zodiac Age, 13, 13-2 Lightning Returns, 13 and 15.
- Forager (Xbox One and PC)
- Haven (Xbox One and PC)
- It Lurks Below (Xbox One and PC)
- Levelhead (Xbox One and PC)
- Life Is Strange 2: Episodes 4 and 5 (Xbox One)
- My Friend Pedro (Xbox One/PC)
- PHOGS (Xbox One and PC)
- She Dreams Elsewhere (Xbox One and PC)
- SkateBIRD (Xbox One and PC)
- Streets of Rage 4 (Xbox One and PC)
- Scourge Bringer (Xbox One and PC)
- Supraland (Xbox One)
- Tekken 7 (Xbox One)
- Touhou Luna Nights (Xbox One and PC)
- The Escapists 2 (Xbox One)
- The Red Lantern (Xbox One)
- The Red Strings Club (PC)
- The Witcher 3: Wild Hunt (Xbox One)
- Vambrace: Cold Soul (Xbox One and PC)
- West of Dead (Xbox One and PC)


Home
Home
Home 2
Home 3
Layouts
About Us
Widgets & Sidebars
Sitemap
Error Page
Open Post
Open Project
Open Profile
Blog
Standard
Masonry
Timeline
Portfolio
Puzzle
Grid
Profiles
Vertical
Horisontal
Elements
Typography
Shortcodes
Shortcodes #1
Shortcodes #2
Shortcodes #3
Shortcodes #4
Shortcodes #5
Forms
Contacts
Shortcodes #5
Galleries
Thumbnails Gallery
Hover Slider
Slider
Progress Counters
KEEP TRACK OF THE NATURE SAVING PROGRESS
Water Supply
0
%
Bio Energy
0
%
Recycling
0
%
Save Rainforest
0
%
LOCAL CLIMATE SUMMARY
0
days
Snowy
0
days
Rainy
0
days
Sunny
Ecology
88
%
Recycling
68
%
Organic
84
%
Nature
75
%
Support
77
%
Clients
Without Border
Grid
Slider
Custom Height
Embedded
Vimeo
Youtube
Soundcloud


The Foundation
1: Hello World - Using Markdown with Preprocessor
2: Material Design, SASS and Pug
3: Go-Live - Deploy to Cloud and Use a CDN
4: AppShell, Turbo and Caching for Performance
The Bricks and Mortar
5: UI Reading from an API
6: UI Writing to an API (Example: Firebase)
7: Log-in Security and Tokens
8: Mobile App (Phonegap)
The Perspectives
9: Standard Web Components and their Communication
10: NEW! Server-side rendering (SSR) of Web Components
11: Accelerated Mobile Pages (AMP)


Holiday Gift Guide 2019: The Best Cannabis Gear For Travel
by Katie ShapiroWhile traveling with cannabis is still technically illegal—even when you’re going to or coming from a legal state, products like smell-proof containers and luxe leather cases are essential for travelers willing to risk transporting their stash with subtlety. Plus, TSA recently stated, "We’re cool and we’re not looking for your weed.” So for the jet-setting cannabis enthusiast in your life, here are the eight best gifts to make heading home for the holidays a little less stressful this season.
Another Room New Kit, $88
Designed and hand-sewn in Vancouver, British Columbia, Another Room’s New Kit is all you need to smoke weed wherever you land. The clear carrying case comes complete with a signature Doob Tube, Joint Locker, and smell-proof pouch for flower with tons of extra room for more supplies. Surfaceless? The door of the bag doubles as a makeshift rolling tray. anotherroom.io
SilverStick Wallet Dugout, $99
Sturdy, discreet, and sleek, SilverStick is the dugout of choice for the day-to-day and is so compact, fits in the palm of your hand. Designed in Boulder, Colo. and handcrafted in the United States from Horween leather and European veg-tanned hides, its just-released wallet version holds the signature SilverStick one-hitter pipe, flower container, lighter, poker, and filters with a flap on the back to hold your ID, cash, and a credit card. thesilverstick.com
Green Jay Travel Set, $55
Every on-the-go quiver should have one of these high-grade aluminum tubes in it, perfect for packing pre-rolls. Available in white, black, and rose gold, Green Jay’s Single Carrier is airtight, waterproof, and discreet with grooves in the cap to keep it in place on flat surfaces and to secure the joint tip on the inside. Pair it with the Smooth Grinder, a four-piece magnetic system and windproof E-Lighter for a complete travel kit. green-jay.com
Tetra Travel Kit, $90
Ready, set, roll anywhere with Tetra’s handpicked set of essentials: private-label unbleached hemp rolling papers, a white bronze Fog Pin for packing and fine-tuning, a flameless Slide lighter, airtight storage container, and a jewel-like bottle of Japanese eye drops—all encased in a leather zip pouch with keyring by Minor History. shop-tetra.com
Mister Green x Dangle Bong, $139
In collaboration with Mister Green and the introduction of its new outdoor GEAR line, Dangle Supply has created a limited-edition, custom painted titanium adventure bong that includes a rubber stopper, machined titanium bowl, and branded carabiner. Dubbed the Dangle Bong, the camp mug-esque construction is indestructible, non-corroding, and was developed by a professional mountain biker and a bicycle designer/engineer. green-mister.com
PAX 3, $249.99; PAX Era, $29.99
PAX provides the easiest and most packable portable vaporizers hands down. Its PAX 3 device is compatible with both flower and concentrates, has more than 60 temperature settings, and can be controlled through its Bluetooth functionality and mobile app. The slimmer PAX Era device is outfitted for its patented pods (with dispensary partners spanning all legal states), each containing 500 milligrams of pure cannabis oil. The new PodID addition to the PAX app addresses the cannabis industry’s transparency issues with batch number matching, lab test results, and terpene profiles so you know exactly what you’re inhaling. pax.com
Cannabolish Set, $29.99
Despite the many advances in accoutrements, the smell left behind when smoking flower is still unavoidable. Ditch the harsh chemicals of old school odor control products like Ozium in favor of Cannabolish—an all-natural spray and candle line to clear the air around you. Made from natural plant oils and water, it’s effective in removing the scent of smoke quickly and is completely safe for use around plants, animals, and people. cannabolish.com
Cannador Leather Toolkit, $49
Cannabis storage company Cannador tapped a 100-year-old family leather business to create a toolkit for organizing all of your accoutrements in five separate pockets. An interior flap keeps it from falling out and stays closed with an exterior button strap. cannador.com


BENTLEY CONTINENTAL GT V8 S AUTO WHITE
The Bentley Continental GT Convertible has serious visual drama,
and the mighty performance and capable handling prove it isn't just an act.
It’s comfortable, refined and hugely luxurious. You get in and close the door
and it’s as though you’ve stepped into a world of whale song and tea lights
on water lilies.
LAND ROVER RANGE ROVER SPORT 5.0 V8 BLACK
Incredible refinement, high-quality interior, go-anywhere ability. For a huge,
heavy seven-seat SUV, the composure with which the RRS goes down a twisty road
is nothing short of baffling. The performance-focused version of Land Rover’s
all-new posh SUV, available for the first time with the option of seven seats.
LAND ROVER RANGE ROVER SPORT 5.0 V8 BLUE
Incredible refinement, high-quality interior, go-anywhere ability. For a huge,
heavy seven-seat SUV, the composure with which the RRS goes down a twisty road
is nothing short of baffling. The performance-focused version of Land Rover’s
all-new posh SUV, available for the first time with the option of seven seats.
MERCEDES-BENZ S350 L AMG BLACK
The Mercedes-Benz S-class is one of the most advanced and pampering cars money can buy
It’s the most prestigious Mercedes money can buy, and it’s always combined cutting-edge
technology with some of the highest standards of quality and comfort around.
LAND ROVER RANGE ROVER VOGUE SILVER GOLD
Range Rover Vogue 4.4 SDV8 Vogue is an excellent example of a brand new period
for Range Rover. Comfort isn't compromised either; the new Vogue 4.4 features
full leather upholstery and the ambiance is set with interior mood lighting and
automatic dimming interior mirror. This makes the car feel intimate and
comfortable during day and night time car journeys.
BENTLEY FLYING SPUR V8 AUTO GREY
The Bentley Flying Spur V8 is the embodiment of everything Bentley stands for.
Pure unadulterated luxury combined with outstanding performance. The lighter,
leaner sibling combines an upright grille, large jewel LED headlamps, sharp
fender wing vents and the Flying Spur's familiar contemporary lines to present
a muscular yet elegant exterior design, now further refined with a choice of
striking new alloy wheels.
MERCEDES-BENZ V250 SPORT BLUETEC AUTO BLACK
Lots of practicality and luxury mean the Mercedes V250 is one of the best
upmarket MPVs. Mercedes offered a luxurious and comfortable passenger
transporter, the new V-Class has the demands of a limousine.


Before Change
from Cython.Distutils import build_ext as _build_ext
list_pyx = ["cydtw", "cygak", "cysax", "cycc", "soft_dtw_fast"]
ext = [Extension("tslearn.%s" % s, ["tslearn/%s.pyx" % s], include_dirs=[numpy.get_include()]) for s in list_pyx]
setup(
name="tslearn",
description="A machine learning toolkit dedicated to time-series data",
After Change
// If something messes up, let the build process fail noisy, BEFORE my release!
// thanks Pipy for handling markdown now
ROOT = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(ROOT, "README.md"), encoding="utf-8") as f:
README = f.read()
setup(


Preparation time
less than 30 mins
Cooking time
over 2 hours
Serves
Serves 4
Dietary
Pepper and spices add zing to a layered sweet dream of strawberries, ice cream, meringue and raspberry syrup.
For the pavlova, preheat the oven to 100C/80C Fan/Gas ¼. Line a baking tray with parchment.
In a large bowl, beat the egg whites until frothy and add the cream of tartar. Beat until soft peaks form when the whisk is removed.
Mix ½ tablespoon of sugar with the cornflour and set aside. Gradually add the remaining sugar, 1 tablespoon at a time, beating well after each addition. Beat until thick and glossy. Whisk in the cornflour and sugar mixture. Gently fold in the vanilla extract and vinegar.
Spoon the mixture onto the prepared baking tray creating a circle 25cm/10in accross. Bake for 2 hours. Once cooked, cool on a wire rack.
For the monkey blood, place all ingredients in a bowl with two tablespoons of water and mix well. Cover with cling film and set on top of a simmering pan of water for 1 hour.
Pass the monkey blood through a sieve collecting the liquid in a bowl. Heat to reduce it in volume if you want a thicker monkey blood. Set aside until cold.
For the pepper corn syrup, mix the sugar and cinnamon in a pan of 500ml/18fl oz water and bring to the boil. Simmer for 5 minutes. Add the peppercorns. Simmer for 2 minutes, then set aside to cool.
Cut the strawberries in half. Spoon a little of the syrup over them and set aside until you are ready to serve.
To serve, assemble the sundaes in bowls with layers of ice cream, strawberries, pepper syrup, pavlova and then top with monkey blood. Garnish with mint.


{# TITLE: Default #} {% extends "site_base.html" %} {% load url from future %} {% load i18n %} {% load bootstrap_tags %} {% load form_utils %} {% load staticfiles %} {% block extra_style %} {{ form.media.css }} {{ formset.media.css }} {% endblock %} {% block head_title %}{% trans "Question" %}{% endblock %} {% block body %}
{% blocktrans %} Here, you can ask a question about one or several products:
{% trans "You can also answer your own question if there is something you would like to share and you haven't found the related question. That way, you document your knowledge so it can help others." %}


Estonian village for autism care under construction
by BNNIn Estonia’s north-west, a village, where different forms of the care of persons with autism spectrum disorder is under construction.
Estonian public broadcaster ERR reports that the village in Liikva, Harju County, is meant for adults with autism spectrum disorder, Down syndrome and other rare disorders. The project is planned to be completed in 2020, at a total cost of over four million euros.
«Our plan is to begin by offering day- and weekly care, which at a later stage will transition to permanent services,» Janno Kell, a project manager at the Liikva Päikesekodu foundation, explained. «The need for this tends to come up after a child or client loses one or both of their parents.»
ERR reports that the village would consist of three family homes for ten people each, one of which will be dedicated to Russian-speaking residents. An additional building will be erected for recreation and work purposes.


--- layout: post title: "The Command Handler contravariant functor" description: "An introduction to the Command Handler contravariant functor for object-oriented programmers." date: 2021-09-06 5:46 UTC tags: [Software Design, Architecture] --- {% include JB/setup %}
{{ page.description }}
This article is an instalment in an article series about contravariant functors. It assumes that you've read the introduction.
Asynchronous software architectures, such as those described in Enterprise Integration Patterns, often make good use of a pattern where Commands are (preferably immutable) Data Transfer Objects (DTOs) that are often placed on a persistent queue and later handled by a background process.
Even if you don't use asynchronous processing, separating command data from command handling can be beneficial for your software's granular architecture. In perhaps his most remarkable contribution to our book, Steven van Deursen describes how this pattern can greatly simplify how you deal with cross-cutting concerns.
In DIPPP the interface is called ICommandService
, but in this article I'll instead call it ICommandHandler
. It's a generic interface with a single method:
public interface ICommandHandler<TCommand> { void Execute(TCommand command); }
The book explains how this interface enables you to gracefully handle cross-cutting concerns without any reflection magic. You can also peruse its example code base on GitHub. In this article, however, I'm using a fork of that code because I wanted to make the properties of contravariant functors stand out more clearly.
In the sample code base, an ASP.NET Controller delegates work to an injected ICommandHandler<AdjustInventory>
called inventoryAdjuster
.
[Route("inventory/adjustinventory")] public ActionResult AdjustInventory(AdjustInventoryViewModel viewModel) { if (!this.ModelState.IsValid) { return this.View(nameof(Index), this.Populate(viewModel)); } AdjustInventory command = viewModel.Command; this.inventoryAdjuster.Execute(command); this.TempData["SuccessMessage"] = "Inventory successfully adjusted."; return this.RedirectToAction(nameof(HomeController.Index), "Home"); }
There's a single implementation of ICommandHandler<AdjustInventory>
, which is a class called AdjustInventoryService
:
public class AdjustInventoryService : ICommandHandler<AdjustInventory> { private readonly IInventoryRepository repository; public AdjustInventoryService(IInventoryRepository repository) { if (repository == null) throw new ArgumentNullException(nameof(repository)); this.repository = repository; } public void Execute(AdjustInventory command) { var productInventory = this.repository.GetByIdOrNull(command.ProductId) ?? new ProductInventory(command.ProductId); int quantityAdjustment = command.Quantity * (command.Decrease ? -1 : 1); productInventory = productInventory.AdjustQuantity(quantityAdjustment); if (productInventory.Quantity < 0) throw new InvalidOperationException("Can't decrease below 0."); this.repository.Save(productInventory); } }
The Execute
method first loads the inventory data from the database, calculates how to adjust it, and saves it. This is all fine and good object-oriented design, and my intent with the present article isn't to point fingers at it. My intent is only to demonstrate how the ICommandHandler
interface gives rise to a contravariant functor.
I'm using this particular code base because it provides a good setting for a realistic example.
Consider these two lines of code from AdjustInventoryService
:
int quantityAdjustment = command.Quantity * (command.Decrease ? -1 : 1); productInventory = productInventory.AdjustQuantity(quantityAdjustment);
Doesn't that look like a case of Feature Envy? Doesn't this calculation belong better on another class? Which one? The AdjustInventory
Command? That's one option, but in this style of architecture Commands are supposed to be dumb DTOs, so that may not be the best fit. ProductInventory
? That may be more promising.
Before making that change, however, let's consider the current state of the class.
One of the changes I made in my fork of the code was to turn the ProductInventory
class into an immutable Value Object, as recommended in DDD:
public sealed class ProductInventory { public ProductInventory(Guid id) : this(id, 0) { } public ProductInventory(Guid id, int quantity) { Id = id; Quantity = quantity; } public Guid Id { get; } public int Quantity { get; } public ProductInventory WithQuantity(int newQuantity) { return new ProductInventory(Id, newQuantity); } public ProductInventory AdjustQuantity(int adjustment) { return WithQuantity(Quantity + adjustment); } public override bool Equals(object obj) { return obj is ProductInventory inventory && Id.Equals(inventory.Id) && Quantity == inventory.Quantity; } public override int GetHashCode() { return HashCode.Combine(Id, Quantity); } }
That looks like a lot of code, but keep in mind that typing isn't the bottleneck - and besides, most of that code was written by various Visual Studio Quick Actions.
Let's try to add a Handle
method to ProductInventory
:
public ProductInventory Handle(AdjustInventory command) { var adjustment = command.Quantity * (command.Decrease ? -1 : 1); return AdjustQuantity(adjustment); }
While AdjustInventoryService
isn't too difficult to unit test, it still does require setting up and configuring some Test Doubles. The new method, on the other hand, is actually a pure function, which means that it's trivial to unit test:
[Theory] [InlineData(0, false, 0, 0)] [InlineData(0, true, 0, 0)] [InlineData(0, false, 1, 1)] [InlineData(0, false, 2, 2)] [InlineData(1, false, 1, 2)] [InlineData(2, false, 3, 5)] [InlineData(5, true, 2, 3)] [InlineData(5, true, 5, 0)] public void Handle( int initial, bool decrease, int adjustment, int expected) { var sut = new ProductInventory(Guid.NewGuid(), initial); var command = new AdjustInventory { ProductId = sut.Id, Decrease = decrease, Quantity = adjustment }; var actual = sut.Handle(command); Assert.Equal(sut.WithQuantity(expected), actual); }
Now that the new function is available on ProductInventory
, you can use it in AdjustInventoryService
:
public void Execute(AdjustInventory command) { var productInventory = this.repository.GetByIdOrNull(command.ProductId) ?? new ProductInventory(command.ProductId); productInventory = productInventory.Handle(command); if (productInventory.Quantity < 0) throw new InvalidOperationException("Can't decrease below 0."); this.repository.Save(productInventory); }
The Execute
method now delegates its central logic to ProductInventory.Handle
.
If you consider the Execute
method in its current incarnation, you may wonder why it checks whether the Quantity
is negative. Shouldn't that be the responsibility of ProductInventory
? Why do we even allow ProductInventory
to enter an invalid state?
This breaks encapsulation. Encapsulation is one of the most misunderstood concepts in programming, but as I explain in my PluralSight course, as a minimum requirement, an object should not allow itself to be put into an invalid state.
How to better encapsulate ProductInventory
? Add a Guard Clause to the constructor:
public ProductInventory(Guid id, int quantity) { if (quantity < 0) throw new ArgumentOutOfRangeException( nameof(quantity), "Negative quantity not allowed."); Id = id; Quantity = quantity; }
Again, such behaviour is trivial to drive with a unit test:
[Theory] [InlineData( -1)] [InlineData( -2)] [InlineData(-19)] public void SetNegativeQuantity(int negative) { var id = Guid.NewGuid(); Action action = () => new ProductInventory(id, negative); Assert.Throws<ArgumentOutOfRangeException>(action); }
With those changes in place, AdjustInventoryService
becomes even simpler:
public void Execute(AdjustInventory command) { var productInventory = this.repository.GetByIdOrNull(command.ProductId) ?? new ProductInventory(command.ProductId); productInventory = productInventory.Handle(command); this.repository.Save(productInventory); }
Perhaps even so simple that the class begins to seem unwarranted.
It's just a database Query, a single pure function call, and another database Command. In fact, it looks a lot like an impureim sandwich:
public void Execute(AdjustInventory command) { var productInventory = this.repository.GetByIdOrNull(command.ProductId) ?? new ProductInventory(command.ProductId); productInventory = productInventory.Handle(command); this.repository.Save(productInventory); }
In fact, it'd probably be more appropriate to move the null-handling closer to the other referentially transparent code:
public void Execute(AdjustInventory command) { var productInventory = this.repository.GetByIdOrNull(command.ProductId); productInventory = (productInventory ?? new ProductInventory(command.ProductId)).Handle(command); this.repository.Save(productInventory); }
Why do we need the AdjustInventoryService
class, again?
Can't we move those three lines of code to the Controller? We could, but that might make testing the above AdjustInventory
Controller action more difficult. After all, at the moment, the Controller has an injected ICommandHandler<AdjustInventory>
, which is easy to replace with a Test Double.
If only we could somehow compose an ICommandHandler<AdjustInventory>
from the above sandwich without having to define a class...
Fortunately, an interface like ICommandHandler<T>
gives rise to a contravariant functor. This will enable you to compose an ICommandHandler<AdjustInventory>
object from the above constituent parts.
In order to enable contravariant mapping, you must add a ContraMap
method:
public static ICommandHandler<T1> ContraMap<T, T1>( this ICommandHandler<T> source, Func<T1, T> selector) { Action<T1> action = x => source.Execute(selector(x)); return new DelegatingCommandHandler<T1>(action); }
Notice that, as explained in the overview article, in order to map from an ICommandHandler<T>
to an ICommandHandler<T1>
, the selector
has to go the other way: from T1
to T
. How this is possible will become more apparent with an example, which will follow later in the article.
The ContraMap
method uses a DelegatingCommandHandler
that wraps any Action<T>
:
public class DelegatingCommandHandler<T> : ICommandHandler<T> { private readonly Action<T> action; public DelegatingCommandHandler(Action<T> action) { this.action = action; } public void Execute(T command) { action(command); } }
If you're now wondering whether Action<T>
itself gives rise to a contravariant functor, then yes it does.
A ContraMap
method with the right signature isn't enough to be a contravariant functor. It must also obey the contravariant functor laws. As usual, it's proper computer-science work to actually prove this, but you can write some tests to demonstrate the identity law for the ICommandHandler<T>
interface. In this article, you'll see parametrised tests written with xUnit.net. First, the identity law:
[Theory] [InlineData("foo")] [InlineData("bar")] [InlineData("baz")] [InlineData("qux")] [InlineData("quux")] [InlineData("quuz")] [InlineData("corge")] [InlineData("grault")] [InlineData("garply")] public void IdentityLaw(string input) { var observations = new List<string>(); ICommandHandler<string> sut = new DelegatingCommandHandler<string>(observations.Add); T id<T>(T x) => x; ICommandHandler<string> projection = sut.ContraMap<string, string>(id); // Run both handlers sut.Execute(input); projection.Execute(input); Assert.Equal(2, observations.Count); Assert.Single(observations.Distinct()); }
In order to observe that the two handlers have identical behaviours, the test has to Execute
both of them to verify that both observations are the same.
All test cases pass.
Like the above example, you can also write a parametrised test that demonstrates that ContraMap
obeys the composition law for contravariant functors:
[Theory] [InlineData("foo")] [InlineData("bar")] [InlineData("baz")] [InlineData("qux")] [InlineData("quux")] [InlineData("quuz")] [InlineData("corge")] [InlineData("grault")] [InlineData("garply")] public void CompositionLaw(string input) { var observations = new List<TimeSpan>(); ICommandHandler<TimeSpan> sut = new DelegatingCommandHandler<TimeSpan>(observations.Add); Func<string, int> f = s => s.Length; Func<int, TimeSpan> g = i => TimeSpan.FromDays(i); ICommandHandler<string> projection1 = sut.ContraMap((string s) => g(f(s))); ICommandHandler<string> projection2 = sut.ContraMap(g).ContraMap(f); // Run both handlers projection1.Execute(input); projection2.Execute(input); Assert.Equal(2, observations.Count); Assert.Single(observations.Distinct()); }
This test defines two local functions, f
and g
. Once more, you can't directly compare methods for equality, so instead you have to Execute
them to verify that they produce the same observable effect.
They do.
We can now return to the inventory adjustment example. You may recall that the Controller would Execute
a command
on an injected ICommandHandler<AdjustInventory>
:
this.inventoryAdjuster.Execute(command);
As a first step, we can attempt to compose inventoryAdjuster
on the fly:
ICommandHandler<AdjustInventory> inventoryAdjuster = new DelegatingCommandHandler<ProductInventory>(repository.Save) .ContraMap((ProductInventory inv) => (inv ?? new ProductInventory(command.ProductId)).Handle(command)) .ContraMap((AdjustInventory cmd) => repository.GetByIdOrNull(cmd.ProductId)); inventoryAdjuster.Execute(command);
Contra-mapping is hard to get one's head around, and to make matters worse, you have to read it from the bottom towards the top to understand what it does. It really is contrarian.
How do you arrive at something like this?
You start by looking at what you have. The Controller may already have an injected repository
with various methods. repository.Save
, for example, has this signature:
void Save(ProductInventory productInventory);
Since it has a void
return type, you can treat repository.Save
as an Action<ProductInventory>
. Wrap it in a DelegatingCommandHandler
and you have an ICommandHandler<ProductInventory>
:
ICommandHandler<ProductInventory> inventoryAdjuster = new DelegatingCommandHandler<ProductInventory>(repository.Save);
That's not what you need, though. You need an ICommandHandler<AdjustInventory>
. How do you get closer to that?
You already know from the AdjustInventoryService
class that you can use a pure function as the core of the impureim sandwich. Try that and see what it gives you:
ICommandHandler<ProductInventory> inventoryAdjuster = new DelegatingCommandHandler<ProductInventory>(repository.Save) .ContraMap((ProductInventory inv) => (inv ?? new ProductInventory(command.ProductId)).Handle(command));
That doesn't change the type of the handler, but implements the desired functionality.
You have an ICommandHandler<ProductInventory>
that you need to somehow map to an ICommandHandler<AdjustInventory>
. How do you do that?
By supplying a function that goes the other way: from AdjustInventory
to ProductInventory
. Does such a method exist? Yes, it does, on the repository:
ProductInventory GetByIdOrNull(Guid id);
Or, close enough. While AdjustInventory
is not a Guid
, it comes with a Guid
:
ICommandHandler<AdjustInventory> inventoryAdjuster = new DelegatingCommandHandler<ProductInventory>(repository.Save) .ContraMap((ProductInventory inv) => (inv ?? new ProductInventory(command.ProductId)).Handle(command)) .ContraMap((AdjustInventory cmd) => repository.GetByIdOrNull(cmd.ProductId));
That's cool, but unfortunately, this composition cheats. It closes over command
, which is a run-time variable only available inside the AdjustInventory
Controller action.
If we're allowed to compose the Command Handler inside the AdjustInventory
method, we might as well just have written:
var inv = repository.GetByIdOrNull(command.ProductId); inv = (inv ?? new ProductInventory(command.ProductId)).Handle(command); repository.Save(inv);
This is clearly much simpler, so why don't we do that?
In this particular example, that's probably a better idea overall, but I'm trying to explain what is possible with contravariant functors. The goal here is to decouple the caller (the Controller) from the handler. We want to be able to define the handler outside of the Controller action.
That's what the AdjustInventory
class does, but can we leverage the contravariant functor to compose an ICommandHandler<AdjustInventory>
without adding a new class?
The use of a closure in the above composition is what disqualifies it. Is it possible to compose an ICommandHandler<AdjustInventory>
when the command
object is unavailable to close over?
Yes, but it isn't pretty:
ICommandHandler<AdjustInventory> inventoryAdjuster = new DelegatingCommandHandler<ProductInventory>(repository.Save) .ContraMap((ValueTuple<AdjustInventory, ProductInventory> t) => (t.Item2 ?? new ProductInventory(t.Item1.ProductId)).Handle(t.Item1)) .ContraMap((AdjustInventory cmd) => (cmd, repository.GetByIdOrNull(cmd.ProductId)));
You can let the composing function return a tuple of the original input value and the projected value. That's what the lowest ContraMap
does. This means that the upper ContraMap
receives this tuple to map. Not pretty, but possible.
I never said that this was the best way to address some of the concerns I've hinted at in this article. The purpose of the article was mainly to give you a sense of what a contravariant functor can do.
Wrapping an Action<T>
in a DelegatingCommandHandler
isn't necessary in order to form the contravariant functor. I only used the ICommandHandler
interface as an object-oriented-friendly introduction to the example. In fact, any Action<T>
gives rise to a contravariant functor with this ContraMap
function:
public static Action<T1> ContraMap<T, T1>(this Action<T> source, Func<T1, T> selector) { return x => source(selector(x)); }
As you can tell, the function being returned is similar to the lambda expression used to implement ContraMap
for ICommandHandler<T>
.
This turns out to make little difference in the context of the examples shown here, so I'm not going to tire you with more example code.
Any generic polymorphic interface or abstract method with a void
return type gives rise to a contravariant functor. This includes the ICommandHandler<T>
(originally ICommandService<T>
) interface, but also another interface discussed in DIPPP: IEventHandler<TEvent>
.
The utility of this insight may not be immediately apparent. Contrary to its built-in support for functors, C# doesn't have any language features that light up if you implement a ContraMap
function. Even in Haskell where the Contravariant functor is available in the base library, I can't recall having ever used it.
Still, even if not a practical insight, the ubiquitous presence of contravariant functors in everyday programming 'building blocks' tells us something profound about the fabric of programming abstraction and polymorphism.


April 2020
Thank you for using the Labstache LabVIEW toolkit. Labstache provides a API to render logic-free Mustache templates. No external dependencies are required. The template compiler is 100% LabVIEW and can be used anywhere the LabVIEW run-time engine is installed.
The following sections are available:
This section documents installation instructions for the Labstache LabVIEW toolkit.
The following operating systems are supported by the Labstache LabVIEW toolkit:
The following table lists the NI application software versions supported by the Labstache LabVIEW toolkit:
| NI Application Software | Supported Versions |
|---|---|
| LabVIEW | 2014 and later |
For more information please contact Field R&D Services, LLC at<EMAIL_ADDRESS>This library is provided "as-is" and no support is provided.
The following individuals have helped or contributed in some fashion to the Labstache project but are not associated with Field R&D Services, LLC.
Copyright © 2018 Field R&D Services, LLC. All rights reserved.
Labstache is licensed under the MIT license. Please see the Legal page for more information about copyright and licensing.


SPONSORED CONTENT
Caretaker role at local school
Jobs Alert
by David LynchScoil Mhuire na Trócaire Primary School, Ardee requires a Caretaker/Janitor of a Full Time position
For an application form, contact the school office on<PHONE_NUMBER>
Closing date for applications – Wednesday December 4, 2019


Multiple state machines on a page
On. Off.
Cat states
Cassette player
Sprint states
This state machine happens to be described in scxml
The kitchen sink
Not a legal or practical state machine, but most of state machine cat's features are in.
as is
de-sugared
DHCP
Output json with scxml executable content
Output smcat from scxml with executable content
Error scenarios for the inpage script
src not found
no textContent
syntax error in scxml
syntax error in smcat source


Methods summary
public
|
#
__construct( string $className )
Creates a new factory class.
Creates a new factory class.
Parameters
- $className
- The fully-qualified class name.
|
public
static
|
#
setClassName( string $className )
Sets the fully-qualified name of the factory class.
Sets the fully-qualified name of the factory class.
Parameters
- $className
- The fully-qualified class name.
Returns
static The current instance.
|
public
string
|
#
getClassName( )
Returns the fully-qualified name of the factory class.
Returns the fully-qualified name of the factory class.
Returns
string The fully-qualified class name.
|
public
string
|
#
getNamespaceName( )
Returns the namespace of the factory class.
Returns the namespace of the factory class.
Returns
string The namespace or an empty string if the class is in the
global namespace.
|
public
string
|
#
getShortClassName( )
Returns the short class name.
Returns the short class name.
Returns
string The short name of the factory class.
|
public
string
|
#
getDirectory( )
Returns the path to the directory holding the factory class file.
Returns the path to the directory holding the factory class file.
Returns
string The absolute directory path.
|
public
static
|
#
setDirectory( string $directory )
Sets the path to the directory holding the factory class file.
Sets the path to the directory holding the factory class file.
Parameters
- $directory
- The absolute directory path.
Returns
static The current instance.
|
public
string
|
#
getFileName( )
Returns the name of the factory class file.
Returns the name of the factory class file.
If no file name was set, the file is named after the short class name
suffixed with ".php".
Returns
string The file name.
|
public
static
|
#
setFileName( string $fileName )
Sets the name of the factory class file.
Sets the name of the factory class file.
Parameters
Returns
static The current instance.
|
public
static
|
#
resetFileName( )
Resets the name of the factory class file to the default value.
Resets the name of the factory class file to the default value.
By default, the file is named after the short class name suffixed with
".php".
Returns
static The current instance.
|
public
string
|
#
getFilePath( )
Returns the absolute file path of the factory class file.
Returns the absolute file path of the factory class file.
Returns
string The absolute file path.
|
public
static
|
#
setFilePath( string $filePath )
Sets the absolute file path of the factory class file.
Sets the absolute file path of the factory class file.
Parameters
- $filePath
- The absolute file path.
Returns
static The current instance.
|
public
string|null
|
#
getParentClass( )
Returns the parent class name.
Returns the parent class name.
Returns
string|null The parent class name or null if the class has no
parent class.
|
public
static
|
#
setParentClass( string $parentClass )
Sets the parent class name.
Sets the parent class name.
If you don't pass a fully-qualified name, make sure to import the name
with Puli\Manager\Api\Php\Clazz::addImport() .
Parameters
- $parentClass
- The parent class name.
Returns
static The current instance.
|
public
boolean
|
#
hasParentClass( )
Returns whether the class extends another class.
Returns whether the class extends another class.
Returns
boolean Returns true if the class has a parent class and false
otherwise.
|
public
static
|
#
removeParentClass( )
Removes the parent class.
Removes the parent class.
Returns
static The current instance.
|
public
string[]
|
#
getImplementedInterfaces( )
Returns the interfaces that the class implements.
Returns the interfaces that the class implements.
Returns
string[] The names of the implemented interfaces.
|
public
boolean
|
#
hasImplementedInterfaces( )
Returns whether the class implements any interfaces.
Returns whether the class implements any interfaces.
Returns
boolean Returns true if the class implements any interfaces and
false otherwise.
|
public
static
|
#
setImplementedInterfaces( array $interfaceNames )
Sets the interfaces that the class implements.
Sets the interfaces that the class implements.
Previously added interfaces are overwritten.
If you don't pass fully-qualified names, make sure to import the names
with Puli\Manager\Api\Php\Clazz::addImport() .
Parameters
- $interfaceNames
- The names of the implemented interfaces.
Returns
static The current instance.
|
public
static
|
#
addImplementedInterfaces( array $interfaceNames )
Adds implemented interfaces to the class definition.
Adds implemented interfaces to the class definition.
Previously added interfaces are kept.
If you don't pass fully-qualified names, make sure to import the names
with Puli\Manager\Api\Php\Clazz::addImport() .
Parameters
- $interfaceNames
- The names of the added interfaces.
Returns
static The current instance.
|
public
static
|
#
addImplementedInterface( string $interfaceName )
Adds an implemented interface to the class definition.
Adds an implemented interface to the class definition.
If you don't pass a fully-qualified name, make sure to import the name
with Puli\Manager\Api\Php\Clazz::addImport() .
Parameters
- $interfaceName
- The name of the added interfaces.
Returns
static The current instance.
|
public
static
|
#
removeImplementedInterface( string $interfaceName )
Removes an implemented interface from the class definition.
Removes an implemented interface from the class definition.
Parameters
- $interfaceName
- The name of the removed interfaces.
Returns
static The current instance.
|
public
static
|
#
clearImplementedInterfaces( )
Removes all implemented interfaces from the class definition.
Removes all implemented interfaces from the class definition.
Returns
static The current instance.
|
public
Puli\Manager\Api\Php\Import[]
|
#
getImports( )
Returns the import statements of the class file.
Returns the import statements of the class file.
Returns
|
public
boolean
|
#
hasImports( )
Returns whether the class file imports any class name.
Returns whether the class file imports any class name.
Returns
boolean Returns true if the class file imports class names and
false otherwise.
|
public
static
|
#
setImports( array $imports )
Sets the import statements of the class file.
Sets the import statements of the class file.
Previously added imports are overwritten.
Parameters
- $imports
- The imported fully-qualified class names.
Returns
static The current instance.
|
public
static
|
#
addImports( array $imports )
Adds import statements to the class file.
Adds import statements to the class file.
Previously added imports are kept.
Parameters
- $imports
- The imported fully-qualified class names.
Returns
static The current instance.
|
public
static
|
#
addImport( Puli\Manager\Api\Php\Import $import )
Adds an import statement to the class file.
Adds an import statement to the class file.
Parameters
- $import
- The imported fully-qualified class name.
Returns
static The current instance.
|
public
static
|
#
removeImport( string $className )
Removes an import statement from the class file.
Removes an import statement from the class file.
If the import statement is not found, this method does nothing.
Parameters
- $className
- The removed imported class name.
Returns
static The current instance.
|
public
static
|
#
clearImports( )
Removes all import statements from the class file.
Removes all import statements from the class file.
Returns
static The current instance.
|
public
Puli\Manager\Api\Php\Method[]
|
#
getMethods( )
Returns the methods of the factory class.
Returns the methods of the factory class.
Returns
|
public
Puli\Manager\Api\Php\Method
|
#
getMethod( string $name )
Returns the method with the given name.
Returns the method with the given name.
Parameters
- $name
- The name of the method.
Returns
Throws
OutOfBoundsException If the method with the given name does not
exist.
|
public
boolean
|
#
hasMethods( )
Returns whether the class contains any methods.
Returns whether the class contains any methods.
Returns
boolean Returns true if the class contains methods and false
otherwise.
|
public
boolean
|
#
hasMethod( string $name )
Returns whether the class contains a method with the given name.
Returns whether the class contains a method with the given name.
Parameters
- $name
- The name of the method.
Returns
boolean Returns true if the method with the given name exists and
false otherwise.
|
public
static
|
#
setMethods( array $methods )
Sets the methods of the class.
Sets the methods of the class.
Previously added methods are overwritten.
Parameters
- $methods
- The methods of the class.
Returns
static The current instance.
|
public
static
|
#
addMethods( array $methods )
Adds methods to the class.
Adds methods to the class.
Previously added methods are kept.
Parameters
- $methods
- The methods to add to the class.
Returns
static The current instance.
|
public
static
|
#
addMethod( Puli\Manager\Api\Php\Method $method )
Adds a method to the class.
Adds a method to the class.
Parameters
- $method
- The method to add to the class.
Returns
static The current instance.
|
public
static
|
#
removeMethod( string $name )
Removes a method from the class.
Removes a method from the class.
Parameters
- $name
- The name of the removed method.
Returns
static The current instance.
|
public
static
|
#
clearMethods( )
Removes all methods from the class.
Removes all methods from the class.
Returns
static The current instance.
|
public
string
|
#
getDescription( )
Returns the description of the class.
Returns the description of the class.
Returns
string The class description.
|
public
static
|
#
setDescription( string $description )
Sets the description of the class.
Sets the description of the class.
Parameters
- $description
- The class description.
Returns
static The current instance.
|


PyChoose: Switch between installed versions of Python
You can switch between different installed versions of Python by simply prepending to your PATH. However, this goes wrong in some scenarios, such as when a tool like 'virtualenv' is installed in one Python version, but not in another. Pretty soon you will be executing your project with one Python version, but referencing the site-packages of another. When switching, other versions of Python need to be stripped from your PATH.
As a solution, I present a new Python module, pychoose. For the moment this is Windows only:
>python -V Python 2.6.4 >easy_install pychoose ... >pychoose 24 (Py24) >python -V Python 2.4.4 (Py24) >exit >python -V Python 2.6.4
It prepends to the PATH as above, but it also filters other Python versions out the PATH. It modifies the PROMPT to show the user they are operating in a modified environment. It works by spawning a new shell with the modified environment. To return to your default Python interpreter, type 'exit'.
PyPI page: http://pypi.python.org/pypi/pychoose
Subversion repository: http://code.google.com/p/pychoose
Preview the module source code.
It seems to work for simple scenarios, but there are a bunch of known problems with it (see the PyPI page above), which I'd like to fix if people think this is useful. I just whipped this up and don't really understand the issues surrounding this. In particular is spawning a new shell the best way to modify the current console's environment? Is a less-instrusive alternative to generate .bat file which can be executed to change the current shell's environment?
Feedback & suggestions very welcome.


PHILIPPE MOROZOV
123 Anywhere Street, City, State
(555) 000-0000
<EMAIL_ADDRESS>GEORGE ABRASHEV
State the type of job you are seeking and highlight several of your most important, impressive and marketable skills.
SUMMARY OF SKILLS
- Include your most marketable skills and accomplishments here.
- Ensure the skills you list are relevant to the type of job you are seeking.
- Be as specific as possible.
- Ensure that this section is full of the keywords employers will likely use when sorting resumes.
- If keywords are commonly stated more than on way, you must use both forms of the word (for example, Master of Business Administration and MBA)
WORK EXPERIENCE
Administrative Assistant, ABC Company, City, State, 2006 to present
- Use a combination of verbs and nouns to describe job duties and accomplishments that are most relevant to the work you are currently seeking.
- Don't forget to include a variety of targeted keywords
- List jobs in reverse chronological order; your most recent job goes first.
Administrative Assistant, XYZ Company, City, State, 2000 to 2006
- Continue to use verbs and nouns to describe job duties and accomplishments that are most relevant to the work you are currently seeking and target important keywords.
Customer Service Representative, Another Company, City, State, 1998 to 2000
- Continue to use verbs and nouns to describe job duties and include important keywords.
- Normally you should only include your most recent ten years of work experience on your resume. There are exceptions, but typically employers are most interested in your most recent experience, and going back more than ten years on your resume can age you.
EDUCATION
Administrative Assistant Certificate, Any College, City, State
VOLUNTEER EXPERIENCE
- Only include this section if it adds information that is relevant to the job you are seeking.
- You may also include hobbies here, but only if they are positive and relevant to the job you are seeking.
REFERENCES
available upon request
A (final_)new production company based in Sofia, Bulgaria


Posts about til
Today I learned
- TIL: git push --force-with-lease
- TIL: Makefiles that are self-documenting, and process all extant files.
- TIL: Creating Animated Meme GIFs on the Command-Line
- TIL: Energy use per transaction for cryptocurrencies vs Visa
- TIL: Download audio from YouTube
- TIL: Git Annotated Tags
- TIL: ‰ is per mille
- TIL: Format Python Snippets with Black.
- TIL: When to use three dots vs two in Git
- TIL: Listen to your phone through your PC speakers
- TIL: Understanding git rebase so it sticks
- TIL: Launch Gitk displaying all branches
- TIL: 'Go to Definition' in Vim for Python using Ctags, Done Right
- TIL: Undocumented feature of the week: $PIP_DOWNLOAD_CACHE
- TIL: More Colored Terminal text on Windows: AnsiCon
- TIL: MSWindows Programming : Propogating child process exit values out of .bat scripts
- TIL: Show last command exit value in Bash shell prompt
- TIL: Using assertAlmostEquals to compare to N Significant Figures


Sign in to your account using email and password provided during registration.
Don't have an account? Sign up
Already have an account? Sign in
Or sign in with


|
||||||||||
| PREV NEXT | FRAMES NO FRAMES |
| Packages that use SocketClient | |
|---|---|
| org.apache.commons.net.bsd | Classes for rcommand, rexec, rlogin |
| org.apache.commons.net.chargen | Chargen over TCP and UDP |
| org.apache.commons.net.daytime | Daytime over TCP and UDP |
| org.apache.commons.net.discard | Discard over TCP and UDP |
| org.apache.commons.net.echo | Echo over TCP and UDP |
| org.apache.commons.net.finger | Finger implementation |
| org.apache.commons.net.ftp | FTP and FTPS support classes |
| org.apache.commons.net.imap | Basic IMAP and IMAPS support classes |
| org.apache.commons.net.nntp | NNTP - network news transfer protocol |
| org.apache.commons.net.pop3 | POP3 and POP3S mail |
| org.apache.commons.net.smtp | SMTP and SMTPS mail |
| org.apache.commons.net.telnet | Telnet implementation |
| org.apache.commons.net.time | Time protocol (RFC 868) over TCP and UDP |
| org.apache.commons.net.whois | Whois client |
| Uses of SocketClient in org.apache.commons.net.bsd |
|---|
| Subclasses of SocketClient in org.apache.commons.net.bsd | |
|---|---|
class |
RCommandClient
RCommandClient is very similar to RExecClient ,
from which it is derived, and implements the rcmd() facility that
first appeared in 4.2BSD Unix. |
class |
RExecClient
RExecClient implements the rexec() facility that first appeared in 4.2BSD Unix. |
class |
RLoginClient
RLoginClient is very similar to RCommandClient ,
from which it is derived, and uses the rcmd() facility implemented
in RCommandClient to implement the functionality of the rlogin command that
first appeared in 4.2BSD Unix. |
| Uses of SocketClient in org.apache.commons.net.chargen |
|---|
| Subclasses of SocketClient in org.apache.commons.net.chargen | |
|---|---|
class |
CharGenTCPClient
The CharGenTCPClient class is a TCP implementation of a client for the character generator protocol described in RFC 864. |
| Uses of SocketClient in org.apache.commons.net.daytime |
|---|
| Subclasses of SocketClient in org.apache.commons.net.daytime | |
|---|---|
class |
DaytimeTCPClient
The DaytimeTCPClient class is a TCP implementation of a client for the Daytime protocol described in RFC 867. |
| Uses of SocketClient in org.apache.commons.net.discard |
|---|
| Subclasses of SocketClient in org.apache.commons.net.discard | |
|---|---|
class |
DiscardTCPClient
The DiscardTCPClient class is a TCP implementation of a client for the Discard protocol described in RFC 863. |
| Uses of SocketClient in org.apache.commons.net.echo |
|---|
| Subclasses of SocketClient in org.apache.commons.net.echo | |
|---|---|
class |
EchoTCPClient
The EchoTCPClient class is a TCP implementation of a client for the Echo protocol described in RFC 862. |
| Uses of SocketClient in org.apache.commons.net.finger |
|---|
| Subclasses of SocketClient in org.apache.commons.net.finger | |
|---|---|
class |
FingerClient
The FingerClient class implements the client side of the Internet Finger Protocol defined in RFC 1288. |
| Uses of SocketClient in org.apache.commons.net.ftp |
|---|
| Subclasses of SocketClient in org.apache.commons.net.ftp | |
|---|---|
class |
FTP
FTP provides the basic the functionality necessary to implement your own FTP client. |
class |
FTPClient
FTPClient encapsulates all the functionality necessary to store and retrieve files from an FTP server. |
class |
FTPHTTPClient
Experimental attempt at FTP client that tunnels over an HTTP proxy connection. |
class |
FTPSClient
FTP over SSL processing. |
| Uses of SocketClient in org.apache.commons.net.imap |
|---|
| Subclasses of SocketClient in org.apache.commons.net.imap | |
|---|---|
class |
AuthenticatingIMAPClient
An IMAP Client class with authentication support. |
class |
IMAP
The IMAP class provides the basic the functionality necessary to implement your own IMAP client. |
class |
IMAPClient
The IMAPClient class provides the basic functionalities found in an IMAP client. |
class |
IMAPSClient
The IMAPSClient class provides SSL/TLS connection encryption to IMAPClient. |
| Uses of SocketClient in org.apache.commons.net.nntp |
|---|
| Subclasses of SocketClient in org.apache.commons.net.nntp | |
|---|---|
class |
NNTP
The NNTP class is not meant to be used by itself and is provided only so that you may easily implement your own NNTP client if you so desire. |
class |
NNTPClient
NNTPClient encapsulates all the functionality necessary to post and retrieve articles from an NNTP server. |
| Uses of SocketClient in org.apache.commons.net.pop3 |
|---|
| Subclasses of SocketClient in org.apache.commons.net.pop3 | |
|---|---|
class |
ExtendedPOP3Client
A POP3 Cilent class with protocol and authentication extensions support (RFC2449 and RFC2195). |
class |
POP3
The POP3 class is not meant to be used by itself and is provided only so that you may easily implement your own POP3 client if you so desire. |
class |
POP3Client
The POP3Client class implements the client side of the Internet POP3 Protocol defined in RFC 1939. |
class |
POP3SClient
POP3 over SSL processing. |
| Uses of SocketClient in org.apache.commons.net.smtp |
|---|
| Subclasses of SocketClient in org.apache.commons.net.smtp | |
|---|---|
class |
AuthenticatingSMTPClient
An SMTP Client class with authentication support (RFC4954). |
class |
SMTP
SMTP provides the basic the functionality necessary to implement your own SMTP client. |
class |
SMTPClient
SMTPClient encapsulates all the functionality necessary to send files through an SMTP server. |
class |
SMTPSClient
SMTP over SSL processing. |
| Uses of SocketClient in org.apache.commons.net.telnet |
|---|
| Subclasses of SocketClient in org.apache.commons.net.telnet | |
|---|---|
class |
TelnetClient
The TelnetClient class implements the simple network virtual terminal (NVT) for the Telnet protocol according to RFC 854. |
| Uses of SocketClient in org.apache.commons.net.time |
|---|
| Subclasses of SocketClient in org.apache.commons.net.time | |
|---|---|
class |
TimeTCPClient
The TimeTCPClient class is a TCP implementation of a client for the Time protocol described in RFC 868. |
| Uses of SocketClient in org.apache.commons.net.whois |
|---|
| Subclasses of SocketClient in org.apache.commons.net.whois | |
|---|---|
class |
WhoisClient
The WhoisClient class implements the client side of the Internet Whois Protocol defined in RFC 954. |
|
||||||||||
| PREV NEXT | FRAMES NO FRAMES |


GenValue: 4
Supplemental Usage
| GEOS SDK TechDocs
|
|
| 3 GenValue Basics
| 4.1 Adjusting the Value Indirectly
Besides altering instance data, there are several other messages and mechanisms for your use in
GenValueClass
.
Adjusting the Value Indirectly
Status Messages
Retrieving Text
Using Value Ratios
Text Filters for the GenValue
Using Ranges in GenValues
| GEOS SDK TechDocs
|
|
| 3 GenValue Basics
| 4.1 Adjusting the Value Indirectly


XMLLINT(1) XMLLINT(1) NAME xmllint - command line XML tool SYNOPSIS xmllint [--version --debug --shell --debugent --copy --recover --noent --noout --nonet --path "PATH(S)" --load-trace --htmlout --nowrap --valid --postvalid --dtdvalid URL --dtdvalidfpi FPI --timing --output FILE --repeat --insert --compress --html --xmlout --push --memory --maxmem NBBYTES --nowarning --noblanks --nocdata --format --encode ENCODING --dropdtd --nsclean --testIO --catalogs --nocatalogs --auto --xinclude --noxincludenode --loaddtd --dtdattr --stream --walker --pattern PATTERNVALUE --chkregister --relaxng SCHEMA --schema SCHEMA --c14n] {XML-FILE(S)... -} xmllint --help DESCRIPTION The xmllint program parses one or more XML files, specified on the command line as XML-FILE (or the standard input if the filename provided is - ). It prints various types of output, depending upon the options selected. It is useful for detecting errors both in XML code and in the XML parser itself. xmllint is included in libxml(3). OPTIONS xmllint accepts the following options (in alphabetical order): --auto Generate a small document for testing purposes. --catalogs Use the SGML catalog(s) from SGML_CATALOG_FILES. Otherwise XML catalogs starting from /etc/xml/catalog are used by default. --chkregister Turn on node registration. Useful for developers testing libxml(3) node tracking code. --compress Turn on gzip(1) compression of output. --copy Test the internal copy implementation. --c14n Use the W3C XML Canonicalisation (C14N) to serialize the result of parsing to stdout. It keeps comments in the result. --dtdvalid URL Use the DTD specified by an URL for validation. --dtdvalidfpi FPI Use the DTD specified by a Formal Public Identifier FPI for validation, note that this will require a catalog exporting that Formal Public Identifier to work. --debug Parse a file and output an annotated tree of the in-memory version of the document. --debugent Debug the entities defined in the document. --dropdtd Remove DTD from output. --dtdattr Fetch external DTD and populate the tree with inherited attributes. --encode ENCODING Output in the given encoding. --format Reformat and reindent the output. The XMLLINT_INDENT environment variable controls the indentation. The default value is two spaces " "). --help Print out a short usage summary for xmllint. --html Use the HTML parser. --htmlout Output results as an HTML file. This causes xmllint to output the necessary HTML tags surrounding the result tree output so the results can be displayed/viewed in a browser. --insert Test for valid insertions. --loaddtd Fetch an external DTD. --load-trace Display all the documents loaded during the processing to stderr. --maxmem NNBYTES Test the parser memory support. NNBYTES is the maximum number of bytes the library is allowed to allocate. This can also be used to make sure batch processing of XML files will not exhaust the virtual memory of the server running them. --memory Parse from memory. --noblanks Drop ignorable blank spaces. --nocatalogs Do not use any catalogs. --nocdata Substitute CDATA section by equivalent text nodes. --noent Substitute entity values for entity references. By default, xmllint leaves entity references in place. --nonet Do not use the Internet to fetch DTDs or entities. --noout Suppress output. By default, xmllint outputs the result tree. --nowarning Do not emit warnings from the parser and/or validator. --nowrap Do not output HTML doc wrapper. --noxincludenode Do XInclude processing but do not generate XInclude start and end nodes. --nsclean Remove redundant namespace declarations. --output FILE Define a file path where xmllint will save the result of parsing. Usually the programs build a tree and save it on stdout, with this option the result XML instance will be saved onto a file. --path "PATH(S)" Use the (space- or colon-separated) list of filesystem paths specified by PATHS to load DTDs or entities. Enclose space-separated lists by quotation marks. --pattern PATTERNVALUE Used to exercise the pattern recognition engine, which can be used with the reader interface to the parser. It allows to select some nodes in the document based on an XPath (subset) expression. Used for debugging. --postvalid Validate after parsing has completed. --push Use the push mode of the parser. --recover Output any parsable portions of an invalid document. --relaxng SCHEMA Use RelaxNG file named SCHEMA for validation. --repeat Repeat 100 times, for timing or profiling. --schema SCHEMA Use a W3C XML Schema file named SCHEMA for validation. --shell Run a navigating shell. Details on available commands in shell mode are below (see the section called “SHELL COMMANDS”). --stream Use streaming API - useful when used in combination with --relaxng or --valid options for validation of files that are too large to be held in memory. --testIO Test user input/output support. --timing Output information about the time it takes xmllint to perform the various steps. --valid Determine if the document is a valid instance of the included Document Type Definition (DTD). A DTD to be validated against also can be specified at the command line using the --dtdvalid option. By default, xmllint also checks to determine if the document is well-formed. --version Display the version of libxml(3) used. --walker Test the walker module, which is a reader interface but for a document tree, instead of using the reader API on an unparsed document it works on an existing in-memory tree. Used for debugging. --xinclude Do XInclude processing. --xmlout Used in conjunction with --html. Usually when HTML is parsed the document is saved with the HTML serializer. But with this option the resulting document is saved with the XML serializer. This is primarily used to generate XHTML from HTML input. SHELL COMMANDS xmllint offers an interactive shell mode invoked with the --shell command. Available commands in shell mode include (in alphabetical order): base Display XML base of the node. bye Leave the shell. cat NODE Display the given node or the current one. cd PATH Change the current node to the given path (if unique) or root if no argument is given. dir PATH Dumps information about the node (namespace, attributes, content). du PATH Show the structure of the subtree under the given path or the current node. exit Leave the shell. help Show this help. free Display memory usage. load FILENAME Load a new document with the given filename. ls PATH List contents of the given path or the current directory. pwd Display the path to the current node. quit Leave the shell. save FILENAME Save the current document to the given filename or to the original name. validate Check the document for errors. write FILENAME Write the current node to the given filename. ENVIRONMENT SGML_CATALOG_FILES SGML catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting the SGML_CATALOG_FILES environment variable to a list of catalogs. An empty one should deactivate loading the default /etc/sgml/catalog catalog. XML_CATALOG_FILES XML catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting the XML_CATALOG_FILES environment variable to a list of catalogs. An empty one should deactivate loading the default /etc/xml/catalog catalog. XML_DEBUG_CATALOG Setting the environment variable XML_DEBUG_CATALOG to non-zero using the export command outputs debugging information related to catalog operations. XMLLINT_INDENT Setting the environment variable XMLLINT_INDENT controls the indentation. The default value is two spaces " ". DIAGNOSTICS xmllint return codes provide information that can be used when calling it from scripts. 0 No error 1 Unclassified 2 Error in DTD 3 Validation error 4 Validation error 5 Error in schema compilation 6 Error writing output 7 Error in pattern (generated when --pattern option is used) 8 Error in Reader registration (generated when --chkregister option is used) 9 Out of memory error SEE ALSO libxml(3) More information can be found at · libxml(3) web page http://www.xmlsoft.org/ · W3C XSLT page http://www.w3.org/TR/xslt AUTHOR John Fleck<EMAIL_ADDRESS>Ziying Sherwin<EMAIL_ADDRESS>Heiko Rupp<EMAIL_ADDRESS>libxml2 $Date$ XMLLINT(1)


{% extends 'blog/base.html' %} {% block content %}
Please confirm your email address to complete the registration.