public class Canvas
extends java.lang.Object
For more information about how to use Canvas, read the Canvas and Drawables developer guide.
| Modifier and Type | Class and Description |
|---|---|
static class |
Canvas.EdgeType |
static interface |
Canvas.Saveflags |
static class |
Canvas.VertexMode |
| Modifier and Type | Field and Description |
|---|---|
static int |
ALL_SAVE_FLAG
Restore everything when restore() is called (standard save flags).
|
static int |
CLIP_SAVE_FLAG
Restore the current clip when restore() is called.
|
static int |
CLIP_TO_LAYER_SAVE_FLAG
Clip drawing to the bounds of the offscreen layer, omit at your own peril.
|
static int |
FULL_COLOR_LAYER_SAVE_FLAG
The layer requires full 8-bit precision for each color channel.
|
static int |
HAS_ALPHA_LAYER_SAVE_FLAG
The layer requires a per-pixel alpha channel.
|
static int |
MATRIX_SAVE_FLAG
Restore the current matrix when restore() is called.
|
protected int |
mDensity |
protected long |
mNativeCanvasWrapper
Should only be assigned in constructors (or setBitmap if software canvas),
freed in finalizer.
|
protected int |
mScreenDensity
Used to determine when compatibility scaling is in effect.
|
static boolean |
sCompatibilityRestore |
| Constructor and Description |
|---|
Canvas()
Construct an empty raster canvas.
|
Canvas(Bitmap bitmap)
Construct a canvas with the specified bitmap to draw into.
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
checkRange(int length,
int offset,
int count) |
boolean |
clipPath(Path path)
Intersect the current clip with the specified path.
|
boolean |
clipPath(Path path,
Region.Op op)
Modify the current clip with the specified path.
|
boolean |
clipRect(float left,
float top,
float right,
float bottom)
Intersect the current clip with the specified rectangle, which is
expressed in local coordinates.
|
boolean |
clipRect(float left,
float top,
float right,
float bottom,
Region.Op op)
Modify the current clip with the specified rectangle, which is
expressed in local coordinates.
|
boolean |
clipRect(int left,
int top,
int right,
int bottom)
Intersect the current clip with the specified rectangle, which is
expressed in local coordinates.
|
boolean |
clipRect(Rect rect)
Intersect the current clip with the specified rectangle, which is
expressed in local coordinates.
|
boolean |
clipRect(RectF rect)
Intersect the current clip with the specified rectangle, which is
expressed in local coordinates.
|
boolean |
clipRect(RectF rect,
Region.Op op)
Modify the current clip with the specified rectangle.
|
boolean |
clipRect(Rect rect,
Region.Op op)
Modify the current clip with the specified rectangle, which is
expressed in local coordinates.
|
boolean |
clipRegion(Region region)
Deprecated.
Unlike all other clip calls this API does not respect the
current matrix. Use
clipRect(Rect) as an alternative. |
boolean |
clipRegion(Region region,
Region.Op op)
Deprecated.
Unlike all other clip calls this API does not respect the
current matrix. Use
clipRect(Rect) as an alternative. |
void |
concat(Matrix matrix)
Preconcat the current matrix with the specified matrix.
|
void |
drawArc(float left,
float top,
float right,
float bottom,
float startAngle,
float sweepAngle,
boolean useCenter,
Paint paint)
Draw the specified arc, which will be scaled to fit inside the
specified oval.
|
void |
drawArc(RectF oval,
float startAngle,
float sweepAngle,
boolean useCenter,
Paint paint)
Draw the specified arc, which will be scaled to fit inside the
specified oval.
|
void |
drawARGB(int a,
int r,
int g,
int b)
Fill the entire canvas' bitmap (restricted to the current clip) with the
specified ARGB color, using srcover porterduff mode.
|
void |
drawBitmap(Bitmap bitmap,
float left,
float top,
Paint paint)
Draw the specified bitmap, with its top/left corner at (x,y), using
the specified paint, transformed by the current matrix.
|
void |
drawBitmap(Bitmap bitmap,
Matrix matrix,
Paint paint)
Draw the bitmap using the specified matrix.
|
void |
drawBitmap(Bitmap bitmap,
Rect src,
RectF dst,
Paint paint)
Draw the specified bitmap, scaling/translating automatically to fill
the destination rectangle.
|
void |
drawBitmap(Bitmap bitmap,
Rect src,
Rect dst,
Paint paint)
Draw the specified bitmap, scaling/translating automatically to fill
the destination rectangle.
|
void |
drawBitmap(int[] colors,
int offset,
int stride,
float x,
float y,
int width,
int height,
boolean hasAlpha,
Paint paint)
Deprecated.
Usage with a
hardware accelerated canvas
requires an internal copy of color buffer contents every time this method is called. Using a
Bitmap avoids this copy, and allows the application to more explicitly control the lifetime
and copies of pixel data. |
void |
drawBitmap(int[] colors,
int offset,
int stride,
int x,
int y,
int width,
int height,
boolean hasAlpha,
Paint paint)
Deprecated.
Usage with a
hardware accelerated canvas
requires an internal copy of color buffer contents every time this method is called. Using a
Bitmap avoids this copy, and allows the application to more explicitly control the lifetime
and copies of pixel data. |
void |
drawBitmapMesh(Bitmap bitmap,
int meshWidth,
int meshHeight,
float[] verts,
int vertOffset,
int[] colors,
int colorOffset,
Paint paint)
Draw the bitmap through the mesh, where mesh vertices are evenly
distributed across the bitmap.
|
void |
drawCircle(float cx,
float cy,
float radius,
Paint paint)
Draw the specified circle using the specified paint.
|
void |
drawColor(int color)
Fill the entire canvas' bitmap (restricted to the current clip) with the
specified color, using srcover porterduff mode.
|
void |
drawColor(int color,
PorterDuff.Mode mode)
Fill the entire canvas' bitmap (restricted to the current clip) with the
specified color and porter-duff xfermode.
|
void |
drawLine(float startX,
float startY,
float stopX,
float stopY,
Paint paint)
Draw a line segment with the specified start and stop x,y coordinates,
using the specified paint.
|
void |
drawLines(float[] pts,
int offset,
int count,
Paint paint)
Draw a series of lines.
|
void |
drawLines(float[] pts,
Paint paint) |
void |
drawOval(float left,
float top,
float right,
float bottom,
Paint paint)
Draw the specified oval using the specified paint.
|
void |
drawOval(RectF oval,
Paint paint)
Draw the specified oval using the specified paint.
|
void |
drawPaint(Paint paint)
Fill the entire canvas' bitmap (restricted to the current clip) with
the specified paint.
|
void |
drawPaintText(java.lang.String text,
int start,
int end,
float x,
float y,
Paint paint)
Draw the text, with origin at (x,y), using the specified paint.
|
void |
drawPatch(NinePatch patch,
RectF dst,
Paint paint)
Draws the specified bitmap as an N-patch (most often, a 9-patches.)
|
void |
drawPatch(NinePatch patch,
Rect dst,
Paint paint)
Draws the specified bitmap as an N-patch (most often, a 9-patches.)
|
void |
drawPath(Path path,
Paint paint)
Draw the specified path using the specified paint.
|
void |
drawPicture(Picture picture)
Save the canvas state, draw the picture, and restore the canvas state.
|
void |
drawPicture(Picture picture,
Rect dst)
Draw the picture, stretched to fit into the dst rectangle.
|
void |
drawPicture(Picture picture,
RectF dst)
Draw the picture, stretched to fit into the dst rectangle.
|
void |
drawPoint(float x,
float y,
Paint paint)
Helper for drawPoints() for drawing a single point.
|
void |
drawPoints(float[] pts,
int offset,
int count,
Paint paint)
Draw a series of points.
|
void |
drawPoints(float[] pts,
Paint paint)
Helper for drawPoints() that assumes you want to draw the entire array
|
void |
drawPosText(char[] text,
int index,
int count,
float[] pos,
Paint paint)
Deprecated.
|
void |
drawPosText(java.lang.String text,
float[] pos,
Paint paint)
Deprecated.
|
void |
drawRect(float left,
float top,
float right,
float bottom,
Paint paint)
Draw the specified Rect using the specified paint.
|
void |
drawRect(RectF rect,
Paint paint)
Draw the specified Rect using the specified paint.
|
void |
drawRect(Rect r,
Paint paint)
Draw the specified Rect using the specified Paint.
|
void |
drawRGB(int r,
int g,
int b)
Fill the entire canvas' bitmap (restricted to the current clip) with the
specified RGB color, using srcover porterduff mode.
|
void |
drawRoundRect(float left,
float top,
float right,
float bottom,
float rx,
float ry,
Paint paint)
Draw the specified round-rect using the specified paint.
|
void |
drawRoundRect(RectF rect,
float rx,
float ry,
Paint paint)
Draw the specified round-rect using the specified paint.
|
void |
drawText(char[] text,
int index,
int count,
float x,
float y,
Paint paint)
Draw the text, with origin at (x,y), using the specified paint.
|
void |
drawText(java.lang.CharSequence text,
int start,
int end,
float x,
float y,
Paint paint)
Draw the specified range of text, specified by start/end, with its
origin at (x,y), in the specified Paint.
|
void |
drawText(java.lang.String text,
float x,
float y,
Paint paint)
Draw the text, with origin at (x,y), using the specified paint.
|
void |
drawTextOnPath(char[] text,
int index,
int count,
Path path,
float hOffset,
float vOffset,
Paint paint)
Draw the text, with origin at (x,y), using the specified paint, along
the specified path.
|
void |
drawTextOnPath(java.lang.String text,
Path path,
float hOffset,
float vOffset,
Paint paint)
Draw the text, with origin at (x,y), using the specified paint, along
the specified path.
|
void |
drawTextRun(char[] text,
int index,
int count,
int contextIndex,
int contextCount,
float x,
float y,
boolean isRtl,
Paint paint)
Draw a run of text, all in a single direction, with optional context for complex text
shaping.
|
void |
drawTextRun(java.lang.CharSequence text,
int start,
int end,
int contextStart,
int contextEnd,
float x,
float y,
boolean isRtl,
Paint paint)
Draw a run of text, all in a single direction, with optional context for complex text
shaping.
|
void |
drawVertices(Canvas.VertexMode mode,
int vertexCount,
float[] verts,
int vertOffset,
float[] texs,
int texOffset,
int[] colors,
int colorOffset,
short[] indices,
int indexOffset,
int indexCount,
Paint paint)
Draw the array of vertices, interpreted as triangles (based on mode).
|
static void |
freeCaches()
Free up as much memory as possible from private caches (e.g.
|
static void |
freeTextLayoutCaches()
Free up text layout caches
|
Rect |
getClipBounds()
Retrieve the bounds of the current clip (in local coordinates).
|
boolean |
getClipBounds(Rect bounds)
Return the bounds of the current clip (in local coordinates) in the
bounds parameter, and return true if it is non-empty.
|
int |
getDensity()
Returns the target density of the canvas.
|
DrawFilter |
getDrawFilter() |
protected GL |
getGL()
Deprecated.
This method is not supported and should not be invoked.
|
int |
getHeight()
Returns the height of the current drawing layer
|
Matrix |
getMatrix()
Deprecated.
|
void |
getMatrix(Matrix ctm)
Deprecated.
|
int |
getMaximumBitmapHeight()
Returns the maximum allowed height for bitmaps drawn with this canvas.
|
int |
getMaximumBitmapWidth()
Returns the maximum allowed width for bitmaps drawn with this canvas.
|
long |
getNativeCanvasWrapper() |
int |
getSaveCount()
Returns the number of matrix/clip states on the Canvas' private stack.
|
int |
getWidth()
Returns the width of the current drawing layer
|
void |
insertInorderBarrier() |
void |
insertReorderBarrier() |
boolean |
isHardwareAccelerated()
Indicates whether this Canvas uses hardware acceleration.
|
boolean |
isOpaque()
Return true if the device that the current layer draws into is opaque
(i.e.
|
boolean |
isRecordingFor(java.lang.Object o) |
boolean |
quickReject(float left,
float top,
float right,
float bottom,
Canvas.EdgeType type)
Return true if the specified rectangle, after being transformed by the
current matrix, would lie completely outside of the current clip.
|
boolean |
quickReject(Path path,
Canvas.EdgeType type)
Return true if the specified path, after being transformed by the
current matrix, would lie completely outside of the current clip.
|
boolean |
quickReject(RectF rect,
Canvas.EdgeType type)
Return true if the specified rectangle, after being transformed by the
current matrix, would lie completely outside of the current clip.
|
void |
release()
Releases the resources associated with this canvas.
|
void |
restore()
This call balances a previous call to save(), and is used to remove all
modifications to the matrix/clip state since the last save call.
|
void |
restoreToCount(int saveCount)
Efficient way to pop any calls to save() that happened after the save
count reached saveCount.
|
void |
rotate(float degrees)
Preconcat the current matrix with the specified rotation.
|
void |
rotate(float degrees,
float px,
float py)
Preconcat the current matrix with the specified rotation.
|
int |
save()
Saves the current matrix and clip onto a private stack.
|
int |
save(int saveFlags)
Based on saveFlags, can save the current matrix and clip onto a private
stack.
|
int |
saveLayer(float left,
float top,
float right,
float bottom,
Paint paint)
Convenience for saveLayer(left, top, right, bottom, paint,
ALL_SAVE_FLAG ) |
int |
saveLayer(float left,
float top,
float right,
float bottom,
Paint paint,
int saveFlags)
Helper version of saveLayer() that takes 4 values rather than a RectF.
|
int |
saveLayer(RectF bounds,
Paint paint)
Convenience for saveLayer(bounds, paint,
ALL_SAVE_FLAG ) |
int |
saveLayer(RectF bounds,
Paint paint,
int saveFlags)
This behaves the same as save(), but in addition it allocates and
redirects drawing to an offscreen bitmap.
|
int |
saveLayerAlpha(float left,
float top,
float right,
float bottom,
int alpha)
Helper for saveLayerAlpha(left, top, right, bottom, alpha,
ALL_SAVE_FLAG ) |
int |
saveLayerAlpha(float left,
float top,
float right,
float bottom,
int alpha,
int saveFlags)
Helper for saveLayerAlpha() that takes 4 values instead of a RectF.
|
int |
saveLayerAlpha(RectF bounds,
int alpha)
Convenience for saveLayerAlpha(bounds, alpha,
ALL_SAVE_FLAG ) |
int |
saveLayerAlpha(RectF bounds,
int alpha,
int saveFlags)
This behaves the same as save(), but in addition it allocates and
redirects drawing to an offscreen bitmap.
|
void |
scale(float sx,
float sy)
Preconcat the current matrix with the specified scale.
|
void |
scale(float sx,
float sy,
float px,
float py)
Preconcat the current matrix with the specified scale.
|
void |
setBitmap(Bitmap bitmap)
Specify a bitmap for the canvas to draw into.
|
void |
setDensity(int density)
Specifies the density for this Canvas' backing bitmap.
|
void |
setDrawFilter(DrawFilter filter) |
void |
setHighContrastText(boolean highContrastText) |
void |
setMatrix(Matrix matrix)
Completely replace the current matrix with the specified matrix.
|
void |
setScreenDensity(int density) |
void |
setViewport(int width,
int height)
Set the viewport dimensions if this canvas is GL based.
|
void |
skew(float sx,
float sy)
Preconcat the current matrix with the specified skew.
|
protected static void |
throwIfCannotDraw(Bitmap bitmap) |
void |
translate(float dx,
float dy)
Preconcat the current matrix with the specified translation
|
public static boolean sCompatibilityRestore
protected long mNativeCanvasWrapper
protected int mDensity
protected int mScreenDensity
public static final int MATRIX_SAVE_FLAG
public static final int CLIP_SAVE_FLAG
public static final int HAS_ALPHA_LAYER_SAVE_FLAG
public static final int FULL_COLOR_LAYER_SAVE_FLAG
public static final int CLIP_TO_LAYER_SAVE_FLAG
Note: it is strongly recommended to not
omit this flag for any call to saveLayer()
and
saveLayerAlpha()
variants. Not passing this flag generally
triggers extremely poor performance with hardware accelerated rendering.
public static final int ALL_SAVE_FLAG
Note: for performance reasons, it is
strongly recommended to pass this - the complete set of flags - to any
call to saveLayer()
and saveLayerAlpha()
variants.
public Canvas()
Bitmap#DENSITY_NONE
;
this will typically be replaced when a target bitmap is set for the
canvas.public Canvas(Bitmap bitmap)
The initial target density of the canvas is the same as the given bitmap's density.
bitmap
- Specifies a mutable bitmap for the canvas to draw into.public long getNativeCanvasWrapper()
public boolean isRecordingFor(java.lang.Object o)
@Deprecated protected GL getGL()
public boolean isHardwareAccelerated()
public void setBitmap(Bitmap bitmap)
bitmap
- Specifies a mutable bitmap for the canvas to draw into.setDensity(int)
,
getDensity()
public void setViewport(int width, int height)
width
- The width of the viewportheight
- The height of the viewportpublic void setHighContrastText(boolean highContrastText)
public void insertReorderBarrier()
public void insertInorderBarrier()
public boolean isOpaque()
public int getWidth()
public int getHeight()
public int getDensity()
Returns the target density of the canvas. The default density is
derived from the density of its backing bitmap, or
Bitmap#DENSITY_NONE
if there is not one.
setDensity(int)
,
Bitmap#getDensity()
public void setDensity(int density)
Specifies the density for this Canvas' backing bitmap. This modifies
the target density of the canvas itself, as well as the density of its
backing bitmap via Bitmap.setDensity(int)
.
density
- The new target density of the canvas, which is used
to determine the scaling factor when drawing a bitmap into it. Use
Bitmap#DENSITY_NONE
to disable bitmap scaling.getDensity()
,
Bitmap#setDensity(int)
public void setScreenDensity(int density)
public int getMaximumBitmapWidth()
getMaximumBitmapHeight()
public int getMaximumBitmapHeight()
getMaximumBitmapWidth()
public int save()
Subsequent calls to translate,scale,rotate,skew,concat or clipRect, clipPath will all operate as usual, but when the balancing call to restore() is made, those calls will be forgotten, and the settings that existed before the save() will be reinstated.
public int save(int saveFlags)
Note: if possible, use the parameter-less save(). It is simpler and faster than individually disabling the saving of matrix or clip with this method.
Subsequent calls to translate,scale,rotate,skew,concat or clipRect, clipPath will all operate as usual, but when the balancing call to restore() is made, those calls will be forgotten, and the settings that existed before the save() will be reinstated.
saveFlags
- flag bits that specify which parts of the Canvas state
to save/restorepublic int saveLayer(RectF bounds, Paint paint, int saveFlags)
Note: this method is very expensive,
incurring more than double rendering cost for contained content. Avoid
using this method, especially if the bounds provided are large, or if
the CLIP_TO_LAYER_SAVE_FLAG
is omitted from the
saveFlags
parameter. It is recommended to use a
hardware layer
on a View
to apply an xfermode, color filter, or alpha, as it will perform much
better than this method.
All drawing calls are directed to a newly allocated offscreen bitmap. Only when the balancing call to restore() is made, is that offscreen buffer drawn back to the current target of the Canvas (either the screen, it's target Bitmap, or the previous layer).
Attributes of the Paint - alpha
,
Xfermode
, and
ColorFilter
are applied when the
offscreen bitmap is drawn back when restore() is called.
bounds
- May be null. The maximum size the offscreen bitmap
needs to be (in local coordinates)paint
- This is copied, and is applied to the offscreen when
restore() is called.saveFlags
- see _SAVE_FLAG constants, generally ALL_SAVE_FLAG
is recommended
for performance reasons.public int saveLayer(RectF bounds, Paint paint)
ALL_SAVE_FLAG
)public int saveLayer(float left, float top, float right, float bottom, Paint paint, int saveFlags)
public int saveLayer(float left, float top, float right, float bottom, Paint paint)
ALL_SAVE_FLAG
)public int saveLayerAlpha(RectF bounds, int alpha, int saveFlags)
Note: this method is very expensive,
incurring more than double rendering cost for contained content. Avoid
using this method, especially if the bounds provided are large, or if
the CLIP_TO_LAYER_SAVE_FLAG
is omitted from the
saveFlags
parameter. It is recommended to use a
hardware layer
on a View
to apply an xfermode, color filter, or alpha, as it will perform much
better than this method.
All drawing calls are directed to a newly allocated offscreen bitmap. Only when the balancing call to restore() is made, is that offscreen buffer drawn back to the current target of the Canvas (either the screen, it's target Bitmap, or the previous layer).
The alpha
parameter is applied when the offscreen bitmap is
drawn back when restore() is called.
bounds
- The maximum size the offscreen bitmap needs to be
(in local coordinates)alpha
- The alpha to apply to the offscreen when when it is
drawn during restore()saveFlags
- see _SAVE_FLAG constants, generally ALL_SAVE_FLAG
is recommended
for performance reasons.public int saveLayerAlpha(RectF bounds, int alpha)
ALL_SAVE_FLAG
)public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha, int saveFlags)
public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha)
ALL_SAVE_FLAG
)public void restore()
public int getSaveCount()
public void restoreToCount(int saveCount)
saveCount
- The save level to restore to.public void translate(float dx, float dy)
dx
- The distance to translate in Xdy
- The distance to translate in Ypublic void scale(float sx, float sy)
sx
- The amount to scale in Xsy
- The amount to scale in Ypublic final void scale(float sx, float sy, float px, float py)
sx
- The amount to scale in Xsy
- The amount to scale in Ypx
- The x-coord for the pivot point (unchanged by the scale)py
- The y-coord for the pivot point (unchanged by the scale)public void rotate(float degrees)
degrees
- The amount to rotate, in degreespublic final void rotate(float degrees, float px, float py)
degrees
- The amount to rotate, in degreespx
- The x-coord for the pivot point (unchanged by the rotation)py
- The y-coord for the pivot point (unchanged by the rotation)public void skew(float sx, float sy)
sx
- The amount to skew in Xsy
- The amount to skew in Ypublic void concat(Matrix matrix)
matrix
- The matrix to preconcatenate with the current matrixpublic void setMatrix(Matrix matrix)
concat(Matrix)
,
scale(float, float)
, translate(float, float)
and
rotate(float)
instead of this method.matrix
- The matrix to replace the current matrix with. If it is
null, set the current matrix to identity.concat(Matrix)
@Deprecated public void getMatrix(Matrix ctm)
@Deprecated public final Matrix getMatrix()
public boolean clipRect(RectF rect, Region.Op op)
rect
- The rect to intersect with the current clipop
- How the clip is modifiedpublic boolean clipRect(Rect rect, Region.Op op)
rect
- The rectangle to intersect with the current clip.op
- How the clip is modifiedpublic boolean clipRect(RectF rect)
rect
- The rectangle to intersect with the current clip.public boolean clipRect(Rect rect)
rect
- The rectangle to intersect with the current clip.public boolean clipRect(float left, float top, float right, float bottom, Region.Op op)
left
- The left side of the rectangle to intersect with the
current cliptop
- The top of the rectangle to intersect with the current
clipright
- The right side of the rectangle to intersect with the
current clipbottom
- The bottom of the rectangle to intersect with the current
clipop
- How the clip is modifiedpublic boolean clipRect(float left, float top, float right, float bottom)
left
- The left side of the rectangle to intersect with the
current cliptop
- The top of the rectangle to intersect with the current clipright
- The right side of the rectangle to intersect with the
current clipbottom
- The bottom of the rectangle to intersect with the current
clippublic boolean clipRect(int left, int top, int right, int bottom)
left
- The left side of the rectangle to intersect with the
current cliptop
- The top of the rectangle to intersect with the current clipright
- The right side of the rectangle to intersect with the
current clipbottom
- The bottom of the rectangle to intersect with the current
clippublic boolean clipPath(Path path, Region.Op op)
path
- The path to operate on the current clipop
- How the clip is modifiedpublic boolean clipPath(Path path)
path
- The path to intersect with the current clippublic boolean clipRegion(Region region, Region.Op op)
clipRect(Rect)
as an alternative.region
- The region to operate on the current clip, based on opop
- How the clip is modifiedpublic boolean clipRegion(Region region)
clipRect(Rect)
as an alternative.region
- The region to operate on the current clip, based on oppublic DrawFilter getDrawFilter()
public void setDrawFilter(DrawFilter filter)
public boolean quickReject(RectF rect, Canvas.EdgeType type)
rect
- the rect to compare with the current cliptype
- Canvas.EdgeType.AA
if the path should be considered antialiased,
since that means it may affect a larger area (more pixels) than
non-antialiased (Canvas.EdgeType.BW
).public boolean quickReject(Path path, Canvas.EdgeType type)
path
- The path to compare with the current cliptype
- Canvas.EdgeType.AA
if the path should be considered antialiased,
since that means it may affect a larger area (more pixels) than
non-antialiased (Canvas.EdgeType.BW
).public boolean quickReject(float left, float top, float right, float bottom, Canvas.EdgeType type)
left
- The left side of the rectangle to compare with the
current cliptop
- The top of the rectangle to compare with the current
clipright
- The right side of the rectangle to compare with the
current clipbottom
- The bottom of the rectangle to compare with the
current cliptype
- Canvas.EdgeType.AA
if the path should be considered antialiased,
since that means it may affect a larger area (more pixels) than
non-antialiased (Canvas.EdgeType.BW
).public boolean getClipBounds(Rect bounds)
bounds
- Return the clip bounds here. If it is null, ignore it but
still return true if the current clip is non-empty.public final Rect getClipBounds()
public void drawRGB(int r, int g, int b)
r
- red component (0..255) of the color to draw onto the canvasg
- green component (0..255) of the color to draw onto the canvasb
- blue component (0..255) of the color to draw onto the canvaspublic void drawARGB(int a, int r, int g, int b)
a
- alpha component (0..255) of the color to draw onto the canvasr
- red component (0..255) of the color to draw onto the canvasg
- green component (0..255) of the color to draw onto the canvasb
- blue component (0..255) of the color to draw onto the canvaspublic void drawColor(int color)
color
- the color to draw onto the canvaspublic void drawColor(int color, PorterDuff.Mode mode)
color
- the color to draw withmode
- the porter-duff mode to apply to the colorpublic void drawPaint(Paint paint)
paint
- The paint used to draw onto the canvaspublic void drawPoints(float[] pts, int offset, int count, Paint paint)
pts
- Array of points to draw [x0 y0 x1 y1 x2 y2 ...]offset
- Number of values to skip before starting to draw.count
- The number of values to process, after skipping offset
of them. Since one point uses two values, the number of
"points" that are drawn is really (count >> 1).paint
- The paint used to draw the pointspublic void drawPoints(float[] pts, Paint paint)
public void drawPoint(float x, float y, Paint paint)
public void drawLine(float startX, float startY, float stopX, float stopY, Paint paint)
Note that since a line is always "framed", the Style is ignored in the paint.
Degenerate lines (length is 0) will not be drawn.
startX
- The x-coordinate of the start point of the linestartY
- The y-coordinate of the start point of the linepaint
- The paint used to draw the linepublic void drawLines(float[] pts, int offset, int count, Paint paint)
pts
- Array of points to draw [x0 y0 x1 y1 x2 y2 ...]offset
- Number of values in the array to skip before drawing.count
- The number of values in the array to process, after
skipping "offset" of them. Since each line uses 4 values,
the number of "lines" that are drawn is really
(count >> 2).paint
- The paint used to draw the pointspublic void drawLines(float[] pts, Paint paint)
public void drawRect(RectF rect, Paint paint)
rect
- The rect to be drawnpaint
- The paint used to draw the rectpublic void drawRect(Rect r, Paint paint)
r
- The rectangle to be drawn.paint
- The paint used to draw the rectanglepublic void drawRect(float left, float top, float right, float bottom, Paint paint)
left
- The left side of the rectangle to be drawntop
- The top side of the rectangle to be drawnright
- The right side of the rectangle to be drawnbottom
- The bottom side of the rectangle to be drawnpaint
- The paint used to draw the rectpublic void drawOval(RectF oval, Paint paint)
oval
- The rectangle bounds of the oval to be drawnpublic void drawOval(float left, float top, float right, float bottom, Paint paint)
public void drawCircle(float cx, float cy, float radius, Paint paint)
cx
- The x-coordinate of the center of the cirle to be drawncy
- The y-coordinate of the center of the cirle to be drawnradius
- The radius of the cirle to be drawnpaint
- The paint used to draw the circlepublic void drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint)
Draw the specified arc, which will be scaled to fit inside the specified oval.
If the start angle is negative or >= 360, the start angle is treated as start angle modulo 360.
If the sweep angle is >= 360, then the oval is drawn completely. Note that this differs slightly from SkPath::arcTo, which treats the sweep angle modulo 360. If the sweep angle is negative, the sweep angle is treated as sweep angle modulo 360
The arc is drawn clockwise. An angle of 0 degrees correspond to the geometric angle of 0 degrees (3 o'clock on a watch.)
oval
- The bounds of oval used to define the shape and size
of the arcstartAngle
- Starting angle (in degrees) where the arc beginssweepAngle
- Sweep angle (in degrees) measured clockwiseuseCenter
- If true, include the center of the oval in the arc, and
close it if it is being stroked. This will draw a wedgepaint
- The paint used to draw the arcpublic void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, Paint paint)
Draw the specified arc, which will be scaled to fit inside the specified oval.
If the start angle is negative or >= 360, the start angle is treated as start angle modulo 360.
If the sweep angle is >= 360, then the oval is drawn completely. Note that this differs slightly from SkPath::arcTo, which treats the sweep angle modulo 360. If the sweep angle is negative, the sweep angle is treated as sweep angle modulo 360
The arc is drawn clockwise. An angle of 0 degrees correspond to the geometric angle of 0 degrees (3 o'clock on a watch.)
startAngle
- Starting angle (in degrees) where the arc beginssweepAngle
- Sweep angle (in degrees) measured clockwiseuseCenter
- If true, include the center of the oval in the arc, and
close it if it is being stroked. This will draw a wedgepaint
- The paint used to draw the arcpublic void drawRoundRect(RectF rect, float rx, float ry, Paint paint)
rect
- The rectangular bounds of the roundRect to be drawnrx
- The x-radius of the oval used to round the cornersry
- The y-radius of the oval used to round the cornerspaint
- The paint used to draw the roundRectpublic void drawRoundRect(float left, float top, float right, float bottom, float rx, float ry, Paint paint)
rx
- The x-radius of the oval used to round the cornersry
- The y-radius of the oval used to round the cornerspaint
- The paint used to draw the roundRectpublic void drawPath(Path path, Paint paint)
path
- The path to be drawnpaint
- The paint used to draw the pathprotected static void throwIfCannotDraw(Bitmap bitmap)
public void drawPatch(NinePatch patch, Rect dst, Paint paint)
patch
- The ninepatch object to renderdst
- The destination rectangle.paint
- The paint to draw the bitmap with. may be nullpublic void drawPatch(NinePatch patch, RectF dst, Paint paint)
patch
- The ninepatch object to renderdst
- The destination rectangle.paint
- The paint to draw the bitmap with. may be nullpublic void drawBitmap(Bitmap bitmap, float left, float top, Paint paint)
Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height (e.g. BlurMaskFilter), then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated.
If the bitmap and canvas have different densities, this function will take care of automatically scaling the bitmap to draw at the same density as the canvas.
bitmap
- The bitmap to be drawnleft
- The position of the left side of the bitmap being drawntop
- The position of the top side of the bitmap being drawnpaint
- The paint used to draw the bitmap (may be null)public void drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint)
Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height (e.g. BlurMaskFilter), then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated.
This function ignores the density associated with the bitmap. This is because the source and destination rectangle coordinate spaces are in their respective densities, so must already have the appropriate scaling factor applied.
bitmap
- The bitmap to be drawnsrc
- May be null. The subset of the bitmap to be drawndst
- The rectangle that the bitmap will be scaled/translated
to fit intopaint
- May be null. The paint used to draw the bitmappublic void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint)
Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height (e.g. BlurMaskFilter), then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated.
This function ignores the density associated with the bitmap. This is because the source and destination rectangle coordinate spaces are in their respective densities, so must already have the appropriate scaling factor applied.
bitmap
- The bitmap to be drawnsrc
- May be null. The subset of the bitmap to be drawndst
- The rectangle that the bitmap will be scaled/translated
to fit intopaint
- May be null. The paint used to draw the bitmap@Deprecated public void drawBitmap(int[] colors, int offset, int stride, float x, float y, int width, int height, boolean hasAlpha, Paint paint)
hardware accelerated
canvas
requires an internal copy of color buffer contents every time this method is called. Using a
Bitmap avoids this copy, and allows the application to more explicitly control the lifetime
and copies of pixel data.colors
- Array of colors representing the pixels of the bitmapoffset
- Offset into the array of colors for the first pixelstride
- The number of colors in the array between rows (must be
>= width or <= -width).x
- The X coordinate for where to draw the bitmapy
- The Y coordinate for where to draw the bitmapwidth
- The width of the bitmapheight
- The height of the bitmaphasAlpha
- True if the alpha channel of the colors contains valid
values. If false, the alpha byte is ignored (assumed to
be 0xFF for every pixel).paint
- May be null. The paint used to draw the bitmap@Deprecated public void drawBitmap(int[] colors, int offset, int stride, int x, int y, int width, int height, boolean hasAlpha, Paint paint)
hardware accelerated
canvas
requires an internal copy of color buffer contents every time this method is called. Using a
Bitmap avoids this copy, and allows the application to more explicitly control the lifetime
and copies of pixel data.public void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint)
bitmap
- The bitmap to drawmatrix
- The matrix used to transform the bitmap when it is drawnpaint
- May be null. The paint used to draw the bitmapprotected static void checkRange(int length, int offset, int count)
public void drawBitmapMesh(Bitmap bitmap, int meshWidth, int meshHeight, float[] verts, int vertOffset, int[] colors, int colorOffset, Paint paint)
bitmap
- The bitmap to draw using the meshmeshWidth
- The number of columns in the mesh. Nothing is drawn if
this is 0meshHeight
- The number of rows in the mesh. Nothing is drawn if
this is 0verts
- Array of x,y pairs, specifying where the mesh should be
drawn. There must be at least
(meshWidth+1) * (meshHeight+1) * 2 + vertOffset values
in the arrayvertOffset
- Number of verts elements to skip before drawingcolors
- May be null. Specifies a color at each vertex, which is
interpolated across the cell, and whose values are
multiplied by the corresponding bitmap colors. If not null,
there must be at least (meshWidth+1) * (meshHeight+1) +
colorOffset values in the array.colorOffset
- Number of color elements to skip before drawingpaint
- May be null. The paint used to draw the bitmappublic void drawVertices(Canvas.VertexMode mode, int vertexCount, float[] verts, int vertOffset, float[] texs, int texOffset, int[] colors, int colorOffset, short[] indices, int indexOffset, int indexCount, Paint paint)
mode
- How to interpret the array of verticesvertexCount
- The number of values in the vertices array (and
corresponding texs and colors arrays if non-null). Each logical
vertex is two values (x, y), vertexCount must be a multiple of 2.verts
- Array of vertices for the meshvertOffset
- Number of values in the verts to skip before drawing.texs
- May be null. If not null, specifies the coordinates to sample
into the current shader (e.g. bitmap tile or gradient)texOffset
- Number of values in texs to skip before drawing.colors
- May be null. If not null, specifies a color for each
vertex, to be interpolated across the triangle.colorOffset
- Number of values in colors to skip before drawing.indices
- If not null, array of indices to reference into the
vertex (texs, colors) array.indexCount
- number of entries in the indices array (if not null).paint
- Specifies the shader to use if the texs array is non-null.public void drawText(char[] text, int index, int count, float x, float y, Paint paint)
text
- The text to be drawnx
- The x-coordinate of the origin of the text being drawny
- The y-coordinate of the baseline of the text being drawnpaint
- The paint used for the text (e.g. color, size, style)public void drawText(java.lang.String text, float x, float y, Paint paint)
text
- The text to be drawnx
- The x-coordinate of the origin of the text being drawny
- The y-coordinate of the baseline of the text being drawnpaint
- The paint used for the text (e.g. color, size, style)public void drawPaintText(java.lang.String text, int start, int end, float x, float y, Paint paint)
text
- The text to be drawnstart
- The index of the first character in text to drawend
- (end - 1) is the index of the last character in text to drawx
- The x-coordinate of the origin of the text being drawny
- The y-coordinate of the baseline of the text being drawnpaint
- The paint used for the text (e.g. color, size, style)public void drawText(java.lang.CharSequence text, int start, int end, float x, float y, Paint paint)
text
- The text to be drawnstart
- The index of the first character in text to drawend
- (end - 1) is the index of the last character in text
to drawx
- The x-coordinate of origin for where to draw the texty
- The y-coordinate of origin for where to draw the textpaint
- The paint used for the text (e.g. color, size, style)public void drawTextRun(char[] text, int index, int count, int contextIndex, int contextCount, float x, float y, boolean isRtl, Paint paint)
See drawTextRun(CharSequence, int, int, int, int, float, float, boolean, Paint)
for more details. This method uses a character array rather than CharSequence to
represent the string. Also, to be consistent with the pattern established in
drawText(char[], int, int, float, float, Paint)
, in this method count
and contextCount
are used rather
than offsets of the end position; count = end - start, contextCount = contextEnd -
contextStart
.
text
- the text to renderindex
- the start of the text to rendercount
- the count of chars to rendercontextIndex
- the start of the context for shaping. Must be
no greater than index.contextCount
- the number of characters in the context for shaping.
contexIndex + contextCount must be no less than index + count.x
- the x position at which to draw the texty
- the y position at which to draw the textisRtl
- whether the run is in RTL directionpaint
- the paintpublic void drawTextRun(java.lang.CharSequence text, int start, int end, int contextStart, int contextEnd, float x, float y, boolean isRtl, Paint paint)
The run of text includes the characters from start
to end
in the text. In
addition, the range contextStart
to contextEnd
is used as context for the
purpose of complex text shaping, such as Arabic text potentially shaped differently based on
the text next to it.
All text outside the range contextStart..contextEnd
is ignored. The text between
start
and end
will be laid out and drawn.
The direction of the run is explicitly specified by isRtl
. Thus, this method is
suitable only for runs of a single direction. Alignment of the text is as determined by the
Paint's TextAlign value. Further, 0 <= contextStart <= start <= end <= contextEnd
<= text.length
must hold on entry.
Also see android.graphics.Paint#getRunAdvance
for a corresponding method to
measure the text; the advance width of the text drawn matches the value obtained from that
method.
text
- the text to renderstart
- the start of the text to render. Data before this position
can be used for shaping context.end
- the end of the text to render. Data at or after this
position can be used for shaping context.contextStart
- the index of the start of the shaping contextcontextEnd
- the index of the end of the shaping contextx
- the x position at which to draw the texty
- the y position at which to draw the textisRtl
- whether the run is in RTL directionpaint
- the paintdrawTextRun(char[], int, int, int, int, float, float, boolean, Paint)
@Deprecated public void drawPosText(char[] text, int index, int count, float[] pos, Paint paint)
text
- The text to be drawnindex
- The index of the first character to drawcount
- The number of characters to draw, starting from index.pos
- Array of [x,y] positions, used to position each
characterpaint
- The paint used for the text (e.g. color, size, style)@Deprecated public void drawPosText(java.lang.String text, float[] pos, Paint paint)
text
- The text to be drawnpos
- Array of [x,y] positions, used to position each characterpaint
- The paint used for the text (e.g. color, size, style)public void drawTextOnPath(char[] text, int index, int count, Path path, float hOffset, float vOffset, Paint paint)
text
- The text to be drawnpath
- The path the text should follow for its baselinehOffset
- The distance along the path to add to the text's
starting positionvOffset
- The distance above(-) or below(+) the path to position
the textpaint
- The paint used for the text (e.g. color, size, style)public void drawTextOnPath(java.lang.String text, Path path, float hOffset, float vOffset, Paint paint)
text
- The text to be drawnpath
- The path the text should follow for its baselinehOffset
- The distance along the path to add to the text's
starting positionvOffset
- The distance above(-) or below(+) the path to position
the textpaint
- The paint used for the text (e.g. color, size, style)public void drawPicture(Picture picture)
Note: This forces the picture to internally call
Picture#endRecording
in order to prepare for playback.
picture
- The picture to be drawnpublic void drawPicture(Picture picture, RectF dst)
public void drawPicture(Picture picture, Rect dst)
public void release()
public static void freeCaches()
public static void freeTextLayoutCaches()


Welcome! this is my new website and is currently under constructions.
Fousseini Konate
My name is Fousseini Konate, I am currently a junior at Point Park University. Located
in Pittsburgh, Pennsylvania, while I am studying Iformation Technology. I love anything about Technology, and also enjoy telling computer to do amazing things.


Authorities say 3 squatters killed in NYC house fire
by Associated PressNEW YORK (AP) — A fire in an abandoned house in Queens has killed three men who apparently were squatting there.
Authorities say the three victims were in the house on 110th Road in Jamaica when the fire broke out just before midnight Thursday. The unidentified men were pronounced dead at the scene.
About 100 firefighters battled the blaze. A Fire Department spokesman says four of them were treated for minor injuries.
The cause of the fire is under investigation.


Stephen's Blog
Home
Motorbikes
Bikes
Rugby
Contact Us
Site Navigation
Home
Motorbikes
Road Cycling
Rugby
Contact Us
First Name *
Last Name *
Email Address *
Telephone Number
Comments *


GoT2Neo is a small Game of Thrones Wiki built with Flask and Neo4j as Database 2 class project.
Characters Houses Episodes


SendLocation allows you to send out text message with your exact location to multiple contacts at a click of a Button. The application is small,simple and real easy to use. The application works with or without GPS.
HOW TO USE:
To text your location, you need to choose contacts first. Choose as many contacts as you want.
Click the Done Button. On the main screen, you can see the contacts you have chosen.
Once contacts have been chosen, the application saves it for future use.
To change the contacts, hit menu button, click "Add Contacts" and choose your contacts. After the necessary contacts have been selected, click the Send Message Button.
Let the GPS fix your location before clicking the Send Button.
NOTE:
The cell phone must be able to send text message for SendLocation to work properly.
The application must be able to access your contact list to work properly.
The SMS send by your phone will be charged as per your current rate plan.
The data used for finding out your location by SendLocation will be charged as per your current data plan.
For most accurate results, ensure that the GPS is turned on.
The accuracy of the location returned by the network provider is approximate. It may or may not be the correct address.
Ensure that you have Wifi/data connectivity before using the application.


lodsafasdfas
This is a link
Here is some more information about this product that is only revealed once clicked on.


Class TFBuffer
Holds a block of data, suitable to pass, or retrieve from TensorFlow.
Namespace: TensorFlow
Assembly: TensorFlowSharp.dll
Syntax
public class TFBuffer : TensorFlow.TFDisposable
Remarks
Use the TFBuffer to blobs of data into TensorFlow, or to retrieve blocks of data out of TensorFlow.
There are two constructors to wrap existing data, one to wrap blocks that are pointed to by an IntPtr and one that takes a byte array that we want to wrap.
The empty constructor can be used to create a new TFBuffer that can be populated by the TensorFlow library and returned to user code.
Typically, the data consists of a serialized protocol buffer, but other data may also be held in a buffer.
Constructors
TFBuffer()
Initializes a new instance of the TFBuffer class.
Declaration
public TFBuffer ();
TFBuffer(Byte[])
Initializes a new instance of the TFBuffer by making a copy of the provided byte array.
Declaration
public TFBuffer (byte[] buffer);
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | buffer | Buffer of data that will be wrapped. |
Remarks
This constructor makes a copy of the data into an unmanaged buffer, so the byte array is not pinned.
TFBuffer(Byte[], Int32, Int32)
Initializes a new instance of the TFBuffer by making a copy of the provided byte array.
Declaration
public TFBuffer (byte[] buffer, int start, int count);
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | buffer | Buffer of data that will be wrapped. |
| System.Int32 | start | Starting offset into the buffer to wrap. |
| System.Int32 | count | Number of bytes from the buffer to keep. |
Remarks
This constructor makes a copy of the data into an unmanaged buffer, so the byte array is not pinned.
TFBuffer(IntPtr, Int64, TFBuffer+BufferReleaseFunc)
Initializes a new instance of the TFBuffer by wrapping the unmanaged resource pointed by the buffer.
Declaration
public TFBuffer (IntPtr buffer, long size, TensorFlow.TFBuffer.BufferReleaseFunc release);
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | buffer | Pointer to the data that will be wrapped. |
| System.Int64 | size | The size of the buffer to wrap. |
| release | Optional, if not null, this method will be invoked to release the block. |
Remarks
This constructor wraps the buffer as a the data to be held by the TFBuffer, if the release parameter is null, then you must ensure that the data is not released before the TFBuffer is no longer in use. If the value is not null, the provided method will be invoked to release the data when the TFBuffer is disposed, or the contents of the buffer replaced.
Methods
ToArray()
Returns a byte array representing the data wrapped by this buffer.
Declaration
public byte[] ToArray ();
Returns
| Type | Description |
|---|---|
| System.Byte[] | The array. |


Take a look under the hood
easyb is hosted at Google code, which provides an accessible Subversion repository. To checkout easyb's source code, simply type
svn checkout http://easyb.googlecode.com/svn/trunk/easyb easyb-read-only
Building easyb requires Groovy 1.6.0 and Gant 1.6.0. Once you've downloaded the project, in the project's root directory, type gant -p
. You should see something like this:
bundle-docs creates a war file containing static html docs
clean cleans target dir
compile-all compile Groovy & Java classes
compile-behaviors compile Groovy & Java classes in easyb behavior
compile-core compile Groovy & Java classes in easyb core
configuregroovy configures environment to compile w/Groovy
dist create a distribution from the release
doc create documenation from docbook
getdeps retrieves dependencies
init init dirs
init-doc initialize the doc environment
jar create an archive of the project's classfiles
jar-javadocs creates a javadocs jar
jar-sources creates a sources jar
maven-bundle creates an upload bundle for the central maven repository
maven-install install into the default local maven repository
publish-easyb uploads easyb distribution to googlecode
release compile and archive
run-main runs easyb BehaviorRunner class
validate runs and validates both, behaviors and reports
validate-behaviors runs and validates the easyb behaviors
validate-reports runs and validates the easyb reports
To verify everything works, type gant dist
, which will basically run everything (including validation). At the end you should see some .tar.gz
files created and some text like this:
[easyb] 90 total behaviors run with no failures
[easyb] easyb execution passed
Now you are good to go. Now wasn't that easy? If you have any questions or comments, drop us a note on our mailing list.


Traveling through New York Harbor on the water has been enjoyable and
exciting. The trip from Long Island Sound starts with
going under the Throgs Neck Bridge, the timing of this is most
critical. As you go along the East river you get to a spot
called "Hells Gate". At this spot you can have a
current of 4 to 5 knots, hopefully going in the direction
you are; otherwise the trip takes a lot longer.
So by studying the tide tables you are able to time the journey
to coincide with favorable current. On the travel you go
under 10 bridges (of course one is the Brooklyn Bridge), ending
with the Verrazano-Narrows Bridge at the entrance to New York
harbor from the Atlantic Ocean. You also get to view
LaGuardia Airport, Manhattan/downtown New York,
and that heliport in downtown NY that you see in so many movies.
Of course, the Statue of Liberty and the Manhattan skyline, and
on occasion the Queen Elizabeth II.  There
are also all the buildings, some old and others like the new
Trade Center that are still being built.
With all that there is also the boat traffic, some going up and
down the East River but as you get into Manhattan the ferry boat
traffic, the tour boats, and water taxis make the passage rather
bumpy of a ride.
For the four hours it takes you to travel down the East river
and out to the Atlantic it is one of the most diverse and
interesting trips.
09/08/12; New York and the East River
|
|
|
|
|
|
|
|
|
boat speed 5.3 with current 10.4 |
|
| |
|


Stéphane is a full stack developer who grew up in the Bay Area and was fortunate enough to return.
From leading a team in the world of television post production, to traveling the world teaching yoga, meditation and philophy, Stéphane's kindness, clarity, and dedication have followed him into the realm of coding.
A Python and Flask based social media clone. Write small "warbles" and follow other users to see their warbles. Login here!
Close ProjectThe Student Information System at the Rithm School allows both students and staff to interract meaningfully with Rithm School's complex database. SIS is primarily Python running Django with PostgreSQL. Using Django's generic views I created several student and staff pages: some for the students to be able to monitor their own information as well as see upcoming classes and events, some for staff to be able to see studend details and run queries on the database from the app. I also improved site security writing custom middleware to keep track of user login status, even for add-on views that were not covered by built in middleware. As this is software and the data it accesses is property of the Rithm School I cannot link directly to the app.
Close ProjectA React front with Node/Express backend app where you can search for and rate movies.
Close Project


Protypes podcast
Overzicht
Prototype 1
Prototype 2: test 1
Prototype 2: test 2
Prototype 3: test 1
Prototype 3: test 2
Prototype 3: test 3
Final product


--- title: The ggplot package weight: 21 ---
By the end of this section you will:
The most common data visualisation package in RStudio is ggplot. We may install ggplot by using the install.packages()
function. We write install.packages("ggplot2")
and we call the package by using the library()
function.
library(ggplot2)
First of all, as most packages in RStudio the ggplot team created a cheatsheet. You may find it here ggplot Cheatsheet
If we call the ggplot()
function then we will create an empty canvas.
We start by loading our dataset entitled EVS_UK.RData
load("EVS_UK.RData")
ggplot(EVS_UK) # this created an empty plot
the next step is to specify the variables we would like to use, as you know we cannot plot the whole dataset!
To specify which variables we would like to plot we have to include in the function the so called aes() section that specifies the aesthetic mappings, in other words, this section specifies how to map our variables.
Let’s start by creating a bar to see how the aes section works - you already know how to do that but this time we will give a name to our plot.
In our analysis we will use two socio-demographics variables gender and education. Gender is a dichotomous variable describing gender. Education is an ordinal variable with three levels - low, medium, and high.
In the dataset the code of the variable describing gender is EVS_UK$v225
, and the name of the variable describing education is EVS_UK$v243_r_weight
.
Before we proceed, we will give meaningful names to our variable swhile at the same time we will make sure that our new variables are categorical (factor) variable for gender- as it should be. We can easily do that by using the assignment operator \(<-\) and the as.factor
function.
EVS_UK$gender<- factor(EVS_UK$v225,
levels = c(1,2),
labels = c("Men", "Women"))
table(EVS_UK$gender)
##
## Men Women
## 792 996
Note: at the left side of the equation I specified the dataset at which my new variable belongs to - that is EVS_UK
.
We will do the same for the variable describing education and is currently named v243_r_weight
.
Recall, Lecture 2 (Descriptive Statistics) during the lab session we used the same function to rename v243_r_weight
to education
.
In this example education is an ordinal variable with three levels- low, medium, high.
EVS_UK$education <- ordered(EVS_UK$v243_r_weight, #here you specify that this is ordered variable
levels = c(1,2,3), # here you specify the values of the variable
labels = c("Low", "Medium", "High")) #here you specify the names of the values
aes()
is the function used tell ggplot2 which variables to use in our plot.


Covers many important models used in marketing and micro-econometrics applications. The package includes: Bayes Regression (univariate or multivariate dep var), Bayes Seemingly Unrelated Regression (SUR), Binary and Ordinal Probit, Multinomial Logit (MNL) and Multinomial Probit (MNP), Multivariate Probit, Negative Binomial (Poisson) Regression, Multivariate Mixtures of Normals (including clustering), Dirichlet Process Prior Density Estimation with normal base, Hierarchical Linear Models with normal prior and covariates, Hierarchical Linear Models with a mixture of normals prior and covariates, Hierarchical Multinomial Logits with a mixture of normals prior and covariates, Hierarchical Multinomial Logits with a Dirichlet Process prior and covariates, Hierarchical Negative Binomial Regression Models, Bayesian analysis of choice-based conjoint data, Bayesian treatment of linear instrumental variables models, Analysis of Multivariate Ordinal survey data with scale usage heterogeneity (as in Rossi et al, JASA (01)), Bayesian Analysis of Aggregate Random Coefficient Logit Models as in BLP (see Jiang, Manchanda, Rossi 2009) For further reference, consult our book, Bayesian Statistics and Marketing by Rossi, Allenby and McCulloch (Wiley 2005) and Bayesian Non- and Semi-Parametric Methods and Applications (Princeton U Press 2014).
| Version: | 3.1-0.1 |
| Depends: | R (≥ 3.2.0) |
| Imports: | Rcpp (≥ 0.12.0), utils, stats, graphics, grDevices |
| LinkingTo: | Rcpp, RcppArmadillo |
| Suggests: | knitr, rmarkdown |
| Published: | 2017-07-21 |
| Author: | Peter Rossi |
| Maintainer: | Peter Rossi <perossichi at gmail.com> |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| URL: | http://www.perossi.org/home/bsm-1 |
| NeedsCompilation: | yes |
| In views: | Bayesian, Cluster, Distributions, Econometrics, Multivariate |
| CRAN checks: | bayesm results |
| Reference manual: | bayesm.pdf |
| Vignettes: |
Hierarchical Multinomial Logit with Sign Constraints bayesm Overview |
| Package source: | bayesm_3.1-0.1.tar.gz |
| Windows binaries: | r-devel: bayesm_3.1-0.1.zip, r-release: bayesm_3.1-0.1.zip, r-oldrel: bayesm_3.1-0.1.zip |
| OS X binaries: | r-release: bayesm_3.1-0.1.tgz, r-oldrel: bayesm_3.1-0.1.tgz |
| Old sources: | bayesm archive |
| Reverse depends: | compositions, mpbart, ocomposition, siar |
| Reverse imports: | BTYDplus, effectFusion, HBglm, mvProbit |
| Reverse suggests: | ChoiceModelR |
Please use the canonical form https://CRAN.R-project.org/package=bayesm to link to this page.


It's a beginner in Web development.
Read the Mozilla Manifesto to learn even more about the values and principles that guide the pursuit of our mission.


Aamir Liaquat posts heartfelt note for wife on first wedding anniversary
by Entertainment DeskThe internet remained so occupied with arguments surrounding Imran Khan and Nawaz Sharif that it completely forgot about the anniversary of the most beloved couple of the country, Aamir Liaquat and Tuba Aamir.
The two celebrated their one year of marriage on November 16, 2019 and uploaded pictures with each other on their social media. However, Aamir’s caption stirred several questions as it attempted to mock his critics, but managed to express his admiration for his second wife.
He started off by thanking Tuba for facing endless criticism with him, during the time of their marriage. He claimed that the criticism was a ‘storm of envy,’ adding sarcastically that it came from ‘virtuous elements of the society,’ who ‘believed in fornication but refused the sunnah’.
“Thanks my love for coming in my life! November 16, 2018 was the day we faced a storm of envy & enmity together, from so called virtuous elements of our society who believed in fornication but refused the Sunnah of the Prophet (PBUH), the Nikah and forget the meaning of #GharBasana in #OxfordDictionary .”
This was followed by Tuba Aamir’s appreciation post, which was not as controversial, but expressed her feelings for her beloved husband.
The newly found blogger also posted a picture of herself donning a black leather jacket while holding a heart-shaped bouquet of roses. Her caption stated that she had a lovely weekend celebrating both her birthday and her anniversary.
It is pertinent to mention here that Aamir’s second marriage and his take on his first wife, Bushra, stirred quite a controversy and the host had recently expressed the desire to tie the knot for the third time with Fiza Ali.


Avatar
The Last Airbender
Long ago, the four nations lived together in harmony.
Then, everything changed when the Fire Nation attacked.
Only the Avatar, master of all four elements, could stop them, but when the world needed him most, he vanished.
A hundred years passed and my brother and I discovered the new Avatar, an airbender named Aang.
And although his airbending skills are great, he has a lot to learn before he's ready to save anyone.
But I believe Aang can save the world.


Login Here


??
???
0
1
23456789
10
The
New
York
?
?
?
?
vvÕ
cm
copyright
reserved
Botanical
Garden
EX
HERB.
HORT.
REG.
KEW.
Oreopanax
oapitatum
(Jao
Deo.
&
pi
Determined
by
A.
C.
Smith,
1930.
Examined
for
NORTH
AMERICAN
FLORA
01500660
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Context Free Art Playground
Variation
('A'-'ZZZZZZ')
random
Some code examples are taken from
Context Free GitHub repository
.
Project Home at GitHub


Home
Social
Budget
Settings
Garden Members:
Bart
Lisa
Homer
Marge
Add/Remove Members
Friends:
Kyle
Stan
Kenny
Cartman
Butters
Add/Remove Friends


Money Play. How should Red play 51?
pips Red=105 White=97
(CorrectAnswer= 0/0, ErrorScore= 0)
8/7/2 is way too passive, despite’s White’s strong board. With a close race, allowing White to run with 4’s and 6’s is far too meek.
The other factor is the gammon percentage. When Red hits and White fans, Red’s gammon percentage increases significantly. 8/3*, 2/1 is very clear here. Even 8/3*/2 (with no direct covers for the blot) is better than 8/7/2.
As I have mentioned countless times before, aggression is a necessary attribute of any strong backgammon player! Your cup should always be half-full, not half-empty.
The other factor is the gammon percentage. When Red hits and White fans, Red’s gammon percentage increases significantly. 8/3*, 2/1 is very clear here. Even 8/3*/2 (with no direct covers for the blot) is better than 8/7/2.
As I have mentioned countless times before, aggression is a necessary attribute of any strong backgammon player! Your cup should always be half-full, not half-empty.
1. Cubeful 2-ply 8/3* 2/1 Eq.: +0.038 0.580 0.154 0.003 - 0.420 0.160 0.001 2. Cubeful 2-ply 8/3*/2 Eq.: +0.005 (-0.033) 0.576 0.137 0.003 - 0.424 0.139 0.001 3. Cubeful 2-ply 8/2 Eq.: -0.054 (-0.092) 0.538 0.060 0.001 - 0.462 0.035 0.000 4. Cubeful 0-ply 6/5 6/1 Eq.: -0.192 (-0.230) 0.496 0.042 0.000 - 0.504 0.056 0.000 5. Cubeful 0-ply 11/6 2/1 Eq.: -0.229 (-0.267) 0.487 0.086 0.001 - 0.513 0.116 0.001


Warehouse Keeper Parman:
Your enthusiasm is admirable but you aren't ready for the second test yet. Return when you have more experience.


Quantity:
Payment Address:
Street:
Town:
Zip code:
State:
Name on card
Credit Card Number:<PHONE_NUMBER>000004)
CVV2 code
Expiration Date (MMYYYY)
Errors:
Server:
Time to process parameters:
0
Time to access database:
0
Time to process page data:
0
Time to render page:
0
Total time to process:
0


@import common.layout.mainlayout @mainlayout(title = "Welcome to Crakken") {
A web crawler built on Akka and the Play! Framework.
Release the Crakken!


angular-form-builder says: {{ greeting}}
{{item.name}}
setPath
Builder
Form
Show scope
{{input| json}}


Table of Content
When I come across some interesting thought provoking incident or idea I write them. Since all these articles are not about a particular theme or have anything common but are on different topics. So to hint about topic a small text box is added in the end of article title similar to this topic
- Reading "Death - An inside Story" by "Sadhguru"book
- False Hopemoral lesson
- Use of standard keywords while talkingideas
- Why we do jugaad in software features?experience
- Lessons learned from "Rich Dad Poor Dad"finance
- Lessons learned from "The Richest Man in Babylon"finance
- Egg is vegetarian or non vegetarian?food
- Why gold is valuable?finance
- Do we need friends in life?philosophy
- How to make life easy?life lesson
- What is better Job or service?career
- What we are lacking?philosophy
- Important lesson to learn from Lord Krishnalife lesson
- Important lesson to learn from Buddhalife lesson
- Important lesson to learn from Osholife lesson
- Important lesson to learn from Baba Saheb Ambedkarlife lesson
- What questions to ask before marriage from spouse ?relationship
- Why brothers fight ?relationship
- Is there god?philosophy
- Can you connect 3 wells and 3 houses without overlapping pipes?puzzle
- How to sort without comparing the items?programming
- Important lesson to learn from Chanakyaphilosophy
- Important lesson to learn from Ramayan and Mahabharatphilosophy
- How to get motivation?life lesson
- Important lesson to learn from Vishwamitralife lesson


Wim Hof Breathing Method Benefits:
• Boosts your immune system
• Improves concentration
• Improves your mental well-being
• Increases your willpower
• Increases your energy
• Manages some symptoms of depression
• Helps to relieve stress
• Improves your sleep
This powerful breathing method will help you to fight COVID-19.
Learn more about Wim Hof Method on their YouTube or their website.


Synergy (Leopard) won't start at login
-
wig
I can't get synergy to start at login, I have the box checked in the preferences but it won't start at login. The program works if I start in Manually.
Thanks
-
Greg Hurrell
Can you try the following and let me know how you go?
1. In the Synergy preferences, uncheck the "launch at login" checkbox 2. Click "Apply" 3. Now check the "launch at login" checkbox 4. Click "Apply" 5. Test to see if it actually launches at login
-
wig
That Worked!
Thanks for the quick response!
-
Greg Hurrell
Good to know. This isn't actually a Leopard-specific issue, but can happen any time that your login items get "stale". It may have been that your login items somehow got deleted, or not carried over, or otherwise altered when you installed Leopard, or it could have been something else; but the important thing to remember is that the general technique mentioned above is they way to overcome any "staleness" and ensure that Synergy gets re-added to the login items.
-
Greg Hurrell
See also:
Reply
This topic is now closed.


Hello, Sign In
Home
About
Contact
Dashboard
(current)
CREATE YOUR PROFILE
First Name:
Last Name:
Title:
Display Name
CREA License Number:
Phone Number:
Email Address:
Password:
Save


#Heatmaps
#NOTE : This page is made to give the user an idea of how this webpage will be implemented after it is connected to the CCTV of the store. The current prototype is made using available sample videos and layout.
Considering the present situation that we are in, it is not suggessted that more than 3-4 people gather at one place. We are also aware that lockdown is open, so everybody is allowed to visit stores, shopping malls, supermarkets and retail stores without much knowledge about how safe the environment is. So to solve this problem we bring forward to you "LOOK"
Lets LOOK as somethings!
Consider a fashion store, LOOK counts the number of people present in every indivisual section of store like men, women, kids etc using the video recording accumalated using CCTV present in the store itself. In the sample video provided below you can see how LOOK counts the number of people entering and leaving the counter (right side mens and left side womens) and the head count is being taken.
Men's Section Footage
Working Details: Up - Shows the number of people entering the men's section Down - Shows the number of people leaving the men's section.
Womens Section Footage
Working Details: Up - Shows the number of people entering the women's section Down - Shows the number of people leaving the women's section.
This data is stored in the database and helps the stores in many ways. LOOK helps the managing staff of that store to maintain charts regarding the increment or decrement in customer count.
#QUESTION : What help can LOOK provide during pandemic!? Most productive one - HEATMAPS!!
Concentration of people in a particular section : Red - Maximum Yellow - Manageable Green - Minimum
Heatmaps mainly show the concentration of people in one place which can lead to loss of safety during this time. So this chart can help the stores to make their management better and easier. The store management can be informed about the crowding and proper actions can be taken by the present staff to guide people to maintain proper and safer distance from each other. Hence, the outside social distancing can be improved leading to less spread of virus in malls, supermarkets etc.
# BIG PICTURE: As you can see, the video sample above made using deep learning provides us with many features which acts as service for stores and malls to maintain a safe environment and to guide people through this crucial time. Our aim is to not only become helpful for the fashion storeline but also for all available retail stores.


You may want extra credit. This assignment is available for all, but recommended especially if you failed a Disputation, or have many unexcused absences, or missed a lot of reading. (Those who already have a high grade [98+] are welcome, but not encouraged, to take this opportunity.) If you would like to earn some extra credit, here’s how.
Discussion Leading (all classes)
We will pick a date wherein you will read ahead and help start the discussion. I will mentor you in how to prepare for and lead a discussion. To take advantage of this opportunity, let me know sometime before midterms.
 You may design your own question. I must approve the question before you begin. Your question prompt is due a week in advance of the paper. You may draw your question from any of the semester texts, handouts, books, or films. The question must: Be clear; Deeply interest you; Admit of a yes/no answer; Be rooted in one of our semester texts.
- Charles Williams, Descent Into Hell
- A “supernatural thriller” novel about a small town putting on a play, while each character in real life is willfully moving toward heaven or hell.
- C. S. Lewis, Great Divorce
- A fantasy novel about a man who goes to the afterlife, learns about virtue and vice, and witnesses his fellow men willfully choosing heaven or hell.
- Fyodor Dosteyevsky, Notes from the Underground
- An existentialist confessional novel from the rambling memoirs of a bitter, isolated, unnamed narrator who is a retired civil servant living in St. Petersburg.
- Jean Paul Sartre, No Exit
- An existentialist stageplay about three people stuck with each other for ever.
- G. K. Chesterton, What’s Wrong with the World?
- A series of essays on the modern world, its values, beliefs, and errors.
- C. S. Lewis, Mere Christianity
- A popular exploration and defense of the common core of Christian belief, practice, and community.
- Walker Percy, Lost in the Cosmos
- A mock self-help book and social satire on the American value of autonomy, exposing the emptiness of the self.
- Sam Harris, The End of Faith
- A popular exploration and critique of the great religions, including Christianity and Islam, of religious belief and practices.
Viewing (Business Ethics only)
For extra credit, you may watch and reflect on a film or documentary. Watch it entirely, determine the major theme, and write your reflection about it.
DO NOT “review” or summarize the film. Certainly do not copy or paraphrase online summaries.
DO
(a) what you think the main point of the film seems to be and
(b) whether that main point is correct.
(c) share how in general you reacted to the film (like, dislike, interested, confused, etc.), and
The essay should be at least 2 double-spaced pages (500+ words) but may be more. It is due by the Wednesday of Finals Week.
Here are 10 films (5 documentary, 5 movies) you could choose.
Film (and theme)
- Field of Dreams (Entrepreneurial Activity)
- Network (Media, Deception, Globalism)
- Outsourced (Globalism)
Documentary (and theme)
- Walmart, The High Cost of Low Prices (Capitalism)
- Black Gold (Globalism)
- Constant Gardener (Deception)
- A Decent Factory (Globalism)
- Enron: The Smartest Guys in the Room (The Great Recession)
- Option B (Moreland, Plato, Augustine, Sophie’s World) Does Platonism contradict Christianity? Augustine was a Manichaean first, a Platonist second, and a traditional Christian third. He details why he thought each of these. Where do the teachings of “Platonism” differ from teachings of the historic Christian Church and where do they overlap? How does “Athens” relate to “Jerusalem”? Does Platonism contradict Christianity? Does philosophy/science contradict theology? In your disputation, use Augustine’s arguments (especially Book VII) in either your argument or objections, and argue your answer to this question.
- Option C. (Films) Is man evolving into something superhuman or devolving into something subhuman? 2001 A Space Odyssey and Wall-E present very different pictures of the relationship between man and technology. Is humanity essentially good, and becoming better? Essentially evil, and becoming worse? Essentially bad but becoming good? Essentially good but becoming bad?
- Option D (Plato, Kreeft) Do forms exist in reality or only in our minds? Are they things and concepts or just concepts? Socrates argues that truly real objects he calls “forms” exist and are stable, eternal things that underly all this changing flux. However, forms are (in one sense) invisible… What is a form and why think they exist? Why think they don’t? Are the just “in the mind”? In your disputation, use Plato and Kreeft article to present your own answer to this question.


Match Play. Red trails 2-6 to 9. Should Red redouble? If redoubled, should White take?
pips Red=123 White=78
(CorrectAnswer= 0/0, ErrorScore= 0)
It is very close but Red should redouble. When things go well, he will be pleased to have redoubled. He even wins a gammon and the match 6% of the time.
If things go badly which they do most of the time, White will probably win a gammon and the match.
However, Red is not risking a huge amount by redoubling. Many players wouldn’t even think of redoubling here.
Naturally White has a trivial take of Red’s double. Passing would be a 20 times blunder!
If things go badly which they do most of the time, White will probably win a gammon and the match.
However, Red is not risking a huge amount by redoubling. Many players wouldn’t even think of redoubling here.
Naturally White has a trivial take of Red’s double. Passing would be a 20 times blunder!
Cube analysis 2-ply cubeless equity -0.804 (Money: -0.959) 0.235 0.063 0.004 - 0.765 0.493 0.002 Cubeful equities: 1. Double, take -0.568 2. Double, pass +1.000 (+1.568) 3. No double -0.599 (-0.031) Proper cube action: Redouble, take


Seven Wonders Of the World |
||
|---|---|---|
| Taj Mahal | ||
| Machu Picchu | ||
| Chichen Itza | ||
| Christ the Redeemer | ||
| The Great Wall Of China | ||
| Roman Colosseum | ||
| Petra Jordan | ||
| The Taj Mahal is a white marble mausoleum located on the southern bank of the Yamuna River in the Indian city of Agra. It was commissioned in 1632 by the Mughal emperor Shah Jahan to house the tomb of his favorite wife of three, Mumtaz Mahal. |


Example showing how to transform svg elements that using SVGTransform objects
Click on a shape to transform it


Galvanize Delivers
Order delivery
Menu
Order
Item
Price
Subtotal
$0.00
Tax
$0.00
Total
$0.00
account_circle
Name
phone
Phone number
business
Address
Place order


Failed to load origins: {{ui.errorMessage}}
You are not currently an owner or member of any origins.
Note: If you've already created an origin with the Habitat CLI tool, then you'll need to create it here, too, using the same name.
New to Habitat? Try the demo app.


Testing AngularJS with Protractor and Karma - part 1
This article details how to test a simple AngularJS application using unit tests and end-to-end (E2E) tests.
- Part 1 - In the first part we’ll look at unit tests, which ensure that small, isolated pieces of code (e.g., a unit) behave as expected (current).
- Part 2 - In part two we’ll address E2E tests, which verify that all the pieces of code (units) fit together by simulating the user experience through browser automation.
Updates:
- December 3rd, 2016 - bumped dependencies
To accomplish this we will be using Karma v0.12.31 (test runner) and Chai v2.2.0 (assertions) for the unit tests (along with Karma-Mocha) and Protractor v2.0.0 for the E2E tests. This article also uses Angular v1.3.15. Be sure to take note of all dependencies and their versions in the package.json and bower.json files in the repo.
The repo includes the following tags:
- v1 - project boilerplate
- v2 - adds testing boilerplate/configuration
- v3 - adds unit tests
- v4 - adds E2E tests
Contents
Project Setup
Start by cloning the repo, checkout out the first tag, and then install the dependencies:
$ git clone https://github.com/mjhea0/angular-testing-tutorial.git
$ cd angular-testing-tutorial
$ git checkout tags/v1
$ npm install && bower install
Run the app:
$ gulp
Navigate to http://localhost:8888 to view the live app.
Test it out.
Run the unit tests:
$ gulp unit
They should pass:
[05:28:02] Using gulpfile ~/angular-testing-tutorial/Gulpfile.js
[05:28:02] Starting 'unit'...
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 41.0.2272 (Mac OS X 10.10.2)]: Connected on socket JBQp0aEyu8KSqUfGoxsd with id 94772581
Chrome 41.0.2272 (Mac OS X 10.10.2): Executed 2 of 2 SUCCESS (0.061 secs / 0.002 secs)
[05:28:05] Finished 'unit' after 3.23 s
Now for the e2e tests:
- 1st terminal window:
webdriver-manager start
- 2nd terminal window (within the project directory):
gulp
- 3rd terminal window (within the project directory):
gulp e2e
They should pass as well:
[05:29:45] Using gulpfile ~/angular-testing-tutorial/Gulpfile.js
[05:29:45] Starting 'e2e'...
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
.
Finished in 0.921 seconds
1 test, 1 assertion, 0 failures
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
So, what’s happening here…
Configuration Files
There are two configuration files in the “tests” folder - one for Karma and the other for Protractor.
Karma
Karma is a test runner built by the AngularJS team that executes the unit tests and reports the results.
Let’s look the config file, karma.conf.js:
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns
basePath: '.',
// frameworks to use
frameworks: ['mocha', 'chai'],
// list of files / patterns to load in the browser
files: [
'../app/bower_components/angular/angular.js',
'../app/bower_components/jquery/dist/jquery.js',
'../app/bower_components/angular-strap/dist/angular-strap.js',
'../app/bower_components/angular-strap/dist/angular-strap.tpl.js',
'../app/bower_components/angular-mocks/angular-mocks.js',
'../app/bower_components/angular-route/angular-route.js',
'./unit/*.js',
'../app/app.js'
],
// test result reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
browsers: ['Chrome'],
// Continuous Integration mode
singleRun: false
});
};
You can also run
karma init
to be guided through the creation of a config file.
Be sure to read over the comments for an overview of each config option. For more information, review the official documentation.
Protractor
Protractor provides a nice wrapper around WebDriverJS, the JavaScript bindings for Selenium Webdriver, to run tests against an AngularJS application running live in a browser.
Turn your attention to the Protractor config file, protractor.conf.js:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['tests/e2e/*.js']
};
This tells protractor where to find the test files (called specs) and specifies the address that the Selenium server is running on. Simple.
Ready to start testing?
Unit Tests
We’ll start with unit tests since they are much easier to write, debug, and maintain.
Keep in mind that unit tests, by definition, only test isolated units of code so they rely heavily on mocking fake data. This can add much complexity to your tests and can decrease the effectiveness of the actual tests. For example, if you’re mocking out an HTTP request to a back-end API, then you’re not really testing your application. Instead you’re simulating the request and then using fake JSON data to simulate the response back. The tests may run faster, but they are much less effective.
When starting out, mock out only the most expensive requests and make the actual API call in other situations. Over time you will develop a better sense of which requests should be mocked and which should not.
Finally, if you decide not to mock a request in a specific test, then the test is no longer a unit test since it’s not testing an isolated unit of code. Instead you are testing multiple units, which is an integration test. For simplicity, we will continue to refer to such tests as unit tests.
With that, let’s create some tests, broken up by controller!
TestOneController
Take a look at the code in the first controller:
myApp.controller('TestOneController', function($scope) {
$scope.greeting = "Hello, World!";
$scope.newText = undefined;
$scope.changeGreeting = function() {
$scope.greeting = $scope.newText;
};
});
What’s happening here? Confirm your answer by running your app and watching what happens. Now, what can/should we test?
greeting
has an initial value of"Hello, World!"
, and- The
changeGreeting
function updatesgreeting
.
You probably noticed that we are already testing this in the spec:
describe('TestOneController', function () {
var controller = null;
$scope = null;
beforeEach(function () {
module('myApp');
});
beforeEach(inject(function ($controller, $rootScope) {
$scope = $rootScope.$new();
controller = $controller('TestOneController', {
$scope: $scope
});
}));
it('initially has a greeting', function () {
assert.equal($scope.greeting, "Hello, World!");
});
it('clicking the button changes the greeting', function () {
$scope.newText = "Hi!";
$scope.changeGreeting();
assert.equal($scope.greeting, "Hi!");
});
});
What’s happening?
- The
describe
block is used to group similar tests. - The module,
myApp
, is loaded, into each test, in the firstbeforeEach
block, which instantiates a clean testing environment. - The dependencies are injected, a new scope is created, and the controller is instantiated in the second
beforeEach
. - Each
it
function is a separate test, which includes a title, in human readable form, and a function with the actual test code. - The first test asserts that the initial state of
greeting
is"Hello, World!"
. - Meanwhile, the second test assets that the
changeGreeting()
function actually changes the value ofgreeting
.
Make sense?
In most cases, unit tests simply change the scope and assert that the results are what we expected.
In general, when testing controllers, you inject then register the controller with a
beforeEach
block, along with the$rootScope
and then test that the functions within the controller act as expected.
Run the tests again to ensure they still pass - gulp unit
.
What else could we test? How about if newText
doesn’t change - e.g., if the user submits the button without entering any text in the input box - then the value of greeting
should stay the same. Try writing this on your own, before you look at my answer:
it('clicking the button does not change the greeting if text is not inputed', function () {
$scope.changeGreeting();
assert.equal($scope.greeting, "Hello, World!");
});
Try running this. It should fail.
Chrome 41.0.2272 (Mac OS X 10.10.2) TestOneController clicking the button does not change the greeting FAILED
AssertionError: expected undefined to equal 'Hello, World!'
So, we’ve revealed a bug. We could fix this by adding validation to the input box to ensure the end user enters a value or we could update changeGreeting
to only update greeting
if newText
is not undefined
. Let’s go with the latter.
$scope.changeGreeting = function() {
if ($scope.newText !== undefined) {
$scope.greeting = $scope.newText;
}
};
Save the code, and then run the tests again:
$ gulp unit
[08:28:18] Using gulpfile ~/angular-testing-tutorial/Gulpfile.js
[08:28:18] Starting 'unit'...
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 41.0.2272 (Mac OS X 10.10.2)]: Connected on socket HGnVC5-cAXOZjAsrSCWj with id 83240025
Chrome 41.0.2272 (Mac OS X 10.10.2): Executed 3 of 3 SUCCESS (0.065 secs / 0.001 secs)
[08:28:21] Finished 'unit' after 3.13 s
Nice!
Since controllers are used to bind data to the template (via scope), unit tests are perfect for testing the controller logic - e.g., what happens to the scope as the controller runs - while E2E tests ensure that the template is updated accordingly.
TestTwoController
Start by analyzing the code:
myApp.controller('TestTwoController', function($scope) {
$scope.total = 6;
$scope.newItem = undefined;
$scope.items = [1, 2, 3];
$scope.add = function () {
$scope.items.push($scope.newItem);
$scope.total = 0;
for(var i = 0; i < $scope.items.length; i++){
$scope.total += parseInt($scope.items[i]);
}
};
});
What should we test? Take out a pen and paper and write down everything that should be tested. Once done, write the code. Check your code against mine.
Be sure to start with the following boilerplate:
describe('TestTwoController', function () {
var controller = null;
$scope = null;
beforeEach(function () {
module('myApp');
});
beforeEach(inject(function ($controller, $rootScope) {
$scope = $rootScope.$new();
controller = $controller('TestTwoController', {
$scope: $scope
});
}));
});
Test 1: The initial value of total
it('initially has a total', function () {
assert.equal($scope.total, 6);
});
Test 2: The initial value of items
it('initially has items', function () {
assert.isArray($scope.items);
assert.deepEqual($scope.items, [1, 2, 3]);
});
Test 3: The add
function updates the total
and items
array when a value is added
it('the `add` function updates the `total` and `items` array when a value is added', function () {
$scope.newItem = 7;
$scope.add();
assert.equal($scope.total, 13);
assert.deepEqual($scope.items, [1, 2, 3, 7]);
});
Test 4: The add
function does not update the total
and items
array when an empty value is added
it('does not update the `total` and `items` array when an empty value is added', function () {
$scope.newItem = undefined;
$scope.add();
assert.equal($scope.total, 6);
assert.deepEqual($scope.items, [1, 2, 3]);
$scope.newItem = 22;
$scope.add();
assert.equal($scope.total, 28);
assert.deepEqual($scope.items, [1, 2, 3, 22]);
});
Run
Each test should be straightforward. Run the tests. There should be one failure:
Chrome 41.0.2272 (Mac OS X 10.10.2) TestTwoController does not update the `total` and `items` array when an empty value is added FAILED
AssertionError: expected NaN to equal 6
Update the code, adding a conditional again:
$scope.add = function () {
if(typeof $scope.newItem == 'number') {
$scope.items.push($scope.newItem);
$scope.total = 0;
for(var i = 0; i < $scope.items.length; i++){
$scope.total += parseInt($scope.items[i]);
}
}
};
Also update the partial, /app/partials/two.html:
<input type="number" ng-model="newItem">
Run it again:
$ gulp unit
[09:56:10] Using gulpfile ~/angular-testing-tutorial/Gulpfile.js
[09:56:10] Starting 'unit'...
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 41.0.2272 (Mac OS X 10.10.2)]: Connected on socket Lbv1sROpYrEHgotlmJZf with id 91008249
Chrome 41.0.2272 (Mac OS X 10.10.2): Executed 7 of 7 SUCCESS (0.082 secs / 0.003 secs)
[09:56:13] Finished 'unit' after 3.05 s
Success!
Did I miss anything? Comment below.
TestThreeController
Again, check out the code in app.js:
myApp.controller('TestThreeController', function($scope) {
$scope.modal = {title: 'Hi!', content: 'This is a message!'};
});
What can we test here?
it('initially has a modal', function () {
assert.isObject($scope.modal);
assert.deepEqual($scope.modal, {title: 'Hi!', content: 'This is a message!'});
});
Perhaps a better question is: What should we test here? Is the above test really necessary? Probably not. But we may need to test it out more in the future if we build out the functionality. Let’s go for it!
Update app.js:
myApp.controller('TestThreeController', function($scope, $modal) {
$scope.modalNumber = 1;
var myModal = $modal({scope: $scope, template: 'modal.tpl.html', show: false});
$scope.showModal = function() {
myModal.$promise.then(myModal.show);
};
$scope.changeModalText = function() {
$scope.modalNumber++;
};
});
Here we are defined a custom template, modal.tpl.html
, to be used for the modal text and then we assigned $scope.modalNumber
to 1
as well as function to iterate the number.
Add modal.tpl.html:

<button class="btn btn-default" ng-click="changeModalText()">Iterate</button>
→
{{ modalNumber }}

<button type="button" class="btn btn-default" ng-click="$hide()">Close</button>

Add this template to the “app” folder.
Update three.html:
Finally, update the partial:

Just a modal

<button type="button" class="btn btn-lg btn-default" data-template="modal.tpl.html" bs-modal="modal">
Launch modal!
</button>
Run the app to make sure everything works, and then update the test…
Test redux
describe('TestThreeController', function () {
var controller = null;
$scope = null;
beforeEach(function () {
module('myApp');
});
beforeEach(inject(function ($controller, $rootScope) {
$scope = $rootScope.$new();
controller = $controller('TestThreeController', {
$scope: $scope
});
}));
it('initially has a modalNumber', function () {
assert.equal($scope.modalNumber, 1);
});
it('updates the `modalNumber` when a value is added', function () {
$scope.changeModalText();
assert.equal($scope.modalNumber, 2);
$scope.changeModalText();
assert.equal($scope.modalNumber, 3);
});
});
Notice how we’re no longer testing that a modal is present. We’ll test that via the E2E tests.
TestFourController
Finally, let’s test the AJAX request:
myApp.controller('TestFourController', function($scope, $http) {
$scope.repos = [];
$scope.loadRepos = function () {
$http.get('https://api.github.com/repositories').then(function (repos) {
$scope.repos = repos.data;
});
};
});
Remember the discussion earlier on mocking HTTP requests? Well, here’s probably a good place to actually use a mocking library since this request hits an external API. To do this, we can use the $httpBackend
directive from the angular-mocks library.
First, let’s first add the mock.js file found in the repo into a new folder called “mock” within the “tests” folder. This module uses angular.module().value
to set a JSON value to use as the fake data.
Update the list of files in karma.conf.js so that the the mock file is loaded and served by Karma:
files: [
'../app/bower_components/angular/angular.js',
'../app/bower_components/jquery/dist/jquery.js',
'../app/bower_components/angular-strap/dist/angular-strap.js',
'../app/bower_components/angular-strap/dist/angular-strap.tpl.js',
'../app/bower_components/angular-mocks/angular-mocks.js',
'../app/bower_components/angular-route/angular-route.js',
'./unit/*.js',
'./mock/*.js',
'../app/app.js'
],
Next, add the test:
describe('TestFourController', function () {
var controller = null;
var $scope = null;
var $httpBackend = null;
var mockedDashboardJSON = null;
beforeEach(function () {
module('myApp', 'mockedDashboardJSON');
});
beforeEach(inject(function ($controller, $rootScope, _$httpBackend_, defaultJSON) {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
$httpBackend.when('GET','https://api.github.com/repositories').respond(defaultJSON.fakeData);
controller = $controller('TestFourController', {
$scope: $scope
});
}));
afterEach(function () {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
it('initially has repos', function () {
assert.isArray($scope.repos);
assert.deepEqual($scope.repos, []);
});
it('clicking the button updates the repos', function () {
$scope.loadRepos();
$httpBackend.flush();
assert.equal($scope.repos.length, 100);
});
});
What’s happening?
- Essentially, here we’re injecting
defaultJSON
so that when the app tries to make the HTTP request, it triggers$httpBackend
, which, in turn, uses thedefaultJSON
value. - Did you notice the underscores surrounding the
$httpBackend
directive? This is a hack that allows us to use the dependency in multiple tests. You can find more information on this from the official documentation. - Finally, we’re using an
afterEach
block to check that we’re not missing any HTTP requests in our tests via theverifyNoOutstandingExpectation()
andverifyNoOutstandingRequest()
methods. Again, you can read more about these methods from the Angular docs.
Test it out!
Routes
How about the routes, templates, and partials?
describe('routes', function(){
beforeEach(function () {
module('myApp');
});
beforeEach(inject(function (_$httpBackend_, _$route_, _$location_, $rootScope) {
$httpBackend = _$httpBackend_;
$route = _$route_;
$location = _$location_;
$scope = $rootScope.$new();
}));
it('should load the one.html template', function(){
$httpBackend.whenGET('partials/one.html').respond('...');
$scope.$apply(function() {
$location.path('/one');
});
assert.equal($route.current.templateUrl, 'partials/one.html');
assert.equal($route.current.controller, 'TestOneController');
});
});
- When the route is loaded, the
current
property is updated. We then test to ensure that the current controller and template areTestOneController
andpartials/one.html
, respectively. - Did you notice that we wrapped the route change inside the
$apply
callback? Since unit tests don’t run the full Angular app, we had to simulate it by triggering the digest cycle. - Curious about
WhenGET
? Check out the Angular documentation. Take note ofExpectGET
as well. Can you re-write the above test to useExpectGET
?
Make sure to run the tests one last time:
$ gulp unit
[05:20:07] Using gulpfile ~/angular-testing-tutorial/Gulpfile.js
[05:20:07] Starting 'unit'...
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 41.0.2272 (Mac OS X 10.10.2)]: Connected on socket R5qQUcjswAbpcvMK6JKu with id 67365006
Chrome 41.0.2272 (Mac OS X 10.10.2): Executed 12 of 12 SUCCESS (0.16 secs / 0.027 secs)
[05:20:10] Finished 'unit' after 3.44 s
Conclusion
That’s it for unit tests. In the next part, we’ll test the entire application, front to back, using end-to-end (E2E) tests via Protractor.
Checkout the third tag, v3
, to view all the completed unit tests:
$ git checkout tags/v3
Ready for more?
Try adding some Factories/Services and Filters to your app to continue practicing. Since the syntax is relatively the same for testing all parts of an Angular app, you should be able to extend your testing knowledge to both factories and filters. Take a look at this example for help getting started. Once you feel comfortable with factories, controllers, and filters, move on to testing more difficult components, like directives, resources, and animations. Good luck!
Comment below with questions.


How to save equivalent stresses
The generated equivalent stresses can be saved to an Excel Worksheet in tabulated form. For this, select the equivalent stresses
you want to save from the file tree and right-click to open the popup menu. In the popup menu, select - Save Equivalent Stress As..
as shown in the following figure. This will open the options panel for saving the equivalent stresses.
Here, you can select all related information to be placed into the Excel Worksheet table.


iMoney Varnish Bot Cache Clearer
What do you want to clear today?™
Hosts
Add hosts
URL
equals
contains
/
Confirm
Note: Leaving the parameter blank will clear the whole site.
Status


Please tell us your name.
Please tell us something about your history.
You may be this if you like beer, gadgets, and Playboy Magazine.
You may be this if you like prosecco, make up, and Playgirl Magazine.
Tell us how old you are.


All Modules / Classes
Wesabe
(class)
Wesabe::Account
(class)
Wesabe::BaseModel
(class)
Wesabe::Credential
(class)
Wesabe::Currency
(class)
Wesabe::FinancialInstitution
(class)
Wesabe::Job
(class)
Wesabe::Request
(class)
Wesabe::Request::Exception
(class)
Wesabe::Request::Redirect
(class)
Wesabe::Request::RequestFailed
(class)
Wesabe::Request::ResourceNotFound
(class)
Wesabe::Request::ServerBrokeConnection
(class)
Wesabe::Request::Unauthorized
(class)
Wesabe::Target
(class)
Wesabe::Upload
(class)
Wesabe::Upload::Exception
(class)
Wesabe::Upload::StatementError
(class)
Wesabe::Util
(module)


| Stakeholder name : | |||
| Relation since (e.g. year): | |||
| Contact Person: | FirstName LastName Email   |
||
| Full Address: | StreetNumber ZIPCode City Region Province Country |
||
| Stakeholder type: | Internal | External | |
| (e.g. worker) | (e.g. trade union, client) | ||
| Specify stakeholder type (e.g. local NGO) : | |||
| Topic related | |||
| Anti-corruption | Occupational health and safety | ||
| Stop Child labour | Special protection for vulnerable workers | ||
| Freedom of association | Training | ||
| Grievance mechanism | Other | ||
| Relevant for child labour remediation? | YesNo | ||
| Additional comments about stakeholder (if any): |