AWS::CodePipeline::Pipeline
The AWS::CodePipeline::Pipeline
resource creates a CodePipeline pipeline
that describes how software changes go through a release process. For more information, see
What Is
CodePipeline? in the AWS CodePipeline User Guide.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::CodePipeline::Pipeline", "Properties" : { "ArtifactStore" :
ArtifactStore
, "ArtifactStores" :[ ArtifactStoreMap, ... ]
, "DisableInboundStageTransitions" :[ StageTransition, ... ]
, "Name" :String
, "RestartExecutionOnUpdate" :Boolean
, "RoleArn" :String
, "Stages" :[ StageDeclaration, ... ]
, "Tags" :[ Tag, ... ]
} }
YAML
Type: AWS::CodePipeline::Pipeline Properties: ArtifactStore:
ArtifactStore
ArtifactStores:- ArtifactStoreMap
DisableInboundStageTransitions:- StageTransition
Name:String
RestartExecutionOnUpdate:Boolean
RoleArn:String
Stages:- StageDeclaration
Tags:- Tag
Properties
ArtifactStore
-
The S3 bucket where artifacts for the pipeline are stored.
Note You must include either
artifactStore
orartifactStores
in your pipeline, but you cannot use both. If you create a cross-region action in your pipeline, you must useartifactStores
.Required: Conditional
Type: ArtifactStore
Update requires: No interruption
ArtifactStores
-
A mapping of
artifactStore
objects and their corresponding AWS Regions. There must be an artifact store for the pipeline Region and for each cross-region action in the pipeline.Note You must include either
artifactStore
orartifactStores
in your pipeline, but you cannot use both. If you create a cross-region action in your pipeline, you must useartifactStores
.Required: Conditional
Type: List of ArtifactStoreMap
Update requires: No interruption
DisableInboundStageTransitions
-
Represents the input of a
DisableStageTransition
action.Required: No
Type: List of StageTransition
Update requires: No interruption
Name
-
The name of the pipeline.
Required: No
Type: String
Minimum:
1
Maximum:
100
Pattern:
[A-Za-z0-9.@\-_]+
Update requires: Replacement
RestartExecutionOnUpdate
-
Indicates whether to rerun the CodePipeline pipeline after you update it.
Required: No
Type: Boolean
Update requires: No interruption
RoleArn
-
The Amazon Resource Name (ARN) for CodePipeline to use to either perform actions with no
actionRoleArn
, or to use to assume roles for actions with anactionRoleArn
.Required: Yes
Type: String
Maximum:
1024
Pattern:
arn:aws(-[\w]+)*:iam::[0-9]{12}:role/.*
Update requires: No interruption
Stages
-
Represents information about a stage and its definition.
Required: Yes
Type: List of StageDeclaration
Update requires: No interruption
Tags
-
Specifies the tags applied to the pipeline.
Required: No
Type: List of Tag
Update requires: No interruption
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the pipeline name, such as
mysta-MyPipeline-A1BCDEFGHIJ2.
For more information about using the Ref
function, see Ref.
Fn::GetAtt
The Fn::GetAtt
intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAtt
intrinsic function, see Fn::GetAtt.
Examples
Pipeline Resource Configuration
The following example creates a pipeline with a source, beta, and release stage. For the source stage, CodePipeline detects changes to the application that is stored in the S3 bucket and pulls them into the pipeline. The beta stage deploys those changes to EC2 instances by using CodeDeploy. For the release stage, inbound transitions are disabled, which enables you to control when the changes are ready to be deployed to release.
JSON
"AppPipeline": { "Type": "AWS::CodePipeline::Pipeline", "Properties": { "RoleArn": { "Ref" : "CodePipelineServiceRole" }, "Stages": [ { "Name": "Source", "Actions": [ { "Name": "SourceAction", "ActionTypeId": { "Category": "Source", "Owner": "AWS", "Version": "1", "Provider": "S3" }, "OutputArtifacts": [ { "Name": "SourceOutput" } ], "Configuration": { "S3Bucket": { "Ref" : "SourceS3Bucket" }, "S3ObjectKey": { "Ref" : "SourceS3ObjectKey" } }, "RunOrder": 1 } ] }, { "Name": "Beta", "Actions": [ { "Name": "BetaAction", "InputArtifacts": [ { "Name": "SourceOutput" } ], "ActionTypeId": { "Category": "Deploy", "Owner": "AWS", "Version": "1", "Provider": "CodeDeploy" }, "Configuration": { "ApplicationName": {"Ref" : "ApplicationName"}, "DeploymentGroupName": {"Ref" : "DeploymentGroupName"} }, "RunOrder": 1 } ] }, { "Name": "Release", "Actions": [ { "Name": "ReleaseAction", "InputArtifacts": [ { "Name": "SourceOutput" } ], "ActionTypeId": { "Category": "Deploy", "Owner": "AWS", "Version": "1", "Provider": "CodeDeploy" }, "Configuration": { "ApplicationName": {"Ref" : "ApplicationName"}, "DeploymentGroupName": {"Ref" : "DeploymentGroupName"} }, "RunOrder": 1 } ] } ], "ArtifactStore": { "Type": "S3", "Location": { "Ref" : "ArtifactStoreS3Location" }, "EncryptionKey": { "Id": "arn:aws:kms:useast-1:ACCOUNT-ID:key/KEY-ID", "Type": "KMS" }, "DisableInboundStageTransitions": [ { "StageName": "Release", "Reason": "Disabling the transition until integration tests are completed" } ], "Tags": [ { "Key": "Project", "Value": "ProjectA" }, { "Key": "IsContainerBased", "Value": "true" } ] } }
YAML
AppPipeline: Type: AWS::CodePipeline::Pipeline Properties: RoleArn: Ref: CodePipelineServiceRole Stages: - Name: Source Actions: - Name: SourceAction ActionTypeId: Category: Source Owner: AWS Version: 1 Provider: S3 OutputArtifacts: - Name: SourceOutput Configuration: S3Bucket: Ref: SourceS3Bucket S3ObjectKey: Ref: SourceS3ObjectKey RunOrder: 1 - Name: Beta Actions: - Name: BetaAction InputArtifacts: - Name: SourceOutput ActionTypeId: Category: Deploy Owner: AWS Version: 1 Provider: CodeDeploy Configuration: ApplicationName: Ref: ApplicationName DeploymentGroupName: Ref: DeploymentGroupName RunOrder: 1 - Name: Release Actions: - Name: ReleaseAction InputArtifacts: - Name: SourceOutput ActionTypeId: Category: Deploy Owner: AWS Version: 1 Provider: CodeDeploy Configuration: ApplicationName: Ref: ApplicationName DeploymentGroupName: Ref: DeploymentGroupName RunOrder: 1 ArtifactStore: Type: S3 Location: Ref: ArtifactStoreS3Location EncryptionKey: Id: arn:aws:kms:useast-1:ACCOUNT-ID:key/KEY-ID Type: KMS DisableInboundStageTransitions: - StageName: Release Reason: "Disabling the transition until integration tests are completed" Tags: - Key: Project Value: ProjectA - Key: IsContainerBased Value: 'true'


[1]
we even had a bonus '' and had chosen to recommend.
[2]
muroran itself was spotlessly clean and well maintained but many of the service.


JavaScript vs. Ruby
Similar than you think!
4th May, 2015
If you look at English, French, and Spanish they all have Latin as its root language and are therefore related to one another. Similarly JavaScript and Ruby both are related languages.
Since Ruby and JavaScript are related, many of the things are similar in those languages. For example both languages are object oriented and shair looping structures like while, if and for statements.
Ruby programming is much easier because you dont have to worry about defining types of variable, also you dont have to worry about ending a line with ";" as a seprate charater because each line aututomatically stands own its own.
When declairing a function/method in Ruby all you need to do is use "def" in front of the method. On the other hand if you want to use a function/method in JavaScript you need to type "function" before the function name. You also dont have to worry about the extra brackets and paranthesis.


Table CSS Selection Mode None single multi Checkbox Expandable Selected: {{table.selectedRows.size}}/{{table.processedData.length}} Hello {{object.firstName}} {{object.lastName}}, How are you today? I can see that you are under age. 84">I can see that you are over the average life expectancy. 84}">{{value}}


Array Class Reference
N-dimensional arrays over scalar data.
More...
#include <array.h>
Visible Fields
Structures
| • |
min
| : Vector * |
| • |
max
| : Vector * |
|
|
Enumerated Scalars
| |
Array_Kind
| : { PLAIN_KIND, RGB_KIND, RGBA_KIND, COMPLEX_KIND } |
| |
Color_Index
| : { RED_INDEX, GREEN_INDEX, BLUE_INDEX, ALPHA_INDEX } |
| |
Complex_Index
| : { REAL_INDEX, IMAG_INDEX } |
|
|
Descriptive Types
Routines
Creation and Basic Manipulation
| Dimn_Type |
ADIMN
(Array *a) |
| Indx_Type |
AINDX
(Array *a) |
| Size_Type |
ASIZE
(Array *a) |
| Offs_Type |
AOFFS
(Array *a) |
| Array * |
Make_ArrayG
(Array_Kind kind, Value_Type type, int ndims, Dimn_Type *dims) |
| Array * |
Make_Array_With_ShapeG
(Array_Kind kind, Value_Type type, Coordinate *shape F) |
| Array * |
Make_Array_From_ArraysG
(Array_Kind kind, int n, Array **arrays) |
| Array * |
Make_Array_Of_DataG
(Array_Kind kind, Value_Type type, int ndims, Dimn_Type *dims, void *data) |
Coordinates
| Coordinate * |
CoordG
(string list) |
| void |
Print_Coord
(FILE *f, Coordinate *coord F) |
| Coordinate * |
Coord1G
(Dimn_Type d1) |
| Coordinate * |
Coord2G
(Dimn_Type d2, Dimn_Type d1) |
| Coordinate * |
Coord3G
(Dimn_Type d3, Dimn_Type d2, Dimn_Type d1) |
| Coordinate * |
Coord4G
(Dimn_Type d4, Dimn_Type d3, Dimn_Type d2, Dimn_Type d1) |
| Coordinate * |
AppendCoord
(Dimn_Type d, Coordinate *coord RM) |
| Coordinate * |
PrependCoord
(Coordinate *coord RM, Dimn_Type d) |
| Coordinate * |
Idx2CoordAG
(Array *a, Indx_Type idx) |
| Indx_Type |
Coord2IdxA
(Array *a, Coordinate *coord F) |
| Coordinate * |
Idx2CoreAG
(Array *a, Indx_Type idx) |
| Coordinate * |
Idx2CoreG
(Indx_Type idx) |
Conversion, Element-Wise Ops, Padding, Clipping, and Down-Sampling
| Array * |
Convert_ArrayG
(Array *a, Array_Kind kind, Value_Type type, int scale, int|double factor) |
| Array * |
Convert_Array_Inplace
(Array *a RM, Array_Kind kind, Value_Type type, int scale, int|double factor) |
| Range_Bundle * |
Array_Range
(Range_Bundle *range RO, AForm *a) |
| APart * |
Array_Op_Scalar
(APart *a RM, Operator op, Value_Type type, Value v) |
| APart * |
Complex_Op_Scalar
(APart *a RM, Operator op, Value_Type type, Value v, Value w) |
| APart * |
Array_Fct_Val
(APart *a RM, Value (*fct)(void * valp)) |
| APart * |
Array_Fct_Idx
(APart *a RM, Value (*fct)(Coordinate *coord)) |
| Array * |
Apply_MapG
(Array *image, Array *map) |
| Array * |
Down_SampleG
(AForm *source, Coordinate *box F) |
| Array * |
Clip_ArrayG
(AForm *source, Coordinate *beg F, Coordinate *end F) |
| Array * |
Pad_ArrayG
(AForm *source, Coordinate *anchor F, Coordinate *shape F) |
Detailed Description
An array is the central object of the Mylib library and is used throughout. This page
describes primarily those routines and matters that pertain to arrays in and of themselves.
All the fields of an Array object's structure are visible to the user in order to facilitate
access. One may freely change the values of the elements in an array without concern for
unanticipated side-effects. However, we recommend that you do not make any changes to the
dimensions, type, kind, or any other facet of an array that changes its size unless you
have familiarized yourself with the object conventions and how Mylib's object manager works
by reading the document
Object.Management.
Anatomy of an Array
An array can have any number of dimensions ndims and the size of each dimension
is given by dims[i] for i from 0 to ndims-1 where 0 is the innermost (and fastest moving)
dimension.
The elements of an array of are all of a given type that is one of the ten scalar
Value_Types that
cover unsigned integers, signed integers, and floating point values of all standard sizes.
Moreover, for the signed and unsigned integer types, the scale-field specifies the number
of bits used to encode the value. Typically this is just the number of bits in the underlying
element type (e.g. 32 if INT32_TYPE, or UINT32_TYPE), but it may be
a smaller number if desirable. This is motivated by the frequent occurence in microscopy
data, of 12-bit or 10-bit D/A converters in a microscope's CCD camera.
One might, for example, recieve an array with elements of type UINT16_TYPE and a scale of 12.
This makes almost no difference to any routine in the package which will happily treat
the values as uint16, except when the array is read or written to a TIFF file
(e.g. Read_Image, Read_Images, etc.),
or when one converts an array from one type and scale to another
(e.g. Convert_Array, Convert_Image, etc.)
The data field is a void pointer to the elements of the array stored as a linear vector.
To obtain a pointer to the appropriate type use one of the routines AUINT8, AUINT16, ...
AFLOAT64 below (these are actually simple macros). The elements are layed out
with dims[0] being the fastest moving dimension, i.e., for an n-dimensional array
the index of
A[xn-1,...,x1,x0]
is
(... (xn-1*dims[n-2] + xn-2)*dims[n-3] + ...)*dims[0] + x0
using Horner's rule. While it could be computed from dims and ndims, Mylib keeps the
size of an array as a field (NB: this is not the size in bytes, but the number of elements
in the array).
There are four kinds of arrays: plain, rgb, rgba, and complex that are indicated by the
values of the enum Array_Kind. Every kind of array is basically an n-dimensional array
over the ten scalar types, but in the case of all but PLAIN_KIND arrays, there is a
restriction on one of the dimensions. Specifically, if an array is of RGB_KIND or RGBA_KIND
then the outermost dimension must be 3 and 4, respectively, one (n-1)-dimensional sub-array
of red, green, blue, and alpha values. If an array is of COMPLEX_KIND then the innermost
dimension is 2, where the first element in this dimension is the real part, and the second
the imaginary part of a complex number. As an example, consider a 3 x 5 x 2 array, A.
It can be interpreted as either a 3 x 5 x 2 plain array, a 5 x 2 array of rgb colors, or
a 3 x 5 array of complex numbers, depending on its kind.
That is, (A[0,y,x],A[1,y,x],A[2,y,x]) can represent an rgb-triple or color, or
A[x,y,0] + i A[x,y,1] can represents a complex number. The choice to have color be
the outer rather than the inner dimension is unconventional, but it gives one the ability
to work independently on a red, green, blue, or alpha sub-array easily, with no real
downside to setting or computing on color-tuples in terms of code or efficiency on today's
machines with 4-or-more-way interleaved caches.
The shape of an array is the ndims element vector of its dimensions dims. For example,
for the array A in our example above, it's shape is the vector (3,5,2). The core shape
of an array is its shape less the special dimension attributed to its kind. For example,
A has core shape (3,5) if it is of COMPLEX_KIND, (5,2) if it is of RGB_KIND, and
(3,5,2) if it is of PLAIN_KIND. Care must be taken that some routines work with core
shapes (e.g. all the drawing routines) while most work directly with an array's shape.
While rgb and rgba arrays are typically of type UINT8_TYPE or UINT16_TYPE, and complex
array are typically FLOAT32_TYPE or FLOAT64_TYPE, we do not so restrict them nor do
our tiff reader/writer routines. For the alpha channel the convention is that alpha
is between 0. and 1. for floating point types, and for integer types, no transparency
or 100% opacity, is denoted by the largest possible positive value
encodable with the number of bits given by the type and scale, e.g. 1024 = 2^10-1 when
type = UINT8_TYPE and scale = 10, and 32677 = 2^15-1 when type = INT16_TYPE
and scale = 16.
Finally, every array has an associated text tag, text, whose length is tlen.
The text tag is generally the empty string for ordinary arrays, but one can label
arrays with arbitrarily long strings if they find it useful. In particular, the
Print_Inuse_List routine will list the text tag of each array so one can identify
them in the usage analysis report when trying to debug an object memory leak. Furthermore
the text tag is read/written from and to the JF_TAGGER tag of a TIFF file by Mylib, so
it can be used as a means to encode arbirary amounts of meta-data about an array or image.
Creating and Accessing Arrays
There are currently four ways to generate a new array from scratch: Make_Array,
Make_Array_With_Shape, Make_Array_Of_Data and Make_Array_From_Arrays. The first
two routines take parameters that specify the kind, type, and core shape of the array
desired. Make_Array recieves the shape as an ndim,dims pair and Make_Array_With_Shape
recieves it in the form of an integer Coordinate. Make_Array_Of_Data takes a
linear data array supplied by the caller and wraps an array object around it, taking
ownership of the data vector. Make_Array_From_Arrays takes an array of pointers to say
n arrays all of the same shape α, generates an array of shape (n,&alpha), and
fills it in with the values of the n arrays. For example, one can construct an
RGB_KIND array from three planes as follows:
Array **planes[3];
planes[0] = a_red_array;
planes[1] = a_green_array;
planes[2] = a_blue_array;
color = Make_Array_From_Arrays(RGB_KIND,3,planes);
One can set the text tag of an array with Set_Array_Text and append to it with
Append_To_Array_Text. There are also simple routines to get and set a given element
of an array: Get_Array_Value and Set_Array_Value. These are provided mostly as an
example for users in order to make sure they understand how elements are indexed and
accessed. Any serious computation over an array is expected to be done directly with
indices into an array's data or with the aid of the array traversal mechanisms provided
by the Slice and Frame classes.
One can select sub-slices of an array by peeling away the outer dimension with Get_Array_Plane.
The idea is to be efficient and not create a new array object, but rather a "fake" array that
is valid as long as the underlying real array object is not modified. This "fake" array is
an Array_Bundle that is just the outer struct of an array object whose dims, data, and
text pointers are into a real array's structure. Get_Array_Plane takes a valid
Array_Bundle and modifies it so that upon return the bundle models the requested sub-array.
The tricky part is that the bundle must initially be set up by assigning it to the outer-struct
of a real array object. For example, the code below, takes the color
array from the example above, and peals off each color sub-array:
Array_Bundle red, green, blue;
red = green = blue = *color;
Get_Array_Plane(&red,0);
Get_Array_Plane(&green,1);
Get_Array_Plane(&blue,2);
If a real independent, and proper object is need for a sub-array then call
Copy_Array on
the fetched plane, e.g. Copy_array(&red).
Moreover, more than one layer of outer dimensions can be peeled away:
Array_Bundle bundle;
Get_Array_Plane(Get_Array_Plane(&(bundle=*color),1),3);
gets the 3rd z-plane of the green pixels when color
is a 3D RGB_KIND array.
One can produce an ASCII print out of an array, slice, or frame with Print_Array. The
caller can specify the indentation, the output stream to be written to, and the format in
which to print the numbers. Obviously this capability is not designed for very large
arrays, but more for small examples to help one develope a code using Mylib. Moreover,
arrays are typically so frequently used in a code that there is the possibility of failing
to free or kill one, creating a memory leak. To facilitate the developers efforts we provide
the routine Print_Inuse_List that gives a report of all the currently active arrays,
slices, and frames at the current moment. A typical output follows:
Arrays:
1 : 3 int32 = 12
1 : 3 int32 = 12
3 : 3 x 4 x 5 int32 = 240
Slices:
1 : (0,0,0) - (2,3,4) int32
Frames:
1 : 8 x 8 x 8 int32 = 12.3Kb
Generalization and Specializations of Arrays: AForms, Matrices, ...
There are a large number of type definitions in the header of this page -- e.g. Matrix,
Vector, etc. -- that are effectively all equivalent to Array.
The intent is to document the kind, type, and/or dimensionality of the array that is
being operated upon. For example, if one sees a routine declaration where the
argument is a Complex_Matrix, then one knows that the argument should be a
FLOAT32_TYPE or FLOAT64_TYPE, 2D array of either PLAIN_KIND or COMPLEX_KIND.
In general, if a routine
takes an argument that can only be a subset of all the possible array types, kinds, and
dimensionalities, then the routine actually checks that the argument meets those constraints
before proceeding, and conversely if it returns such a typed retult, then one can be sure
that it satisfies the constraints of the type name.
In the direction of generalization, note that the key attributes of an array-like object is that
it is an n-dimensional lattice of values of some Value_Type that may be interpreted
specially based on its Array_Kind. In addition to Arrays, Mylib also supports Slices
that are any hyper-rectangular sub-region of an underlying array, and Frames that are
hyper-rectangular shape windows that can be moved over an underlying array (but need not
lie within its lattice). Any routine that takes an Array as a read-only argument could
equally well take a Slice or a Frame as the argument. The union of the three classes
is termed an array form and an AForm class is introduced to model this generalization of
the three base classes. Note carefully that many of the "array" routines on this page have
been generalized to take AForms as arguments. Similarly, note that any routine that takes
an Array as an argument for which only it's elements will be modified (and not it's shape,
type, etc.), could equally well take a Slice as an argument (but not a Frame as a frame
may not lie with the boundary of its underlying array), in which case only the elements of
the underlying array delimited by the slice's hyper-rectangle are modified. The union of
the Array and the Slice classes is termed an array part and an APart type is introduced
to model this genalization. Again, note that many of the "array" routines on this page have been
generalized to take AParts as arguments.
Coordinates
Many if not most Mylib routines address an element of an array with an index directly
into the linear vector pointed at by the data field. But conceptually an address into
an n-dimensional array, is an integer coordinate
(x0,x1...xn)
into the n-dimensional lattice --
[0,dims[0]-1] x [0,dims[1]-1] x ... x [0,dims[n]-1]
-- of the array. In the subsection on the anatomy of an array above we showed how to
map such a coordinate to an index into the data vector, that is, we specified the mapping
Mylib uses to assign lattice positions to linear positions in data's linear vector.
It is clearly conceptually easier for a human being to think in terms of coordinates than
in terms of indices. So Mylib supports the idea of a Coordinate which is itself an
array that is 1-dimensional and of type Dimn_Type (a signed 32-bit integer).
There are routines that create coordinates with specific values and lengths
(Coord, Coord1, Coord2, Coord3, Coord4),
routines that convert coordinates to indices and vice versa
(Idx2CoordA, Idx2CoreA, Coord2IdxA),
routines that add dimensions to a coordinate
(AppendCoord, PrependCoord),
and routines to round real-valued n-dimensional points to the nearest coordinate
(Floor_Coord, Ceiling_Coord, Nearest_Coord).
Coordinates are also used to specify the shape of an array (see AForm_Shape for an
example) and to model offsets relative to a point in an array's n-dimensional lattice
(see Make_Frame for an example). Coordinates are generally short-lived objects and
so the convention is that most routines that recieve coordinates as input parameters,
free or subsume them before returning.
The routines Idx2CoordA and Coord2IdxA convert between coordinates and array indices.
Note carefully that the conversions require a parameter specifying the array in question as
the shape of the array must be known in order to perform the conversion.
As an alternative to always supplying the array as an argument, we maintain a global
current basis which can be set with Set_Coord_Basis or Use_Array_Basis and
retrieved with Get_Coord_Basis. The conversions of Idx2Coord and Coord2Idx (note the
'A' is missing from the names) take place with respect to the current basis. Clearly the use
of the current basis is not re-entrant, but the routines for setting it are thread-safe.
For code that must be re-entrant, you must use Idx2CoordA and Coord2IdxA.
For arrays whose kind is not PLAIN_KIND, one often needs to describe coordinates as if the
special dimension (i.e. the outermost for RGB_KIND and RGBA_KIND, and the innermost for
COMPLEX_KIND) were not present. This is particularly true of drawing routines (see
the Draw module) where a "brush" of kind PLAIN_, RGB_, RGBA_, or COMPLEX_KIND is
being applied to an array of the given kind. We consider such a truncated coordinate a
core coordinate in direct analogy to the idea of the core shape of an array. Many
routines in the library will accept either a core coordinate or a complete coordinate.
In those instances, it is generally the case that:
when a core coordinate is being used as a point, the special dimension is assumed to be 0,
and when being used as a shape or basis, it gets filled in with the width of the special
dimension. Idx2CoreA and Idx2Core convert an array index into a core coordinate
(where any offset in the special dimension is ignored), and Coord2IdxA and Coord2Idx
will accept core coordinates and assume the coorindate for the special dimension is 0.
Note, that Idx2Core requires that the current basis also records the kind of the basis
as well.
Basic Array Routines
Converting an array from one type, kind, and/or scale to another is frequently required.
Convert_Array performs such a conversion generating a new array for the result, whereas
Convert_Array_Inplace does so in the existing memory blocks of the array in question,
increasing the size of said blocks if necessary. Similarly, Convert_Image and
Convert_Image_Inplace convert arrays that are presumed to model an image where the
routine Image_Check will ascertain if a given array is an image.
An array is considered an image if all values are between 0 and
2scale-1−1
for a signed integer array, are all between 0 and
2scale−1
for an unsigned integer array, and between 0. and 1., inclusive, for a floating point array.
There are quite a few routines for performing basic element-by-element functions on an
array. Array_Range computes the range of values in an array, and Scale_Array and
Scale_Array_To_Range offer two ways to scale and offset the values in an array.
Array_Op_Scalar combines every element of an array with a particular scalar value
via any of the ten supported Operators and Array_Op_Array does an element-wise
combination between two arrays. There are also Complex_Op_Scalar, Complex_Op_Array,
and Complex_Op_Complex that require the first argument be a COMPLEX_KIND array and
for these routines the combining is done via complex arithmetic when it makes sense.
Array_Fct_Val replaces each element of an array with a new value that is any caller-defined
function of its current value, while Array_Fct_Idx replaces each element with a caller-defined
function of its coordinate in the array's lattice. Threshold_Array binarizes an array
against a background/foreground threshold value.
Array multiplication and index-table mapping are two operations that can be generalized
to arrays of any dimension provided the innermost dimension of the first array equals the
outermost dimension of the second for multiplication, and the range of values in the first
array equals the innermost dimension of the second for mapping. The routines Array_Multiply
and Apply_Map realize these generalized versions of the operations. For fast matrix
multiplication for linear algebra, one should use Matrix_Multiply in the Linear Algebra
module. On the other hand if you read a color-mapped image in the Image I/O module then
one should use Apply_Map to perform the color mapping if desired.
Finally, there are routines to clip, pad, and downsample an array. They come in a
generator version that makes a new array holding the result
(Clip_Array, Pad_Array, and Down_Sample),
and in-place versions that perform the operation in the memory of the subject array,
expanding said if necessary
(Clip_Array_Inplace, Pad_Array_Inplace, and Down_Sample_Inplace).
One should particularly note that
how an array gets padded is a function of the current boundary effect.
Visible Fields Documentation
Indicates whether an array can be interpreted as an rgb, rgba, or complex array, as opposed
to just an ordinary or plain array.
If an RGB_KIND array, then the outermost dimension is 3 and
(A[0,α],A[1,α],A[2,α])
is an rgb color triple for each index sequence α.
If an RGBA_KIND array, then the outermost dimension is 4 and
(A[0,α],A[1,α],A[2,α],A[3,α])
is an rgba color for each α.
If an COMPLEX_KIND array, then the innermost dimension is 2 and
A[α,0] + [i] A[α,1]
is a complex number for each α.
Specifies the type of the elements of an array which can be one of the ten number types
supported in C.
If the array has integer elements, then this field specifies the number of bits used to
encode the values. It cannot be more than the number of bits in the type. A typical
example where this field comes into play would be 12-bit microscopy data, for which type
would be UINT16_TYPE and scale would be 12. This field only has an effect when
converting an array (e.g. Convert_Array) or when reading or writing the array to a TIFF
file (where only the number of bits per value is read or written).
The number of dimensions of the array.
dims[i] gives the size of the ith dimension of the array for
i from 0 to ndims-1.
The length of the text tag text.
An arbirary text tag for the array. Typically empty, but you can use it to label an array
so you can identify it in a space usage report produced by Print_Inuse_List, or you can
place, say xml-encoded meta-data describing the image acquisition parameters of the microscope
that produced the data. This tag is read and written to and from the JF_TAGGER tag of a
TIFF file for this purpose.
A void pointer to the elements of the array stored as a linear vector.
To obtain a pointer to the appropriate type use one of the routines AUINT8, AUINT16, ...
AFLOAT64 below (these are actually simple macros). The elements are layed out
with dims[0] being the fastest moving dimension, i.e., for an n-dimensional array
the index of
A[xn-1,...,x1,x0]
is
(... (xn-1*dims[n-2] + xn-2)*dims[n-3] + ...)*dims[0] + x0
using Horner's rule.
The total number of elements in the array.
Structure Documentation
Used to serve as a short term construct that can be passed as an array to any routine that
does not modify that array argument. It is just the outer struct of an array object:
the dims vector, data vector, and text tag all point to another array's memory
(so do not modify that array until the Array_Bundle is no longer in use).
This is not often used save for efficiency or simplicity. For example, for a 3D array A
one can get the ith z-plane as an Array_Bundle using Get_Array_Plane
as follows:
Array_Bundle plane;
Range_Bundle range;
...
plane = *A;
Get_Array_Bundle(&plane,i);
Array_Range(&range,&plane);
Used by Array_Range so that it can record the minimum and maximum value seen in the
AForm in question.
This bundle is passed to routines like Region_Extent and SWC_Tree_Extent so that they can
be filled in with the minimum and maximum vectors, min and max, respectively, of the
smallest bounding box that encloses all the elements of the object in question. The type of the
arrays for min and max depends on the routine, e.g. Region_Extent fills in Coordinates
and SWC_Tree_Extent fills in Double_Vectors.
Enumerated Scalars Documentation
| Array_Kind | : { PLAIN_KIND, RGB_KIND, RGBA_KIND, COMPLEX_KIND } |
The four supported kinds of an array.
| Color_Index | : { RED_INDEX, GREEN_INDEX, BLUE_INDEX, ALPHA_INDEX } |
The indices into the red, green, blue, and alpha sub-arrays of a color array. Primarily
defined for those that wish to write more descriptive code as one can equally well use
0, 1, 2, and 3 as the indices.
| Complex_Index | : { REAL_INDEX, IMAG_INDEX } |
The indices for the real and imaginary parts of the innermost dimension of a complex array.
Primarily defined for those that wish to write more descriptive code as one can equally well
use 0 and 1 for this purpose.
Routine Documentation
| uint8 |
AUINT8 (Array *a) |
| uint16 |
AUINT16 (Array *a) |
| uint32 |
AUINT32 (Array *a) |
| uint64 |
AUINT64 (Array *a) |
| int8 |
AINT8 (Array *a) |
| int16 |
AINT16 (Array *a) |
| int32 |
AINT32 (Array *a) |
| int64 |
AINT64 (Array *a) |
| float32 |
AFLOAT32 (Array *a) |
| float64 |
AFLOAT64 (Array *a) |
Each function returns a pointer to the data of array a that is of the type implied
by its name. These functions are implemented as macros.
Each function returns a pointer to the data of array a that is of the type implied
by its name. For example, if a is a Coordinate then while one could access its elements
with AINT32(a), it is better to do so with ADIMN(a), as the latter will remain
correct even if the type of Dimn_Type were to change. These functions are implemented as macros.
Creates an array of the given kind, type, and core shape, that is, if kind is other
than PLAIN_KIND, then the shape specified by ndims and dims does not include the extra
dimension for the kind which is automatically added.
Creates an array where the Coordinate shape gives the dimensionality
and size of each dimension of the core shape of the matrix. See Coord for one way to
easily make a shape (e.g. you could write
Make_Array_With_Shape(RGB_KIND,UINT8_TYPE,Coord("4,2,3")).
The shape coordinate is freed before returning.
The parameter arrays is expected to be contain n pointers to arrays that all have the same
type, kind, and shape α. Creates an array with shape
(n,α)
that is the concatenation of the n arrays. The n array objects are unaffected by the
construction as their elements are copied to the new array.
NB: If kind is COMPLEX_KIND then the arrays pointed at must all be of COMPLEX_KIND,
otherwise all the array must be of PLAIN_KIND. Moreover, if
kind is RGB_KIND then n must be 3 and if kind is RGBA_KIND then n must be 4.
Creates an array whose data vector is the one supplied as the last
argument data. The argument conventions are otherwise exactly as for Make_Array.
The data vector must be of size at least size*sizeof(type) bytes and the
memory management of this vector is taken over by the array class.
| void |
Set_Array_Text (Array *a M, string text) |
Set the text tag of array a to text.
| void |
Append_To_Array_Text (Array *a M, string text) |
Append text to the text tag of array a.
Get the value of the element at coordinate coord in array a. The coordinate coord
is freed upon return and the value is passed back in a Value structure.
Set the value of the element at coordinate coord in array a to v. The coordinate coord
is freed upon return and the value v is passed to the routine in a Value structure.
Select the planeth (n-1)-dimension sub-array of the,
say n-dimensional, Array_Bundle a, which is basically just the outer struct of
an array object, where the dims, data, and text fields point to the memory of some
real array object. A bundle is initialized by assigning it the value of a proper array's
struct. Get_Array_Plane returns a pointer to a after modifying
its fields (in the bundle only) so that it now models the selected sub-array. For example,
the code below, takes the color
array from the example above, and peals off each color sub-array:
Array_Bundle red, green, blue;
red = green = blue = *color;
Get_Array_Plane(&red,0);
Get_Array_Plane(&green,1);
Get_Array_Plane(&blue,2);
If a real independent, and proper object is need for a sub-array then call
Copy_Array on
the fetched plane, e.g. Copy_Array(&red).
Moreover, more than one layer of outer dimensions can be peeled away:
Array_Bundle bundle;
Get_Array_Plane(Get_Array_Plane(&(bundle=*color),1),3);
gets the 3rd z-plane of the green pixels when color
is a 3D RGB_KIND array.
| void |
Print_Array (AForm *a, FILE *output, int indent, string format) |
Print an array or slice or frame in a tabular form on the open FILE output. The display
depends on the kind of the array and is indented by indent spaces from the left margin.
The format string must be appropriate for the type of data in the array, e.g. "%10lld"
for an INT64_TYPE array, or "%6.4f" for a FLOAT32_TYPE array.
| void |
Print_Inuse_List (FILE *output, int indent) |
Prints out a report of the current set of arrays, slices, and frames currently
in use by the program to the specified output, indented by the amount specified by indent.
The routine expects the string list to be a comma-separated list of integer constants.
The routine generates a coordinate corresponding to the list, e.g.
Coord("3,4,2") produces a 3-element coordinate.
Print the coordinate coord as an comma-separated list of integers to the file f.
Generate a k-element coordinate (d1,d2,d3,...) according to the name of the routine
and the number of its arguments.
Add integer d as the outermost dimension of coordinate coord and return a pointer to
the modified coordinate.
Add integer d as the innermost dimension of coordinate coord and return a pointer to
the modified coordinate.
Generates the coordinate in array a's lattice corresponding to index idx into its
data vector.
Returns the index corresponding to the position of coordinate coord within the lattice of
array a.
Sets the current basis for Mylib to the given shape and kind. Specifying the kind
is important as it affects the operation of Idx2Core which must know if any of the dimensions
of shape are special.
| void |
Use_Array_Basis (Array *a) |
Sets the current basis for Mylib to that of the array a.
Generates a coordinate that models the shape of the current basis, and returns
in the value pointed at by kind the kind of the current basis.
Returns the coordinate in the current basis corresponding to index idx.
Returns the index corresponding to the position of coordinate coord within the lattice of
the current basis.
Generates the core coordinate in array a's lattice corresponding to index idx into its
data vector.
Generates the core coordinate in the lattice of the current basis corresponding to
index idx.
Generate the coordinate produced by taking the floor of every element of point.
Generate the coordinate produced by taking the ceiling of every element of point.
Generate the coordinate produced by taking rounding every element of point to the nearest
integer.
Converts the array a to one of the specified kind, type, and scale in a newly generated
array, say t, and returns a pointer to it. The result is as if the assignement
t[i] = Mapping(a[i])*β
were made for each core element (i.e. RGB-triple, complex number, ...) where i ranges over
the core shape of a, Mapping converts between different kinds of elements,
and β is a scaling factor. If the types of a and t are different then the the
right hand side is computed in a's type space and then the type conversion takes place
during the assignment as per C's type rules.
If the kind remains unchanged, the Mapping is the identity fucntion. Otherwise the table
below gives the function implied by each source/target kind pair. The free variable i is
assumed to range over all possible core coordinates of a (and t).
| Conversion | Mapping |
| PLAIN to RGB |
t[0,i] = t[1,i] = t[2,i] = a[i] |
| PLAIN to RGBA |
t[0,i] = t[1,i] = t[2,i] = a[i], t[3,i] = &alpha(t) |
| RGB to RGBA |
t[c,i] = a[c,i] for c ∈ {0,1,2}, t[3,i] = &alpha(t) |
| RGBA to RGB |
t[c,i] = a[c,i]*a[3,i] / α(a) for c ∈ {0,1,2} |
| RGB to PLAIN |
t[i] = .30*a[0,i] + .59*a[1,i] + .11*a[2,i] |
| RGBA to PLAIN |
t[i] = (.30*a[0,i] + .59*a[1,i] + .11*a[2,i])*a[3,i] / α(a) |
| PLAIN to COMPLEX |
t[i,0] = a[i], t[i,1] = 0 |
| COMPLEX to PLAIN |
t[i] = (a[i,0]2 + a[i,1]2).5 |
| KIND X to KIND Y |
KIND X to PLAIN to KIND Y |
The last row of the table is intended to capture any conversion not specified in the previous
rows of the table. For example, a COMPLEX_KIND to RGB_KIND transformation is conceptually
the result of first converting the COMPLEX_KIND to a PLAIN_KIND and then converting the
PLAIN_KIND to an RGB_KIND. The quantity &alpha(x) is
(a) 2 x->scale−1 if the type of x is one of the unsigned integer types,
(b) 2 x->scale-1−1 if the type of x is one of the signed integer types,
and
(c) 1 if the type of x is one of the floating point types. Intuitively it is the fully
opaque value for the alpha component of an RGBA_KIND array of the same type as x.
Conceptually after being mapped as per the table above, each value is then scaled by a factor
β except for an alpha component if it has been newly introduced. The value of β
is determined by the parameter factor as follows. If the type of a or the type of t
is a floating point type, then the parameter factor is interpreted as a double value
and it is β. Otherwise, factor is interpreted as an int argument and the value
of β is effectively 2-factor. We say "effectively" because the
multiplication by β is actually accomplished with a left or right bit shift.
The scale of t is simply set to the scale parameter; one must set factor appropriately
if an actually scale change in the value resulting from the kind Mapping is required.
Convert a in the same way as Convert_Array above, but do so in-place, that is, a is
overwritten with the converted result and a pointer to a is returned.
| boolean |
Image_Check (Array *a) |
Check whether or not an array is an image.
An array is considered an image if all its values are between 0 and
2 scale-1−1
for a signed integer array, are all between 0 and
2 scale−1
for an unsigned integer array, and between 0. and 1., inclusive, for a floating point array.
Converts an image into one of the given kind, type, and scale in a newly generated array
that is returned as the result. Unlike Convert_Array, values are scaled so that the relative
intensity of a pixel element is preserved. For example, if a has type UINT16_TYPE and scale
12, then
(a) if type is UINT8_TYPE and scale is 8, then values of a will be right-shifted 4 bits,
(a) if type is FLOAT32_TYPE, then values of a will be divided by the floating point value
2 scale−1, and (c) if type is INT32_TYPE and scale is 24, then
the values of a will be left-shifted 11 bits.
Convert image a in the same way as Convert_Image above, but do so in-place, that is, a is
overwritten with the converted result and a pointer to a is returned.
Returns the smallest and largest value in array in the maxval and minval fields of the
Range_Bundle.
| APart * |
Scale_Array (APart *a RM, double factor, double offset) |
Each element of a is first ofset by offset and then scaled by factor, i.e.
a[i] = factor * (a[i] + offset) for all i in basis of a.
Scales every element of a so that the largest (after scaling) equals
max and the smallest equals min. Returns a for convenience.
Combines each element in a with the value v of type type according to
the selected Operator op. The table below lists the operational effect. Not carefully that
if a and v are not of the same type, then results are coreced for the operation and
assignment according to the rules of the C-language. v must be a positive integer if either
of the two shift operators is requested.
| Operator | Effect |
| SET_OP | a[i] = v |
| ADD_OP | a[i] = a[i] + v |
| SUB_OP | a[i] = a[i] - v |
| MUL_OP | a[i] = a[i] * v |
| DIV_OP | a[i] = a[i] / v |
| POW_OP | a[i] = a[i] ^ v |
| LSH_OP | a[i] = a[i] << v |
| RSH_OP | a[i] = a[i] >> v |
| MIN_OP | a[i] = min(a[i],v) |
| MAX_OP | a[i] = max(a[i],v) |
Assumes a is of COMPLEX_KIND and combines each complex element of a with
the complex number v+iw. All arithmetic is done in the field of complex numbers.
However, for the shift and min/max operators, the operations are performed on the real and imaginary
parts separately, e.g. for LSH_OP, a[i].real <<= v and a[i].imag <<= w.
v and w must be positive integers if either of the two shift operators is requested.
Combine, element-wise, the elements of the arrays a and b with Operator op, leaving the
result in the element of a. a and b do not have to be the same size,
type, or kind. If b is larger than a, then the first a->size elements of b are combined
with the elements of a. If b is smaller than a, then the elements of b are used in a
circular fashion until every element of a has been operated upon. This is reflected in the
table below by the use of the expression b[i%|B|] where |B| is, b->size, the size of b.
| Operator | Effect |
| SET_OP | a[i] = b[i%|B|] |
| ADD_OP | a[i] = a[i] + b[i%|B|] |
| SUB_OP | a[i] = a[i] - b[i%|B|] |
| MUL_OP | a[i] = a[i] * b[i%|B|] |
| DIV_OP | a[i] = a[i] / b[i%|B|] |
| POW_OP | a[i] = a[i] ^ b[i%|B|] |
| LSH_OP | a[i] = a[i] << b[i%|B|] |
| RSH_OP | a[i] = a[i] >> b[i%|B|] |
| MIN_OP | a[i] = min(a[i],b[i%|B|]) |
| MAX_OP | a[i] = max(a[i],b[i%|B|]) |
The effect is similar to Array_Op_Array above except that a must be of COMPLEX_KIND and
each non-complex element of b is combined with each complex element of a and complex
arithmetic is used for all but the shift and min/max operators. To be a bit more precise, if
p is the index corresponding to a core coordinate c of a, then the complex number
a[c,0] + i a[c,1] is combined with b[p%|B|] according to op. For, the
shift and min/max operators, the b-value is applied to both parts of the a-value, e.g.
x+iy << e is (x<<e) + i (y<<e).
The effect is similar to Array_Op_Array above except that a and b must both be of
COMPLEX_KIND and complex arithmetic is used to combine elements except for the shift
and min/max operators which take place on the real and imaginary parts separately, e.g.
x+iy << c+id is (x<<c) + i (y<<d).
For each element of a, the routine calls the handler fct with a void pointer
to the element and replaces the element with whatever Value fct returns.
For each element of a, the routine calls the handler fct with the Coordinate of the
element and replaces the element with whatever Value fct returns.
Binarizes the image with respect to threshold cutoff. That is, every element whose value
is less than or equal to cutoff is set to 0, and every element other element is set to 1.
Multiply arrays a and b where they must both be of the same type and the innermost
dimension of a must be of the same length as the outermost dimension of b. If either
a or b is of COMPLEX_KIND then complex arithmetic is performed and a COMPLEX_KIND
array is returned. The kind of the arrays is otherwise ignored and a PLAIN_KIND array
returned.
The routine handles all type situations and complex multiplication and is therefore not
as efficient as the carefully-crafted Matrix_Multiply routine in the Linear Algebra
module for multiplying Double_Matrixes together.
A general routine for mapping array data, but specifically inspired by image "color maps".
The array image must be of PLAIN_KIND and unsigned integer type. The array map must
have dimension at least 1 and its inner dimension must be equal to m =
2 image->scale, i.e. the range of values in image. Suppose the shape
of map is (α,m). Each value v in image is replaced with the *array*
map[β,v]β of shape α.
Thus the resulting array is of shape α.shape(image) and has the type and scale of map.
A new array is created to hold the result and a pointer to it is returned.
Downsample array source where the downsampling in each dimension is given by box.
For example, Coord("2,3,4"), would downsample a 3 dimensional array by
4 pixels in dimension 0, 3 pixels in dimension 1, and 2 pixels in dimension 2. If the
array is RGB_KIND, RGBA_KIND, or COMPLEX_KIND then the downsample vector need only
specify the downsampling in the core shape, in which case the downsampling in the special
dimesnion is assumed to be 1 (i.e. no downsampling). A pixel in the result is the average
of the pixels it replaces. A new array is generated for the result and a pointer to it
returned.
Select the subset of source in the rectangle whose opposing corners are at the
coordinates beg and end. For example, if beg = (2,4,3) and end = (6,7,8) then the
sub-array source[2..6][4..7][3..8] will be returned. If the array is RGB_KIND,
RGBA_KIND, or COMPLEX_KIND, then one is free to use core coordinates as well, in which
case the entire range of the special dimension is assumed.
Place the array source in a padded array of shape shape where its origin (index 0 pixel)
is placed at coordinate anchor in the padded array. shape must be not smaller than the shape
of source in every dimension. The padded array is padded according to the
current boundary effect. (NB: Padding with zero's is the most efficient, the other
padding effects take an extra pass over the boundary pixels.)
If the array is RGB_KIND, RGBA_KIND, or COMPLEX_KIND, then shape and anchor
can be a core shape and core coordinate, in which case the special dimension is not
padded and the origins of the special dimension are aligned.
Same effect as Down_Sample except that it only applies to Arrays and modifies source
to hold the downsampled result and returns a pointer to source.
Be sure to pack the array
Pack_Array)
if you want to free up the space no longer
required by the downsampled array.
Same effect as Clip_Array except that it only applies to Arrays and modifies source
to hold the clipped result and returns a pointer to source.
Same effect as Pad_Array except that it only applies to Arrays and modifies source
to hold the padded result and returns a pointer to source.
|


[Full featured example]
[Advanced example]
[Simple example]
[Word example]
Full featured example
This page shows all available plugins that are included in the TinyMCE distribution. Some of these plugins will only be visible on MSIE due to the lack of some support in FF. For more details on the various options on TinyMCE check the
manual
or for more third party plugins check the plugin section.
Test header 1
 Test header 2
 Test header 3
 Some element, this is to be editor 1.
 This editor instance has a 100% width to it.
Some paragraph. Some link


File generated from /Users/xenykr/Documents/project/Tellet/ssam/apps/ssam/.eunit/ssam_cowboy.erl by COVER 2014-10-10 at 15:20:01 **************************************************************************** | %% ------------------------------------------------------------------------ | %% Copyright (c) 2014, Kook Maeng<EMAIL_ADDRESS>| %% | %% Permission to use, copy, modify, and/or distribute this software for any | %% purpose with or without fee is hereby granted, provided that the above | %% copyright notice and this permission notice appear in all copies. | %% | %% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | %% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | %% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | %% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | %% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | %% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | %% ------------------------------------------------------------------------ | | -module(ssam_cowboy). | | -export([ | start_protocol/3, | add_routes/1, | delete_routes/0 | ]). | | -include("ssam.hrl"). | | -define(BUCKET, <<"ssam_cowboy">>). | -define(KEY, <<"routes">>). | | start_protocol(Protocol, Port, Routes) -> 0..| Dispatch = cowboy_router:compile(Routes), 0..| start(Protocol, {Port, Dispatch}). | | start(http, {Port, Dispatch}) -> 0..| {ok, _} = cowboy:start_http( | ssam_http, 10, [{port, Port}], [{env, [{dispatch, Dispatch}]}] | ); | start(https, {Port, Dispatch}) -> 0..| {ok, _} = cowboy:start_https( | ssam_https, 10, | [{port, Port}, | {certfile, code:priv_dir(ssam) ++ "/ssl/unified.crt"}, | {keyfile, code:priv_dir(ssam) ++ "/ssl/tellet.io.key"}], | [{env, [{dispatch, Dispatch}]}] | ), 0..| ok. | | add_routes(Routes) -> 0..| lager:debug("Routes: ~p", [Routes]), 0..| case get_routes() of | {ok, OldRoutes} -> 0..| {ok, NewRoutes} = reduce_routes(OldRoutes ++ Routes), 0..| ok = set_routes(NewRoutes), 0..| ok = store_routes(NewRoutes); | {?error, Reason} -> 0..| {?error, Reason} | end. | | | %% Private functions | | get_routes() -> 0..| case ssam_riakc:get(?BUCKET, ?KEY) of 0..| {ok, Bin} -> {ok, binary_to_term(Bin)}; 0..| {?error, Reason} -> {?error, Reason} | end. | | delete_routes() -> 0..| ok = ssam_riakc:put(?BUCKET, ?KEY, []). | | set_routes(Routes) -> 0..| ok = cowboy:set_env(?ssam_https, dispatch, cowboy_router:compile(Routes)). | | store_routes(Routes) -> 0..| ok = ssam_riakc:put(?BUCKET, ?KEY, term_to_binary(Routes)). | | reduce_routes(Routes) -> 0..| Keys = proplists:get_keys(Routes), 0..| reduce_routes(Keys, Routes, []). | | reduce_routes([Key|Tail], Routes, NewRoutes) -> 0..| Routes1 = lists:usort(proplists:append_values(Key, Routes)), %% removes duplicates 0..| Routes2 = proplists:delete(Key, Routes1), 0..| NewRoutes1 = NewRoutes ++ [{Key, Routes1}], 0..| reduce_routes(Tail, Routes2, NewRoutes1); | reduce_routes([], _, Routes) -> 0..| {ok, Routes}. | | |


| Employee Name |
Finished Tasks |
Tasks in Progress |
Unfinished Tasks |
Clients' Reviews (1-5) |
Absence (per month) |
|---|---|---|---|---|---|
| M.Hooper | 92 | 3 | 5 | 4 | 2 |
| S.Rodrigues | 103 | 2 | 3 | 5 | 0 |
| P.Chaney | 54 | 1 | 2 | 3 | 0 |
| D.Rice | 75 | 4 | 4 | 3 | 1 |
| M.Adams | 102 | 3 | 4 | 5 | 2 |
| T.Collins | 65 | 3 | 5 | 3 | 1 |
| J.Doe | 79 | 5 | 3 | 5 | 1 |
| A.Jones | 105 | 5 | 3 | 5 | 0 |


Most data scientists are familiar with the basic tools for data cleaning, data manipulation, and machine learning - especially the excellent Pandas, Numpy and Sci-Kit Learn libraries. However, there are so many supplementary libraries that complement these core libraries so well that it would behove most data scientists who are serious about their careers to learn them.
Many Data Scientists know Flask. Flask, by itself, lets you build very simple applications. AJAX and jQuery let you build significantly more involved applications that are more interactive and more complex visually.
I had wanted to build a program that would solve Sudoku puzzles for some time, mostly for philosophical reasons. This turned out to be a perfect project to learn AJAX and jQuery. Here's are two Medium posts explaining in detail how to use AJAX and jQuery to build this Sudoku app:
Also, check out the GitHub repo here, as well as the final web app here.When I was teaching the Summer 2017 data science immersive program at Metis, I decided to give the lecture on the Selenium library since I hadn’t used it much before. I prepared a short demo of how one could use Selenium - which lets you interact with websites in all the ways you normally would, such as by clicking on things and entering text in forms - to make a reservation on OpenTable.
The students - and Metis students so often do - took this and ran with it, doing amazing projects using Selenium in the week-and-a-half following the lecture.
Here is the GitHub repo containing the Selenium OpenTable example and the two projects that the students did. I was very proud of them!


{% extends 'layout.html' %} {% block body %}
Data has a normal distribution?
Yes
Will the mean be tested?
Proportions Z Test
Are the variables independent?
Are the variances homogeneous?
No
Welch's T-Test
Two Sample T-Test
Paired Student’s T-Test
Two Sample K–S Test
Mann-Whitney U Test
Wilcoxon Signed-Rank Test


Shoutout to miguelmota for his intent-utterance-generator node module!
The syntax is very similar to the original syntax for making the utterances. You can check it out here. The only difference is that the new syntax makes it easier to create variations of utterances with parenthesis groups.
Input: "(hello|hi) world" Output: "hello world", "hi world"
You also can specify the parenthesis group to be 'optional', with the '|' symbol.
Input: "I (love|hate) (|big) dogs" Output: "I love big dogs", "I love dogs", "I hate big dogs", "I hate dogs"
Note that (|big|small)
would work the same as (big|small)
, but adding an empty space to the beginning makes it work as expected (i.e. ( |big|small)
). I'm working a fix at the moment.
If you want more examples, the original author of the node module, miguelmota, has some here!


"x" "1" "KFIR,R, JOHANNSEN,E AND VLEGGAAR,R, MUTAGENIC ACTIVITY OF AUSTOCYSTINS- SECONDARY METABOLITES OF ASPERGILLUS USTUS,BULL. ENVIRON. CONTAM. TOXICOL.37(5):643-650, 1986"


BASIC INSTINCT A film review by Edwin Jahiel Copyright 1995 Edwin Jahiel
(1992) ** 1/2 Directed by Paul Verhoeven. Written by Joe Eszterhas. Cinematography, Jean De Bont. Production design, Terrence Marsh. Music, Jerry Goldsmith. Cast: Michael Douglas, Sharon Stone, George Dzundza, Jeanne Tripplehorn, Denis Arndt, Leilani Sarelle, Bruce A. Young, Dorothy Malone. A Tri-Star release. 120 minutes.  Whether you call its instinct basic or base, the movie tells you to beware. Warning: don't get tied to a bed while engaging into furiously panting sex, unless the other party has supplied you with a Certificate of Sanity. Warning: don't get obsessively involved with carnal knowledge of murder suspects. Warning: The Ice Pick Cometh. Caution: cops, do not sleuth in empty buildings without your buddy. Watch out: for alumni of the Berkeley class of 1983. Caveat to foreign car makers: your costly racing machines may be nimble but Detroit can give them a run for their money.
The plot of BASIC INSTINCT has more bare flesh than bare bones. In a nutshell ("nut" as in "crazy", "shell" as in "shell game"), it opens with a strokes-to-strikes scene: in his palatial home, a retired rock star reaches a copulatory climax while his shapely blond (but not otherwise identified) partner dispatches him with multiple thrusts of an ice pick.
Troubled San Francisco cop Michael Douglas suspects Sharon Stone, an heiress (110 million dollars) who owns spectacular houses, is bisexual and writes books about killings that later materialize in real life. Stone defies, mocks and taunts Douglas and the authorities. Douglas lusts after her but will not stop investigating. Both in computer searches or in bed he leaves no Stone unturned. He also lusts after his ex-girl, police shrink Jeanne Tripplehorn.
As a detection thriller the movie is a game of planting red herrings and false leads and, possibly of implants. Stone's blend of mind-games and sex-games is not beguiling but it is intriguingly kinky, with her provocations, her dialectics, her much-publicized and barely visible flash of pantylessness, her fencing with Douglas, her flaunting of live-in lover Leilani Sarelle, her disregard of traditional ways and niceties. Her psychological and physiological motivations are not especially crystalline. Tentatively, they seem to me less a result of overcharged sexuality than of boredom and perversity caused by having too much money.
"Basic Instinct" has several striking (in every way) scenes, top-notch sets and photography, a menacing score, canny face and body makeup, sexily tight clothes, nastily tight performances and direction. Its basic weakness however is the script structure. It overdoes its misanthropy (unexplained) and its trickiness (gratuitous) when it carries the characters' cat-and-mouse games into the audience.
The public may be primarily paying for titillation, but that's no a reason for neglecting the thriller elements, those that draw the line between BASIC INSTINCT as soft porn and BASIC INSTINCT as an erotic police cliff-hanger. Yet the sleuthing and suspense parts are made incoherent as the game-playing tactics reach levels of convolution where you stop following, or caring, or both. What you're left with is subjecting yourself to manipulation for the doubtful bonus of shock effects.
As the film makes less and less sense it hides its conceptual murkiness behind glitter. Anything goes. Plot and characters keep shifting, not simply fooling expectations but actually cheating us, notably in the concluding, arbitrary twist--a final shot that's also a cheap shot.
For the thousandth time since Alfred Hitchcock left us, his lessons of holy simplicity, relative logic and clean narrative lines that build up suspense, have been ignored.
Thanks to its production values, BASIC INSTINCT does keep going at an un-boring clip, but in basically unexciting ways. Its unleashed sex makes voyeurs of the viewers, yet its sizzle is soulless and its studied lack of feeling, a liability.
The police action entails much suspension of disbelief, a term that, ironically, Stone herself explains to George Dzundza, Douglas's partner and only friend. The script relies heavily on very familiar cliche's and set-pieces: the buddy who almost always gets his; car chases (inventive but wildly improbable); political interference from above (remember Dirty Harry's problems?); unbelievable internal police conflicts and enmities. The bigger-than-life syndrome extends from performances, behavior, events and situations, down to the needless loudness of the Douglas-Dzundza exchanges. It's like volume replacing melody in music.
No real concern is created for anti-hero Douglas or anyone else. The dialogue (in case any lookers are listening) is simplistic yet ponderous. A pity, because the casting is good. Douglas's cold, calculating persona makes him unconvincing in heroic or romantic roles, but right for films like WALL STREET or BASIC INSTINCT. Stone and Tripplehorn are handsome, not too young, and--in a good match with Douglas--like people who have been repeatedly around the block, high-mileage but beautifully maintained. Call them pre-owned. Yet while the women's faces are good to look at, the barrage of Douglas close-ups should please mostly his mother and father.
In a filmic conceit, 67-year old Dorothy Malone, the vampish star of the 1950s, makes brief and bizarre appearances. Her lovely smile might remind film-buffs of the young Dorothy in "Tarnished Angels, " which is just what she represents here.
Having started with warnings, I end with another warning. The R rating is a mild compromise reached after repeated modifications and submissions, to avoid the commercially undesirable NC-17. But it is still a hard R, quite close to a NC-17.
Addendum: The notorious missing seconds were reinstated at the Cannes Film Festival. As many people had already seen the film, someone suggested that it might save time if the deleted naughty bits were to have special showings by themselves. This did not come to pass. The European release, however, was uncut.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


summary:
Trigger some event. It can be either a Dom Event, Custom Event,
or direct function call.
description:
Trigger some event. It can be either a Dom Event, Custom Event,
or direct function call. NOTE: This function does not trigger
default behavior, only triggers bound event listeneres. eg:
one cannot trigger(“anchorNode”, “onclick”) and expect the browser
to follow the href=”” attribute naturally.
obj: String|DomNode|Object|Function
An ID, or DomNode reference, from which to trigger the event.
If an Object, fire the event
in the scope of this object,
similar to calling dojo.hitch(obj, event)(). The return value
in this case is returned from dojo.trigger
event: String|Function
The name of the event to trigger. can be any DOM level 2 event
and can be in either form: “onclick” or “click” for instance.
In the object-firing case, this method can be a function or
a string version of a member function, just like dojo.hitch
.
extraArgs: Object?
An object to mix into the event
object passed to any bound
listeners. Be careful not to override important members, like
type
, or preventDefault
. It will likely error.
Additionally, extraArgs is moot in the object-triggering case,
as all arguments beyond the `event` are curried onto the triggered
function.
example:
| dojo.connect(node, “onclick”, function(e){ / stuff / });
| // later:
| dojo.trigger(node, “onclick”);
example:
| // or from within dojo.query: (requires dojo.NodeList)
| dojo.query(“a”).onclick(function(){}).trigger(“onclick”);
example:
| // fire obj.method() in scope of obj
| dojo.trigger(obj, “method”);
example:
| // fire an anonymous function:
| dojo.trigger(d.global, function(){ / stuff / });
example:
| // fire and anonymous function in the scope of obj
| dojo.trigger(obj, function(){ this == obj; });
example:
| // with a connected function like:
| dojo.connect(dojo.doc, “onclick”, function(e){
| if(e && e.manuallydone){
| console.log(“this was a triggered onclick, not natural”);
| }
| });
| // fire onclick, passing in a custom bit of info
| dojo.trigger(“someId”, “onclick”, { manuallydone:true });
returns: Anything
Will not return anything in the Dom event case, but will return whatever
return value is received from the triggered event.
return isfn(obj) || isfn(event) || isfn(obj[event]) ? d.hitch.apply(d, arguments)() : d._trigger.apply(d, arguments);
};
d.NodeList.prototype.trigger = d.NodeList._adaptAsForEach(d._trigger);


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.beanutils.WrapDynaClass
Implementation of DynaClass
for DynaBeans that wrap
standard JavaBean instances.
It is suggested that this class should not usually need to be used directly
to create new WrapDynaBean
instances.
It's usually better to call the WrapDynaBean
constructor directly.
For example:
Object javaBean = ...;
DynaBean wrapper = new WrapDynaBean(javaBean);
| Field Summary | |
protected java.lang.Class |
beanClass
The JavaBean Class which is represented by this
WrapDynaClass . |
protected java.beans.PropertyDescriptor[] |
descriptors
The set of PropertyDescriptors for this bean class. |
protected java.util.HashMap |
descriptorsMap
The set of PropertyDescriptors for this bean class, keyed by the property name. |
protected static java.util.HashMap |
dynaClasses
The set of WrapDynaClass instances that have ever been
created, keyed by the underlying bean Class. |
protected DynaProperty[] |
properties
The set of dynamic properties that are part of this DynaClass. |
protected java.util.HashMap |
propertiesMap
The set of dynamic properties that are part of this DynaClass, keyed by the property name. |
| Constructor Summary | |
private |
WrapDynaClass(java.lang.Class beanClass)
Construct a new WrapDynaClass for the specified JavaBean class. |
| Method Summary | |
static void |
clear()
Clear our cache of WrapDynaClass instances. |
static WrapDynaClass |
createDynaClass(java.lang.Class beanClass)
Create (if necessary) and return a new WrapDynaClass
instance for the specified bean class. |
DynaProperty[] |
getDynaProperties()
Return an array of ProperyDescriptors for the properties
currently defined in this DynaClass. |
DynaProperty |
getDynaProperty(java.lang.String name)
Return a property descriptor for the specified property, if it exists; otherwise, return null . |
java.lang.String |
getName()
Return the name of this DynaClass (analogous to the getName() method of java.lang.Class DynaClass implementation class to support
different dynamic classes, with different sets of properties. |
java.beans.PropertyDescriptor |
getPropertyDescriptor(java.lang.String name)
Return the PropertyDescriptor for the specified property name, if any; otherwise return null . |
protected void |
introspect()
Introspect our bean class to identify the supported properties. |
DynaBean |
newInstance()
Instantiates a new standard JavaBean instance associated with this DynaClass and return it wrapped in a new WrapDynaBean instance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.Class beanClass
Class
which is represented by this
WrapDynaClass
.
protected java.beans.PropertyDescriptor[] descriptors
protected java.util.HashMap descriptorsMap
descriptors
list.
protected DynaProperty[] properties
protected java.util.HashMap propertiesMap
properties
list.
protected static java.util.HashMap dynaClasses
WrapDynaClass
instances that have ever been
created, keyed by the underlying bean Class.
| Constructor Detail |
private WrapDynaClass(java.lang.Class beanClass)
createDynaClass(Class)
method.
beanClass
- JavaBean class to be introspected around| Method Detail |
public java.lang.String getName()
getName()
method of java.lang.Class
DynaClass implementation class to support
different dynamic classes, with different sets of properties.
getName
in interface DynaClass
public DynaProperty getDynaProperty(java.lang.String name)
null
.
getDynaProperty
in interface DynaClass
name
- Name of the dynamic property for which a descriptor
is requested
java.lang.IllegalArgumentException
- if no property name is specifiedpublic DynaProperty[] getDynaProperties()
Return an array of ProperyDescriptors
for the properties
currently defined in this DynaClass. If no properties are defined, a
zero-length array will be returned.
FIXME - Should we really be implementing
getBeanInfo()
instead, which returns property descriptors
and a bunch of other stuff?
getDynaProperties
in interface DynaClass
public DynaBean newInstance() throws java.lang.IllegalAccessException, java.lang.InstantiationException
Instantiates a new standard JavaBean instance associated with this DynaClass and return it wrapped in a new WrapDynaBean instance. NOTE the JavaBean should have a no argument constructor.
NOTE - Most common use cases should not need to use this method. It is usually better to create newWrapDynaBean
instances by calling its constructor.
For example:
Object javaBean = ...;
DynaBean wrapper = new WrapDynaBean(javaBean);
(This method is needed for some kinds of DynaBean
framework.)
newInstance
in interface DynaClass
java.lang.IllegalAccessException
- if the Class or the appropriate
constructor is not accessible
java.lang.InstantiationException
- if this Class represents an abstract
class, an array class, a primitive type, or void; or if instantiation
fails for some other reasonpublic java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String name)
null
.
name
- Name of the property to be retrievedpublic static void clear()
public static WrapDynaClass createDynaClass(java.lang.Class beanClass)
WrapDynaClass
instance for the specified bean class.
beanClass
- Bean class for which a WrapDynaClass is requestedprotected void introspect()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


{% extends "global/Page.html" %} {% load otree static %} {% block title %} Balance {% endblock %} {% block content %}
At the beginning of each session, everyone in your group will be given the same amount (ten) of ShruteBucks as initial balance. You will use ShruteBucks to place bets. At the end of each session, your ShruteBuck balance will be recorded, and then reset for the next session.
For each prediction task, you can only select one color to bet on (Green or Red). In addition, you can choose the size of your bet (1 share, 2 shares, etc.) and you will be shown the respective prices. Before you submit your bets, you will have access to the price of all potential bets in ShruteBucks.
If your bet matches the outcome, you will receive 1 ShruteBuck for every share you have. For example, if the outcome is red in a session, then you will receive 1 ShruteBuck if you have 1 share of red, 2 ShruteBucks if you have 2 shares of red in this session; however, you will receive 0 ShruteBuck for any amount of green shares in this session.
{% next_button %}(If the image is not loading properly, please right click on the image icon, and select "Open Image in New Tab".)
{% endblock %}


{% include head.html %}
{% include banner.html %}
Executive summary
About the Index
2019 RDR Index methodology
Index categories
Company types
What the index evaluates
Evaluation and scoring
1. Introduction
1.1 How to read this report
1.2 Explore the data and details
1.3 Beyond the RDR Index
1.4 Beyond 2019
2. The 2019 RDR Index ranking
2.1 Internet and mobile ecosystem highlights
2.2 Telecommunications company highlights
2.3 Notable changes
3. Governance
3.1 Global Network Initiative members lead the pack
3.2 Governance gap: Expression and privacy
3.3 Due diligence
3.4 Grievance and remedy
3.5 Government policy and regulatory trends
3.6 Recommendations for companies
3.7 Recommendations for governments
4. Freedom of Expression
4.1 Transparency remains inadequate
4.2 Terms of service and enforcement
4.3 External demands to restrict content or accounts
4.4 Network management and shutdowns
4.5 Regulatory developments and challenges
4.6 Recommendations for companies
4.7 Recommendations for governments
5. Privacy
5.1 Transparency remains inadequate
5.2 Handling of user information
5.3 Privacy gaps: collection and sharing
5.4 Government demands
5.5 Security trends
5.6 Regulatory trends and gaps
5.7 Recommendations for companies
5.8 Recommendations for governments
6. Questions for investors
7. Appendix
7.1 RDR Index methodology development
7.2 Company selection
7.3 Selection of services
7.4 Levels of disclosure
7.5 Research process and steps
7.6 Company engagement
7.7 Scoring
7.8 For further information
Acknowledgments
{{content}}
{% if page.prev %}
{{ page.prev.text }}
{% endif %} {% if page.next %}
{{ page.next.text }}
{% endif %}
{% if page.footnotes %}
Footnotes
{{ page.footnotes }}
{% endif %}
{% include footer.html %}


strpos
(PHP 4, PHP 5, PHP 7)
strpos — 查找字符串首次出现的位置
说明
mixed strpos ( string $haystack , mixed $needle [, int $offset = 0 ] )
返回 needle 在 haystack 中首次出现的数字位置。
参数
haystack
在该字符串中进行查找。
needle
如果 needle 不是一个字符串，那么它将被转换为整型并被视为字符的顺序值。
offset
如果提供了此参数，搜索会从字符串该字符数的起始位置开始统计。和 strrpos()、
strripos()不一样，这个偏移量不能是负数。
返回值
返回 needle 存在于 haystack 字符串起始的位置(独立于 offset)。同时注意字符串位置
是从0开始，而不是从1开始的。
如果没找到 needle，将返回 FALSE。
Warning
此函数可能返回布尔值 FALSE，但也可能返回等同于 FALSE 的非布尔值。请阅读布尔类型
章节以获取更多信息。应使用 === 运算符来测试此函数的返回值。
范例
Example #1 使用 ===
Example #2 使用 !==
Example #3 使用位置偏移量
注释
Note: 此函数可安全用于二进制对象。
参见
• stripos() - 查找字符串首次出现的位置（不区分大小写）
• strrpos() - 计算指定字符串在目标字符串中最后一次出现的位置
• strripos() - 计算指定字符串在目标字符串中最后一次出现的位置（不区分大小写）
• strstr() - 查找字符串的首次出现
• strpbrk() - 在字符串中查找一组字符的任何一个字符
• substr() - 返回字符串的子串
• preg_match() - 执行一个正则表达式匹配
User Contributed Notes 45 notes
===============================================================================
WARNING
As strpos may return either FALSE (substring absent) or 0 (substring at start
of string), strict versus loose equivalency operators must be used very
carefully.
To know that a substring is absent, you must use:
=== FALSE
To know that a substring is present (in any position including 0), you can use
either of:
!== FALSE (recommended)
> -1 (note: or greater than any negative number)
To know that a substring is at the start of the string, you must use:
=== 0
To know that a substring is in any position other than the start, you can use
any of:
> 0 (recommended)
!= 0 (note: but not !== 0 which also equates to FALSE)
!= FALSE (disrecommended as highly confusing)
Also note that you cannot compare a value of "" to the returned value of
strpos. With a loose equivalence operator (== or !=) it will return results
which don't distinguish between the substring's presence versus position. With
a strict equivalence operator (=== or !==) it will always return false.
===============================================================================
when you want to know how much of substring occurrences, you'll use
"substr_count".
But, retrieve their positions, will be harder.
So, you can do it by starting with the last occurrence :
function strpos_r($haystack, $needle)
{
if(strlen($needle) > strlen($haystack))
trigger_error(sprintf("%s: length of argument 2 must be <= argument 1",
__FUNCTION__), E_USER_WARNING);
$seeks = array();
while($seek = strrpos($haystack, $needle))
{
array_push($seeks, $seek);
$haystack = substr($haystack, 0, $seek);
}
return $seeks;
}
it will return an array of all occurrences a the substring in the string
Example :
$test = "this is a test for testing a test function... blah blah";
var_dump(strpos_r($test, "test"));
// output
array(3) {
[0]=>
int(29)
[1]=>
int(19)
[2]=>
int(10)
}
Paul-antoine
Malézieux.
===============================================================================
Be careful when the $haystack or $needle parameter is an integer.
If you are not sure of its type, you should convert it into a string.
===============================================================================
I lost an hour before I noticed that strpos only returns FALSE as a boolean,
never TRUE.. This means that
strpos() !== false
is a different beast then:
strpos() === true
since the latter will never be true. After I found out, The warning in the
documentation made a lot more sense.
===============================================================================
My version of strpos with needles as an array. Also allows for a string, or an
array inside an array.
===============================================================================
This might be useful.
===============================================================================
if you want to get the position of a substring relative to a substring of your
string, BUT in REVERSE way:
===============================================================================
I found a function in this post http://softontherocks.blogspot.com/2014/11/
buscar-multiples-textos-en-un-texto-con.html
that implements the search in both ways, case sensitive or case insensitive,
depending on an input parameter.
The function is:
function getMultiPos($haystack, $needles, $sensitive=true, $offset=0){
foreach($needles as $needle) {
$result[$needle] = ($sensitive) ? strpos($haystack, $needle, $offset) :
stripos($haystack, $needle, $offset);
}
return $result;
}
It was very useful for me.
===============================================================================
A function I made to find the first occurrence of a particular needle not
enclosed in quotes(single or double). Works for simple nesting (no backslashed
nesting allowed).
===============================================================================
I found that whatever I was using as a test with strpos it came out false exept
if $pos was == 1
I figured it gives me a numeric value if found else it is null or false
here is what i did to make my code work:
===============================================================================
Parse strings between two others in to array.
$value){
$type = explode('::',$value);
if(sizeof($type)>1){
if(!is_array($out[$type[0]]))
$out[$type[0]] = array();
$out[$type[0]][] = $type[1];
} else {
$out[] = $value;
}
}
return $out;
}
print_r(g('Sample text, [/text to extract/] Rest of sample text [/WEB::http://
google.com/] bla bla bla. ','[/','/]'));
?>
results:
Array
(
[0] => text to extract
[WEB] => Array
(
[0] => http://google.com
)
)
Can be helpfull to custom parsing :)
===============================================================================
routine to return -1 if there is no match for strpos
===============================================================================
Code like this:
gets repetitive, is not very self-explanatory, and most people handle it
incorrectly anyway. Make your life easier:
Then, you may do:
===============================================================================
The most straightforward way to prevent this function from returning 0 is:
strpos('x'.$haystack, $needle, 1)
The 'x' is simply a garbage character which is only there to move everything 1
position.
The number 1 is there to make sure that this 'x' is ignored in the search.
This way, if $haystack starts with $needle, then the function returns 1 (rather
than 0).
===============================================================================
It is interesting to be aware of the behavior when the treatment of strings
with characters using different encodings.
===============================================================================
## html
# HEading

Click here to go to the support pages.
Click here to submit a bug report.
Click here to request a feature.
(Again, please note, if you ask a question, report a bug, or request a feature,
your note will be deleted.)
***heading***
===============================================================================
"case insensitive".
define('STRPOSM_NC' , 2); // NC => "needle case".
define('STRPOSM_MATCH_AS_INDEX', 4);
function strposm($haystack, $needles, $offset = 0, &$match = null, $flags = 0)
{
// In the special case where $needles is not an array, simply wrap
// strpos and stripos for performance reasons.
if (!is_array($needles)) {
$func = $flags & STRPOSM_CI ? 'stripos' : 'strpos';
$pos = $func($haystack, $needles, $offset);
if ($pos !== false) {
$match = (($flags & STRPOSM_MATCH_AS_INDEX)
? 0
: (($flags & STRPOSM_NC)
? $needles
: substr($haystack, $pos, strlen($needles))
)
);
return $pos;
} else goto strposm_no_match;
}
// $needles is an array. Proceed appropriately, initially by...
// ...escaping regular expression meta characters in the needles.
$needles_esc = array_map('preg_quote', $needles);
// If either of the "needle case" or "match as index" flags are set,
// then create a sub-match for each escaped needle by enclosing it in
// parentheses. We use these later to find the index of the matching
// needle.
if (($flags & STRPOSM_NC) || ($flags & STRPOSM_MATCH_AS_INDEX)) {
$needles_esc = array_map(
function($needle) {return '('.$needle.')';},
$needles_esc
);
}
// Create the regular expression pattern to search for all needles.
$pattern = '('.implode('|', $needles_esc).')';
// If the "case insensitive" flag is set, then modify the regular
// expression with "i", meaning that the match is "caseless".
if ($flags & STRPOSM_CI) $pattern .= 'i';
// Find the first match, including its offset.
if (preg_match($pattern, $haystack, $matches, PREG_OFFSET_CAPTURE, $offset
)) {
// Pull the first entry, the overall match, out of the matches array.
$found = array_shift($matches);
// If we need the index of the matching needle, then...
if (($flags & STRPOSM_NC) || ($flags & STRPOSM_MATCH_AS_INDEX)) {
// ...find the index of the sub-match that is identical
// to the overall match that we just pulled out.
// Because sub-matches are in the same order as needles,
// this is also the index into $needles of the matching
// needle.
$index = array_search($found, $matches);
}
// If the "match as index" flag is set, then return in $match
// the matching needle's index, otherwise...
$match = (($flags & STRPOSM_MATCH_AS_INDEX)
? $index
// ...if the "needle case" flag is set, then index into
// $needles using the previously-determined index to return
// in $match the matching needle in needle case, otherwise...
: (($flags & STRPOSM_NC)
? $needles[$index]
// ...by default, return in $match the matching needle in
// haystack case.
: $found[0]
)
);
// Return the captured offset.
return $found[1];
}
strposm_no_match:
// Nothing matched. Set appropriate return values.
$match = ($flags & STRPOSM_MATCH_AS_INDEX) ? false : null;
return false;
}
?>
===============================================================================
strpos: Want to find lines in text file, NOT beginning with a comment (// for
example)?
That way it Works:
$komm=strpos($var,'//');
if($komm === FALSE || $komm == TRUE){}
Generally, it is a nonsense. Why 'strpos' cant ALWAYS output an integer?
===============================================================================
This function will return 0 if the string that you are searching matches i.e.
needle matches the haystack
{code}
echo strpos('bla', 'bla');
{code}
Output: 0
===============================================================================
This is a function I wrote to find all occurrences of a string, using strpos
recursively.
This is how you use it:
'.$pos
.'
';
}
} else {
echo '"'.$search.'" not found in "'.$string.'"';
}
?>
===============================================================================
A pair of functions to replace every nth occurrence of a string with another
string, starting at any position in the haystack. The first works on a string
and the second works on a single-level array of strings, treating it as a
single string for replacement purposes (any needles split over two array
elements are ignored).
Can be used for formatting dynamically-generated HTML output without touching
the original generator: e.g. add a newLine class tag to every third item in a
floated list, starting with the fourth item.
= strlen($haystack) or substr_count($haystack, $needle, $pos) <
$first) return $haystack;
$firstpos = strnposr($haystack, $needle, $first, $pos);
$nl = strlen($needle);
$qty = floor(substr_count($haystack, $needle, $firstpos + 1)/$interval);
do { //in reverse order
$nextpos = strnposr($haystack, $needle, ($qty * $interval) + 1, $firstpos);
$qty--;
$haystack = substr_replace($haystack, $repl, $nextpos, $nl);
} while ($nextpos > $firstpos);
return $haystack;
}
//$needle = string to find
//$repl = string to replace needle
//$haystack = string to do replacing in
//$interval = number of needles in loop
//$first=1 = first occurrence of needle to replace (defaults to first)
//$pos=0 = position in haystack string to start from (defaults to first)
//replace every nth occurrence of $needle with $repl, starting from any
position, in a single-level array
function arr_replace_int($needle, $repl, $arr, $interval, $first=1, $pos=0,
$glue='|+|') {
if (!is_array($arr)) return $arr;
foreach($arr as $key=>$value){
if (is_array($arr[$key])) return $arr;
}
$haystack = implode($glue, $arr);
$haystack = str_replace_int($needle, $repl, $haystack, $interval, $first,
$pos);
$tarr = explode($glue, $haystack);
$i = 0;
foreach($arr as $key=>$value){
$arr[$key] = $tarr[$i];
$i++;
}
return $arr;
}
?>
If $arr is not an array, or a multilevel array, it is returned unchanged.
===============================================================================
strpos that accepts an array for $needle
===============================================================================
TO find the position specific word in a para:-
\" $find \" was found on position : $string_pos
" ;
$start_pos = $string_pos + $find_leg;
}
?>
===============================================================================
The above example will output
ID 100 in $check_me_in I found in value '100,101'
ID 200 in $check_me_in I found in value '200,201'
ID 300 in $check_me_in I found in value '300,301'
===============================================================================
This function finds postion of nth occurence of a letter starting from offset.
===============================================================================
A strpos modification to return an array of all the positions of a needle in
the haystack
= $i){
$i = $offset;
$result[] = $offset;
}
}
}
return $result;
}
?>
example:-
===============================================================================
If you would like to find all occurences of a needle inside a haystack you
could use this function strposall($haystack,$needle);. It will return an array
with all the strpos's.
===============================================================================
if you want need a fast function to find the first occurrence of any ch element
of an needle array this function might be of use:
0,'\''=>0,'>'=>0, ' '=>0, "\n"=>0
), $surl);
function strpos_needle_array(& $text, $needle_ary, $offset=0){
for($ch_pos=$offset;$ch_pos
===============================================================================
If you want to get all positions in an array, you can use this function. If the
optional parameter count is especified, the function will put there the number
of matches.
strlen($pajar)) trigger_error("strallpos(): Offset not
contained in string.", E_USER_WARNING);
$match = array();
for ($count=0; (($pos = strpos($pajar, $aguja, $offset)) !== false); $count
++) {
$match[] = $pos;
$offset = $pos + strlen($aguja);
}
return $match;
}
?>
===============================================================================
Many people look for in_string which does not exist in PHP, so, here's the most
efficient form of in_string() (that works in both PHP 4/5) that I can think of:
===============================================================================
This is a bit more useful when scanning a large string for all occurances
between 'tags'.
,
If no second tag is specified, then match between identical tags
Returns an array indexed with the encapsulated text, which is in turn
a sub-array, containing the position of each item.
Notes:
strpos($needle,$haystack,$offset)
substr($string,$start,$length)
====================================================================*/
if( $s2 === false ) { $s2 = $s1; }
$result = array();
$L1 = strlen($s1);
$L2 = strlen($s2);
if( $L1==0 || $L2==0 ) {
return false;
}
do {
$pos1 = strpos($s,$s1,$offset);
if( $pos1 !== false ) {
$pos1 += $L1;
$pos2 = strpos($s,$s2,$pos1);
if( $pos2 !== false ) {
$key_len = $pos2 - $pos1;
$this_key = substr($s,$pos1,$key_len);
if( !array_key_exists($this_key,$result) ) {
$result[$this_key] = array();
}
$result[$this_key][] = $pos1;
$offset = $pos2 + $L2;
} else {
$pos1 = false;
}
}
} while($pos1 !== false );
return $result;
}
?>
===============================================================================
Beware the mindless "if needle is not string":
# php -r 'var_dump(strpos("X1234567",5));'
bool(false)
# php -r 'var_dump(strpos("X1234567","5"));'
int(5)
===============================================================================
The Situation:
I wanted to return TRUE if strpos returned position 0, and only position 0,
without the added overhead of preg_match.
The Solution:
As PHP treats 0 (zero) as NULL, and strpos returns the int 0 (but not NULL), I
used type casting and the "===" comparison operator (as it compares types) to
resolve my issue.
Returns:
db is in position zero
This returns:
db is in NOT position zero
===============================================================================
this function returns the text between 2 strings:
if $s1 or $s2 are not found, $mid_url will be empty
to add an offset, simply compare $pos_s to the offset, and only let it continue
if the offset is smaller then $pos_s.
===============================================================================
Dan Brown and I had a discussion on the PHP list about the speed difference
between the popular three string searching techniques. He wrote a simple timing
test, and I adapted it further. The end result is that all three are very close
and not even noticeable for sets < 1M. Although, technically strpos() is about
twice as fast (as the docs allude to above). Here it is for your own amusement
and testing purposes.
array of 10,000
Array
(
[strpos] => 0.00766682624817
[substr] => 0.0116670131683
[preg_match] => 0.0124950408936
)
array of 100,000
Array
(
[strpos] => 0.0817799568176
[substr] => 0.120522975922
[preg_match] => 0.125612974167
)
array of 1,000,000
Array
(
[strpos] => 0.805890083313
[substr] => 1.19799995422
[preg_match] => 1.25615906715
)
I ran out of memory with more than 1M array elements.
===============================================================================
here's a php implementation of stdc++ string class find_first_of using strpos.
strlen($haystack)? FALSE: $index);
}
?>
Example:
This prints out:
5
24
31
32
===============================================================================
This function finds ALL occurrences of a substring, returning an array of
indexes referring to the start of each occurrence. Overlapping subtrings are
not included.
===============================================================================
What the manual says about "if $needle is not a string" is confusing.
in fact, strpos() compares strings, and nothing else.
Example:
$haystack = "123456789";
$needle = 2;
strpos($haystack, $needle) returns boolean false
$needle = "2";
strpos($haystack, $needle) returns 1;
My real life problem were timestamps. I had a list of timestamps like this: "!
!!..." Then I tried to find out, wheter an
actualy by "mktime()" generated timestamp is found in this list or not. But
strpos() returned always boolean 0, because mktime() results are integers.
It worked only like this:
strpos($timestamp_list, strval($mktime_result))
may be helpfull for others...
Niklaus
===============================================================================
Don't know if already posted this, but if I did this is an improvement.
This function will check if a string contains a needle. It _will_ work with
arrays and multidimensional arrays (I've tried with a > 16 dimensional array
and had no problem).
===============================================================================
I wasn't aware of the !== operator, only the === for false. I was using this
code on strpos:
This gave a false if the string was found at position 0, which is weird.
However using
Gives no such error and seems to work correctly
===============================================================================
So I needed a function to check if a string contains a string. But that also
works with arrays. And multidimensional arrays.
Well commented, because I'm sharing the source I use this in.
===============================================================================
Extend (ohcc at 163 dot com)s comment:
Be careful when the $haystack or $needle parameter is an integer.
If you are not sure of its type, you should convert it into a string.
===============================================================================
Using strpos can be tricky sometimes. To reuse it for one search you can use
this form:
For example:
Clearly we see that the position will be 0 but the $found will be true and so
we can use more than one time of if ($found) which is much easier.
To further reuse it we could make a very short function:
Wonder why php didn't have such function for easier use?


Ethiopia says its 1st satellite will launch next month
ADDIS ABABA, Ethiopia (AP) - Ethiopian officials say the country will launch its first ever satellite next month.
It is the latest example of space ambitions by several African nations.
The satellite was built in China and will be launched from a site there.
Ethiopia’s Innovation and Technology Minister Getahun Mekuria on Friday told reporters the satellite will be used for agricultural, mining, environmental protection and earth observatory purposes.
The minister said Ethiopian engineers took part in the satellite’s construction.
A control center has been set up on the outskirts of Ethiopia’s capital, Addis Ababa.
Sign up for Daily Newsletters
Copyright © 2019 The Washington Times, LLC.
Please read our comment policy before commenting.


▶
Algorithm
Equal-Power Panning
HRTF
Physical model
Head diameter:
meters
Settings
Max Distance:
meters
Enable Collisions
Playback:
Headphones
Speakers
Crosstalk Cancellation
Speaker distance:
meters
Listener distance:
meters
Head diameter:
meters
Elevation


Your Journey Starts Here
Milford Sound, South Island
Māori: [aɔˈtɛaɾɔa] the name for New Zealand originally used by the Māori people
Plan
Go
Explore
Home to the iconic Sky Tower with breathtaking views of Viaduct Harbour, full of superyachts and lined with bars and cafes. Perfect for that city break but still only a stones throw away from the white sand beaches of Waiheke island
The capital of New Zealand, sits near the North Island’s southernmost point on the Cook Strait. A compact city, with a beautiful waterfront promenade, sandy beaches, a working harbour and some of the best museums in New Zealand
The picturesque coastal town of Kaikoura is the perfect place for marine life encounters. The village is caught between the rugged Seaward Kaikōura Range and the Pacific Ocean, surrounded by snow-capped mountains and sun kissed beaches
Rotorua named after the lake it's set around, renowned for its geothermal activity and Maori culture with one of the few living Maori villages. Find bubbling mud pools and the 30m-tall Pohutu Geyser, which erupts many times daily
The adrenaline junkies playground. Queenstown is the home of the original bungy jump, skydiving over the Southern alps, and the hub of winter sports in the Southern hemisphere all taking place in one of the most picturesque places in earth
One of the most dramatic and beautiful parts of New Zealand; the power of Fiordland's scenery never fails to enthral travellers
One of the steepest glaciers in New Zealand, descending from its origins high in the Southern Alps deep into the lush native rainforest of Westland's National Park
Abel Tasman National Park is New Zealand's smallest national park, inviting sandy beaches fill the spaces between trees and tide line. Crystal clear streams tumble down mossy valleys to join the ocean
Waiheke is known for it's high quality red wines. There are around 30 boutique wineries scattered about, many with tasting rooms, delightful restaurants and breathtaking views
The Nevis Bungy is a bungee jumping platform in the Southern Alps near Queenstown. It is the third highest bungee jumping platform in the world at a height of 134 metres


{% extends "basic-template.html" %} {% block title %} Linear system {% endblock %} {% block content %}
Let's determine $\Gamma_k$ as following: $$ \Gamma_k = \| \sum_{p=0}^{n} (\vec{x_i}, \vec{x_j})^p \|_{i,j=1}^{k} $$ Where $k$ stands for count of nodes, $n$ is largest power in sum and $k$ stands for dimention of vector space.
Let's say we calculate $\vec{x_i} = (\alpha_{i, 1}, \alpha_{i, 2}, \dots, \alpha_{i, m}), i=\overline{1, k}$. Also, we are only talking about $\alpha \in [0; 1]$
We want to calculate inverted matrix $\Gamma_k^{-1}$ and it's allowed to set $n, m, k$ and $f(i, j)$ which will determine $\alpha_{i, j}$