Build your TypeScript v2 application with Express decorators !
Ts.ED is a framework on top of Express to write your application with TypeScript (or in ES6). It provide
a lot of decorators
to write your code.
- Define class as Controller,
- Define class as Service (IoC),
- Define class as Middleware and MiddlewareError,
- Define class as Converter (POJ to Model and Model to POJ),
- Define root path for an entire controller and versioning your Rest API,
- Define as sub-route path for a method,
- Define routes on GET, POST, PUT, DELETE and HEAD verbs,
- Define middlewares on routes,
- Define required parameters,
- Inject data from query string, path parameters, entire body, cookies, session or header,
- Inject Request, Response, Next object from Express request,
- Template (View),
- Swagger documentation and Swagger-ui,
- Testing.
See migrate from 1.x to 2.x section.


| Methods' Details |
getBitsPerPixel
- Description
- Query number of bits used per bitmap pixel.
This method yields the total number of bits used for a color
value. At the associated XIntegerBitmap, the
XIntegerBitmap::setPixel() method will expect
a sequence of ceil(BitsPerPixel/8) bytes, and the
XIntegerReadOnlyBitmap::getPixel() will
return that number of bytes. Similarly, the color conversion
expect input data in multiples of ceil(BitsPerPixel/8), and
also return converted data in chunks of this.
|
|
getComponentBitCounts
| sequence< long > |
| getComponentBitCounts(); |
- Description
- Query the number of bits used for each component.
This method returnes a sequence of integers, each denoting the
number of bits occupied by the respective component. The sum
of all component bits must be less or equal than the value
returned from getBitsPerPixel(). If the sum is
less, excess bits are always kept in the most significant bits
of a pixel. Color components will appear in the byte sequences
returned from the XIntegerBitmap methods in the
order defined here, with the first element starting from the
least significant bits of the pixel, etc.
- Example
- For the typical 32 bit RGBA color data, the four
values would all contain the value eight. For a 16 bit 1555
ARGB format, with mask values 0x8000 for alpha, 0x7C for red,
0x3E for green and 0x1F for blue, the values would be 5, 5, 5,
1, in that order.
|
|
getEndianness
- Description
- Query whether color data bytes need to be swapped.
- Returns
- true, This method returns the endiannes of the color
data. The value is one of the ::Endianness
constants. If color data is represented using more than one
byte, the actual channel positions are specified using bit
positions. Therefore, depending on the architecture, the
actual color data bytes might need to get swapped, for the
bits to align properly.
- Example
- with a 16 bit 565 RGB format, written on a big endian
architecture, a destination machine using little endian CPU
will need to swap the bytes, in order to keep the green
channel bits together.
|
|
convertFromIntegerColorSpace
- Description
- Convert integer bitmap color to generic IEEE double device
color of another color space.
Color values are properly rounded and clipped, to be valid in
the target color space.
- Parameter deviceColor
- Sequence of device color components. Is
permitted to contain more than one device color element,
therefore, batch conversion of multiple color values is
possible.
- Returns
- the corresponding sequence of device colors in the
target color space
- Throws
- a
com::sun::star::lang::IllegalArgumentException,
if the input sequence does not match the device color format.
|
|
convertToIntegerColorSpace
- Description
- Convert integer bitmap color to integer bitmap color of
another integer bitmap color space.
Color values are properly rounded and clipped, to be valid in
the target color space.
- Parameter deviceColor
- Sequence of device color components. Is
permitted to contain more than one device color element,
therefore, batch conversion of multiple color values is
possible.
- Returns
- the corresponding sequence of device colors in the
target color space
- Throws
- a
com::sun::star::lang::IllegalArgumentException,
if the input sequence does not match the device color format.
|
|
convertIntegerToRGB
- Description
- Convert color value in this color space to sRGB color values.
Any information not representable in the RGBColor
struct is discarded during the conversion. This includes alpha
information. Color values are properly rounded and clipped,
to be valid in the target color space.
- Parameter deviceColor
- Sequence of device color components. Is
permitted to contain more than one device color element,
therefore, batch conversion of multiple color values is
possible.
- Returns
- the corresponding sequence of sRGB colors.
- Throws
- a
com::sun::star::lang::IllegalArgumentException,
if the input sequence does not match the device color format.
- See also
- XIntegerBitmapColorSpace::convertIntegerToARGB
|
|
convertIntegerToARGB
- Description
- Convert color value in this color space to sRGB color values,
with linear alpha.
If the given input color does not carry alpha information, an
alpha value of 1.0 (fully opaque) is assumed. Color values
are properly rounded and clipped, to be valid in the target
color space.
- Parameter deviceColor
- Sequence of device color components. Is
permitted to contain more than one device color element,
therefore, batch conversion of multiple color values is
possible.
- Returns
- the corresponding sequence of sRGB colors.
- Throws
- a
com::sun::star::lang::IllegalArgumentException,
if the input sequence does not match the device color format.
|
|
convertIntegerToPARGB
- Description
- Convert color value in this color space to premultiplied sRGB
color values, with linear alpha.
If the given input color does not carry alpha information, an
alpha value of 1.0 (fully opaque) is assumed. Color values
are properly rounded and clipped, to be valid in the target
color space. The resulting individual RGB color values are
premultiplied by the alpha value (e.g. if alpha is 0.5, each
color value has only half of the original intensity).
- Parameter deviceColor
- Sequence of device color components. Is
permitted to contain more than one device color element,
therefore, batch conversion of multiple color values is
possible.
- Returns
- the corresponding sequence of sRGB colors.
- Throws
- a
com::sun::star::lang::IllegalArgumentException,
if the input sequence does not match the device color format.
|
|
convertIntegerFromRGB
- Description
- Convert sRGB color to an integer representation in this color
space.
If this color space conveys alpha information, it is assumed
be fully opaque for the given rgb color value. Color values
are properly rounded and clipped, to be valid in the target
color space.
- Parameter deviceColor
- Sequence of sRGB color components. Is
permitted to contain more than one color element, therefore,
batch conversion of multiple color values is possible.
- Returns
- the corresponding sequence of device colors.
- Throws
- a
com::sun::star::lang::IllegalArgumentException,
if the input sequence does not match the device color format.
|
|
convertIntegerFromARGB
- Description
- Convert sRGB color with linear alpha into this color space.
If this color space does not convey alpha information, the
specified alpha value is silently ignored. Color values are
properly rounded and clipped, to be valid in the target color
space.
- Parameter deviceColor
- Sequence of sRGB color components. Is
permitted to contain more than one color element, therefore,
batch conversion of multiple color values is possible.
- Returns
- the corresponding sequence of device colors.
- Throws
- a
com::sun::star::lang::IllegalArgumentException,
if the input sequence does not match the device color format.
|
|
convertIntegerFromPARGB
- Description
- Convert premultiplied sRGB color with linear alpha into this
color space.
If this color space does not convey alpha information, the
specified alpha value is silently ignored. Color values are
properly rounded and clipped, to be valid in the target color
space.
- Parameter deviceColor
- Sequence of sRGB color components. Is
permitted to contain more than one color element, therefore,
batch conversion of multiple color values is possible. The
individual RGB color values are assumed to be premultiplied by
the alpha value already.
- Returns
- the corresponding sequence of device colors.
- Throws
- a
com::sun::star::lang::IllegalArgumentException,
if the input sequence does not match the device color format.
|
|
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


--- title: How It Works layout: base --- How It Works Convox runs your infrastructure so that you can focus on your applications.
One command to boot your app on any Windows, Mac or Linux laptop.
One command to deploy your application to production.
Automated workflows based on GitHub pushes.
Slack notifications keep your whole team up to date.
Stay up to date with the latest AWS changes.
Save money and shrink your infrastructure.
Adopt a peer-reviewed cloud architecture.
Containerize your application effortlessly.


Members: Louise Stolz, Fernanda Juarez, Xuefeng Yan
Our lab studies diseases related to neuroinflammation and depression using PET neuroimaging. Our research has shown that there is a relationship between neuroinflammation and depression however, for this project, we wanted to see if there was a correlation between depression and obesity.
Studies have shown that certain parts of the brain, for example the hypothalamus, hippocampus, cortex, brainstem, and amygdala, are affected by obesity-derived neuroinflammation.
The following project presents four graphs of obesity and mental health prevalence in the United States. We have compared gender and age group across the US over time in an attempt to better understand the link between the two diseases.


{% extends "cctbx/header.html" %} {% load static %} {% block content %}
There are several methods to determine the secondary structure of macromolecules. This script shows how to automatically determine secondary structure using several methods with cctbx tools and how to numerically compare the result.
Author: Pavel V. Afonine
The following script reads in a model file and numerically compares the secondary structure annotation:
from __future__ import absolute_import, division, print_function
import sys
import mmtbx.secondary_structure
from scitbx.array_family import flex
from libtbx.utils import null_out
from iotbx.data_manager import DataManager
def match_score(x,y):
assert x.size() == y.size()
match_cntr = 0
for x_,y_ in zip(x,y):
if(x_==y_): match_cntr+=1
return match_cntr/x.size()
def get_ss(hierarchy,
sec_str_from_pdb_file=None,
method="ksdssp",
use_recs=False):
if(use_recs): params = None
else:
params = mmtbx.secondary_structure.manager.get_default_ss_params()
params.secondary_structure.protein.search_method=method
params = params.secondary_structure
ssm = mmtbx.secondary_structure.manager(
pdb_hierarchy = hierarchy,
sec_str_from_pdb_file = sec_str_from_pdb_file,
params = params,
log = null_out())
alpha = ssm.helix_selection()
beta = ssm.beta_selection()
assert alpha.size() == beta.size() == hierarchy.atoms().size()
annotation_vector = flex.double(hierarchy.atoms().size(), 0)
annotation_vector.set_selected(alpha, 1)
annotation_vector.set_selected(beta, 2)
return annotation_vector
def run(args):
dm = DataManager() # Initialize the DataManager and call it dm
dm.set_overwrite(True) # tell the DataManager to overwrite files with the same name
model_filename = args[0] # Name of model file
model = dm.get_model(model_filename) # Deliver model object with model info
pdb_hierarchy = model.get_hierarchy() # Get hierarchy object
sec_str_from_pdb_file = model.get_ss_annotation()
# get secodary structure annotation vector from HELIX/SHEET records (file header)
print('Running secondary structure annotation...')
v1 = get_ss(
hierarchy = pdb_hierarchy,
sec_str_from_pdb_file = sec_str_from_pdb_file)
# get secodary structure annotation vector from method CA atoms
v2 = get_ss(hierarchy = pdb_hierarchy, method = "from_ca")
# secodary structure annotation vector from KSDSSP
v3 = get_ss(hierarchy = pdb_hierarchy, method = "ksdssp")
#
print()
print("CC REMARK vs from_ca:", flex.linear_correlation(x = v1, y = v2).coefficient())
print("CC REMARK vs ksdssp:", flex.linear_correlation(x = v1, y = v3).coefficient())
print("CC from_ca vs ksdssp:", flex.linear_correlation(x = v3, y = v2).coefficient())
print()
print("match REMARK vs from_ca:", match_score(x = v1, y = v2))
print("match REMARK vs ksdssp:", match_score(x = v1, y = v3))
print("match from_ca vs ksdssp:", match_score(x = v3, y = v2))
if __name__ == '__main__':
run(args=sys.argv[1:])
The script consists of several parts:
Imports: At the beginning of the script are import statements. They are used to import the modules needed for a task.
Main function: The run()
function is used to read the input file, to call the helper functions and to print the result to standard output.
Helper functions: match_score()
and get_ss()
: To avoid duplicating code, some part of the calculations are put into functions. The get_ss()
function runs automatic secondary structure annotation, then returns a 1dimensional array representing the annotation. This vector is a linear array of length equal to the number of atoms in the model. It is initialized with zeros. Using the information from the SS annotation, the array elements are set to a non-zero number for helices and to a different number for sheets.
The bottom lines represent best practice. They enable the script to be imported and used from other Python scripts.
The script requires the following imports:
In the beginning of the run()
function, we read in a PDB file using the DataManager and create a model
object as well as a hierarchy
object:
Model files from the PDB usually have records with secondary structure annotation. Let's get the records from model
:
Then we get the annotation vectors from the helper function get_ss()
, using three different methods:
v1 represents the annotation vector based on the records in the model file. v2 is obtained from the annotation method "from_ca", which uses CA positions to find out if a residue belongs to secondary structure element. The annotation vector v3 relies on the the KSDSSP method.
The last lines print the results. With the annotation vectors, we can calculatie correlation coefficients using the method flex.linear_correlation(x = v1, y = v2).coefficient()
. We can also calculate the percentage of similarity of the vectors, which is done in the match_score()
function.
In the get_ss()
function, we calculate the annotation vectors. To do this, we first obtain the default parameters for the secondary structure module:
The params
object is a container for the parameters used in the mmtbx.secondary_structure.manager
. As we want to get the annotation via different methods, we change the parameter params.secondary_structure.protein.search_method
.
Then we get the secondary structure manager object:
We get the selections for helices and sheets with the helix_selection()
and beta_selection()
methods:
These selections are flex bool arrays. The length of the array corresponds to the number of atoms. We then make an annotation vector that has the same length. Its values are 1 if the atom is part of a helix, 2 if the atom is part of a sheet and 0 if the atom is not part of a secondary structure element.
We can then use this vector to compare the annotations numerically, as done with flex.linear_correlation(x = v1, y = v2).coefficient()
and the match_score()
function.
The match_score()
function calculates how many atoms have the same annotation and then divides the result by the number of atoms. This gives therefore a percentage of how many atoms of the model have the same secondary structure annotation.
Note the assertion in the first line, which makes sure that the arrays x and y have the same length.
You can run the script via the command line:
python script.py my_model.pdb
For example, if you run the script with model 1us0, the output will be the following (you can conveniently fetch a PDB model with "phenix.fetch_pdb 1us0"):
CC REMARK vs from_ca: 0.803945216619
CC REMARK vs ksdssp: 0.869800857769
CC from_ca vs ksdssp: 0.727252951902
match REMARK vs from_ca: 0.91220440337
match REMARK vs ksdssp: 0.916009785268
match from_ca vs ksdssp: 0.864908942647
You can get some more information about the annotation if you remove the parameter log = null_out()
in the generation of the SS manager:
(The default for log is the standard output.)
Then we'll get the additional output:
Secondary structure from input PDB file:
14 helices and 2 sheets defined
46.5% alpha, 8.6% beta
0 base pairs and 0 stacking pairs defined.
running find_ss_from_ca liberal...
Secondary structure from input PDB file:
12 helices and 3 sheets defined
47.5% alpha, 13.7% beta
0 base pairs and 0 stacking pairs defined.
running ksdssp...
Secondary structure from input PDB file:
14 helices and 3 sheets defined
39.5% alpha, 7.6% beta
0 base pairs and 0 stacking pairs defined.


{% extends "default.html" %} {% block bodyClass %}landing header--documentation{% endblock %} {% block headerClass %}landing header--documentation{% endblock %} {% block header %} {{ super() }}
{% endblock %} {% block extraHeader%}Read our tutorials, explore the full API documentation, or check out the glossary.
Our tutorials cover everything you need to know to get started as an Apostrophe developer. Everyone should start here. Our tutorials are progressive, so you can learn as you go.
Our technical overviews are ideal for pros who want to understand our decisions and philosophy.
Our module reference provides complete coverage of Apostrophe's modules and their related object types. Each module provides a particular feature, often including both front and back end code.
Need to hook into the life cycle of Apostrophe's documents and pages? Apostrophe emits "promise events" when documents are saved, when pages are rendered, and more.
Apostrophe is powered by the Nunjucks template language, which is compatible with Jinja and Twig. In addition to many helper functions, Apostrophe provides additional Nunjucks "filters" to transform data for output.
You've met the core modules that ship in the apostrophe
npm module. But there are more. And you can create more.


|
iamweezykon
Follow
235
posts
663
followers
638
following
Akinbode Weezykon
Full Stack Developer
iamweezykon
Follow
Akinbode Weezykon
Full Stack Developer
235
posts
663
followers
638
following
Designed By
Weezykon


SEDANS
Choose a sedan for its affordability and excellent fuel economy. Ideal for cruising in the city and or your next road trip.
Learn more
SUVs
Take an SUV for its spacious interior, power and versatility perfect for your next family vacation and off-road adventure.
Learn more
LUXURY
Cruise in the best car brands without the bloated prices. Enjoy the enhanced comfort of luxury rental and arriving style.


User Account: {{(userToDisplay | async)?.name}}
Points: {{(userToDisplay | async)?.points}}
You gave the mouse a cookie! Now he wants some milk. Look what you started...


Coverage Summary for Class: Actions (it.polimi.ingsw.Game.Actions)
| Class |
|---|
| Actions |
1 package it.polimi.ingsw.Game.Actions;
2
3 import it.polimi.ingsw.Game.Tile;
4 import it.polimi.ingsw.Utils.Pair;
5 import it.polimi.ingsw.Game.Worker;
6
7 public interface Actions {
8
9 /**
10 * To be called whenever the caller's turn began.
11 * Used for initialization purposes.
12 */
13 public void beginTurn();
14
15 /**
16 * Is the caller allowed to perform a move
17 *
18 * @return true if can move action
19 */
20 public boolean canMove();
21
22 /**
23 * Is the caller forced to move this turn
24 *
25 * @return true if must move
26 */
27 public boolean mustMove();
28
29 /**
30 * Is the given move valid
31 *
32 * @param w the worker
33 * @param to the destination tile
34 * @return true if `w` can move into `to`
35 */
36 public boolean validMove(Worker w, Tile to);
37
38 /**
39 * Perform a Move action and all its related behaviours
40 *
41 * @param w the worker
42 * @param to the destination tile
43 * @return true if the move resulted into a win
44 */
45 public boolean doMove(Worker w, Tile to);
46
47 /**
48 * Is the caller allowed to perform a build action
49 *
50 * @return true if can build
51 */
52 public boolean canBuild();
53
54 /**
55 * Is the caller forced to build this turn
56 *
57 * @return true if must build
58 */
59 public boolean mustBuild();
60
61 /**
62 * Is the given build valid
63 *
64 * @param w the worker
65 * @param to the destination tile
66 * @param level the block to build
67 * @return true if `w` can build a `level` at `to`
68 */
69 public boolean validBuild(Worker w, Tile to, int level);
70
71 /**
72 * Perform a Build action and all its related behaviours
73 *
74 * @param w the worker
75 * @param to the destination tile
76 * @param level the block level to build. starts from zero
77 */
78 public void doBuild(Worker w, Tile to, int level);
79
80 /**
81 * Get the last move the caller has completed.
82 *
83 * @return a Pair object representing the move from first to second
84 */
85 public Pair<Tile, Tile> getLastMove();
86
87 /**
88 * Get the last build the caller completed
89 *
90 * @return the last tile where it was built
91 */
92 public Tile getLastBuild();
93
94 /**
95 * Has the caller moved
96 *
97 * @return true if this player has already moved
98 */
99 public boolean getHasMoved();
100
101 /**
102 * Has the caller built
103 *
104 * @return true if this player has already built
105 */
106 public boolean getHasBuilt();
107
108 /**
109 * Actions to be taken when hen the caller loses
110 */
111 public void onLose();
112
113 /**
114 * Has the caller lost
115 *
116 * @return true if this player has lost
117 */
118 public boolean hasLost();
119
120 /**
121 * Check if the player can perform an action with a specific worker
122 *
123 * @param w the worker
124 * @return true if the player can use the worker for my next move
125 */
126 public boolean canUseThisWorkerNow(Worker w);
127 }


Defines | |
| #define | GLFW_NOT_INITIALIZED 0x00010001 |
| GLFW has not been initialized. | |
| #define | GLFW_NO_CURRENT_CONTEXT 0x00010002 |
| No context is current for this thread. | |
| #define | GLFW_INVALID_ENUM 0x00010003 |
| One of the arguments to the function was an invalid enum value. | |
| #define | GLFW_INVALID_VALUE 0x00010004 |
| One of the arguments to the function was an invalid value. | |
| #define | GLFW_OUT_OF_MEMORY 0x00010005 |
| A memory allocation failed. | |
| #define | GLFW_API_UNAVAILABLE 0x00010006 |
| GLFW could not find support for the requested API on the system. | |
| #define | GLFW_VERSION_UNAVAILABLE 0x00010007 |
| The requested OpenGL or OpenGL ES version is not available. | |
| #define | GLFW_PLATFORM_ERROR 0x00010008 |
| A platform-specific error occurred that does not match any of the more specific categories. | |
| #define | GLFW_FORMAT_UNAVAILABLE 0x00010009 |
| The requested format is not supported or available. | |
| #define | GLFW_NO_WINDOW_CONTEXT 0x0001000A |
| The specified window does not have an OpenGL or OpenGL ES context. |
| #define GLFW_API_UNAVAILABLE 0x00010006 |
GLFW could not find support for the requested API on the system.
GLFW could not find support for the requested API on the system.
The installed graphics driver does not support the requested API, or does not support it via the chosen context creation backend. Below are a few examples.
| #define GLFW_FORMAT_UNAVAILABLE 0x00010009 |
The requested format is not supported or available.
If emitted during window creation, the requested pixel format is not supported.
If emitted when querying the clipboard, the contents of the clipboard could not be converted to the requested format.
If emitted during window creation, one or more [hard constraints](window_hints_hard) did not match any of the available pixel formats. If your application is sufficiently flexible, downgrade your requirements and try again. Otherwise, inform the user that their machine does not match your requirements.
| #define GLFW_INVALID_ENUM 0x00010003 |
One of the arguments to the function was an invalid enum value.
One of the arguments to the function was an invalid enum value, for example requesting [GLFW_RED_BITS](window_hints_fb) with glfwGetWindowAttrib.
Application programmer error. Fix the offending call.
| #define GLFW_INVALID_VALUE 0x00010004 |
One of the arguments to the function was an invalid value.
One of the arguments to the function was an invalid value, for example requesting a non-existent OpenGL or OpenGL ES version like 2.7.
Requesting a valid but unavailable OpenGL or OpenGL ES version will instead result in a GLFW_VERSION_UNAVAILABLE error.
Application programmer error. Fix the offending call.
| #define GLFW_NO_CURRENT_CONTEXT 0x00010002 |
No context is current for this thread.
This occurs if a GLFW function was called that needs and operates on the current OpenGL or OpenGL ES context but no context is current on the calling thread. One such function is glfwSwapInterval.
Application programmer error. Ensure a context is current before calling functions that require a current context.
| #define GLFW_NO_WINDOW_CONTEXT 0x0001000A |
| #define GLFW_NOT_INITIALIZED 0x00010001 |
| #define GLFW_OUT_OF_MEMORY 0x00010005 |
A memory allocation failed.
A memory allocation failed.
A bug in GLFW or the underlying operating system. Report the bug to our [issue tracker](https://github.com/glfw/glfw/issues).
| #define GLFW_PLATFORM_ERROR 0x00010008 |
A platform-specific error occurred that does not match any of the more specific categories.
A platform-specific error occurred that does not match any of the more specific categories.
A bug or configuration error in GLFW, the underlying operating system or its drivers, or a lack of required resources. Report the issue to our [issue tracker](https://github.com/glfw/glfw/issues).
| #define GLFW_VERSION_UNAVAILABLE 0x00010007 |
The requested OpenGL or OpenGL ES version is not available.
The requested OpenGL or OpenGL ES version (including any requested context or framebuffer hints) is not available on this machine.
The machine does not support your requirements. If your application is sufficiently flexible, downgrade your requirements and try again. Otherwise, inform the user that their machine does not match your requirements.


pyCWD¶
Submodules¶
pyCWD.CWD module¶
Created on Mon Jun 4 14:42:02 2018
@author: rwilson
-
class
pyCWD.CWD.
utilities
[source]¶ Bases:
object
Some helper functions
-
src_rec_pairs
(channels, exclude=None, reciprocity=False, randSample=None)[source]¶ Generate a list of source receiver pairs for all excluding a certain channels.
Parameters: channels : list
list of channels from which src rec pairs should be generated
exclude : list (Default = None)
list of channels which should be excluded from the list of channels
reciprocity : bool (Default = False)
Include reciprocal pairs.
randSample : int (Default = None)
Extract a random subset from the list of length
randSample
Returns: src_rec : list
list of unique source receiver pairs
-
read_channelPos
(file, dimensions)[source]¶ Read in csv containing each channel position. Currently expecting that the channel position csv is of a specific type and needs shifting to bottom zeroed coord. system.
Parameters: file : str
Location of csv containing the channel locations
dimensions : dict
The
height
of the mesh.Returns: dfChan : DataFrame
Database of each channel location
-
HDF5_data_save
(HDF5File, group, name, data, attrb={'attr': 0}, ReRw='w')[source]¶ Saves data into a hdf5 database, if data name already exists, then an attempt to overwrite the data will be made
Parameters: HDF5File : str
Relative location of database
group : str
The expected group name
name : str
The name of the data to be saved within group
attrb : dict
attribute dictionary to store along with the database.
ReRw : str (Default = ‘w’)
The read/write format
-
HDF5_data_read
(HDF5File, group, name, ReRw='r')[source]¶ Saves data into a hdf5 database
Parameters: HDF5File : str
Relative location of database
group : str
The expected group name
attrb : tuple/list
attribute to store along with the database.
ReRw : str (Default = ‘w’)
The read/write format
Returns: dset : ()
Data contained within group/name
-
HDF5_attri_read
(HDF5File, group, name, ReRw='r')[source]¶ Read keys and attributes from hdf5 database.
Parameters: HDF5File : str
Relative location of database
group : str
The expected group name
attrb : tuple/list
attribute to store along with the database.
ReRw : str (Default = ‘w’)
The read/write format
Returns: dic : dict
A dictionary of all the attributes stored within the group/name.
-
WindowTcent
(TS, wdws)[source]¶ Determine the centre of each correlation window in time from the input time-series database.
Parameters: TS : float
Sampling period
wdws : list(str)
Containing the windows range in sample points separated by -
-
DiffRegress
(Tseries, dfChan, Emaxt0, plotOut=False)[source]¶ Perform linear regression to fit the 1D diffusion equation to an input time series. The output of this function is an estimation of the diffusivity and dissipation. (P. Anguonda et. al. 2001)
Parameters: Tseries : array-like
The input time series
dfChan : DataFrame
Containing the channel positsion columns x, y, z
Emaxt0 : int
The index corresponding to the arrival time (onset of) maximum energy
Returns: popt[1] : float
The diffusitivty determined from the least squared fit. Units depends upon input t and z units check units
popt[2] : float
The Dissipation
-
src_recNo
(CCdata)[source]¶ Extract the source receiver paris within CCdata, excluding common pairs.
Parameters: CCdata : dataframe
CCdata dataframe
Returns: src_recNo : list
List of the source receiver numbers
-
traceAttributes
(SurveyDB, Col)[source]¶ Extract a single trace and its attributes from single survey dataframe, into a dictionary.
Parameters: TStrace : DataFrame
Containing all traces for a single survey.
Col : int
The column to extract from the database.
Returns: traceDict: dict
Containing the trace along with all header information.
-
d_obs_time
(CCdata, src_rec, lag, window, parameter='CC', staTime=None, stopTime=None)[source]¶ Construct the d_obs dataframe over time from the input CCdata, for a select list of source-receiver pairs.
Parameters: CCdata : dataframe
CCdata dataframe
src_rec : list(tuples)
A list of tuples for each source receiver pair.
lag : list(tuples)
The lag value from which the extraction is made.
window : str/list(str)
string of windows or list of str of windows.
parameter : str (Default=’CC’)
Parameter from which to extract from the dataframe
staTime : str
The start time from which
d_obs
is extractedstopTime : str
The stop time before which
d_obs
is extracted.Returns: d_obs_time : dataframe
dataframe containing the in each row the d_obs vector for all requested source-receiver pairs, increasing with time.
-
measNorange
(CCdata, staTime, endTime)[source]¶ Determines the measurement survey number between given time interval. This function is intended to allow the user to quickly determine the measurement number range of interest, thereby allowing the reporcessing of the raw data over this region only. This requires that the user passes a CCdata which represents the entire raw dataset.
Parameters: CCdata : dataframe
CCdata dataframe
staTime : str
The start time of the interval/.
endTime : str
The start time of the interval/.
Returns: None : tuple
Measurement survey numbers within the range given.
-
surveyNorange
(TSsurveys, staTime, endTime)[source]¶ Determines the survey number between given time interval. This function is intended to allow the user to quickly determine the survey number range of interest, thereby allowing the reporcessing of the raw data over this region only. This requires that the user passes a CCdata which represents the entire raw dataset.
Parameters: TSsurveys : list
The survey folder numbers
staTime : str
The start time of the interval/.
endTime : str
The start time of the interval/.
Returns: None : tuple
Measurement survey numbers within the range given.
-
Data_on_mesh
(mesh_obj, data, loc='')[source]¶ Place data onto the mesh, and store each mesh file in subfolder.
Parameters: mesh_obj : mesh.object
mesh object as generated by the class mesh, containing the mesh as well as the functions for setting and saving that mesh.
data : array
Data containing mesh data stored in rows for each time step in columns. Separate mesh file will be generated for each
n
column.loc : str (Default = ‘’)
Location to which the output vtu files will be saved.
-
inversionSetup
(mesh_param, channelPos, noise_chan, drop_ch, noiseCutOff, database, CCdataTBL, Emaxt0, TS_idx, inversion_param, verbose=False)[source]¶ Run function intended to cluster the steps required to setup the inversion mesh and the associated sensitivity kernels. If the mesh_param dictionary key “makeMSH” is true, a new mesh will be constructed, otherweise an attempt to load it from disk will be made.
-
-
class
pyCWD.CWD.
decorrTheory
(src_rec, channels, X_b, t, param, mesh_obj=None)[source]¶ Bases:
object
Calculate the theoretical decorrelation ceofficient between each source receiver pair, based on the Code-Wave Diffusion method (Rossetto2011).
Parameters: src_rec : list(tuples)
List of each source-receiver pair.
channels : DataFrame
Index of channel numbers and the corresponding x,y,z (columns) positions corresponding to the ‘src’ and corresponding ‘rec’ numbers. Units should be according to the physical parameters of
D
andsigma
.X_b : array(x,y,z)
Location coords of perturbation within model domain in SI units.
t : float or list(float)
Centre time of the correlation windows with which the comparison is to be made.
param : dict
Expected parameters of medium, for example
D
(diffusion coefficient) andsigma
(scattering cross-section).mesh_obj : object
Mesh object generated from the
mesh
class.srRx_df : DataFrame
Calculated based on the input
src_rec
,channels
, andX_b
data. Multi-index df of s,r, and R, and Kt columns for each src, rec, tetraNo.G : np.array
Matrix G of row.No = len(src_rec) * len(t).
-
Kt
(t_no=0)[source]¶ The theoretical decorrelation coefficient between a single source-receiver pair.
Parameters: t_no : int (Default=0)
The time at which the kernel is calculated
Notes
The ‘_b’ notation signifies a vector in cartesian coordinates
-
Kt_mat
()[source]¶ Construct the kernel matrix or rows for each source/receiver pair and columns for each tet. cell centre.
-
-
class
pyCWD.CWD.
decorrInversion
(G, d_obs, L_0, L_c, sigma_m, cell_cents, verbose=True)[source]¶ Bases:
object
Perform the inversion(Rossetto2011).
Parameters: G : np.array
Matrix containing each sensitivity kernel stored roweise for each mesh cell stored columnweise.
d_obs : np.array
Data vector or length equal to the number or source/receiver pairs by the number of windows implemented.
L_0 : float
Should correspond to the size of a model cell.
L_c : float
The correlation distance between cells
sigma_m : float
The standard deviation of the model cells
cell_cents : float
The correlation distance between cells
-
paramUpdate
(V_0, f_0, factor=8)[source]¶ Update the L_0 of material parameters. output in [mm] Paerameters ———– V_0 : float
Velocity of the bulk material [m/s]- f_0 : float
- The dominante frequency of the wavefield [Hz]
-
static
C_M_speed
(vecNorm, G, sigma_m, L_c, L_0)[source]¶ Write jitted function for increasing the speed of L_curve operations
-
invTuning
(L_crange, sigma_mrange, runs, d_obs_idx=0)[source]¶ Perform the L-curve trade-off turning base of free param L_0 and sigma_m
Parameters: L_0range : tuple
Range of L_0 parameters (min, max, num).
sigma_mrange : tuple
Range of sigma_m parameters (min, max, num).
runs : int
The number of ramdom samples extracted from each tuning param
d_obs_idx : int
The index of the d_obs step on which turning is performed
-
inv
[source]¶ Estimation of the model parameters, for each time-step found in d_obs, where each row of ‘d_obs’ contains a single time step.
Parameters: d_obs : array
rows of observed data at each time-step
G : array
Sensntivity matrix G
C_M : array
Covarience matrix of the model param
m_prior : array
Prior model param
m_tildes : array
empty matrix into which each time-step generated model param is stored along the columns.
error_thresh : float.32
The error threashold below which the inversion resultes are accepted
no_interation : int
The max. number of repeat inversion steps.
Returns: m_tildes : array
The model response from each of the time-step inversions with rows: of the number of model cells and columns: of the number of time-steps.
rms : float
The root-mean-square diference after inforcing the positivity constraint.
-
invRun
(L_c=None, sigma_m=None, Database='CWD_Inversion.h5', m_tildes=None, error_thresh=100.0, no_iteration=10, chunk=False, d_obs_time=None)[source]¶ Overhead inversion function to perform time-lapse inversion operations for each time-step in parallel
Parameters: L_c : float (default = None)
Define the final L_c to use during the entire inversion
sigma_m : float (default = None)
Define the final sigma_m to use during the entire inversion
Database : h5 object
The database to which all inversion related param are stored.
m_tildes : floats (default = None)
model space vector
error_thresh : float.32 (default = 100.0)
The error threashold below which the inversion resultes are accepted
no_interation : int (default = 10)
The max. number of repeat inversion steps enforcing non-negative cond.
chunk : bool or int (default = False)
Defines the t-step chunks which to perform the inversion. This is intended to reduce the RAM requirements when many time-steps given.
d_obs_time : array[str] (default = None)
The time corresponding to each inversion, should be equal to the number of rows in
self.d_obs
.
-
pyCoda.mesh module¶
Created on Mon Jun 4 11:19:57 2018
@author: rwilson
-
class
pyCWD.mesh.
mesher
(mesh_param)[source]¶ Bases:
object
Mesh generator class using pygmsh to gmsh code.
Parameters: mesh_param : dict
Expected parameters defining the mesh, char_len, height, radius
cell_data : dict
Contains line, tetra, triangle, vertex ‘gmsh:physical’ and ‘gmsh:geometrical’.
cells : dict
Contains line, tetra, triangle, vertex of the point indicies as defined in
points
.points : array(float)
Matrix of xyz coords for each point in the mesh domain
Notes
- Understanding the mesh structure
Points are a list of each point or verticies in x,y,z positions. cell_data[‘tetra’][‘gmsh:physical’] : the physical values of each tetra * cell[‘tetra’] : list of lists of each tetrahedral verticies index referencing to
- the coords inside the points. [points[i1],
- points[i2], points[i3], points[i4]]
-
saveMesh
(name)[source]¶ Save the mesh to file.
Parameters: name : str
Name of the mesh file saved to the current directory.


File Box
Photos
Inbox
Trash
My Files & Folders
Shared Folders
Favorite Folders
x
Current Folder
Download
Copy link
More Actions
Title
Size
Modified
Owner
It will take about 60 seconds for a complete execution cycle.


s6-linux-init
Software
skarnet.org
An overview of s6-linux-init
Organisation of the package
When installed, the s6-linux-init package provides the
following:
- Binaries, that are typically installed in /bin:
- s6-linux-init-maker is the main
program of the package and is used to create /sbin/init scripts
and their supporting environment depending on configuration parameters
given on its command line.
- s6-linux-init-hpr is an
implementation of the SysV halt, poweroff and reboot
commands; s6-linux-init-telinit
is an implementation of the SysV telinit command; and
s6-linux-init-shutdown
is an implementation of the
shutdown
command. s6-linux-init is an
implementation of stage 1 /sbin/init, but it needs to be
given command-line options in order to do what the user has chosen.
An invocation of s6-linux-init-maker
will create proper wrappers for all those commands, named after their
short SysV names; the wrappers are directly usable as turnkey replacements
for SysV commands.
- Other binaries are support binaries, not meant to be called
directly by the user. They are called internally, in scripts
created by a
s6-linux-init-maker invocation -
typically in run scripts for early services.
- A small library, that for now contains a single symbol,
s6_linux_init_logouthook(), intended for distributions using
login programs that add utmp entries for users logging in and
expect init to clean up after them when users log out. See
the s6-linux-init-logouthookd
page for details.
- Skeleton scripts, installed by default in
/etc/s6-linux-init/skel; that location can be changed at build
time via the --skeldir configure option. At
s6-linux-init-maker invocation time, the scripts are copied from the skeleton
directory to the scripts subdirectory of the directory created
by s6-linux-init-maker, and the copy is meant to be edited
by the user. The skeleton scripts are commented and examples of
interaction with various service managers are given; it is recommended
to review them, and possibly edit them too.
These scripts are the following:
- rc.init: the script launching the system initialization
procedure once stage 1 init is done and
s6-svscan is
safely running as pid 1.
- rc.shutdown: the script launching the system shutdown
procedure when the admin runs a halt, poweroff,
reboot or shutdown command.
- runlevel: the script executing a machine state change
at boot time (normally invoked by rc.init, towards the default
runlevel) or when the administrator runs a telinit command.
This script is unused in a container.
- rc.shutdown.final: a script that will be run at the
very end of the shutdown procedure, after all processes have been killed
and all filesystems have been unmounted, just before the system
is rebooted or the power turned off. This script normally remains empty.
Organisation of the booted system
When a system has booted on an /sbin/init program created by
s6-linux-init-maker, the following
invariants are met:
- Global resource limits, if any, are set on the system.
- A tmpfs is mounted on /run - that location can be changed
at build-time via the --tmpfsdir option to configure. The rest
of this document assumes it is /run.
- s6-svscan is
running as pid 1 on the /run/service scandir.
- Every process on the system is running with at least the environment
defined in the /etc/s6-linux-init/current/env envdir. The
/etc/s6-linux-init/current location can be changed at
s6-linux-init-maker invocation time
via the -c option.
- Some early services are defined in /run/service, and running.
They are not seen by the service manager and should remain up all the time,
until the machine shuts down: they are considered a part of the init system,
even if they're not process 1.
Apart from s6-linux-init-shutdownd, which is necessary for the
machine (or container) to respond to shutdown requests, they are only present
depending on the configuration, and different
s6-linux-init-maker invocations will
yield different sets of services. The services are picked from this list:
- s6-linux-init-shutdownd: the shutdown manager, running
the shutdown sequence in a reproducible environment when a shutdown command
is executed, then performing the last shutdown steps.
- s6-svscan-log: the catch-all logger
- s6-linux-init-runleveld: the runlevel manager, running
the runlevel script in a reproducible environment when a telinit
command is executed.
- s6-linux-init-logouthookd: a local service performing
utmp record cleanup duty for patched login programs.
- s6-linux-init-early-getty: the early getty,
allowing the user to login even if rc.init fails early.
- utmpd: a service performing
utmp access when utmps is
used.
Integration with the service manager
The s6-linux-init package's duties stop where the service manager's start.
s6-linux-init simply brings the system up to the point where it is stable and
operational enough for the service manager to take over; and at shutdown
time, s6-linux-init just tells the service manager to bring down the services,
and then performs the last steps of the shutdown: killing all the remaining
processes, unmounting the file systems and halting/powering off/rebooting
the machine.
All the interactions between s6-linux-init and the service manager are
configurable: they happen in the rc.init, rc.shutdown
and runlevel scripts. Examples are provided in the skeleton
scripts, that you should review and edit.


|
QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.30
|
#include <ql/methods/finitedifferences/utilities/fdmhestongreensfct.hpp>
Public Types | |
| enum | Algorithm { ZeroCorrelation , Gaussian , SemiAnalytical } |
Public Member Functions | |
| FdmHestonGreensFct (ext::shared_ptr< FdmMesher > mesher, ext::shared_ptr< HestonProcess > process, FdmSquareRootFwdOp::TransformationType trafoType_, Real l0=1.0) | |
| Array | get (Time t, Algorithm algorithm) const |
Private Attributes | |
| const Real | l0_ |
| const ext::shared_ptr< FdmMesher > | mesher_ |
| const ext::shared_ptr< HestonProcess > | process_ |
| const FdmSquareRootFwdOp::TransformationType | trafoType_ |
Definition at line 32 of file fdmhestongreensfct.hpp.
| enum Algorithm |
| Enumerator | |
|---|---|
| ZeroCorrelation | |
| Gaussian | |
| SemiAnalytical |
Definition at line 34 of file fdmhestongreensfct.hpp.
| FdmHestonGreensFct | ( | ext::shared_ptr< FdmMesher > | mesher, |
| ext::shared_ptr< HestonProcess > | process, | ||
| FdmSquareRootFwdOp::TransformationType | trafoType_, | ||
| Real | l0 = 1.0 |
||
| ) |
Definition at line 35 of file fdmhestongreensfct.cpp.
Definition at line 41 of file fdmhestongreensfct.cpp.
|
private |
Definition at line 44 of file fdmhestongreensfct.hpp.
|
private |
Definition at line 45 of file fdmhestongreensfct.hpp.
|
private |
Definition at line 46 of file fdmhestongreensfct.hpp.
|
private |
Definition at line 47 of file fdmhestongreensfct.hpp.


This package provides support for services that are implemented as an RPC (Remote Procedure Call). PVAccess provideds two flavors of RPC: putProcessGet and channelRPC.
If the service is accessed via a putProcessGet the record that implements the RPC has the structure
record serviceName // may be optional fields structure arguments // sevice specific structure result // service specific
If the service is accessed via a channelRPC the record that implements the RPC has the structure:
record serviceName // may be optional fields structure arguments // sevice specific
The main difference between the two types of service is that for a putProcessGet the structure of the result is fixed and for a channelRPC a completely new structure is returned for each request.
This package provides support for channelRPC: It provides client and server support for implementing a network accessable service that uses PVData for all data communication between a client and the service. The service is implemented via a PVRecord that is present in a javaIOC. The client communicates with the server via a ChannelRPC (Remote Procedure Call) as defined by pvAccess.
The record name is the name of the service. The record has the following fields:
This package provides:
A sevice implementation must implement the following interfaces, which are described in detail below.
interface RPCServer { void destroy() Status initialize(...); void request() }
interface ServiceClientRequester extends Requester{ void connectResult(...); void requestResult(...); }
The rest of this document describes the following:
The client is implemented via the following interfaces and factory:
interface ServiceClientRequester extends Requester{ void connectResult(Status status,PVStructure pvArguments,BitSet bitSet); void requestResult(Status status,PVStructure pvResult); } interface ServiceClient { void destroy(); void waitConnect(double timeout); void sendRequest(); void waitRequest(); } class ServiceClientFactory { public static ServiceClient create(String serviceName,ServiceClientRequester requester); }
ServiceClientRequester, which must be implemented by each client, has the following methods:
ServiceClient is created by ServiceClientFactory. It has the methods:
ServiceClientFactory, which is also implemented by this project, has the following method:
The service is implemented via the following interfaces and factory:
//RPCServer defined in org.epics.ca.server.impl.local public interface RPCServer { void destroy(); Status initialize( Channel channel, PVRecord pvRecord, ChannelRPCRequester channelRPCRequester, PVStructure pvArgument, BitSet bitSet, PVStructure pvRequest); void request(); } class XXXServiceFactory { public static RPCServer create(); }
RPCService, which is implemented by each service, has the following methods:
Called when a client disconnects from the ChannelRPC.
channelRPCRequester.requestDone(okStatus, pvTop);where pvTop is the newly created pvStructure.
Also the service must implement a XXXServiceFactory, which is specified in the record.factory field of the PVRecord. It has the following method:
The project provides examples in package (org.epics.pvService.example). This section describes ExampleClient and ExampleServiceFactory, which are the client and server sides of the example. The example is skeleton code for a service that, given a search string, returns a set of pvnames. Each pvName can have associated properties. The example ignores the search request. Instead it just makes up two pvnames (pvName0 and pvName1) and makes up some properties for each pvname.
The example package has a file pvService.zip that runs the example. To run the example do the following:
./serviceExample
./clientExample
./clientTable
In the window where clientExample is run you should see:
structure { 0 = structure { name = pvName0 properties = structure { a = structure { value = avalue owner = aowner } b = structure { value = bvalue owner = bowner } } } 1 = structure { name = pvName1 properties = structure { a = structure { value = avalue owner = aowner } b = structure { value = bvalue owner = bowner } } } } all done
In the window where clientTable is run you should see:
mrk> ./clientTable structure table int nrows 2 structure columns string[] name [name0,name1] double[] value [10.0000,20.0000] structure[] timeStamp structure timeStamp long secondsPastEpoch 946702800 int nanoseconds 582000000 structure timeStamp long secondsPastEpoch 946702801 int nanoseconds 582000000 timeStamp[] [ 2000-01-01 00:00:00.582, 2000-01-01 00:00:01.582] structure table int nrows 5 structure columns string[] name [name0,name1,name2,name3,name4] double[] value [10.0000,20.0000,30.0000,40.0000,50.0000] structure[] timeStamp structure timeStamp long secondsPastEpoch 946702800 int nanoseconds 582000000 structure timeStamp long secondsPastEpoch 946702801 int nanoseconds 582000000 structure timeStamp long secondsPastEpoch 946702802 int nanoseconds 582000000 structure timeStamp long secondsPastEpoch 946702803 int nanoseconds 582000000 structure timeStamp long secondsPastEpoch 946702804 int nanoseconds 582000000 timeStamp[] [ 2000-01-01 00:00:00.582, 2000-01-01 00:00:01.582, 2000-01-01 00:00:02.582, 2000-01-01 00:00:03.582, 2000-01-01 00:00:04.582] all done
The xml file that implements the example service is:
<database> <record recordName = "exampleService" extends = "org.epics.pvService.service"> <scalar name = "factoryRPC">org.epics.pvService.example.ExampleServiceFactory</scalar> <structure name = "arguments"> <scalar name = "search" scalarType = "string" /> </structure> </record> <record recordName = "tableService" extends = "org.epics.pvService.service"> <scalar name = "factoryRPC">org.epics.pvService.example.TableServiceFactory</scalar> <structure name = "arguments"> <scalar name = "search" scalarType = "string" /> <scalar name = "number" scalarType = "int" /> </structure> </record> </database>
This creates two records.
Note that both records are created by extending org.epics.pvService.service. This is defined in pvService.xml.structure.service.xml:
<structure structureName = "service"> <scalar name = "factoryRPC" scalarType = "string" /> <structure name = "arguments" /> </structure>


Hi, this is Alfarhan Zahedi.
Interesting name, right? All thanks to my grandfather!
As far as I know, "Alfarhan" is an Arabic word which loosely translates to
"happiness".
I always try to keep up with my name!
Now, coming to the important stuff.
I am a full-stack developer. Vue.js + Django + MySQL is my forte. But, I have tried most of
the languages and frameworks out there. Curiosity, you know!
I graduated last year with a shining degree in Computer Science and Engineering.
As of now, I am working as a Software Dev Engineer at . Before that, I interned at CodeChef in their Software Engineering team.
I am hard-working and scrupulous with a get-it-done attitude. This compensates for my lack
of
experience.
So, yeah, you can count on me!
I do have some personal projects on GitHub. And, I write too. Well, very infrequently, and only about Django(as of now!).
Also, I prefer tabs to spaces, tea to coffee, and HIMYM to Friends.
You can call me a cinephile.
My favorite words include "relative" and "perspective".
I love, love, lurrrrve history.
And... umm, I think that's all about me.


All times are UTC/GMT.
Downloads linked from any page are not moderated by the site owners and may contain
harmful materials. Only you are responsible for any damage caused by these.
Images (screenshots) hosted on other sites are not moderated by the site owners
and may contain illegal or obnoxious materials.
Impressum


{% extends 'base.html' %} {% load static from staticfiles %} {% block page_title %} Do Life Yourself - the Lifestyle Blog {% endblock %} {% block content %}
ABOUT
BLOG
MEMBER'S HOME
LOG OUT
REGISTER
LOG IN


Write here all your
thoughts
.
here you can
write
here and don't lose your
thoughts
.
here you can
write
, bookmark, edit or even delete that thought of yours.


What should our test cases be?
def palindrome?(word)
word == word.reverse
end
require 'minitest/autorun'
class TestPalindrome < Minitest::Test
def test_palindrome
assert_true palindrome? ''
assert_true palindrome? 'c'
assert_false palindrome? 'car'
assert_true palindrome? 'racecar'
assert_false palindrome? nil
end
end
$ ruby test_palindrome.rb
Run options: --seed 65310
# Running:
E
Finished in 0.001653s, 604.7796 runs/s, 2419.1183 assertions/s.
1) Error:
TestPalindrome#test_palindrome:
NoMethodError: undefined method `reverse' for nil:NilClass
/Users/nick/testing-talk/palindrome.rb:2:in `palindrome?'
test_palindrome.rb:10:in `test_palindrome'
1 runs, 4 assertions, 0 failures, 1 errors, 0 skips
describe 'palindrome?' do
context 'given an empty string' do
it 'returns true' do
expect(palindrome? '').to be true
end
end
context 'given a string with only one character' do
it 'returns true' do
expect(palindrome? 'c').to be true
end
end
context 'given a longer non-palindrome' do
it 'returns true' do
expect(palindrome? 'car').to be false
end
end
context 'given a longer palindrome' do
it 'returns true' do
expect(palindrome? 'racecar').to be true
end
end
context 'given a null value' do
it 'returns false' do
expect(palindrome? nil).to be false
end
end
end
"Fake" objects that replace the real implementations of code
The process of writing test code before implementation code.
Similar to test driven development, but involving more process and abstraction. Tests (usually acceptance tests) are written to verify specific user stories as they are implemented.
Test frameworks that focus on heirarchal specifications (like RSpec) or executable user stories (like Cucumber) are designed for and frequently used for BDD.


[Add new User]
{{end}}
{{define "script" }}
{{end}}
{{partial "user/_list.html" .}}
{{set . "title" "Demo - User Index" }} {{import "_layout.html" }} {{define "head" }}{{end}} {{define "body" }}
How to use ViewEngine & template, How to route by regexp
source code:/demo/basic/views/user ; /demo/basic/controller/user.go


We're sorry but main doesn't work properly without JavaScript enabled. Please enable it to continue.


This lists all the parameters in logical order. The individual pages provide
detailed information about each one, including:
|
{Common_link_program Link program} |
{Common_keyboard_split Keyboard split} |
|
{Common_link_mode Link mode} |
{Common_edit_mode Edit mode} |
|
{Common_link_balance Link balance} |
{Common_edit_number Edit number} |
|
{Common_link_spread Link spread} |
{Common_sequence_program Sequence program} |
|
{Common_link_detune Link detune} |
{Common_footswitch_mode Footswitch mode} |
|
{Common_main_transpose Main transpose} |
{Common_ribbon_algorithm Ribbon algorithm} |
|
{Common_link_transpose Link transpose} |
{Common_keyboard_algorithm Keyboard algorithm} |
|
{Control_patch Patch} |
{Control_treble_gain Treble gain} |
|
{Control_detune Detune} |
{Control_treble_frequency Treble frequency} |
|
{Control_detune_scale Detune scale} |
{Control_middle_gain Middle gain} |
|
{Control_tune_shift Tune shift} |
{Control_middle_frequency Middle frequency} |
|
{Control_voice_count Voice count} |
{Control_middle_resonance Middle resonance} |
|
{Control_tune_spread Tune spread} |
{Control_bass_gain Bass gain} |
|
{Control_pan_spread Pan spread} |
{Control_bass_frequency Bass frequency} |
|
{Control_lever_modes Lever modes} |
{Control_distortion Distortion} |
|
{Control_pedal_modes Pedal modes} |
{Control_reverb_room Reverb room} |
|
{Control_ribbon_mode Ribbon mode} |
{Control_reverb_send Reverb send} |
|
{Envelope_trigger Trigger} |
{Envelope_decay_time Decay time} |
|
{Envelope_peak_mod_select Peak mod select} |
{Envelope_decay_self_mod Decay self mod} |
|
{Envelope_peak_mod_depth Peak mod depth} |
{Envelope_decay_mod_select Decay mod select} |
|
{Envelope_attack_time Attack time} |
{Envelope_decay_mod_depth Decay mod depth} |
|
{Envelope_attack_conservation Attack conservation} |
{Envelope_release_time Release time} |
|
{Envelope_attack_mod_select Attack mod select} |
{Envelope_release_mod_select Release mod} |
|
{Envelope_attack_mod_depth Attack mod depth} |


LEWIS
Enter AUSTRIA and forces, drums, etc. on one side:
on the other KING PHILIP and his power; LEWIS,
ARTHUR, CONSTANCE and attendants
Before Angiers well met, brave Austria.
Arthur, that great forerunner of thy blood,
Richard, that robb'd the lion of his heart
And fought the holy wars in Palestine,
By this brave duke came early to his grave:
And for amends to his posterity,
At our importance hither is he come,
To spread his colours, boy, in thy behalf,
And to rebuke the usurpation
Of thy unnatural uncle, English John:
Embrace him, love him, give him welcome hither.

LEWIS
A noble boy! Who would not do thee right?
AUSTRIA
Upon thy cheek lay I this zealous kiss,
As seal to this indenture of my love,
That to my home I will no more return,
Till Angiers and the right thou hast in France,
Together with that pale, that white-faced shore,
Whose foot spurns back the ocean's roaring tides
And coops from other lands her islanders,
Even till that England, hedged in with the main,
That water-walled bulwark, still secure
And confident from foreign purposes,
Even till that utmost corner of the west
Salute thee for her king: till then, fair boy,
Will I not think of home, but follow arms.
CONSTANCE
O, take his mother's thanks, a widow's thanks,
Till your strong hand shall help to give him strength
To make a more requital to your love!
AUSTRIA
The peace of heaven is theirs that lift their swords
In such a just and charitable war.
KING PHILIP
Well then, to work: our cannon shall be bent
Against the brows of this resisting town.
Call for our chiefest men of discipline,
To cull the plots of best advantages:
We'll lay before this town our royal bones,
Wade to the market-place in Frenchmen's blood,
But we will make it subject to this boy.
CONSTANCE
Stay for an answer to your embassy,
Lest unadvised you stain your swords with blood:
My Lord Chatillon may from England bring,
That right in peace which here we urge in war,
And then we shall repent each drop of blood
That hot rash haste so indirectly shed.
[Enter CHATILLON]
KING PHILIP
A wonder, lady! lo, upon thy wish,
Our messenger Chatillon is arrived!
What England says, say briefly, gentle lord;
We coldly pause for thee; Chatillon, speak.
CHATILLON
Then turn your forces from this paltry siege
And stir them up against a mightier task.
England, impatient of your just demands,
Hath put himself in arms: the adverse winds,
Whose leisure I have stay'd, have given him time
To land his legions all as soon as I;
His marches are expedient to this town,
His forces strong, his soldiers confident.
With him along is come the mother-queen,
An Ate, stirring him to blood and strife;
With her her niece, the Lady Blanch of Spain;
With them a bastard of the king's deceased,
And all the unsettled humours of the land,
Rash, inconsiderate, fiery voluntaries,
With ladies' faces and fierce dragons' spleens,
Have sold their fortunes at their native homes,
Bearing their birthrights proudly on their backs,
To make hazard of new fortunes here:
In brief, a braver choice of dauntless spirits
Than now the English bottoms have waft o'er
Did nearer float upon the swelling tide,
To do offence and scath in Christendom.
[Drum beats]
The interruption of their churlish drums
Cuts off more circumstance: they are at hand,
To parley or to fight; therefore prepare.
KING PHILIP
How much unlook'd for is this expedition!
AUSTRIA
By how much unexpected, by so much
We must awake endavour for defence;
For courage mounteth with occasion:
Let them be welcome then: we are prepared.
Enter KING JOHN, QUEEN ELINOR, BLANCH, the BASTARD,
Lords, and forces
KING JOHN
Peace be to France, if France in peace permit
Our just and lineal entrance to our own;
If not, bleed France, and peace ascend to heaven,
Whiles we, God's wrathful agent, do correct
Their proud contempt that beats His peace to heaven.
KING PHILIP
Peace be to England, if that war return
From France to England, there to live in peace.
England we love; and for that England's sake
With burden of our armour here we sweat.
This toil of ours should be a work of thine;
But thou from loving England art so far,
That thou hast under-wrought his lawful king
Cut off the sequence of posterity,
Out-faced infant state and done a rape
Upon the maiden virtue of the crown.
Look here upon thy brother Geffrey's face;
These eyes, these brows, were moulded out of his:
This little abstract doth contain that large
Which died in Geffrey, and the hand of time
Shall draw this brief into as huge a volume.
That Geffrey was thy elder brother born,
And this his son; England was Geffrey's right
And this is Geffrey's: in the name of God
How comes it then that thou art call'd a king,
When living blood doth in these temples beat,
Which owe the crown that thou o'ermasterest?
KING JOHN
From whom hast thou this great commission, France,
To draw my answer from thy articles?
KING PHILIP
From that supernal judge, that stirs good thoughts
In any breast of strong authority,
To look into the blots and stains of right:
That judge hath made me guardian to this boy:
Under whose warrant I impeach thy wrong
And by whose help I mean to chastise it.
KING JOHN
Alack, thou dost usurp authority.
KING PHILIP
Excuse; it is to beat usurping down.
QUEEN ELINOR
Who is it thou dost call usurper, France?
CONSTANCE
Let me make answer; thy usurping son.

CONSTANCE
My bed was ever to thy son as true
As thine was to thy husband; and this boy
Liker in feature to his father Geffrey
Than thou and John in manners; being as like
As rain to water, or devil to his dam.
My boy a bastard! By my soul, I think
His father never was so true begot:
It cannot be, an if thou wert his mother.
QUEEN ELINOR
There's a good mother, boy, that blots thy father.
CONSTANCE
There's a good grandam, boy, that would blot thee.
AUSTRIA
What the devil art thou?

BLANCH
O, well did he become that lion's robe
That did disrobe the lion of that robe!
BASTARD
It lies as sightly on the back of him
As great Alcides' shows upon an ass:
But, ass, I'll take that burthen from your back,
Or lay on that shall make your shoulders crack.
AUSTRIA
What craker is this same that deafs our ears
With this abundance of superfluous breath?
KING PHILIP
Lewis, determine what we shall do straight.
LEWIS
Women and fools, break off your conference.
King John, this is the very sum of all;
England and Ireland, Anjou, Touraine, Maine,
In right of Arthur do I claim of thee:
Wilt thou resign them and lay down thy arms?
KING JOHN
My life as soon: I do defy thee, France.
Arthur of Bretagne, yield thee to my hand;
And out of my dear love I'll give thee more
Than e'er the coward hand of France can win:
Submit thee, boy.
QUEEN ELINOR
Come to thy grandam, child.
CONSTANCE
Do, child, go to it grandam, child:
Give grandam kingdom, and it grandam will
Give it a plum, a cherry, and a fig:
There's a good grandam.
ARTHUR
Good my mother, peace!
I would that I were low laid in my grave:
I am not worth this coil that's made for me.

His grandam's wrongs, and not his mother's shames,
Draws those heaven-moving pearls from his poor eyes,
Which heaven shall take in nature of a fee;
Ay, with these crystal beads heaven shall be bribed
To do him justice and revenge on you.
QUEEN ELINOR
Thou monstrous slanderer of heaven and earth!
CONSTANCE
Thou monstrous injurer of heaven and earth!
Call not me slanderer; thou and thine usurp
The dominations, royalties and rights
Of this oppressed boy: this is thy eld'st son's son,
Infortunate in nothing but in thee:
Thy sins are visited in this poor child;
The canon of the law is laid on him,
Being but the second generation
Removed from thy sin-conceiving womb.
KING JOHN
Bedlam, have done.
CONSTANCE
I have but this to say,
That he is not only plagued for her sin,
But God hath made her sin and her the plague
On this removed issue, plague for her
And with her plague; her sin his injury,
Her injury the beadle to her sin,
All punish'd in the person of this child,
And all for her; a plague upon her!
QUEEN ELINOR
Thou unadvised scold, I can produce
A will that bars the title of thy son.

KING PHILIP
Peace, lady! pause, or be more temperate:
It ill beseems this presence to cry aim
To these ill-tuned repetitions.
Some trumpet summon hither to the walls
These men of Angiers: let us hear them speak
Whose title they admit, Arthur's or John's.
[Trumpet sounds. Enter certain Citizens upon the walls]
First Citizen
Who is it that hath warn'd us to the walls?
KING PHILIP
'Tis France, for England.
KING JOHN
England, for itself.
You men of Angiers, and my loving subjects--
KING PHILIP
You loving men of Angiers, Arthur's subjects,
Our trumpet call'd you to this gentle parle--
KING JOHN
For our advantage; therefore hear us first.

But on the sight of us your lawful king,
Who painfully with much expedient march
Have brought a countercheque before your gates,
To save unscratch'd your city's threatened cheeks,
Behold, the French amazed vouchsafe a parle;
And now, instead of bullets wrapp'd in fire,
To make a shaking fever in your walls,
They shoot but calm words folded up in smoke,
To make a faithless error in your ears:
Which trust accordingly, kind citizens,
And let us in, your king, whose labour'd spirits,
Forwearied in this action of swift speed,
Crave harbourage within your city walls.
KING PHILIP
When I have said, make answer to us both.
Lo, in this right hand, whose protection
Is most divinely vow'd upon the right
Of him it holds, stands young Plantagenet,
Son to the elder brother of this man,
And king o'er him and all that he enjoys:
For this down-trodden equity, we tread
In warlike march these greens before your town,
Being no further enemy to you
Than the constraint of hospitable zeal
In the relief of this oppressed child
Religiously provokes. Be pleased then
To pay that duty which you truly owe
To that owes it, namely this young prince:
And then our arms, like to a muzzled bear,
Save in aspect, hath all offence seal'd up;
Our cannons' malice vainly shall be spent
Against the invulnerable clouds of heaven;
And with a blessed and unvex'd retire,
With unhack'd swords and helmets all unbruised,
We will bear home that lusty blood again
Which here we came to spout against your town,
And leave your children, wives and you in peace.
But if you fondly pass our proffer'd offer,
'Tis not the roundure of your old-faced walls
Can hide you from our messengers of war,
Though all these English and their discipline
Were harbour'd in their rude circumference.
Then tell us, shall your city call us lord,
In that behalf which we have challenged it?
Or shall we give the signal to our rage
And stalk in blood to our possession?
First Citizen
In brief, we are the king of England's subjects:
For him, and in his right, we hold this town.
KING JOHN
Acknowledge then the king, and let me in.
First Citizen
That can we not; but he that proves the king,
To him will we prove loyal: till that time
Have we ramm'd up our gates against the world.
KING JOHN
Doth not the crown of England prove the king?
And if not that, I bring you witnesses,
Twice fifteen thousand hearts of England's breed,--
BASTARD
Bastards, and else.
KING JOHN
To verify our title with their lives.
KING PHILIP
As many and as well-born bloods as those,--
BASTARD
Some bastards too.
KING PHILIP
Stand in his face to contradict his claim.
First Citizen
Till you compound whose right is worthiest,
We for the worthiest hold the right from both.
KING JOHN
Then God forgive the sin of all those souls
That to their everlasting residence,
Before the dew of evening fall, shall fleet,
In dreadful trial of our kingdom's king!
KING PHILIP
Amen, amen! Mount, chevaliers! to arms!
BASTARD
Saint George, that swinged the dragon, and e'er since
Sits on his horseback at mine hostess' door,
Teach us some fence!
[To AUSTRIA]
Sirrah, were I at home,
At your den, sirrah, with your lioness
I would set an ox-head to your lion's hide,
And make a monster of you.

KING JOHN
Up higher to the plain; where we'll set forth
In best appointment all our regiments.
BASTARD
Speed then, to take advantage of the field.
KING PHILIP
It shall be so; and at the other hill
Command the rest to stand. God and our right!
[Exeunt]
Here after excursions, enter the Herald of France,
with trumpets, to the gates
French Herald
You men of Angiers, open wide your gates,
And let young Arthur, Duke of Bretagne, in,
Who by the hand of France this day hath made
Much work for tears in many an English mother,
Whose sons lie scattered on the bleeding ground;
Many a widow's husband grovelling lies,
Coldly embracing the discolour'd earth;
And victory, with little loss, doth play
Upon the dancing banners of the French,
Who are at hand, triumphantly display'd,
To enter conquerors and to proclaim
Arthur of Bretagne England's king and yours.
[Enter English Herald, with trumpet]
English Herald
Rejoice, you men of Angiers, ring your bells:
King John, your king and England's doth approach,
Commander of this hot malicious day:
Their armours, that march'd hence so silver-bright,
Hither return all gilt with Frenchmen's blood;
There stuck no plume in any English crest
That is removed by a staff of France;
Our colours do return in those same hands
That did display them when we first march'd forth;
And, like a troop of jolly huntsmen, come
Our lusty English, all with purpled hands,
Dyed in the dying slaughter of their foes:
Open your gates and gives the victors way.
First Citizen
Heralds, from off our towers we might behold,
From first to last, the onset and retire
Of both your armies; whose equality
By our best eyes cannot be censured:
Blood hath bought blood and blows have answered blows;
Strength match'd with strength, and power confronted power:
Both are alike; and both alike we like.
One must prove greatest: while they weigh so even,
We hold our town for neither, yet for both.
Re-enter KING JOHN and KING PHILIP, with their
powers, severally
KING JOHN
France, hast thou yet more blood to cast away?
Say, shall the current of our right run on?
Whose passage, vex'd with thy impediment,
Shall leave his native channel and o'erswell
With course disturb'd even thy confining shores,
Unless thou let his silver water keep
A peaceful progress to the ocean.
KING PHILIP
England, thou hast not saved one drop of blood,
In this hot trial, more than we of France;
Rather, lost more. And by this hand I swear,
That sways the earth this climate overlooks,
Before we will lay down our just-borne arms,
We'll put thee down, 'gainst whom these arms we bear,
Or add a royal number to the dead,
Gracing the scroll that tells of this war's loss
With slaughter coupled to the name of kings.
BASTARD
Ha, majesty! how high thy glory towers,
When the rich blood of kings is set on fire!
O, now doth Death line his dead chaps with steel;
The swords of soldiers are his teeth, his fangs;
And now he feasts, mousing the flesh of men,
In undetermined differences of kings.
Why stand these royal fronts amazed thus?
Cry, 'havoc!' kings; back to the stained field,
You equal potents, fiery kindled spirits!
Then let confusion of one part confirm
The other's peace: till then, blows, blood and death!
KING JOHN
Whose party do the townsmen yet admit?
KING PHILIP
Speak, citizens, for England; who's your king?
First Citizen
The king of England; when we know the king.
KING PHILIP
Know him in us, that here hold up his right.
KING JOHN
In us, that are our own great deputy
And bear possession of our person here,
Lord of our presence, Angiers, and of you.
First Citizen
A greater power then we denies all this;
And till it be undoubted, we do lock
Our former scruple in our strong-barr'd gates;
King'd of our fears, until our fears, resolved,
Be by some certain king purged and deposed.

Your royal presences be ruled by me:
Do like the mutines of Jerusalem,
Be friends awhile and both conjointly bend
Your sharpest deeds of malice on this town:
By east and west let France and England mount
Their battering cannon charged to the mouths,
Till their soul-fearing clamours have brawl'd down
The flinty ribs of this contemptuous city:
I'ld play incessantly upon these jades,
Even till unfenced desolation
Leave them as naked as the vulgar air.

Smacks it not something of the policy?
KING JOHN
Now, by the sky that hangs above our heads,
I like it well. France, shall we knit our powers
And lay this Angiers even to the ground;
Then after fight who shall be king of it?
BASTARD
An if thou hast the mettle of a king,
Being wronged as we are by this peevish town,
Turn thou the mouth of thy artillery,
As we will ours, against these saucy walls;
And when that we have dash'd them to the ground,
Why then defy each other and pell-mell
Make work upon ourselves, for heaven or hell.
KING PHILIP
Let it be so. Say, where will you assault?
KING JOHN
We from the west will send destruction
Into this city's bosom.
AUSTRIA
I from the north.
KING PHILIP
Our thunder from the south
Shall rain their drift of bullets on this town.
BASTARD
O prudent discipline! From north to south:
Austria and France shoot in each other's mouth:
I'll stir them to it. Come, away, away!
First Citizen
Hear us, great kings: vouchsafe awhile to stay,
And I shall show you peace and fair-faced league;
Win you this city without stroke or wound;
Rescue those breathing lives to die in beds,
That here come sacrifices for the field:
Persever not, but hear me, mighty kings.
KING JOHN
Speak on with favour; we are bent to hear.
First Citizen
That daughter there of Spain, the Lady Blanch,
Is niece to England: look upon the years
Of Lewis the Dauphin and that lovely maid:
If lusty love should go in quest of beauty,
Where should he find it fairer than in Blanch?
If zealous love should go in search of virtue,
Where should he find it purer than in Blanch?
If love ambitious sought a match of birth,
Whose veins bound richer blood than Lady Blanch?
Such as she is, in beauty, virtue, birth,
Is the young Dauphin every way complete:
If not complete of, say he is not she;
And she again wants nothing, to name want,
If want it be not that she is not he:
He is the half part of a blessed man,
Left to be finished by such as she;
And she a fair divided excellence,
Whose fulness of perfection lies in him.
O, two such silver currents, when they join,
Do glorify the banks that bound them in;
And two such shores to two such streams made one,
Two such controlling bounds shall you be, kings,
To these two princes, if you marry them.
This union shall do more than battery can
To our fast-closed gates; for at this match,
With swifter spleen than powder can enforce,
The mouth of passage shall we fling wide ope,
And give you entrance: but without this match,
The sea enraged is not half so deaf,
Lions more confident, mountains and rocks
More free from motion, no, not Death himself
In moral fury half so peremptory,
As we to keep this city.
 Here's a large mouth, indeed,
That spits forth death and mountains, rocks and seas,
Talks as familiarly of roaring lions
As maids of thirteen do of puppy-dogs!
What cannoneer begot this lusty blood?
He speaks plain cannon fire, and smoke and bounce;
He gives the bastinado with his tongue:
Our ears are cudgell'd; not a word of his
But buffets better than a fist of France:
Zounds! I was never so bethump'd with words
Since I first call'd my brother's father dad.
QUEEN ELINOR
Son, list to this conjunction, make this match;
Give with our niece a dowry large enough:
For by this knot thou shalt so surely tie
Thy now unsured assurance to the crown,
That yon green boy shall have no sun to ripe
The bloom that promiseth a mighty fruit.
I see a yielding in the looks of France;
Mark, how they whisper: urge them while their souls
Are capable of this ambition,
Lest zeal, now melted by the windy breath
Of soft petitions, pity and remorse,
Cool and congeal again to what it was.
First Citizen
Why answer not the double majesties
This friendly treaty of our threaten'd town?
KING PHILIP
Speak England first, that hath been forward first
To speak unto this city: what say you?
KING JOHN
If that the Dauphin there, thy princely son,
Can in this book of beauty read 'I love,'
Her dowry shall weigh equal with a queen:
For Anjou and fair Touraine, Maine, Poictiers,
And all that we upon this side the sea,
Except this city now by us besieged,
Find liable to our crown and dignity,
Shall gild her bridal bed and make her rich
In titles, honours and promotions,
As she in beauty, education, blood,
Holds hand with any princess of the world.
KING PHILIP
What say'st thou, boy? look in the lady's face.
LEWIS
I do, my lord; and in her eye I find
A wonder, or a wondrous miracle,
The shadow of myself form'd in her eye:
Which being but the shadow of your son,
Becomes a sun and makes your son a shadow:
I do protest I never loved myself
Till now infixed I beheld myself
Drawn in the flattering table of her eye.
[Whispers with BLANCH]
BASTARD
Drawn in the flattering table of her eye!
Hang'd in the frowning wrinkle of her brow!
And quarter'd in her heart! he doth espy
Himself love's traitor: this is pity now,
That hang'd and drawn and quartered, there should be
In such a love so vile a lout as he.
BLANCH
My uncle's will in this respect is mine:
If he see aught in you that makes him like,
That any thing he sees, which moves his liking,
I can with ease translate it to my will;
Or if you will, to speak more properly,
I will enforce it easily to my love.
Further I will not flatter you, my lord,
That all I see in you is worthy love,
Than this; that nothing do I see in you,
Though churlish thoughts themselves should be your judge,
That I can find should merit any hate.
KING JOHN
What say these young ones? What say you my niece?
BLANCH
That she is bound in honour still to do
What you in wisdom still vouchsafe to say.
KING JOHN
Speak then, prince Dauphin; can you love this lady?
LEWIS
Nay, ask me if I can refrain from love;
For I do love her most unfeignedly.
KING JOHN
Then do I give Volquessen, Touraine, Maine,
Poictiers and Anjou, these five provinces,
With her to thee; and this addition more,
Full thirty thousand marks of English coin.
Philip of France, if thou be pleased withal,
Command thy son and daughter to join hands.
KING PHILIP
It likes us well; young princes, close your hands.
AUSTRIA
And your lips too; for I am well assured
That I did so when I was first assured.
KING PHILIP
Now, citizens of Angiers, ope your gates,
Let in that amity which you have made;
For at Saint Mary's chapel presently
The rites of marriage shall be solemnized.
Is not the Lady Constance in this troop?
I know she is not, for this match made up
Her presence would have interrupted much:
Where is she and her son? tell me, who knows.
LEWIS
She is sad and passionate at your highness' tent.
KING PHILIP
And, by my faith, this league that we have made
Will give her sadness very little cure.
Brother of England, how may we content
This widow lady? In her right we came;
Which we, God knows, have turn'd another way,
To our own vantage.
KING JOHN
We will heal up all;
For we'll create young Arthur Duke of Bretagne
And Earl of Richmond; and this rich fair town
We make him lord of. Call the Lady Constance;
Some speedy messenger bid her repair
To our solemnity: I trust we shall,
If not fill up the measure of her will,
Yet in some measure satisfy her so
That we shall stop her exclamation.

[Exeunt all but the BASTARD]
BASTARD
Mad world! mad kings! mad composition!
John, to stop Arthur's title in the whole,
Hath willingly departed with a part,
And France, whose armour conscience buckled on,
Whom zeal and charity brought to the field
As God's own soldier, rounded in the ear
With that same purpose-changer, that sly devil,
That broker, that still breaks the pate of faith,
That daily break-vow, he that wins of all,
Of kings, of beggars, old men, young men, maids,
Who, having no external thing to lose
But the word 'maid,' cheats the poor maid of that,
That smooth-faced gentleman, tickling Commodity,
Commodity, the bias of the world,
The world, who of itself is peised well,
Made to run even upon even ground,
Till this advantage, this vile-drawing bias,
This sway of motion, this Commodity,
Makes it take head from all indifferency,
From all direction, purpose, course, intent:
And this same bias, this Commodity,
This bawd, this broker, this all-changing word,
Clapp'd on the outward eye of fickle France,
Hath drawn him from his own determined aid,
From a resolved and honourable war,
To a most base and vile-concluded peace.
And why rail I on this Commodity?
But for because he hath not woo'd me yet:
Not that I have the power to clutch my hand,
When his fair angels would salute my palm;
But for my hand, as unattempted yet,
Like a poor beggar, raileth on the rich.
Well, whiles I am a beggar, I will rail
And say there is no sin but to be rich;
And being rich, my virtue then shall be
To say there is no vice but beggary.
Since kings break faith upon commodity,
Gain, be my lord, for I will worship thee.
[Exit]


| Interface | Description |
|---|---|
| AsyncResult<T> |
Asynchronous result is a multi-thread object that operates as a container
for a result.
|
| CloseableObject | |
| ConnectionMonitor | |
| ConnectionMonitor.ConnectListener |
Connection listener
|
| EndpointServer |
EndpointServer is an object that binds to a network socket and offers
hosting for endpoints.
|
| EndpointServer.EndpointHandle | |
| IConnectionListener | |
| RequestChannel |
RequestChannel is a channel to do service requests with.
|
| ResultListener<T> |
Result listener.
|
| SecureChannel |
Client's SecureChannel connection.
|
| ServerConnection |
UAConnection is a stateful object with four possible states {Closed,
Opening, Open, Closing}.
|
| ServerConnection.SecureChannelListener | |
| ServerSecureChannel |
Server side Secure channel.
|
| Class | Description |
|---|---|
| AsyncRead | |
| AsyncWrite |
Asynchronous message sending
|
| ChannelService |
This is a autogenerated class, do not modify this class directly.
|
| Endpoint |
Endpoint is a connection point to a server.
|
| EndpointBinding |
Endpoint binding is a 3-way binding between
the endpoint address (Endpoint),
the listening socket (EndpointServer),
and the service server (Server).
|
| EndpointServerCollection | |
| ServiceChannel |
This utility class envelopes Securechannel with client service methods.
|
| TransportChannelSettings |
Transport channel settings for Client.
|
| TransportConstants | |
| UriUtil |
| Enum | Description |
|---|---|
| AsyncResult.AsyncResultStatus | |
| ClientServiceRequestState | |
| CloseableObjectState |
Generic object states.
|
| ReadState |
Message async read states.
|
| UriUtil.MessageFormat | |
| WriteState |
Message write states.
|


Click the left button to start cylinder control, click the button in the center to move the mass to the center of the cylinder, click the right button to run the stabilization algorithm.
Move the slider to modify the radius of the circle on which the mass moves, the negative values make the cylinder roll backwards.
Current radius: 0 [mm]
Place the cylinder on a rigid slope and vary the incline. The cylinder should sway and rebalance up to a certain angle.
The mass will be placed in the center of the cylinder and remain there. This allows to make the cylinder a symmetrical rigid body, which signifies it will continue to roll freely, if it already had a speed.


{% extends 'email_detail.html' %} {% block content %}
Are you sure you want to make a copy of this email? {{ email }}
The new email will be saved as a draft so you can edit it.
{% if email.status == 'sent' %}Because the email was sent, all of the contacts which received the email will be copied, unless you press the checkbox below.
{% else %}Because the email is unsent, all of the filters will be duplicated which will match the same set of contacts.
{% endif %}


- After check a child node, all of its parent node will display bold, it is very useful to find all checked nodes when the parent nodes are collapsed.
- Set icon class id of tree node with field value(iconClassField).
- Set icon class id of tree node with customized event(onGetIconClass):


Pig Latin
Original Text
Enter Some Noisy text..
Here Goes Something...
Convert
Pig-Latin Output
Here Comes Nothing
Clear
About Pig-Latin.
What is Pig-Latin ?
Back to Top
Pig-Latin
project is made and maintained by
crypto-navdeep
•
ved-programmer


const std = @import("std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const testing = std.testing;
const os = std.os;
const math = std.math;
pub const epoch = @import("time/epoch.zig");
/// Spurious wakeups are possible and no precision of timing is guaranteed.
pub fn sleep(nanoseconds: u64) void {
// TODO: opting out of async sleeping?
if (std.io.is_async) {
return std.event.Loop.instance.?.sleep(nanoseconds);
}
if (builtin.os.tag == .windows) {
const big_ms_from_ns = nanoseconds / ns_per_ms;
const ms = math.cast(os.windows.DWORD, big_ms_from_ns) orelse math.maxInt(os.windows.DWORD);
os.windows.kernel32.Sleep(ms);
return;
}
if (builtin.os.tag == .wasi) {
const w = std.os.wasi;
const userdata: w.userdata_t = 0x0123_45678;
const clock = w.subscription_clock_t{
.id = w.CLOCK.MONOTONIC,
.timeout = nanoseconds,
.precision = 0,
.flags = 0,
};
const in = w.subscription_t{
.userdata = userdata,
.u = w.subscription_u_t{
.tag = w.EVENTTYPE_CLOCK,
.u = w.subscription_u_u_t{
.clock = clock,
},
},
};
var event: w.event_t = undefined;
var nevents: usize = undefined;
_ = w.poll_oneoff(&in, &event, 1, &nevents);
return;
}
const s = nanoseconds / ns_per_s;
const ns = nanoseconds % ns_per_s;
std.os.nanosleep(s, ns);
}
test "sleep" {
sleep(1);
}
/// Get a calendar timestamp, in seconds, relative to UTC 1970-01-01.
/// Precision of timing depends on the hardware and operating system.
/// The return value is signed because it is possible to have a date that is
/// before the epoch.
/// See `std.os.clock_gettime` for a POSIX timestamp.
pub fn timestamp() i64 {
return @divFloor(milliTimestamp(), ms_per_s);
}
/// Get a calendar timestamp, in milliseconds, relative to UTC 1970-01-01.
/// Precision of timing depends on the hardware and operating system.
/// The return value is signed because it is possible to have a date that is
/// before the epoch.
/// See `std.os.clock_gettime` for a POSIX timestamp.
pub fn milliTimestamp() i64 {
return @intCast(i64, @divFloor(nanoTimestamp(), ns_per_ms));
}
/// Get a calendar timestamp, in nanoseconds, relative to UTC 1970-01-01.
/// Precision of timing depends on the hardware and operating system.
/// On Windows this has a maximum granularity of 100 nanoseconds.
/// The return value is signed because it is possible to have a date that is
/// before the epoch.
/// See `std.os.clock_gettime` for a POSIX timestamp.
pub fn nanoTimestamp() i128 {
if (builtin.os.tag == .windows) {
// FileTime has a granularity of 100 nanoseconds and uses the NTFS/Windows epoch,
// which is 1601-01-01.
const epoch_adj = epoch.windows * (ns_per_s / 100);
var ft: os.windows.FILETIME = undefined;
os.windows.kernel32.GetSystemTimeAsFileTime(&ft);
const ft64 = (@as(u64, ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
return @as(i128, @bitCast(i64, ft64) + epoch_adj) * 100;
}
if (builtin.os.tag == .wasi and !builtin.link_libc) {
var ns: os.wasi.timestamp_t = undefined;
const err = os.wasi.clock_time_get(os.wasi.CLOCK.REALTIME, 1, &ns);
assert(err == .SUCCESS);
return ns;
}
var ts: os.timespec = undefined;
os.clock_gettime(os.CLOCK.REALTIME, &ts) catch |err| switch (err) {
error.UnsupportedClock, error.Unexpected => return 0, // "Precision of timing depends on hardware and OS".
};
return (@as(i128, ts.tv_sec) * ns_per_s) + ts.tv_nsec;
}
test "timestamp" {
const margin = ns_per_ms * 50;
const time_0 = milliTimestamp();
sleep(ns_per_ms);
const time_1 = milliTimestamp();
const interval = time_1 - time_0;
try testing.expect(interval > 0);
// Tests should not depend on timings: skip test if outside margin.
if (!(interval < margin)) return error.SkipZigTest;
}
// Divisions of a nanosecond.
pub const ns_per_us = 1000;
pub const ns_per_ms = 1000 * ns_per_us;
pub const ns_per_s = 1000 * ns_per_ms;
pub const ns_per_min = 60 * ns_per_s;
pub const ns_per_hour = 60 * ns_per_min;
pub const ns_per_day = 24 * ns_per_hour;
pub const ns_per_week = 7 * ns_per_day;
// Divisions of a microsecond.
pub const us_per_ms = 1000;
pub const us_per_s = 1000 * us_per_ms;
pub const us_per_min = 60 * us_per_s;
pub const us_per_hour = 60 * us_per_min;
pub const us_per_day = 24 * us_per_hour;
pub const us_per_week = 7 * us_per_day;
// Divisions of a millisecond.
pub const ms_per_s = 1000;
pub const ms_per_min = 60 * ms_per_s;
pub const ms_per_hour = 60 * ms_per_min;
pub const ms_per_day = 24 * ms_per_hour;
pub const ms_per_week = 7 * ms_per_day;
// Divisions of a second.
pub const s_per_min = 60;
pub const s_per_hour = s_per_min * 60;
pub const s_per_day = s_per_hour * 24;
pub const s_per_week = s_per_day * 7;
/// An Instant represents a timestamp with respect to the currently
/// executing program that ticks during suspend and can be used to
/// record elapsed time unlike `nanoTimestamp`.
///
/// It tries to sample the system's fastest and most precise timer available.
/// It also tries to be monotonic, but this is not a guarantee due to OS/hardware bugs.
/// If you need monotonic readings for elapsed time, consider `Timer` instead.
pub const Instant = struct {
timestamp: if (is_posix) os.timespec else u64,
// true if we should use clock_gettime()
const is_posix = switch (builtin.os.tag) {
.wasi => builtin.link_libc,
.windows => false,
else => true,
};
/// Queries the system for the current moment of time as an Instant.
/// This is not guaranteed to be monotonic or steadily increasing, but for most implementations it is.
/// Returns `error.Unsupported` when a suitable clock is not detected.
pub fn now() error{Unsupported}!Instant {
// QPC on windows doesn't fail on >= XP/2000 and includes time suspended.
if (builtin.os.tag == .windows) {
return Instant{ .timestamp = os.windows.QueryPerformanceCounter() };
}
// On WASI without libc, use clock_time_get directly.
if (builtin.os.tag == .wasi and !builtin.link_libc) {
var ns: os.wasi.timestamp_t = undefined;
const rc = os.wasi.clock_time_get(os.wasi.CLOCK.MONOTONIC, 1, &ns);
if (rc != .SUCCESS) return error.Unsupported;
return Instant{ .timestamp = ns };
}
// On darwin, use UPTIME_RAW instead of MONOTONIC as it ticks while suspended.
// On linux, use BOOTTIME instead of MONOTONIC as it ticks while suspended.
// On freebsd derivatives, use MONOTONIC_FAST as currently there's no precision tradeoff.
// On other posix systems, MONOTONIC is generally the fastest and ticks while suspended.
const clock_id = switch (builtin.os.tag) {
.macos, .ios, .tvos, .watchos => os.CLOCK.UPTIME_RAW,
.freebsd, .dragonfly => os.CLOCK.MONOTONIC_FAST,
.linux => os.CLOCK.BOOTTIME,
else => os.CLOCK.MONOTONIC,
};
var ts: os.timespec = undefined;
os.clock_gettime(clock_id, &ts) catch return error.Unsupported;
return Instant{ .timestamp = ts };
}
/// Quickly compares two instances between each other.
pub fn order(self: Instant, other: Instant) std.math.Order {
// windows and wasi timestamps are in u64 which is easily comparible
if (!is_posix) {
return std.math.order(self.timestamp, other.timestamp);
}
var ord = std.math.order(self.timestamp.tv_sec, other.timestamp.tv_sec);
if (ord == .eq) {
ord = std.math.order(self.timestamp.tv_nsec, other.timestamp.tv_nsec);
}
return ord;
}
/// Returns elapsed time in nanoseconds since the `earlier` Instant.
/// This assumes that the `earlier` Instant represents a moment in time before or equal to `self`.
/// This also assumes that the time that has passed between both Instants fits inside a u64 (~585 yrs).
pub fn since(self: Instant, earlier: Instant) u64 {
if (builtin.os.tag == .windows) {
// We don't need to cache QPF as it's internally just a memory read to KUSER_SHARED_DATA
// (a read-only page of info updated and mapped by the kernel to all processes):
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-kuser_shared_data
// https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/api/ntexapi_x/kuser_shared_data/index.htm
const qpc = self.timestamp - earlier.timestamp;
const qpf = os.windows.QueryPerformanceFrequency();
// 10Mhz (1 qpc tick every 100ns) is a common enough QPF value that we can optimize on it.
// https://github.com/microsoft/STL/blob/785143a0c73f030238ef618890fd4d6ae2b3a3a0/stl/inc/chrono#L694-L701
const common_qpf = 10_000_000;
if (qpf == common_qpf) {
return qpc * (ns_per_s / common_qpf);
}
// Convert to ns using fixed point.
const scale = @as(u64, std.time.ns_per_s << 32) / @intCast(u32, qpf);
const result = (@as(u96, qpc) * scale) >> 32;
return @truncate(u64, result);
}
// WASI timestamps are directly in nanoseconds
if (builtin.os.tag == .wasi and !builtin.link_libc) {
return self.timestamp - earlier.timestamp;
}
// Convert timespec diff to ns
const seconds = @intCast(u64, self.timestamp.tv_sec - earlier.timestamp.tv_sec);
const elapsed = (seconds * ns_per_s) + @intCast(u32, self.timestamp.tv_nsec);
return elapsed - @intCast(u32, earlier.timestamp.tv_nsec);
}
};
/// A monotonic, high performance timer.
///
/// Timer.start() is used to initalize the timer
/// and gives the caller an opportunity to check for the existence of a supported clock.
/// Once a supported clock is discovered,
/// it is assumed that it will be available for the duration of the Timer's use.
///
/// Monotonicity is ensured by saturating on the most previous sample.
/// This means that while timings reported are monotonic,
/// they're not guaranteed to tick at a steady rate as this is up to the underlying system.
pub const Timer = struct {
started: Instant,
previous: Instant,
pub const Error = error{TimerUnsupported};
/// Initialize the timer by querying for a supported clock.
/// Returns `error.TimerUnsupported` when such a clock is unavailable.
/// This should only fail in hostile environments such as linux seccomp misuse.
pub fn start() Error!Timer {
const current = Instant.now() catch return error.TimerUnsupported;
return Timer{ .started = current, .previous = current };
}
/// Reads the timer value since start or the last reset in nanoseconds.
pub fn read(self: *Timer) u64 {
const current = self.sample();
return current.since(self.started);
}
/// Resets the timer value to 0/now.
pub fn reset(self: *Timer) void {
const current = self.sample();
self.started = current;
}
/// Returns the current value of the timer in nanoseconds, then resets it.
pub fn lap(self: *Timer) u64 {
const current = self.sample();
defer self.started = current;
return current.since(self.started);
}
/// Returns an Instant sampled at the callsite that is
/// guaranteed to be monotonic with respect to the timer's starting point.
fn sample(self: *Timer) Instant {
const current = Instant.now() catch unreachable;
if (current.order(self.previous) == .gt) {
self.previous = current;
}
return self.previous;
}
};
test "Timer + Instant" {
const margin = ns_per_ms * 150;
var timer = try Timer.start();
sleep(10 * ns_per_ms);
const time_0 = timer.read();
try testing.expect(time_0 > 0);
// Tests should not depend on timings: skip test if outside margin.
if (!(time_0 < margin)) return error.SkipZigTest;
const time_1 = timer.lap();
try testing.expect(time_1 >= time_0);
timer.reset();
try testing.expect(timer.read() < time_1);
}
test {
_ = epoch;
}