// This file is part of the WhileLang Compiler (wlc).
//
// The WhileLang Compiler is free software; you can redistribute
// it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// The WhileLang Compiler is distributed in the hope that it
// will be useful, but WITHOUT ANY WARRANTY; without even the
// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with the WhileLang Compiler. If not, see
//
//
// Copyright 2013, David James Pearce.
package whilelang.ast;
import java.util.*;
import whilelang.util.*;
/**
* Represents a statement in the source code of a While program. Many standard
* statement kinds are provided, including if
, while
,
* for
, etc.
*
* @author David J. Pearce
*
*/
public interface Stmt extends SyntacticElement {
/**
* Represents an assert statement which checks whether a given expression
* evaluates to true or not.
*
*
* void f(int x) {
* assert x >= 0;
* }
*
*
* If the assertion fails, then a runtime fault is raised and execution
* aborts.
*
* @author David J. Pearce
*
*/
public static final class Assert extends SyntacticElement.Impl implements
Stmt {
private final Expr expr;
/**
* Construct an assert statement from a given expression.
*
* @param expr
* May not be null.
* @param attributes
*/
public Assert(Expr expr, Attribute... attributes) {
super(attributes);
this.expr = expr;
}
/**
* Construct a print statement from a given expression.
*
* @param expr
* May not be null.
* @param attributes
*/
public Assert(Expr expr, Collection attributes) {
super(attributes);
this.expr = expr;
}
public String toString() {
return "assert " + getExpr();
}
/**
* Get the expression whose value is to be printed.
*
* @return Guaranteed to be non-null.
*/
public Expr getExpr() {
return expr;
}
}
/**
* Represents an assignment statement of the form lhs = rhs
.
* Here, the rhs
is any expression, whilst the lhs
* must be an LVal
--- that is, an expression permitted on the
* left-side of an assignment. The following illustrates different possible
* assignment statements:
*
*
* x = y; // variable assignment
* x.f = y; // field assignment
* x[i] = y; // list assignment
* x[i].f = y; // compound assignment
*
*
* The last assignment here illustrates that the left-hand side of an
* assignment can be arbitrarily complex, involving nested assignments into
* lists and records.
*
* @author David J. Pearce
*
*/
public static final class Assign extends SyntacticElement.Impl implements
Stmt {
private final Expr.LVal lhs;
private final Expr rhs;
/**
* Create an assignment from a given lhs
and
* rhs
.
*
* @param lhs
* --- left-hand side, which may not be null
.
* @param rhs
* --- right-hand side, which may not be null
.
* @param attributes
*/
public Assign(Expr.LVal lhs, Expr rhs, Attribute... attributes) {
super(attributes);
this.lhs = lhs;
this.rhs = rhs;
}
/**
* Create an assignment from a given lhs
and
* rhs
.
*
* @param lhs
* left-hand side, which may not be null
.
* @param rhs
* right-hand side, which may not be null
.
* @param attributes
*/
public Assign(Expr.LVal lhs, Expr rhs, Collection attributes) {
super(attributes);
this.lhs = lhs;
this.rhs = rhs;
}
public String toString() {
return getLhs() + " = " + getRhs();
}
/**
* Get the left-hand side of this assignment.
*
* @return Guaranteed non-null.
*/
public Expr.LVal getLhs() {
return lhs;
}
/**
* Get the right-hand side of this assignment.
*
* @return Guaranteed non-null.
*/
public Expr getRhs() {
return rhs;
}
}
/**
* Represents a return statement which (optionally) returns a value. The
* following illustrates:
*
*
* int f(int x) {
* return x + 1;
* }
*
*
* Here, we see a simple return
statement which returns an
* int
value.
*
* @author David J. Pearce
*
*/
public static final class Return extends SyntacticElement.Impl implements
Stmt {
private final Expr expr;
/**
* Create a given return statement with an optional return value.
*
* @param expr
* the return value, which may be null
.
* @param attributes
*/
public Return(Expr expr, Attribute... attributes) {
super(attributes);
this.expr = expr;
}
/**
* Create a given return statement with an optional return value.
*
* @param expr
* the return value, which may be null
.
* @param attributes
*/
public Return(Expr expr, Collection attributes) {
super(attributes);
this.expr = expr;
}
public String toString() {
if (getExpr() != null) {
return "return " + getExpr();
} else {
return "return";
}
}
/**
* Get the optional return value.
*
* @return --- May be null
.
*/
public Expr getExpr() {
return expr;
}
}
/**
* Represents a while statement whose body is made up from a block of
* statements separated by curly braces. Note that, unlike C or Java, the
* body must be contained within curly braces. As an example:
*
*
* int sum([int] xs) {
* int r = 0;
* int i = 0;
* while(i < |xs|) {
* r = r + xs[i];
* i = i + 1;
* }
* return r;
* }
*
*
* @author David J. Pearce
*
*/
public static final class While extends SyntacticElement.Impl implements Stmt {
private final Expr condition;
private final ArrayList body;
/**
* Construct a While statement from a given condition and body of
* statements.
*
* @param condition
* non-null expression.
* @param body
* non-null collection which contains zero or more
* statements.
* @param attributes
*/
public While(Expr condition, Collection body,
Attribute... attributes) {
super(attributes);
this.condition = condition;
this.body = new ArrayList(body);
}
/**
* Construct a While statement from a given condition and body of
* statements.
*
* @param condition
* non-null expression.
* @param body
* non-null collection which contains zero or more
* statements.
* @param attributes
*/
public While(Expr condition, Expr invariant, Collection body,
Collection attributes) {
super(attributes);
this.condition = condition;
this.body = new ArrayList(body);
}
/**
* Get the condition which controls the while loop.
*
* @return Guaranteed to be non-null.
*/
public Expr getCondition() {
return condition;
}
/**
* Get the statements making up the loop body.
*
* @return Guarantted to be non-null.
*/
public List getBody() {
return body;
}
}
/**
* Represents a classical for statement made up from a variable
* declaration, a loop condition and an increment
* statement. The following illustrates:
*
*
* int sum([int] xs) {
* int r = 0;
* for(int i=0;i<|xs|;i=i+1) {
* r = r + xs[i];
* }
* return r;
* }
*
*
* Observe that the variable declaration does not need to supply an
* initialiser expression. Furthermore, like C and Java, the variable
* declaration, condition and increment statements are all optional. Thus,
* we can safely rewrite the above as follows:
*
*
* int sum([int] xs) {
* int r = 0;
* for(int i=0;i<|xs|;) {
* r = r + xs[i];
* }
* return r;
* }
*
*
* @author David J. Pearce
*
*/
public static final class For extends SyntacticElement.Impl implements Stmt {
private final VariableDeclaration declaration;
private final Expr condition;
private final Stmt increment;
private final ArrayList body;
/**
* Construct a for loop from a given declaration, condition and
* increment. Note that the declaration, conditional and increment are
* all optional.
*
* @param declaration
* An variable declation, which may be null.
* @param condition
* A loop condition which may not be null.
* @param increment
* An increment statement, which may be null.
* @param body
* A list of zero or more statements, which may not be null.
* @param attributes
*/
public For(VariableDeclaration declaration, Expr condition, Stmt increment,
Collection body, Attribute... attributes) {
super(attributes);
this.declaration = declaration;
this.condition = condition;
this.increment = increment;
this.body = new ArrayList(body);
}
/**
* Construct a for loop from a given declaration, condition and
* increment. Note that the declaration, conditional and increment are
* all optional.
*
* @param declaration
* An variable declation, which may be null.
* @param condition
* A loop condition which may be null.
* @param increment
* An increment statement, which may be null.
* @param body
* A list of zero or more statements, which may not be null.
* @param attributes
*/
public For(VariableDeclaration declaration, Expr condition, Stmt increment,
Collection body, Collection attributes) {
super(attributes);
this.declaration = declaration;
this.condition = condition;
this.increment = increment;
this.body = new ArrayList(body);
}
/**
* Get the variable declaration for this loop.
*
* @return May be null.
*/
public VariableDeclaration getDeclaration() {
return declaration;
}
/**
* Get the loop condition.
*
* @return May be null.
*/
public Expr getCondition() {
return condition;
}
/**
* Get the increment statement.
*
* @return May be null.
*/
public Stmt getIncrement() {
return increment;
}
/**
* Get the loop body.
*
* @return May not be null.
*/
public ArrayList getBody() {
return body;
}
}
/**
* Represents a classical if-else statement, made up from a
* condition, true branch and false branch.
* The following illustrates:
*
* int max(int x, int y) {
* if(x > y) {
* return x;
* } else {
* return y;
* }
* }
*
* @author David J. Pearce
*
*/
public static final class IfElse extends SyntacticElement.Impl implements
Stmt {
private final Expr condition;
private final ArrayList trueBranch;
private final ArrayList falseBranch;
/**
* Construct an if-else statement from a condition, true branch and
* optional false branch.
*
* @param condition
* May not be null.
* @param trueBranch
* A list of zero or more statements to be executed when the
* condition holds; may not be null.
* @param falseBranch
* A list of zero of more statements to be executed when the
* condition does not hold; may not be null.
* @param attributes
*/
public IfElse(Expr condition, List trueBranch,
List falseBranch, Attribute... attributes) {
super(attributes);
this.condition = condition;
this.trueBranch = new ArrayList(trueBranch);
this.falseBranch = new ArrayList(falseBranch);
}
/**
* Construct an if-else statement from a condition, true branch and
* optional false branch.
*
* @param condition
* May not be null.
* @param trueBranch
* A list of zero or more statements to be executed when the
* condition holds; may not be null.
* @param falseBranch
* A list of zero of more statements to be executed when the
* condition does not hold; may not be null.
* @param attributes
*/
public IfElse(Expr condition, List trueBranch,
List falseBranch, Collection attributes) {
super(attributes);
this.condition = condition;
this.trueBranch = new ArrayList(trueBranch);
this.falseBranch = new ArrayList(falseBranch);
}
/**
* Get the if-condition.
*
* @return May not be null.
*/
public Expr getCondition() {
return condition;
}
/**
* Get the true branch, which consists of zero or more statements.
*
* @return May not be null.
*/
public List getTrueBranch() {
return trueBranch;
}
/**
* Get the false branch, which consists of zero or more statements.
*
* @return May not be null.
*/
public List getFalseBranch() {
return falseBranch;
}
}
/**
* Represents a print statement which writes expressions (as strings) to the
* console. The following illustrates:
*
*
* void f(int x) {
* print x+1;
* }
*
*
* Observe that the computed value for the expression to be printed is the
* implicitly coerced into a string.
*
* @author David J. Pearce
*
*/
public static final class Print extends SyntacticElement.Impl implements
Stmt {
private final Expr expr;
/**
* Construct a print statement from a given expression.
*
* @param expr
* May not be null.
* @param attributes
*/
public Print(Expr expr, Attribute... attributes) {
super(attributes);
this.expr = expr;
}
/**
* Construct a print statement from a given expression.
*
* @param expr
* May not be null.
* @param attributes
*/
public Print(Expr expr, Collection attributes) {
super(attributes);
this.expr = expr;
}
public String toString() {
return "print " + getExpr();
}
/**
* Get the expression whose value is to be printed.
*
* @return Guaranteed to be non-null.
*/
public Expr getExpr() {
return expr;
}
}
/**
* Represents a break statement which immediately terminates the enclosing
* loop or switch statement
*
* @author David J. Pearce
*
*/
public static final class Break extends SyntacticElement.Impl implements Stmt {
public Break(Attribute... attributes) {
super(attributes);
}
public Break(Collection attributes) {
super(attributes);
}
}
/**
* Represents a continue statement which immediately moves a loop onto the
* next iteration.
*
* @author David J. Pearce
*
*/
public static final class Continue extends SyntacticElement.Impl implements Stmt {
public Continue(Attribute... attributes) {
super(attributes);
}
public Continue(Collection attributes) {
super(attributes);
}
}
/**
* Represents a single case in a switch statement which matches against a
* given value. In the case of a null value, then this is a "default" case.
*
* @author David J. Pearce
*
*/
public static final class Case extends SyntacticElement.Impl {
private final Expr.Constant value;
private final ArrayList body;
public Case(Expr.Constant value, List body, Attribute... attributes) {
super(attributes);
this.value = value;
this.body = new ArrayList(body);
}
public Case(Expr.Constant value, List body, Collection attributes) {
super(attributes);
this.value = value;
this.body = new ArrayList(body);
}
public Expr getValue() {
return value;
}
public List getBody() {
return body;
}
public boolean isDefault() {
return value == null;
}
}
/**
* Represents a switch statement which selects between a number of different
* cases, based on a given value. The following illustrates:
*
*
* int f(int x) {
* switch(x) {
* case 1:
* return 1;
* case 0:
* return 0;
* default:
* return -1;
* }
* }
*
*
* @author David J. Pearce
*
*/
public static final class Switch extends SyntacticElement.Impl implements Stmt {
private final Expr expr;
private final ArrayList cases;
/**
* Construct a switch statement from a given expression and a list of
* cases, of which one may be a "default".
*
* @param expr
* The expression whose generated value is used to match
* cases against
* @param cases
* A list of zero or more cases, of which one may be a
* "default" case.
* @param attributes
*/
public Switch(Expr expr, List cases, Attribute...attributes) {
super(attributes);
this.expr = expr;
this.cases = new ArrayList(cases);
}
/**
* Construct a switch statement from a given expression and a list of
* cases, of which one may be a "default".
*
* @param expr
* The expression whose generated value is used to match
* cases against
* @param cases
* A list of zero or more cases, of which one may be a
* "default" case.
* @param attributes
*/
public Switch(Expr expr, List cases, Collection attributes) {
super(attributes);
this.expr = expr;
this.cases = new ArrayList(cases);
}
/**
* Get the expression which this statement is matching against.
*
* @return
*/
public Expr getExpr() {
return expr;
}
/**
* Get the list of zero or more cases which are used to match against
* the given expression.
*
* @return
*/
public List getCases() {
return cases;
}
}
/**
* Represents a variable declaration which is made up from a type, a
* variable name and an (optional) initialiser expression. If an initialiser
* is given, then this will be evaluated and assigned to the variable when
* the declaration is executed. Some example declarations:
*
*
* int x;
* int y = 1;
* int z = x + y;
*
*
* Observe that, unlike C and Java, declarations that declare multiple
* variables (separated by commas) are not permitted.
*
* @author David J. Pearce
*
*/
public static final class VariableDeclaration extends SyntacticElement.Impl implements
Stmt {
private final Type type;
private final String name;
private final Expr expr;
/**
* Construct a variable declaration from a given type, variable name and
* optional initialiser expression.
*
* @param type
* Type of variable being declared.
* @param name
* Name of varaible being declared.
* @param expr
* Optional initialiser expression, which may be null.
* @param attributes
*/
public VariableDeclaration(Type type, String name, Expr expr,
Attribute... attributes) {
super(attributes);
this.type = type;
this.name = name;
this.expr = expr;
}
/**
* Construct a variable declaration from a given type, variable name and
* optional initialiser expression.
*
* @param type
* Type of variable being declared.
* @param name
* Name of varaible being declared.
* @param expr
* Optional initialiser expression, which may be null.
* @param attributes
*/
public VariableDeclaration(Type type, String name, Expr expr,
Collection attributes) {
super(attributes);
this.type = type;
this.name = name;
this.expr = expr;
}
public String toString() {
String r = getType() + " " + getName();
if (getExpr() != null) {
r = r + " = " + getExpr();
}
return r;
}
/**
* Get the type of the variable being declared.
*
* @return Guaranteed to be non-null.
*/
public Type getType() {
return type;
}
/**
* Get the name of the variable being declared.
*
* @return Guaranteed to be non-null.
*/
public String getName() {
return name;
}
/**
* Get the initialiser expression of the variable being declared (if
* present).
*
* @return May be null.
*/
public Expr getExpr() {
return expr;
}
}
}


Notebooks
Story: Burial (another account)
Burial (another account)
Title
Burial (another account)
Collection
Summary
When a person dies, the !kun (!nanni's people) do not immediately leave the place of death but leave as a group on another day. In !nanni's maternal grandfather's country, the dead go into the Moon.


public class Lines
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
Lines.Joint
|
private static class |
Lines.MergeFocus
|
| Modifier and Type | Field and Description |
|---|---|
(package private) static LineSegmentDetector
|
detector
|
| Constructor and Description |
|---|
Lines()
|
| Modifier and Type | Method and Description |
|---|---|
private static boolean |
ccw(Point A,
Point B,
Point C)
Returns whether three points are clockwise or
counter-clockwise
|
static Line
|
constructLine(Point point,
double angle,
double length)
Constructs a line given a center point, an
angle in the plane, and a length
|
static double |
crossSign(Line line,
Point point)
Returns the signed cross product of a line
and a point, such that the relative position of a point to a
line can be determined.
|
static Line
|
findLeftMost(java.util.List<Line> lines,
Size size)
|
static Line
|
findRightMost(java.util.List<Line> lines,
Size size)
|
static double |
getAngularDistance(Line line1,
Line line2)
Returns the angular distance, in degrees,
between lines 1 and 2.
|
static double |
getMeanAngle(java.util.List<Line> lines)
|
static Point |
getMeanPoint(java.util.List<Line> lines)
|
static java.util.List<Line>
|
getOpenCvLines(Mat original,
int scale,
double minLength)
Modern OpenCV line segment detection - far
better than Canny, but must be carefully adjusted.
|
static Line
|
getPerpindicular(Line line,
double sign)
|
static Line
|
getPerpindicularConnector(Line left,
Line right,
Size size)
|
static double |
getPerpindicularDistance(Line line1,
Line line2)
|
static double |
getPerpindicularDistance(Line line1,
Point point)
|
static java.util.List<java.util.List<Line>>
|
groupLines(java.util.ArrayList<Line> lines,
double seperation)
|
static boolean |
intersect(Line line1,
Line line2)
Returns a boolean corresponding to whether
the two lines intersect
|
static Line
|
linearExtend(Line line,
double scale,
Size size)
Linearly extends a line in both directions by
the given portion of its length
|
static java.util.List<Line>
|
linearExtend(java.util.List<Line> lines,
double scale,
Size size)
Linearly extends a lines in both directions
by the given portion of its length
|
static java.util.List<Line>
|
resize(java.util.List<Line> lines,
double scale)
|
static double |
stdDevX(java.util.List<Line> lines)
|
static double |
stdDevY(java.util.List<Line> lines)
|
static Line
|
vectorExtend(Line line,
double lengthFinal,
Size size)
Extends a line as a vector, increasing the
Euclidean distance of point 2 from point 1 by moving only
point 2.
|
static java.util.List<Line>
|
vectorExtend(java.util.List<Line> lines,
double lengthFinal,
Size size)
Extends a list of lines as vector, increasing
the Euclidean distance of point 2 from point 1 by moving
only point 2.
|
static LineSegmentDetector detector
public static double getAngularDistance(Line line1, Line line2)
line1
-line2
-private static boolean ccw(Point A, Point B, Point C)
A
-B
-C
-public static boolean intersect(Line line1, Line line2)
line1
-line2
-public static double crossSign(Line line, Point point)
line
- The line forming the first vector, taken
from Point 1 to Point 2
point
- The point to form the second vector,
taken from line1.point1 to this point.
public static Line vectorExtend(Line line, double lengthFinal, Size size)
line
- The line to be modified.lengthFinal
- The final desired Euclidean
length of the line
size
- The size of the working imagepublic static java.util.List<Line> vectorExtend(java.util.List<Line> lines, double lengthFinal, Size size)
lines
- The lines to be modifiedlengthFinal
- The final desired Euclidean
length of the line
size
- The size of the working imagepublic static Line linearExtend(Line line, double scale, Size size)
line
- The line to be modifiedscale
- The length of the line will be extended
by the line's length divided by twice this value
size
- The size of the imagepublic static java.util.List<Line> linearExtend(java.util.List<Line> lines, double scale, Size size)
lines
- The lines to be modifiedscale
- The length of the lines will be
extended by the line's length divided by twice this value
size
- The size of the imagepublic static Line constructLine(Point point, double angle, double length)
point
- The center point of the lineangle
- The desired angle of the line, in
degrees
length
- The desired length of the line, in
pixels
public static java.util.List<Line> getOpenCvLines(Mat original, int scale, double minLength)
original
- The original image to be scanned, as
an RGB image
scale
- The factor by which the image is to be
downscaled
minLength
- The minimum line segment length to
be returned
public static Line getPerpindicularConnector(Line left, Line right, Size size)
public static java.util.List<java.util.List<Line>> groupLines(java.util.ArrayList<Line> lines, double seperation)
public static double getMeanAngle(java.util.List<Line> lines)
public static double stdDevX(java.util.List<Line> lines)
public static double stdDevY(java.util.List<Line> lines)


{{ define "title" }}Oops!{{ end }} {{ define "main" }}
A
♥
Well this is awkward, there's nothing here...
Maybe try going back to the home page?
Q


Villagers gherao BJP's C P Yogeshwara in Hunsur
by DHNSBJP leader C P Yogeshwara had to face embarrassment during his election campaign for BJP candidate A H Vishwanath at Heggandur village in Hunsur assembly segment, as the voters gheraoed him, on Friday.
The villagers charged at Yogeshwara and asked him to bring Vishwanath to the village. "You people are sold out to the BJP and necessitated by-elections unnecessarily. We want to speak to Vishwanath, bring him," the villagers charged.
The villagers did not allow the leader to enter the village and sent him back. They also raised slogans for JD(S) and former chief minister H D Kumaraswamy.


We have introduced concept of scope (UI scope) in Atoms.js to emulate UI scope as it exists in other UI frameworks such as flex, silverlight etc. UI scope basically creates boundary and it allows us to identify and reference named properites and named controls that is independent of other scopes. AtomApplication starts with a global scope referred as scope in same scope and as appScope in nested scope.
Usually when you declare a function or variable, it executes in context of current window, JavaScript provides scoping within boundaries of function. However, this scoping has nothing to do with element within which JavaScript is executing. And there is no way to separate variable references in different scope based on its position in the element.
To emulate private scope based on position of script within Html Element and to bind script to specific Element's private scope, Scope scripts were specially designed so that its normal execution does not affect anything, but they are executed in proper scope.
To initialize values in scope, an object literal must be written in a scriptlet as shown below, please make sure, that it is surrounded by rounded brackets. This scriptlet does not get executed and it creates no effect while script is parsed by the browser, however Atoms.js recognizes it as a scope initialization and it creates properties in current scope and sets values.
<script type="text/javascript">
({
start: 0,
size: 20,
infoCommand: function(){
alert('Done');
}
})
</script>
Above script tag, causes start, size and infoCommand as properties in respective scope. infoCommand is a function, and it can be referenced in same scope.
Scope initialization is defined this way, because this form of script is actually just parsed by javascript, but nothing is executed as it is a valid object literal expression. Since scope is nested, and based on control life cycle, scope will be initialized at its perfect position in UI Hierarchy, this is just stored as reference code to be executed later on.
Scope initialization script nodes are removed from Document while parsing further children. For safety, any JavaScript other than Scope Initialization must only be kept in Document's Head Section.
By setting id attribute, HTML element is accessible easily. But when we are dealing with multi item controls such as List, Grid etc, referencing items could be very difficult. Scope helps us in referncing different items in same scope very easily by setting atom-name attribute of the AtomControl. Once you apply atom-name attribute, you can easily refer properties of controls by calling $scope.controlName.propertyName pattern. In binding expression, propertyNames are automatially resolved so you do not have to use Atom.get or Atom.set methods.


Deep Drawing
Home
(current)
About
(current)
Select From The Various Drawings...
Loading Cat model. Please Wait...
This will Change when you select new Model.....
Run Again


{% extends 'base.html' %} {% block content %} Thanks for spending some quality time with the Web site today.


Grocery List
Item
Quantity
Add Grocery
frozen pizza
5
noosa yogurt
10
wine
2
iced coffe
1
a
1
pizza
1


--- name: rules url: /rules animationIn: slideInRight animationOut: slideOutLeft controller: rulesController as rc --- {{::appName}} {{::appName}} Simulation Logout
{{rule.description}}
Are you sure want to delete rule: {{rule.ruleName.toString()}} {{ruleToDelete.name.toString()}}
Are you sure want to delete rules:


Read these instructions carefully. Understand exactly what is expected before starting this Sprint Challenge.
This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored hash tables. During this sprint, you studied hash functions, collision resolution, complexity analysis of hash tables, load factor, resizing, and various use cases for hash tables. In your challenge this week, you will demonstrate mastery of these skills by solving five problems related to hash tables.
The sprint challenge is an individual assessment. All work must be your own. Your challenge score is a measure of your ability to work independently using the material covered through this sprint. You need to demonstrate proficiency in the concepts and objectives introduced and practiced in preceding days.
You are not allowed to collaborate during the sprint challenge. However, you are encouraged to follow the twenty-minute rule and seek support from your TL if you need direction.
You have three hours to complete this challenge. Plan your time accordingly.
This challenge requires you to solve algorithm problems that are amenable to being solved efficiently with a hash table.
Commit your code regularly and meaningfully. This practice helps both you (in case you ever need to return to old code for any number of reasons) and your Team Lead as they evaluate your solution.
Be prepared to demonstrate your understanding of this week’s concepts by answering questions on the following topics. You might prepare by writing down your answers beforehand.
We expect you to be able to answer questions in these areas. Your responses contribute to your Sprint Challenge grade.
<firstName-lastName>
.<firstName-lastName>
branch, committing changes regularly<firstName-lastName>
Your finished project must include all of the following requirements:
For each problem that you choose to solve, complete the following:
.py
skeleton fileNote: For these exercises, we expect you to use Python’s built-in dict
as a hashtable. That said, if you wish, you can attempt to solve using your own hashtable implementation, as well. All solutions should utilize a dict
or hashtable. You should not use Sets. (Though you can make a dict
behave like a set if you wish.)
After finishing your required elements, you can push your work further. These goals may or may not be things you have learned in this module, but they build on the material you just studied. Time allowing, stretch your limits, and see if you can deliver on the following optional goals:
Follow these steps to complete your project.


Cards are built with as little markup and styles as possible, but still manage to deliver a ton of control and customization. Built with flexbox, they offer easy alignment and mix well with other Bootstrap components.
This is an example of a basic card with mixed content and a fixed width. Cards have no fixed width to start, so they’ll naturally fill the full width of its parent element. This is easily customized with our various sizing options.
Some quick example text to build on the card title and make up the bulk of the card's content.
Go somewhereCards support a wide variety of content, including images, text, list groups, links, and more. Mix and match multiple content types to create the card you need.
The building block of the card is the
.card-block
. Use it whenever you need a padded section within a card.
Card titles are used by adding
.card-title
to a
<h*>
tag. In the same way, links are added and placed next to each other by adding
.card-link
to a
<a>
tag.
Subtitles are used by adding a
.card-subtitle
to a
<h*>
tag. If the
.card-title
and the
.card-subtitle
items are placed in a
.card-block
item, the card title and subtitle are aligned nicely.
Some quick example text to build on the card title and make up the bulk of the card's content.
Card link Another link
.card-img-top
places an image to the top of the card. With
.card-text
, text can be added to the card. Text within
.card-text
can also be styled with the standard HTML tags.
Some quick example text to build on the card title and make up the bulk of the card's content.
Create lists of content in a card with a flush list group.
Mix and match multiple content types to create the card you need, or throw everything in there. Shown below are image styles, blocks, text styles, and a list group—all wrapped in a fixed-width card.
Some quick example text to build on the card title and make up the bulk of the card's content.
Add an optional header and/or footer within a card.
With supporting text below as a natural lead-in to additional content.
Go somewhereCard headers can be styled by adding
.card-header
to
<h*>
elements.
With supporting text below as a natural lead-in to additional content.
Go somewhereConstrain the width of cards via custom CSS, our predefined grid classes, or with custom styles using our grid mixins.
Using the grid:
With supporting text below as a natural lead-in to additional content.
Go somewhereWith supporting text below as a natural lead-in to additional content.
Go somewhereUsing custom widths:
With supporting text below as a natural lead-in to additional content.
Go somewhereWith supporting text below as a natural lead-in to additional content.
Go somewhereYou can quickly change the text alignment of any card—in its entirety or specific parts—with our text align classes.
With supporting text below as a natural lead-in to additional content.
Go somewhereWith supporting text below as a natural lead-in to additional content.
Go somewhereWith supporting text below as a natural lead-in to additional content.
Go somewhere


---
notes: Call with a "color" variable to change color and "text" variable to change text. Defaults to green and "Бутон".
❗ This is a showcase of the interaction. It contains prototype JS that starts on click but returns to the button's original state 2s later. Make sure the setTimeout() event is replaced by a a successfull POST request or whatever form submission techni1que is used.
---


Understanding Cross-Site Scripting (XSS)
This article is Part 1 in a 11-Part series about the Owasp Top 10.
- Part 1 - This Article
- Part 2 - Injection Flaws
- Part 3 - Malicious File Execution
- Part 4 - Insecure Direct Object Reference
- Part 5 - Cross Site Request Forgery (CSRF)
- Part 6 - Information Leakage and Improper Error Handling
- Part 7 - Broken Authentication and Session Management
- Part 8 - Insecure Cryptographic Storage
- Part 9 - Insecure Communications
- Part 10 - OWASP 2007 Top 10 Presentation
- Part 11 - Failure to Restrict URL Access
If it hasn't already, Cross-Site Scripting (XSS) will soon be replacing SQL injection as the new buzzword in the security sector. XSS will continually be a topic on this blog as well as others 1, 2, 3, 4.
Due to this fact, I think a primer would be a good idea for those who don't know or understand this problem.
Many articles have been written about Cross-Site Scripting and if you want to have a better understanding of the problem, I suggest you read those documents (Links at the bottom of the post).
Basically, There are 3 types of Cross-Site Scripting:
- Stored/Non-Reflective/Persistent Cross Site Scripting (User visits the XSS'ed page)
- Non-Stored/Reflective/Reflected Cross Sited Scripting (User clicks a link that embeds the script into the loaded page)
- DOM Based Cross Site Scripting
All of these names make it confusing for a first timer to understand XSS. There really should be a better web application security standards organization. Here is a breakdown of Persistent XSS and Reflective XSS. These are the big two that most people talk about when they are referring to Cross Site Scripting. If you understand these well, you will be able to participate in 90% of XSS conversations.
Persistent Cross-Site Scripting
Persistent XSS is arguably more dangerous than reflective XSS. This attack embeds the malicious script permanently into the web application. The script will then wait until people access the page it is located on.
Here is an attack using Persistent Cross-Site Scripting:
- The victim visits a website they trust, amazon.com.
- A script has been inserted by an attacker on a page they happen to visit while on amazon.com.
- The script executes in the context of amazon.com.
- The victim is then compromised.
Note: Obviously, someone can increase the chances of the victim visiting this page (step 2) through social engineering, phishing, etc.
Reflective Cross-Site Scripting
These are the ones the media usually reports on. 1,2,3. In this attack, some type of social engineering is involved for the attack to be successful.
Here is an attack, using Reflective Cross-Site Scripting:
- The victim gets an email/Instant Message that contains a link.
- The victim clicks the link. (Requires User Intervention)
- A script has been inserted by an attacker on the page they then visit.
- The script executes in the context of that site.
- The victim is then compromised.
Note: I want to reiterate that this attack requires some type of user intervention (step 2).
Why is Cross-Site Scripting Bad?
Cross-Site Scripting can lead to all sorts of different exploits, including system compromise. For an attacker to do this, they need to break out of the browser's context. We have seen examples that breaking out of the browser is not that hard to do.
In addition, an attacker can also establish a bi-directional channel using iframes. This creates a man-in-the-middle attack. The attacker can then intercept key strokes, use the victim as an intranet port scanner, and even stealing credentials. The attacker is only limited by their knowledge of scripting.
Hopefully, this gives you a better understanding of Cross-Site Scripting. Feel free to leave comments if you don't understand something and I will address it in the article.


Shopping List
Electronics and Things
Phone Charger: $8.99
Space Heater: $24.79
Headphones: $14.99
Fan: $22.79
You added:
Checkout


Please wait while your file is built. You can find data dictionaries and more in the data dictionaries section of the about page.


gister
- command line gists manager
gister
[ACTION]gister
description <file.txt...>gister
is a command line tool for managing GitHub gists.
Based on gist.rb
by defunkt, this tool helps you to manage a local copy of your gists.
After publishing files to gist.github.com, this tool will:
gists.list
You can also use gisetr
to sync your gists between gist.github.com and your machine.
For Linux, BSD, etc, you also need xclip
or xsel
.
For Cygwin, you need putclip/getclip provided by cygutils-extra.
(Mas OS X users should be fine with the preinstalled pbcopy/pbpaste.)
Note: xsel
users should use gist.rb
v4.1.2+, since there is a bug bitting xsel users in previous versions.
For the first time, you need to run gister init
to associate your GitHub account and configure the directory to store local copies of your gists.
After that, you may run gister sync
to fetch all your gists to local.
Warn: sync
can only fetch up to 10 million gists for you. If you have more than 10 million gists, you need to modify the source of gister
yourself.
Whenever you want to publish a gist, just use
gister description file.txt ...
This will create the gist with the provided description, clone the gist repo, put the gistid to clipborad, and open the url in your x-www-browser
.
Note: you must provide gist description, otherwise gister
will fail.
Hint: gister
will pass all arguments to gist as gist -c -o -d description ...
, so you can use other options that gist understands, e.g. gister descrption -P
will work.
If you've edited your gists at gist.github.com
or local machine, without pull/push changesets, you can sync all your gists via gister sync
.
If you've deleted your gists at gist.github.com
, after gister sync
, the directories of deleted gists at your local machine will be marked with a prefix _
.
Search all of your gists:
gister search regexp
From version 1.0.0, gister
uses a different storage structure.
If you have used gister <1.0.0
, then you need to run this command to migrate:
gister migrate
/path/to/your/gists
|-- gists.list # a list of all your gists (including meta info)
|-- repo # git repositories of your gists
|-- tree # working directory of your gist repositories
|-- 123456 # an example of gist
|-- _123567890 # an example of gist which you have deleted on gist.github.com
|-- ...
`-- .csearchindex # code search index
Fork and/or send pull requests or issues on github: https://github.com/weakish/gister


Legal Resource Registry
— Courts, Tribunals, and their Publishing Channels —
Home
Jurisdictions
Updating a Jurisdiction
Developers
New Zealand
Accident Compensation Appeal Authority
Broadcasting Standards Authority
Court Appeal
Customs Appeal Authority
Commerce Commission
Copyright Tribunal
Deportation Review Tribunal
Human Rights Review Tribunal
Immigration Advisers Complaints Disciplinary Tribunal
International Education Appeal Authority
Immigration And Protection Tribunal
Legal Aid Tribunal
Lawyers And Conveyancers Disciplinary Tribunal
Liquor Licensing Authority
Land Valuation Tribunal
Motor Vehicle Disputes Tribunal
Private Security Personnel Licensing Authority
Real Estate Agents Disciplinary Tribunal
Student Allowance Appeal Authority
Supreme Court
Licensing Authority Of Secondhand Dealers And Pawnbrokers
Social Security Appeal Authority
Taxation Review Authority
Auckland
Blenheim
Christchurch
Dunedin
Gisborne
Greymouth
Hamilton
Invercargill
Maori Land Court Jurisdiction
Masterton
Napier
Nelson
New Plymouth
Palmerston North
Rotorua
Tauranga
Timaru
Wellington
Whanganui
Whangarei


Please eat some cookies
Chocolate Cookie
Lemon Cookie
Sugar Cookie
Click here to pretend you didn't eat any cookies!


First Name:
Last Name:
Gender :
Male
Female
known Languages
C
C++
Java
Residental_address
Country:
Indian
Non-Indian
Date


Hey! Please fill all the fields!
Hey! App is running in offline mode. All data will be synced back to server once network connectivity is back!
Hey! Looks like network connectivity is back. Trying to sync data with server!
Success! Syncing with server was successfull!
Error! Syncing with server failed. If this problem persists, please clear your browser history/cache and try again!


Access to Work
3. Apply
To get an Access to Work grant you must:
- be 16 or over
- live and work in England, Scotland or Wales - there's a different system in Northern Ireland
- have a job
- be disabled or have a long-term health condition
When you apply:
- Department for Work and Pensions will contact your employer
- someone might visit you at work
If you have a mental health condition nobody will contact your employer without talking to you first.
Long-term health conditions
If you're not permanently disabled, your health condition must either:
- have already lasted for at least a year
- be expected to last at least a year
If you're permanently disabled or have a mental health condition it doesn't matter how long you've had your condition.


King James Version + Apocrypha
ASL Translation of The King James Version or Authorized Version of the Holy Bible, based on the standardized text of 1769, with Apocrypha/Deuterocanon
Public Domain
Language: English
Dialect: American
This translation was given freely by those who translated the work. It is based on a work with letters patent issued by King James with no expiration date means that to print this translation in the United Kingdom or import printed copies into the UK, you need permission. You need this permission not because of the translation but because of what the translation was from. Currently, the Cambridge University Press, the Oxford University Press, and Collins have the exclusive right to print this Bible translation in the UK. This royal decree has no effect outside of the UK, where this work is firmly in the Public Domain. Please see http://www.cambridge.org/about-us/who-we-are/queens-printers-patent and https://en.wikipedia.org/wiki/King_James_Version#Copyright_status for more information.
This free text of the King James Version of the Holy Bible is brought to you courtesy of the Crosswire Bible Society and eBible.org.
2018-08-27


Creating ISA content¶
The ISA API provides a set of Python classes that you can use to create ISA content with.
The three main objects that you need to create ISA content are:
Investigation
Study
Assay
…of course!
Important
As a pre-requisite to using ISA model classes, please make sure you have
read and understood the
ISA Abstract Model </isamodel>
{.interpreted-text role=”doc”} that the
ISA formats are based on.
Getting started¶
In isatools.model
, the class Investigation
is used as the top level
container for all other ISA content. The Investigation
Python class
corresponds to the
Investigation
as defined in the ISA Model
Specification.
For example, to create an empty ISA structure consisting of an
investigation with one study, you might use the following code:
from isatools.model import *
investigation = Investigation()
investigation.studies.append(Study()) # adds a new default Study object to investigation
This code simply creates one Investigation
object, and adds a single
Study
object to it. The constructor of each of these objects creates
empty structures for each of these. We can then inspect the structure by
accessing its instance variables as follows:
Checking if a
study
exits:
investigation.studies
[<isatools.model.Study object>]
Checking if
assays
are associated to the firststudy
object:
investigation.studies[0].assays
[]
Checking if the
Investigation
object has atitle
attribute filled:
investigation.title
''
Since we have not set any data in our ISA objects, these are by default mostly empty at the moment. We can set some instance variables with data as follows:
investigation.title = "My ISA Investigation"
investigation.title
'My ISA Investigation'
investigation.studies[0].title = "My ISA Study"
investigation.studies[0].title
'My ISA Study'
investigation.studies[0].assays.append(Assay()) # adds a new default Assay object to study
i.studies[0].assays
[<isatools.model.Assay object>]
If you then write these out to ISA-Tab, we can inspect the output
written into an i_investigation.txt
file. We do this using the
isatab
module to dump()
the Investigation
object we created, as
follows:
from isatools import isatab
isatab.dump(investigation, 'tmp/') # dump out ISA-Tab to tmp/
<isatools.model.Investigation object>
If all went as expected, you should find an i_investigation.txt
file
with the standard Investigation sections, one Study section structured
as defined by the ISA-Tab
Specification.
Hint
Remember that when you dump()
ISA content, you do it on the
Investigation
object. This means any Study
and Assay
objects and
content must be attached to the Investigation
for it to be serialized
out.
Different classes in isatools.model
have class constructors and
instance variables that roughly map to the ISA Abstract Model. For full
details of how to instantiate model classes, access and manipulate ISA
data as objects, please inspect the module’s docstrings.
Obviously this isn’t enough to create a fully populated ISA
investigation, but we would recommend that you have a look in the
isatools.model
package to inspect all the docstring documentation that
is included with each of the ISA model classes.


China limits number of rides drivers can offer through car-pooling services
China's Ministry of Transport said car-pooling services have to limit the daily number of rides drivers can offer through apps such as Didi Chuxing's Hitch, which began trial operations this month a year after passenger deaths left the service suspended.
SHANGHAI/BEIJING: China's Ministry of Transport said car-pooling services have to limit the daily number of rides drivers can offer through apps such as Didi Chuxing's Hitch, which began trial operations this month a year after passenger deaths left the service suspended.
The comment indicates the close regulatory scrutiny ride-hailing firms continue to be under, particularly since the two incidents in which Hitch drivers killed passengers.
Hitch allows users to hail a car via smartphone and share a ride with someone heading in a similar direction at low cost. On its relaunch, Didi said it had improved safety features, limited number of daily rides and established more rigorous driver and passenger verification mechanisms.
"According to local regulations, car-pooling services should have a certain limit on the number of rides each car can offer," Xu Yahua, director of the ministry's transportation services department, said at a press briefing on Thursday in response to a question about Hitch's relaunch.
"There have also been terrible cases that have happened on ride-hailing services so we hope each platform can take in lessons and strengthen safety management measures," Xu said, according to a transcript of his comments.
A Didi Chuxing representative told Reuters via text message on Friday that the market leader will limit the daily number of rides drivers can offer on Hitch according to guidelines of cities where the service operates.
(Reporting by Brenda Goh in Shanghai and Yilei Sun in Beijing; Editing by Christopher Cushing)


View Source
Enum VR
An enum that contains all of the possible DICOM VR types.


--- layout: default title: CV ---
Ph.D. University of British Columbia, 2021
Thesis Title: Essays on Macroeconomics and Expectation Formation
M.S. University of Texas at Austin, 2015
M.A. Simon Fraser University, 2013
B.A. Fudan University, 2012
Primary fields: Macroeconomics, Monetary Economics, Applied Econometrics
Secondary fields: Behavioural Macroeconomics, Expectation Formation, Information Acquisition
STATA, Matlab, Python, TensorFlow, LATEX, Julia, R
Download Full CV