Vector2 class
2D column vector.
class Vector2 { final Float32List storage = new Float32List(2); /// Set the values of [result] to the minimum of [a] and [b] for each line. static void min(Vector2 a, Vector2 b, Vector2 result) { result.x = Math.min(a.x, b.x); result.y = Math.min(a.y, b.y); } /// Set the values of [result] to the maximum of [a] and [b] for each line. static void max(Vector2 a, Vector2 b, Vector2 result) { result.x = Math.max(a.x, b.x); result.y = Math.max(a.y, b.y); } /// Construct a new vector with the specified values. Vector2(double x_, double y_) { setValues(x_, y_); } /// Initialized with values from [array] starting at [offset]. Vector2.array(List<double> array, [int offset=0]) { int i = offset; storage[1] = array[i+1]; storage[0] = array[i+0]; } /// Zero vector. Vector2.zero(); /// Copy of [other]. Vector2.copy(Vector2 other) { setFrom(other); } /// Set the values of the vector. Vector2 setValues(double x_, double y_) { storage[0] = x_; storage[1] = y_; return this; } /// Zero the vector. Vector2 setZero() { storage[0] = 0.0; storage[1] = 0.0; return this; } /// Set the values by copying them from [other]. Vector2 setFrom(Vector2 other) { storage[1] = other.storage[1]; storage[0] = other.storage[0]; return this; } /// Splat [arg] into all lanes of the vector. Vector2 splat(double arg) { storage[0] = arg; storage[1] = arg; return this; } /// Returns a printable string String toString() => '[${storage[0]},${storage[1]}]'; /// Negate. Vector2 operator-() => new Vector2(-storage[0], -storage[1]); /// Subtract two vectors. Vector2 operator-(Vector2 other) => new Vector2(storage[0] - other.storage[0], storage[1] - other.storage[1]); /// Add two vectors. Vector2 operator+(Vector2 other) => new Vector2(storage[0] + other.storage[0], storage[1] + other.storage[1]); /// Scale. Vector2 operator/(double scale) { var o = 1.0 / scale; return new Vector2(storage[0] * o, storage[1] * o); } /// Scale. Vector2 operator*(double scale) { var o = scale; return new Vector2(storage[0] * o, storage[1] * o); } double operator[](int i) => storage[i]; void operator[]=(int i, double v) { storage[i] = v; } /// Length. double get length { double sum; sum = (storage[0] * storage[0]); sum += (storage[1] * storage[1]); return Math.sqrt(sum); } /// Length squared. double get length2 { double sum; sum = (storage[0] * storage[0]); sum += (storage[1] * storage[1]); return sum; } /// Normalize [this]. Vector2 normalize() { double l = length; // TODO(johnmccutchan): Use an epsilon. if (l == 0.0) { return this; } l = 1.0 / l; storage[0] *= l; storage[1] *= l; return this; } /// Normalize [this]. Returns length of vector before normalization. double normalizeLength() { double l = length; if (l == 0.0) { return 0.0; } l = 1.0 / l; storage[0] *= l; storage[1] *= l; return l; } /// Normalized copy of [this]. Vector2 normalized() { return new Vector2.copy(this).normalize(); } /// Normalize vector into [out]. Vector2 normalizeInto(Vector2 out) { out.setFrom(this); return out.normalize(); } /// Inner product. double dot(Vector2 other) { double sum; sum = storage[0] * other.storage[0]; sum += storage[1] * other.storage[1]; return sum; } /// Cross product. double cross(Vector2 other) { return storage[0] * other.storage[1] - storage[1] * other.storage[0]; } /// Rotate [this] by 90 degrees then scale it. Store result in [out]. Return [out]. Vector2 scaleOrthogonalInto(double scale, Vector2 out) { out.setValues(-scale * storage[1], scale * storage[0]); return out; } /// Reflect [this]. Vector2 reflect(Vector2 normal) { sub(normal.scaled(2 * normal.dot(this))); return this; } /// Reflected copy of [this]. Vector2 reflected(Vector2 normal) { return new Vector2.copy(this).reflect(normal); } /// Relative error between [this] and [correct] double relativeError(Vector2 correct) { double correct_norm = correct.length; double diff_norm = (this - correct).length; return diff_norm/correct_norm; } /// Absolute error between [this] and [correct] double absoluteError(Vector2 correct) { return (this - correct).length; } /// True if any component is infinite. bool get isInfinite { bool is_infinite = false; is_infinite = is_infinite || storage[0].isInfinite; is_infinite = is_infinite || storage[1].isInfinite; return is_infinite; } /// True if any component is NaN. bool get isNaN { bool is_nan = false; is_nan = is_nan || storage[0].isNaN; is_nan = is_nan || storage[1].isNaN; return is_nan; } /// Add [arg] to [this]. Vector2 add(Vector2 arg) { storage[0] = storage[0] + arg.storage[0]; storage[1] = storage[1] + arg.storage[1]; return this; } /// Subtract [arg] from [this]. Vector2 sub(Vector2 arg) { storage[0] = storage[0] - arg.storage[0]; storage[1] = storage[1] - arg.storage[1]; return this; } /// Multiply entries in [this] with entries in [arg]. Vector2 multiply(Vector2 arg) { storage[0] = storage[0] * arg.storage[0]; storage[1] = storage[1] * arg.storage[1]; return this; } /// Divide entries in [this] with entries in [arg]. Vector2 divide(Vector2 arg) { storage[0] = storage[0] / arg.storage[0]; storage[1] = storage[1] / arg.storage[1]; return this; } /// Scale [this]. Vector2 scale(double arg) { storage[1] = storage[1] * arg; storage[0] = storage[0] * arg; return this; } Vector2 scaled(double arg) { return clone().scale(arg); } /// Negate. Vector2 negate() { storage[1] = -storage[1]; storage[0] = -storage[0]; return this; } /// Absolute value. Vector2 absolute() { storage[1] = storage[1].abs(); storage[0] = storage[0].abs(); return this; } /// Clone of [this]. Vector2 clone() { return new Vector2.copy(this); } /// Copy [this] into [arg]. Returns [arg]. Vector2 copyInto(Vector2 arg) { arg.storage[1] = storage[1]; arg.storage[0] = storage[0]; return arg; } /// Copies [this] into [array] starting at [offset]. void copyIntoArray(List<double> array, [int offset=0]) { array[offset+1] = storage[1]; array[offset+0] = storage[0]; } /// Copies elements from [array] into [this] starting at [offset]. void copyFromArray(List<double> array, [int offset=0]) { storage[1] = array[offset+1]; storage[0] = array[offset+0]; } set xy(Vector2 arg) { storage[0] = arg.storage[0]; storage[1] = arg.storage[1]; } set yx(Vector2 arg) { storage[1] = arg.storage[0]; storage[0] = arg.storage[1]; } set r(double arg) => storage[0] = arg; set g(double arg) => storage[1] = arg; set s(double arg) => storage[0] = arg; set t(double arg) => storage[1] = arg; set x(double arg) => storage[0] = arg; set y(double arg) => storage[1] = arg; set rg(Vector2 arg) { storage[0] = arg.storage[0]; storage[1] = arg.storage[1]; } set gr(Vector2 arg) { storage[1] = arg.storage[0]; storage[0] = arg.storage[1]; } set st(Vector2 arg) { storage[0] = arg.storage[0]; storage[1] = arg.storage[1]; } set ts(Vector2 arg) { storage[1] = arg.storage[0]; storage[0] = arg.storage[1]; } Vector2 get xx => new Vector2(storage[0], storage[0]); Vector2 get xy => new Vector2(storage[0], storage[1]); Vector2 get yx => new Vector2(storage[1], storage[0]); Vector2 get yy => new Vector2(storage[1], storage[1]); Vector3 get xxx => new Vector3(storage[0], storage[0], storage[0]); Vector3 get xxy => new Vector3(storage[0], storage[0], storage[1]); Vector3 get xyx => new Vector3(storage[0], storage[1], storage[0]); Vector3 get xyy => new Vector3(storage[0], storage[1], storage[1]); Vector3 get yxx => new Vector3(storage[1], storage[0], storage[0]); Vector3 get yxy => new Vector3(storage[1], storage[0], storage[1]); Vector3 get yyx => new Vector3(storage[1], storage[1], storage[0]); Vector3 get yyy => new Vector3(storage[1], storage[1], storage[1]); Vector4 get xxxx => new Vector4(storage[0], storage[0], storage[0], storage[0]); Vector4 get xxxy => new Vector4(storage[0], storage[0], storage[0], storage[1]); Vector4 get xxyx => new Vector4(storage[0], storage[0], storage[1], storage[0]); Vector4 get xxyy => new Vector4(storage[0], storage[0], storage[1], storage[1]); Vector4 get xyxx => new Vector4(storage[0], storage[1], storage[0], storage[0]); Vector4 get xyxy => new Vector4(storage[0], storage[1], storage[0], storage[1]); Vector4 get xyyx => new Vector4(storage[0], storage[1], storage[1], storage[0]); Vector4 get xyyy => new Vector4(storage[0], storage[1], storage[1], storage[1]); Vector4 get yxxx => new Vector4(storage[1], storage[0], storage[0], storage[0]); Vector4 get yxxy => new Vector4(storage[1], storage[0], storage[0], storage[1]); Vector4 get yxyx => new Vector4(storage[1], storage[0], storage[1], storage[0]); Vector4 get yxyy => new Vector4(storage[1], storage[0], storage[1], storage[1]); Vector4 get yyxx => new Vector4(storage[1], storage[1], storage[0], storage[0]); Vector4 get yyxy => new Vector4(storage[1], storage[1], storage[0], storage[1]); Vector4 get yyyx => new Vector4(storage[1], storage[1], storage[1], storage[0]); Vector4 get yyyy => new Vector4(storage[1], storage[1], storage[1], storage[1]); double get r => storage[0]; double get g => storage[1]; double get s => storage[0]; double get t => storage[1]; double get x => storage[0]; double get y => storage[1]; Vector2 get rr => new Vector2(storage[0], storage[0]); Vector2 get rg => new Vector2(storage[0], storage[1]); Vector2 get gr => new Vector2(storage[1], storage[0]); Vector2 get gg => new Vector2(storage[1], storage[1]); Vector3 get rrr => new Vector3(storage[0], storage[0], storage[0]); Vector3 get rrg => new Vector3(storage[0], storage[0], storage[1]); Vector3 get rgr => new Vector3(storage[0], storage[1], storage[0]); Vector3 get rgg => new Vector3(storage[0], storage[1], storage[1]); Vector3 get grr => new Vector3(storage[1], storage[0], storage[0]); Vector3 get grg => new Vector3(storage[1], storage[0], storage[1]); Vector3 get ggr => new Vector3(storage[1], storage[1], storage[0]); Vector3 get ggg => new Vector3(storage[1], storage[1], storage[1]); Vector4 get rrrr => new Vector4(storage[0], storage[0], storage[0], storage[0]); Vector4 get rrrg => new Vector4(storage[0], storage[0], storage[0], storage[1]); Vector4 get rrgr => new Vector4(storage[0], storage[0], storage[1], storage[0]); Vector4 get rrgg => new Vector4(storage[0], storage[0], storage[1], storage[1]); Vector4 get rgrr => new Vector4(storage[0], storage[1], storage[0], storage[0]); Vector4 get rgrg => new Vector4(storage[0], storage[1], storage[0], storage[1]); Vector4 get rggr => new Vector4(storage[0], storage[1], storage[1], storage[0]); Vector4 get rggg => new Vector4(storage[0], storage[1], storage[1], storage[1]); Vector4 get grrr => new Vector4(storage[1], storage[0], storage[0], storage[0]); Vector4 get grrg => new Vector4(storage[1], storage[0], storage[0], storage[1]); Vector4 get grgr => new Vector4(storage[1], storage[0], storage[1], storage[0]); Vector4 get grgg => new Vector4(storage[1], storage[0], storage[1], storage[1]); Vector4 get ggrr => new Vector4(storage[1], storage[1], storage[0], storage[0]); Vector4 get ggrg => new Vector4(storage[1], storage[1], storage[0], storage[1]); Vector4 get gggr => new Vector4(storage[1], storage[1], storage[1], storage[0]); Vector4 get gggg => new Vector4(storage[1], storage[1], storage[1], storage[1]); Vector2 get ss => new Vector2(storage[0], storage[0]); Vector2 get st => new Vector2(storage[0], storage[1]); Vector2 get ts => new Vector2(storage[1], storage[0]); Vector2 get tt => new Vector2(storage[1], storage[1]); Vector3 get sss => new Vector3(storage[0], storage[0], storage[0]); Vector3 get sst => new Vector3(storage[0], storage[0], storage[1]); Vector3 get sts => new Vector3(storage[0], storage[1], storage[0]); Vector3 get stt => new Vector3(storage[0], storage[1], storage[1]); Vector3 get tss => new Vector3(storage[1], storage[0], storage[0]); Vector3 get tst => new Vector3(storage[1], storage[0], storage[1]); Vector3 get tts => new Vector3(storage[1], storage[1], storage[0]); Vector3 get ttt => new Vector3(storage[1], storage[1], storage[1]); Vector4 get ssss => new Vector4(storage[0], storage[0], storage[0], storage[0]); Vector4 get ssst => new Vector4(storage[0], storage[0], storage[0], storage[1]); Vector4 get ssts => new Vector4(storage[0], storage[0], storage[1], storage[0]); Vector4 get sstt => new Vector4(storage[0], storage[0], storage[1], storage[1]); Vector4 get stss => new Vector4(storage[0], storage[1], storage[0], storage[0]); Vector4 get stst => new Vector4(storage[0], storage[1], storage[0], storage[1]); Vector4 get stts => new Vector4(storage[0], storage[1], storage[1], storage[0]); Vector4 get sttt => new Vector4(storage[0], storage[1], storage[1], storage[1]); Vector4 get tsss => new Vector4(storage[1], storage[0], storage[0], storage[0]); Vector4 get tsst => new Vector4(storage[1], storage[0], storage[0], storage[1]); Vector4 get tsts => new Vector4(storage[1], storage[0], storage[1], storage[0]); Vector4 get tstt => new Vector4(storage[1], storage[0], storage[1], storage[1]); Vector4 get ttss => new Vector4(storage[1], storage[1], storage[0], storage[0]); Vector4 get ttst => new Vector4(storage[1], storage[1], storage[0], storage[1]); Vector4 get ttts => new Vector4(storage[1], storage[1], storage[1], storage[0]); Vector4 get tttt => new Vector4(storage[1], storage[1], storage[1], storage[1]); }
Static Methods
Constructors
new Vector2(double x_, double y_) #
Construct a new vector with the specified values.
Vector2(double x_, double y_) { setValues(x_, y_); }
new Vector2.array(List<double> array, [int offset = 0]) #
Initialized with values from array starting at offset.
Vector2.array(List<double> array, [int offset=0]) { int i = offset; storage[1] = array[i+1]; storage[0] = array[i+0]; }
new Vector2.zero() #
Zero vector.
Vector2.zero();
Properties
final Vector4 gggg #
Vector4 get gggg => new Vector4(storage[1], storage[1], storage[1], storage[1]);
final Vector4 gggr #
Vector4 get gggr => new Vector4(storage[1], storage[1], storage[1], storage[0]);
final Vector4 ggrg #
Vector4 get ggrg => new Vector4(storage[1], storage[1], storage[0], storage[1]);
final Vector4 ggrr #
Vector4 get ggrr => new Vector4(storage[1], storage[1], storage[0], storage[0]);
Vector2 gr #
Vector2 get gr => new Vector2(storage[1], storage[0]);
set gr(Vector2 arg) { storage[1] = arg.storage[0]; storage[0] = arg.storage[1]; }
final Vector4 grgg #
Vector4 get grgg => new Vector4(storage[1], storage[0], storage[1], storage[1]);
final Vector4 grgr #
Vector4 get grgr => new Vector4(storage[1], storage[0], storage[1], storage[0]);
final Vector4 grrg #
Vector4 get grrg => new Vector4(storage[1], storage[0], storage[0], storage[1]);
final Vector4 grrr #
Vector4 get grrr => new Vector4(storage[1], storage[0], storage[0], storage[0]);
final bool isInfinite #
True if any component is infinite.
bool get isInfinite { bool is_infinite = false; is_infinite = is_infinite || storage[0].isInfinite; is_infinite = is_infinite || storage[1].isInfinite; return is_infinite; }
final bool isNaN #
True if any component is NaN.
bool get isNaN { bool is_nan = false; is_nan = is_nan || storage[0].isNaN; is_nan = is_nan || storage[1].isNaN; return is_nan; }
final double length #
Length.
double get length { double sum; sum = (storage[0] * storage[0]); sum += (storage[1] * storage[1]); return Math.sqrt(sum); }
final double length2 #
Length squared.
double get length2 { double sum; sum = (storage[0] * storage[0]); sum += (storage[1] * storage[1]); return sum; }
Vector2 rg #
Vector2 get rg => new Vector2(storage[0], storage[1]);
set rg(Vector2 arg) { storage[0] = arg.storage[0]; storage[1] = arg.storage[1]; }
final Vector4 rggg #
Vector4 get rggg => new Vector4(storage[0], storage[1], storage[1], storage[1]);
final Vector4 rggr #
Vector4 get rggr => new Vector4(storage[0], storage[1], storage[1], storage[0]);
final Vector4 rgrg #
Vector4 get rgrg => new Vector4(storage[0], storage[1], storage[0], storage[1]);
final Vector4 rgrr #
Vector4 get rgrr => new Vector4(storage[0], storage[1], storage[0], storage[0]);
final Vector4 rrgg #
Vector4 get rrgg => new Vector4(storage[0], storage[0], storage[1], storage[1]);
final Vector4 rrgr #
Vector4 get rrgr => new Vector4(storage[0], storage[0], storage[1], storage[0]);
final Vector4 rrrg #
Vector4 get rrrg => new Vector4(storage[0], storage[0], storage[0], storage[1]);
final Vector4 rrrr #
Vector4 get rrrr => new Vector4(storage[0], storage[0], storage[0], storage[0]);
final Vector4 ssss #
Vector4 get ssss => new Vector4(storage[0], storage[0], storage[0], storage[0]);
final Vector4 ssst #
Vector4 get ssst => new Vector4(storage[0], storage[0], storage[0], storage[1]);
final Vector4 ssts #
Vector4 get ssts => new Vector4(storage[0], storage[0], storage[1], storage[0]);
final Vector4 sstt #
Vector4 get sstt => new Vector4(storage[0], storage[0], storage[1], storage[1]);
Vector2 st #
Vector2 get st => new Vector2(storage[0], storage[1]);
set st(Vector2 arg) { storage[0] = arg.storage[0]; storage[1] = arg.storage[1]; }
final Float32List storage #
final Float32List storage = new Float32List(2)
final Vector4 stss #
Vector4 get stss => new Vector4(storage[0], storage[1], storage[0], storage[0]);
final Vector4 stst #
Vector4 get stst => new Vector4(storage[0], storage[1], storage[0], storage[1]);
final Vector4 stts #
Vector4 get stts => new Vector4(storage[0], storage[1], storage[1], storage[0]);
final Vector4 sttt #
Vector4 get sttt => new Vector4(storage[0], storage[1], storage[1], storage[1]);
Vector2 ts #
Vector2 get ts => new Vector2(storage[1], storage[0]);
set ts(Vector2 arg) { storage[1] = arg.storage[0]; storage[0] = arg.storage[1]; }
final Vector4 tsss #
Vector4 get tsss => new Vector4(storage[1], storage[0], storage[0], storage[0]);
final Vector4 tsst #
Vector4 get tsst => new Vector4(storage[1], storage[0], storage[0], storage[1]);
final Vector4 tsts #
Vector4 get tsts => new Vector4(storage[1], storage[0], storage[1], storage[0]);
final Vector4 tstt #
Vector4 get tstt => new Vector4(storage[1], storage[0], storage[1], storage[1]);
final Vector4 ttss #
Vector4 get ttss => new Vector4(storage[1], storage[1], storage[0], storage[0]);
final Vector4 ttst #
Vector4 get ttst => new Vector4(storage[1], storage[1], storage[0], storage[1]);
final Vector4 ttts #
Vector4 get ttts => new Vector4(storage[1], storage[1], storage[1], storage[0]);
final Vector4 tttt #
Vector4 get tttt => new Vector4(storage[1], storage[1], storage[1], storage[1]);
final Vector4 xxxx #
Vector4 get xxxx => new Vector4(storage[0], storage[0], storage[0], storage[0]);
final Vector4 xxxy #
Vector4 get xxxy => new Vector4(storage[0], storage[0], storage[0], storage[1]);
final Vector4 xxyx #
Vector4 get xxyx => new Vector4(storage[0], storage[0], storage[1], storage[0]);
final Vector4 xxyy #
Vector4 get xxyy => new Vector4(storage[0], storage[0], storage[1], storage[1]);
Vector2 xy #
Vector2 get xy => new Vector2(storage[0], storage[1]);
set xy(Vector2 arg) { storage[0] = arg.storage[0]; storage[1] = arg.storage[1]; }
final Vector4 xyxx #
Vector4 get xyxx => new Vector4(storage[0], storage[1], storage[0], storage[0]);
final Vector4 xyxy #
Vector4 get xyxy => new Vector4(storage[0], storage[1], storage[0], storage[1]);
final Vector4 xyyx #
Vector4 get xyyx => new Vector4(storage[0], storage[1], storage[1], storage[0]);
final Vector4 xyyy #
Vector4 get xyyy => new Vector4(storage[0], storage[1], storage[1], storage[1]);
Vector2 yx #
Vector2 get yx => new Vector2(storage[1], storage[0]);
set yx(Vector2 arg) { storage[1] = arg.storage[0]; storage[0] = arg.storage[1]; }
final Vector4 yxxx #
Vector4 get yxxx => new Vector4(storage[1], storage[0], storage[0], storage[0]);
final Vector4 yxxy #
Vector4 get yxxy => new Vector4(storage[1], storage[0], storage[0], storage[1]);
final Vector4 yxyx #
Vector4 get yxyx => new Vector4(storage[1], storage[0], storage[1], storage[0]);
final Vector4 yxyy #
Vector4 get yxyy => new Vector4(storage[1], storage[0], storage[1], storage[1]);
final Vector4 yyxx #
Vector4 get yyxx => new Vector4(storage[1], storage[1], storage[0], storage[0]);
final Vector4 yyxy #
Vector4 get yyxy => new Vector4(storage[1], storage[1], storage[0], storage[1]);
Operators
Vector2 operator +(Vector2 other) #
Add two vectors.
Vector2 operator+(Vector2 other) => new Vector2(storage[0] + other.storage[0], storage[1] + other.storage[1]);
Vector2 operator -(Vector2 other) #
Subtract two vectors.
Vector2 operator-(Vector2 other) => new Vector2(storage[0] - other.storage[0], storage[1] - other.storage[1]);
Methods
Vector2 absolute() #
Absolute value.
Vector2 absolute() { storage[1] = storage[1].abs(); storage[0] = storage[0].abs(); return this; }
double absoluteError(Vector2 correct) #
Absolute error between this
and
correct
double absoluteError(Vector2 correct) { return (this - correct).length; }
Vector2 add(Vector2 arg) #
Add
arg to this
.
Vector2 add(Vector2 arg) { storage[0] = storage[0] + arg.storage[0]; storage[1] = storage[1] + arg.storage[1]; return this; }
void copyFromArray(List<double> array, [int offset = 0]) #
Copies elements from
array into this
starting at
offset.
void copyFromArray(List<double> array, [int offset=0]) { storage[1] = array[offset+1]; storage[0] = array[offset+0]; }
Vector2 copyInto(Vector2 arg) #
Copy this
into
arg. Returns
arg.
Vector2 copyInto(Vector2 arg) { arg.storage[1] = storage[1]; arg.storage[0] = storage[0]; return arg; }
void copyIntoArray(List<double> array, [int offset = 0]) #
Copies this
into
array starting at
offset.
void copyIntoArray(List<double> array, [int offset=0]) { array[offset+1] = storage[1]; array[offset+0] = storage[0]; }
double cross(Vector2 other) #
Cross product.
double cross(Vector2 other) { return storage[0] * other.storage[1] - storage[1] * other.storage[0]; }
Vector2 divide(Vector2 arg) #
Divide entries in this
with entries in
arg.
Vector2 divide(Vector2 arg) { storage[0] = storage[0] / arg.storage[0]; storage[1] = storage[1] / arg.storage[1]; return this; }
double dot(Vector2 other) #
Inner product.
double dot(Vector2 other) { double sum; sum = storage[0] * other.storage[0]; sum += storage[1] * other.storage[1]; return sum; }
Vector2 multiply(Vector2 arg) #
Multiply entries in this
with entries in
arg.
Vector2 multiply(Vector2 arg) { storage[0] = storage[0] * arg.storage[0]; storage[1] = storage[1] * arg.storage[1]; return this; }
Vector2 negate() #
Negate.
Vector2 negate() { storage[1] = -storage[1]; storage[0] = -storage[0]; return this; }
Vector2 normalize() #
Normalize this
.
Vector2 normalize() { double l = length; // TODO(johnmccutchan): Use an epsilon. if (l == 0.0) { return this; } l = 1.0 / l; storage[0] *= l; storage[1] *= l; return this; }
Vector2 normalized() #
Normalized copy of this
.
Vector2 normalized() { return new Vector2.copy(this).normalize(); }
Vector2 normalizeInto(Vector2 out) #
Normalize vector into out.
Vector2 normalizeInto(Vector2 out) { out.setFrom(this); return out.normalize(); }
double normalizeLength() #
Normalize this
. Returns length of vector before normalization.
double normalizeLength() { double l = length; if (l == 0.0) { return 0.0; } l = 1.0 / l; storage[0] *= l; storage[1] *= l; return l; }
Vector2 reflect(Vector2 normal) #
Reflect this
.
Vector2 reflect(Vector2 normal) { sub(normal.scaled(2 * normal.dot(this))); return this; }
Vector2 reflected(Vector2 normal) #
Reflected copy of this
.
Vector2 reflected(Vector2 normal) { return new Vector2.copy(this).reflect(normal); }
double relativeError(Vector2 correct) #
Relative error between this
and
correct
double relativeError(Vector2 correct) { double correct_norm = correct.length; double diff_norm = (this - correct).length; return diff_norm/correct_norm; }
Vector2 scale(double arg) #
Scale this
.
Vector2 scale(double arg) { storage[1] = storage[1] * arg; storage[0] = storage[0] * arg; return this; }
Vector2 scaleOrthogonalInto(double scale, Vector2 out) #
Rotate this
by 90 degrees then scale it. Store result in
out. Return
out.
Vector2 scaleOrthogonalInto(double scale, Vector2 out) { out.setValues(-scale * storage[1], scale * storage[0]); return out; }
Vector2 setFrom(Vector2 other) #
Set the values by copying them from other.
Vector2 setFrom(Vector2 other) { storage[1] = other.storage[1]; storage[0] = other.storage[0]; return this; }
Vector2 setValues(double x_, double y_) #
Set the values of the vector.
Vector2 setValues(double x_, double y_) { storage[0] = x_; storage[1] = y_; return this; }
Vector2 setZero() #
Zero the vector.
Vector2 setZero() { storage[0] = 0.0; storage[1] = 0.0; return this; }
Vector2 splat(double arg) #
Splat arg into all lanes of the vector.
Vector2 splat(double arg) { storage[0] = arg; storage[1] = arg; return this; }


Enjoy Cooking
A Recipe Makes Life Better
Grandma's Lemon Meringue Pie
There is something fresh and new about Lemon Meringue Pie. Strangely,
there’s something nostalgic and lovely about it, too. This pie is sweet and perfect,
just like the pie Grandma used to make…except for one major change. Instead of cooking
your lemon custard in a finicky, boiling water bath (who keeps a double broiler on
hand nowadays?), you get to thicken the filling with your trusty microwave.
Old-fashioned flavors made with newfangled technology? Now, that’s a pie you can pull
together in no time at all!
Click here for details!


Click an action to highlight it, and then press any key (with or without shift/ctrl/alt) to bind that action to that key. You can also right click an action to unbind it.
Settings
Change the base GCD to simulate higher Spell Speeds.


Solve this sliding picture puzzle!
Reset
Moves:
INSTRUCTIONS
Move the tiles to complete the picture. To move a tile, click on it.


4.15.7 Summary of Predicates
abort
- abort execution of the program; return to current break level
break
- start a new break-level to interpret commands from the user
catch(
:P,
?E,
:H)
ISO- specify a handler H for any exception E arising in the
execution of the goal P
user:error_exception(
+Exception)
hook- Exception is an exception that traps to the debugger if it is
switched on.
goal_source_info(
+AGoal,
-Goal,
-SourceInfo)
- Decomposes the annotated goal AGoal into a Goal proper
and the SourceInfo descriptor term, indicating the source
position of the goal.
halt
ISOhalt(C)
ISO- exit from Prolog with exit code C
on_exception(
?E,
:P,
:H)
- specify a handler H for any exception E arising in the
execution of the goal P
raise_exception(
+E)
- raise exception E
throw(
+E)
ISO- raise exception E
Send feedback on this subject.


About no no. Cucumber and frigate! Be with us no no... Apart from banana, no; Potato and Potato!
Banana McYellow


Type String Event system Revision Current Public Release (2013.2076) Keywords system, type
Identifies the type of system event that occurred. It will be one of the following values:
"applicationStart"
occurs when the application is launched and all code in main.lua is executed."applicationExit"
occurs when the user or OS task manager quits the application."applicationSuspend"
occurs when the device needs to suspend the application such as during a phone call or if the device goes to sleep (from inactivity or user action). In the simulator, this corresponds to selecting "Suspend" from the Hardware menu. During suspension, no events (not even enterFrame events) are sent to the application while suspended, so if you have code that depends on time, you should account for the time lost to an application being suspended."applicationResume"
occurs when the application resumes after a suspend. On the device, this occurs if the application was suspended because of a phone call or sleep. In the simulator, this corresponds to selecting "Resume" from the Hardware menu."applicationOpen"
occurs when the application is asked to open a URL resource (iOS-only)local function onSystemEvent( event )
print( "System event name and type: " .. event.name, event.type )
end
Runtime:addEventListener( "system", onSystemEvent )


Purpose and Methodology
These measurements are meant to give a ballpark figure that starts a discussion, and are in no way definitive of actual performance for Redis or Redis-V8. Your own mileage may vary.
Details such as specific versions of libraries used can be gleaned from the source files linked below each benchmark graph.
Testbed configuration
Using a `micro-instance` sporting one virtual core with 1GB of RAM
(graciously hosted by www.yooclouds.com)
| Software: | CentOS release 6.3 (Final) |
| Memory: | 1GB DDR3 @ 1066Mhz |
| CPU: | 1 dedicated core @ 2.4 Ghz |
NodeJS + node_redis library
Testing basic operations where each "1 call" is looping on the order of hundreds of thousands of iterations, using NodeJS with the node_redis library. This is done as a ghetto way of building a performance scaling graph out of individual tests.
Test source files: github.com/h0x91b/redis-v8/tree/master/benchmarks (all files ending in *.js)
PHP + predis library
Basic ops are run in a tight loop on the order of hundreds of thousands for each call, with the goal to establish a rough estimate of performance scaling. Tests are run by PHP5 using predis library to communicate with the memory store.
Test source located at github.com/h0x91b/redis-v8/tree/master/benchmarks (all the files with a *.php extension)
redis-benchmark tool (part of official Redis distribution)
You can try this test for yourself by typing:
$ cd redis-v8/redis/src $ ./redis-server ../redis.conf $ ./redis-benchmark -q -s /tmp/redis.sock


{% extends "index.html" %} {% block graphs %} {# Load the AJAX API #} {# #} {% endblock %} {% block main %} {# Main Content #}
Every hour, we look at the live Twitter stream, and grab a few thousand tweets from it. We then perform an analysis of the tweets. The results are given below.
You can also look at the most popular tweets, or topics which are trending on Twitter
We look at the most common languages in the several thousand tweet we grabbed.
Hover over the chart to see details.
This time, we only look at the languages of Tweets that have at least 10,000 retweets.
We look at how many people are using kind/love words, vs how many people are swearing.
The words we looked at were:
Love words = Love, Thank, Happy, Bless
Swear words = Idiot, Shit, F**k, B*t*h, Bastard
We then plot the relative percentages of each.
We measure which countries are being tweeted about.


CI build console
What's this for?
LSL supports a large range of systems, from tiny Raspberry Pis and Android/iOS Phones to large PCs with Windows,
Linux
and OS X. Before proposing changes, it's therefore a good idea to test if your code compiles and runs on these
platforms.
You can register with your GitHub Account at
AppVeyor
and
Travis CI and compile your code on most supported systems. To do
this, request your API tokens (see links below) and
fill out the forms below to start a CI build and see if everything works.
(Request data appears here)
(Request results appear here)


Embrace yourself for these absolutely gigantic blue whale facts!
Blue whale facts
Lifespan (in wild)
: 80 to 90 years
Weight
: More than 130000kg! That's heavier than 3 lorries!
Body size
: 30m long
Habitat
: Oceans
Did you know?
Blue whales are the largest ever animals to have lived on earth.. Their tongues weigh as much an elephant, its heart is the size of a car, and their bloodvessles are so wide you could swim through them!


@MrGeo_Terra Currently the only thing the best browser is missing is a mobile client and syncing across devices.
Join us…


To see the source code or downloads please go here.


Resume
OBJECTIVE
EDUCATION
EXPERIENCE
SKILLS
Software Knowledge
add more..
Languages
add more..
Projects
add more..
submit
Go to Top


A graphical user interface (GUI) is essential for applications which should be used by standard computer users (non-developers, not computer scientists, ...). However, I have almost no experience with GUI development outside of the web.
Multiple GUI toolkits exist and the only one I have ever used is Tk for a very, very simple GUI.
In this article, I want to share some of my thoughts about GUI development with Python as a beginner. I might update this in future.
GUI toolkits
A widget toolkit, widget library, GUI toolkit, or UX library is a library or a collection of libraries containing a set of graphical control elements (called widgets) used to construct the graphical user interface (GUI) of programs.
Source: Widget toolkit
Comparison
I am only interested in GUI toolkits
- which work on Ubuntu 12.04+,
- which have a Python binding,
- which are OpenSource and have a good license,
- which are used by others (and hence have enough documentation and examples)
It seems to me that only the following four toolkits fulfill these requirements: GTK, Qt, Tk, wxWidgets. Some of these have multiple Python bindings and all have multiple GUI builders / designers. I tried to find the most commonly used one. Please let me know if I should add something, replace something:
| Name | GTK+ | Qt | Tk | wxWidgets |
|---|---|---|---|---|
| Latest version (23.01.2015) | 3.14.1 | 5.4.0 | 8.6.3 | 3.0.2 |
| Official Website | gtk.org | qt-project.org | tcl.tk | wxwidgets.org |
| Initial release | 1998 | 1995 | 1991 | 1992 |
| Written in | C | C++ | C | C++ |
| Documentation | gtk.org/documentation.php | doc.qt.io | tkdocs.com | wxwidgets.org/docs |
| Tutorial | developer.gnome.org/gtk-tutorial/stable | qt-project.org/doc/qt-4.8/tutorials.html | tkdocs.com/tutorial | wxwidgets.org/docs/tutorials |
| StackOverflow questions | 4,715 | 37,626 | 929 | 1,918 |
| StackOverflow unanswered | 1,159 | 9,704 | 208 | 429 |
| License | LGPL 2.1 | LGLP 3.0 (mutliple | BSD-style | wxWindows License |
| Python binding | PyGTK (docs) | PySide (docs), PyQt | Tkinter (docs) | wxPython (docs) |
| Python 3 support | yes | yes | yes? | yes |
| Designer | Glade Interface Designer | QtDesigner, QtCreator, QDevelop, Edyuk | SpecTcl | wxGlade |
| Famous applications | Gnome applications like Inkscape, OTR-Verwaltung | vlc, Virtual Box, KDE applications like K3B, Anki | I could not find any | Code::Blocks FileZilla 0 A.D. |
There are also some applications which use custom UI toolkits:
See also
- List of widget toolkits
- Graphical user interface builder
- The Python GTK+ 3 Tutorial
- Why are Tk GUI's considered ugly?
- wxPython vs PyQt vs PyGTK: when and what to use?
- What's the difference between GTK and QT?
Qt-specific
- Differences Between PySide and PyQt
- Should I use PyQt or PySide for a new Qt project?
- PyQt or PySide - which one to use
- Developing Cross Platform Application using Qt, PyQt and PySide : Introduction - Part 1 of 5


You might be familiar with this scenario, you are browsing the Facebook, having your new project plan in mind which dues by Monday, and you still feel not ready to start.
Telling procrastinators “Be practical” or “Just do it” is like telling junk-food lovers “Don’t eat fried chips”. Based on the researches, I realized that it’s more like a habit involving psychology problem than a design question that I can solve. So I set a step back to help people with avoiding the troubles that procrastination brings so that the fear and pressure would be less which let the virtuous circle continues.
After considering the platform that I could exploit best, the target users were narrowed down to those who worked on laptops and had a clue about what to do.
Psychologist Shawn Achor and his Ted talk — The happy secret to better work inspired me with another perspective to see why people procrastinate. If a person sets a plan based on his best behavior and takes it as a qualified line, no wonder he fears to start it.
People love games. Obviously, breaking work into specific steps and making that a game is a good idea, but the game design part would swallow a lot determinations. So the solution should have a more simple game system.
So I chose to create a chrome extension to encourage users to get more time to work. Users don’t need to be productive, they just need to do things related to work, including easing nerves about upcoming work. And users need to earn relax time by devoting working time. The ratio of working time and relax time are set by users.
I did early state design following the chrome extension development guide. The extension let users classify their tabs by clicking the icon with the color switching.
I did a user test on paper prototype to figure out how frequently and under what circumstances people are comfortable to interact with the timer. Based on the results, it made most sense that the color of the icon would follow the former one until user change it.
Chrome allows one object per extension to interact with which gave me one more challenge for my design. At first I designed two part for two function, one was for clarifying tabs, the other was for more information about the timer.
Since the smoothness is a kin user experience which depends on the codes, the design shouldn’t bring any burden, it should be clear and light. I adjusted the design while doing research for the similar functions on Stack Overflow.
I have a team for this project now, one developer helping me with building the extension, and other three as “professional” and picky user testers for feedback and supervise. Codes for this project can be found on GitHub.
By the way, making your individual project as a team project is an efficient way to fight against procrastination.


ZIP: 220 Title: Zcash Shielded Assets Owners: Jack Grigg<EMAIL_ADDRESS>Daira Emma Hopwood<EMAIL_ADDRESS>Status: Withdrawn Category: Consensus Discussions-To: <https://github.com/zcash/zcash/issues/830> Pull-Request: <https://github.com/zcash/zips/pull/269>


>
Please fill in this form to create an account.
Password should contain minimum 8 characters, atleast one uppercase,one lowercase , one special character and one number
By creating an account you agree to our Terms & Privacy.


In reverse proxy mode, mitmproxy accepts standard HTTP requests and forwards them to the specified upstream server. This is in contrast to upstream proxy mode, in which mitmproxy forwards HTTP proxy requests to an upstream proxy server. Note that the displayed URL for flows in this mode will use the value of the __Host__ header field from the request, not the reverse proxy server.
| command-line | -R http[s]://hostname[:port] |
|---|---|
| mitmproxy shortcut | P |


SMA N 13 BANDAR LAMPUNG
15
15 Notifications
4 new messages
3 mins
8 friend requests
12 hours
3 new reports
2 days
See All Notifications
Advanced Form
Home
Advanced Form
Select2 (Bootstrap4 Theme)
Minimal
Alabama
Alaska
California
Delaware
Tennessee
Texas
Washington


Archive Page by TeleSwipe TeleSwipe Scroll Down This Years Archive. 19 Jan Start with Teleswipe Sketches 15 Jan Start with Teleswipe 2017 26 Jul shell.sh


Raritan Valley Fall 2018
Classes
Last Updated: *Date*
Contact
<EMAIL_ADDRESS>with any suggestions, concerns, corrections, or questions.
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
- Chart is currently in construction -


Human: Learn the sun is hot
Bot: Ok I will learn that the sun is hot.
Human: Learn London is in England
Bot: Ok I will learn that London is in England.
Human: Learn a cat has four legs.
Bot: Ok I will learn that a cat has 4 legs.
Human: What has 4 legs?
Bot: a cat.
Human: What is the sun
Bot: hot.
Human: Learn the sun is hot and yellow
Bot: Ok I will learn that the sun is hot and yellow.
Human: What is hot and yellow
Bot: the sun.
Human: What is the sun
Bot: hot and yellow.
Human: Where is London
Bot: in England.
Human: What is in England
Bot: London.
Human: Learn Dr Wallace is an AI expert
Bot: Ok I will learn that Dr Wallace is an AI expert.
Human: What is an AI expert
Bot: Dr Wallace.
Human: Who is an AI expert
Bot: Dr Wallace.
Human: Who is Dr Wallace
Bot: an AI expert.
Human: What is hot
Bot: the sun.
Human: What has a cat?
Bot: 4 legs.


{{/* Simple heading. Preferred to markdown headings to enforce heading level for accessibility. See https://github.com/BCLibraries/burns-exhibits/issues/8 */}}


--- layout: archive title: Zulip Chat Archive permalink: /stream/144837-PR-reviews/topic/.232511.20refactor.20zmod.html ---
As identified in #1564 and #1601, there is currently a bit of a mess involved with primality assumptions. I've made an attempt at refactoring the library, and this is the first step. If people like this, it shouldn't be hard to move the padics over to this framework as well.
I'm not sure the change to make zmod n
be two different types depending on n
is going to be a net positive. It means you can't do cases (i : zmod n)
Here's a crazy idea: zmod n := quotient int (int.modeq n)
with the sizes of numbers in the computational fragment being controlled by appropriate calls to normalize : zmod n -> zmod n
that is provably equal to the identity
BTW, can we use the general add_subgroup.quotient
framework here?
I think I prefer modeq
for its defeq
I think add_subgroup.quotient
is going to require it to be of the form n | a - b
at best, which isn't horrible but doesn't match modeq
Why not use quotient_add_group.left_rel
for modeq
? This will give us many properties for free.
(or better ideal quotient)
it sounds like the sort of change that will get our dependencies in a tangle
Plus most of the work is in nat.modeq
anyway and that's not a subgroup quotient
@Mario Carneiro So far it seems to work fine, after setting up a bit of api
What would you expect to happen after cases (i : zmod n)
?
To get an integer representative?
I guess yes.
well before you would get a nat and a proof it's less than n
with the quotient you would get an int
Now you have i.val
and i.val_lt
.
And the cast : int → zmod n
is surjective, so you can case on that to get an integer representative.
the main time when API boundaries don't work is when defeq stuff gets involved
defining a type by cases on a parameter definitely gets defeq stuff involved
Sure, but I thought you didn't want to rely on defeq too much?
I don't
Like I said, after setting up the api, I didn't have too do much work in refactoring the rest of the library
The changes to the other files are because of [fact p.prime]
not because of the change in the definition of zmod n
I don't have any particular issues to bring up with the new definition of the type. It's only a vague warning flag for me
I also didn't like it at first. But it turned out to work quite well.
perhaps we will see an issue later, perhaps not
With your definition, will you be able to prove stuff in zmod 2
using dec_trivial
?
it's basically equivalent to making the type irreducible, since no one will want to analyze the type now
Except if you are in zmod n
for an explicit n
.
Oh, zmod n
isn't finite anymore
so that might inhibit a dec_trivial
proof
unless we use some mechanism for proving nonzero like Anne's numeral
typeclass in the other thread
Which occurs quite frequently in quadratic reciprocity. You have quite a number of slick dec_trivial
proofs there.
zmod n
is a fintype under the assumption [fact (0 < n)]
.
yes but unless there is a way to prove that assumption it's useless
It is proven automatically for n.succ
, which was good enough for this PR.... ?
I guess your dec_trivial
might become by haveI : fact (0 < 2) := \<dec_trivial\>; exact dec_trivial
Hmm, I don't think I had to do that.
I'm not sure whether 2
counts as 1.succ
or not. Lean always keeps me on my toes here
But maybe [fact (0 < n)]
could be proven from the numeral class as well.
You don't actually need the numeral class here, just a few instances about fact (0 < n)
Right, in this case bit1
will work (-; because -1/2
is not a term of nat
, lol
fact (0 < bit1 n)
and [fact (0 < n)] : fact (0 < bit0 n)
Last updated: Apr 24 2020 at 19:02 UTC


Search dialog library to link this conversation to another starting point
Select a script on the right to view available starting points


The paper presents a formalism for transfer learning, offers a definition of relatedness between tasks, and proposes foliations as a mathematical framework to represent the relationship between tasks.
The term representation denotes a mechanism for describing and realizing abstract objects, thus allowing manipulation and reasoning about the objects. This description goes beyond the usual meaning (in deep learning), where representation denotes some useful information about data.
Relatedness describes what changes between tasks. Consider a set of transformations (or functions) that convert one task to another. A relationship between two tasks is an element of this transformation set.
Given a transformation set, one can define a set of related tasks, which is the set of all the tasks that can be transformed into each other using the functions from the given transformation set. This set of tasks is an equivalence class, and the transformation set is the equivalence relationship.
Given two related tasks t1 and t2, denote the corresponding models (trained on those tasks) as m1 and m2. One can assume that m1 and m2 are related in the same way as t1 and t2 (equivariance).
Now, given a set of transformations, one can partition the space of continuous functions into non-overlapping spaces, which describe a set of related tasks. These spaces are referred to as the parallel spaces or transfer spaces.
The parallel space represents a lower dimension than the original space. So knowing which parallel space a model lies on can make it easier to find it. This is the primary motivation behind transfer learning - knowing the relationship between tasks can make it easier to find a solution to new tasks.
Another way of partitioning the set of transformations is to use tessellation (e.g., Voronoi diagrams). Tasks in the same partition are similar to each other as compared to a task from another partition.
Two tasks are defined as similar if the distance between them (under some distance metric) is small.
Similarity is a geometric notion, while relatedness is a transformative notion. Parallelized space is to relatedness what tessellation is to similarity.
The distinction between similarity and relatedness is quite nuanced, and the authors provide several examples to differentiate between them.
Similarity can only be measured in terms of a reference element (similar to what). For example, when one finetunes a pre-trained model on a new task, one assumes that the model’s pretraining task is similar to the current task.
Given a set (say T), a quantity (a function that maps elemenets of T to a k dimensional vector) is said to be invariant with respect to a transformation p (defined on T) if q(f) = q(p(f)) ie the value of f (belonging to T) does not change if f is transformed by p.
If one assumes that the set of transformations is a group, specifically a Lie group whose action on the set of tasks is locally free and regular, then one can define a parallel partitioning of the space of tasks and the space of models.
One can develop a hierarchial categorization scheme for the set of all considered tasks using the invariant quantities.
One can consider the space of tasks and models to be smooth manifolds as manifolds naturally give a notion of representation and transformations between them.
A manifold is a topological space that can be locally mapped to a Euclidean space using coordinate charts. One can define regular foliation by choosing charts that satisfy certain conditions. In that case, the manifold has immersed, connected, non-intersecting submanifolds called leaves.
The charts (that satisfies those conditions) give a set of rectified coordinates, where the notions of “which leaf a point is on” and “where on the leaf it is” are clearly separated.
Thus, foliation can provide the theoretical tools to work with parallel spaces.
How can the foliations be incorporated into theory and solutions for transfer learning is left aa future work.


Competitive programming is a combination of mathematics, coding, and problem solving. Given a textual description of a problem, and an input specification, a team must write a program to solve that problem using limited computational resources.
There are many programming competitions held every year including Google Codejam, TopCoder, the International Olympiad in Informatics and the Inter Collegiation Programming Contest (ICPC). In the lead up to the South Pacific Regional of the ICPC we will be holding a short three day training camp, on competitive programming and the tools and processes used in the ICPC.
| Time (AEDT) | Topic | Presenter | Resources |
|---|---|---|---|
| Tuesday 19/1/21 | |||
| 12.00-12.30 | Welcome and Overview | Dr Tim French (Reginal Contest Director) | Zoom |
| 12.30-1.30 | Your first solve! | Nicholas Pritchard (UWA) | Zoom |
| 1.30-2.00 | Team formation, and contest setup | Tim and Nicholas | Zoom |
| 2.00-3.30 | Practice Contest | Various mentors | Contest Website |
| 3.30-4.00 | Post-mortem | Nicholas | Zoom |
| Wednesday 20/1/21 | |||
| 12.00-12.30 | Problem Solving Techniques | Dr Max Ward (Head Judge) | Zoom |
| 12.30-1.00 | Graph Data Structures | David Adams | PCS Graph Theory 1 | Zoom
| 1.00-2.00 | Search Techniques | David Adams | PCS Graph Theory 2 | Zoom
| 2.00-3.30 | Practice Contest | Various mentors | Contest Website |
| 3.30-4.00 | Post Mortem | Various mentors | Zoom |
| Thursday 21/1/21 | |||
| 12.00-12.45 | Greedy Algorithms | TBA | PCS Greedy Algorithms | Zoom
| 12.45-1.30 | Shortest Path Algorithms | TBA | Zoom |
| 1.45-3.45 | Programming Contest | Various mentors | Contest Website |
| 3.45-4.00 | Wrap up and awards | Tim French | Zoom Sign up for the SPPC Division 2 |
C++ | ||
|---|---|---|
| Version: | gcc 8.3.0 | |
| Compilation: | g++ -x c++ -Wall -O2 -static -pipe -o prog prog.cc | |
| Execution: | ./prog < input > output
Java | |
| Version: | openjdk 11.0.4 | |
| Compilation: | javac -encoding UTF-8 -d . prog.java | |
| Execution: | java -Dfile.encoding=UTF-8 -XX:+UseSerialGC -Xss128m -Xms${MEMORY_LIMIT}k -Xmx${MEMORY_LIMIT}k < input > output
Python 3 | |
| Version: | 3.7.3 | |
| Compilation: | python3 -m py_compile prog.py3 (Just used to check for Compile Errors, not in the execution of the code) | |
| Execution: | python3 prog.py3 < input > output
C | |
| Version: | gcc 8.3.0 | |
| Compilation: | gcc -x c -Wall -O2 -static -pipe -o prog prog.c -lm | |
| Execution: | ./prog < input > output
|


?essasi*'''
BOTANICAL
^sS^RDÍ-V^
NEW
YORK
BOTANICAL
GARDEN
FIELD
MUSEUM
OF
NATURAL
HISTORY
EXPLORATION
OF
THE
BAHAMAS
no.
.^S5a.Q..’59
THE
CAICOS
GROUP
C,
F.
MILLSPAUGH,
C.
M.
MILLSPAUGH
AMBERGRIS
CAY
MARCH
12,
1911
COLLECTORS.
Garden
1607127
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Rockettes show spectacular performances on stage in dance, off stage as mothers
by WABCMIDTOWN, Manhattan -- Every winter, the Rockettes dazzle audiences with their iconic high kicks and fun dance numbers on the stage, but off the stage, several are pulling double duty as mothers.
"I have three girls," Rockette Tara Tubridy said. "My oldest will be 3 in January, and I have twins."
Tubridy's twins are just 5 months old, and she is one of seven Rockettes this year who are mothers, and they are about as level-headed as they come. Motherhood helps them connect to their audience.
"We are in the audience, running down the aisles, and in their faces sometimes," Rockette Sarah Staker said. "And I think it's a connection that people can tell."
Being at home was the other payoff for Rockette Brittany Newnham.
"It was nice to go to work and show my kids, mommy does this, too," she said. "And mommy can be strong and live her dreams as well."
And strong would be an understatement for Rockette Melinda, who performed while she was six months pregnant, rehearsing six days a week, six hours a day.
The three-month performance season gives them a nice balance the rest of the year with their kids.
All of them have been Rockettes for years before they became moms, having 48 years of experience between them.
"Right before I leave for work every day, he says, 'Mommy's going to be a reindeer,'" Melinda said.
Their kids are believers that mommy knows Santa, but also that mommy magic is about as spectacular as it gets.


A record is a grouped list of variables, which may each be of different data types. Individual elements are accessed using their field names within the record.
Before using a record in a program, most languages require that the record first be dimensioned (that is, defined) as a record type to specify the component field names and data types. If the component fields within the record are strings, their length must also be specified (not in javascript).
Create a product record that contains id, name, description, quantity and price.
myProductRecord.id = 1 myProductRecord.name = "Oven cleaner kit" myProductRecord.description = "The ultimate solution for ovens, trays and racks" myProductRecord.quantity = 10 myProductRecord.price = 5.99 Display "product name = "; myProductRecord.name
var myProductRecord = {}; myProductRecord.id = 1; myProductRecord.name = "Oven cleaner kit"; myProductRecord.description = "The ultimate solution for ovens, trays and racks"; myProductRecord.quantity = 10; myProductRecord.price = 5.99; console.log("product name = " + myProductRecord.name);
Open this document in Chrome and open the developer tools Windows: F12 or Ctrl-shift+I, Mac: Cmd + Opt + I.
Click run button.
Observe the console output.
Modify program.js
: Create another product record with: id = 2, name = Dishwasher Tablets, description = ...


Clean
FReaks
HOME
ABOUT
SERVICES
CONTACT
The Clean Freaks Suppliers
We have all the supplies you need to keep
your area squicky clean and smelling good


{% extends "layout.html" %} {% block content %} Back
We need you to create a password for your new DfE Sign-in account


Use the arrow keys to control the snake.
Made by Didrik Nordström. For more information, see the README file.


Publication
Mustafa Doga Dogan, Raul Garcia-Martin, Patrick William Haertel, Jamison John O'Keefe, Ahmad Taka, Akarsh Aurora, Raul Sanchez-Reillo, Stefanie Mueller
BrightMarker: 3D Printed Fluorescent Markers for Object Tracking.
Conditionally accepted to
ACM UIST '23.
Code (will be released at UIST'23)


 But child education cannot be done in isolation. A child will go to school only if the family, particularly the mother, is assured of healthcare and empowered. Moreover, when an elder sibling is relevantly skilled to be employable and begins earning, the journey of empowerment continues beyond the present generation.
Education is both the means as well as the end to a better life: the means because it empowers an individual to earn his/her livelihood and the end because it increases one's awareness on a range of issues – from healthcare to appropriate social behaviour to understanding one's rights – and in the process help him/her evolve as a better citizen.
Our Foundation, with the help of NGOs for poor child education, is directly benefitting over 15,00,000 children and their families every year, through more than 400 live welfare projects on education, healthcare, livelihood and women empowerment, in over 2000 remote villages and slums across 27 states of India.


--- layout: post title: Google Earth e le impostazioni del proxy date: '2008-04-29T17:55:00.000+02:00' author: Luca Ferrari tags: - linux modified_time: '2008-04-29T17:57:58.725+02:00' blogger_id: tag:blogger.com,1999:blog-1836481905487384887.post-6179388416472571238 blogger_orig_url: http://fluca1978.blogspot.com/2008/04/google-earth-e-le-impostazioni-del.html permalink: /:year/:month/:day/:title.html ---


Setup
This kss setup is tested with
- grunt-kss-node v.1.0.3
- node v.4.2.2
- npm v.2.14.7
What is kss styleguide
It's a npm package that auto compiles a styleguide based on sass and css comments.
Who is it for?
The style guide is created for both front- and back- end developers.
I'm a backend developer
I promise to only copy and use styles that's documented here. If I don't find what I'm looking for here I will ask the frontend team. Also as an backend developer I promise to not hack this styleguide and/or inserting dirt.
I'm a frontend developer
Yay. I'm free and can create anything. But with freedom comes responsibility. I promise to maintain the styleguide updated.
After installation I can ether runt
grunt styleguide
which will compile all sass comments into a up to date styleguide.
Or I can run
grunt watch
Which will constantly check for sass changes and auto compile the styleguide.


Preparation time
less than 30 mins
Cooking time
30 mins to 1 hour
Serves
Serves 8-10
Dietary
This is my idea of a perfect cake: simple, beautiful, fragrant and beguiling. I’ve been making this sort of cake, in one form or another, since my clementine cake in How To Eat, and I can’t help but feel, with a certain calm excitement, that it has reached its apogee here.
For this recipe you will need a 20cm/8in round springform cake tin and a food processor.
Put the dried apricots into a small saucepan, cover them with 250ml/9fl oz cold water, and drop in the cracked cardamom pods with their fragrant seeds. Put on the heat, then bring to the boil and let it bubble for 10 minutes – don’t stray too far away from the pan, as by the end of the 10 minutes the pan will be just about out of water and you want to make sure it doesn’t actually run dry as the apricots will absorb more water as they cool. Take the pan off the heat, place on a cold, heatproof surface and let the apricots cool.
Preheat the oven to 180C/160C Fan/Gas 4. Grease the sides of the springform cake tin and line the bottom with baking parchment.
Remove 5 of the dried apricots and tear each in half, then set aside. Discard the cardamom husks, leaving the seeds in the pan.
Pour and scrape out the sticky contents of the pan into the bowl of a food processor. Add the ground almonds, polenta, baking powder, caster sugar and eggs, and give a good long blitz to combine.
Open the top of the processor, scrape down the batter, add 2 teaspoons of lemon juice and the rosewater, and blitz again. Scrape into the prepared tin and smooth with a spatula. Arrange the apricot halves around the circumference of the tin.
Bake for 40 minutes, though if the cake is browning up a lot before it’s actually ready, you may want to cover loosely with foil at the 30-minute mark. When it’s ready, the cake will be coming away from the edges of the tin, the top will feel firm, and a cake tester will come out with just one or two damp crumbs on it.
Remove the cake to a wire rack. If you’re using apricot jam to decorate, you may want to warm it a little first so that it’s easier to spread; rose petal jam is so lusciously soft-set, it shouldn’t need any help. Stir a teaspoon of lemon juice into the jam and brush over the top of the cake, then sprinkle with the chopped pistachios and leave the cake to cool in its tin before removing to a plate.


User ID
User
Order NO.
Status
selected>All
selected>Canceled
selected>To be paid
selected>Paid
selected>Completed
Query
Info List
Order NO.
Time
User
Amount
EAC
Actual arrival
Status
Manual handling
Canceled To be paid Success


--- comments: true layout: page title: Detecting Integrity Attacks on SCADA Systems ---
Yilin Mo, Rohan Chabukswar and Bruno Sinopoli
IEEE Transactions on Control System Technology, Jul 2014, Volume 22, Issue 4, 1396-1407
Link to the paper
If you want to leave any comments, you can annotate the pdf. I will try to be responsive. You can also annotate this page or leave comments below.
Ensuring security of systems based on supervisory control and data acquisition is a major challenge. The goal of this paper is to develop the model-based techniques capable of detecting integrity attacks on the sensors of a control system. In this paper, the effect of integrity attacks on the control systems is analyzed and countermeasures capable of exposing such attacks are proposed. The main contributions of this paper, beyond the novelty of the problem formulation, lies in enumerating the conditions of the feasibility of the replay attack, and suggesting countermeasures that optimize the probability of detection by conceding control performance. The methodologies are shown and the theoretical results are validated using several sets of simulations.


During the big game, Elmer Fudd and Yosemite Sam get together for a brief homage to Quentin Tarantino. Here are some of the preliminary sketches of the sequence:
Yosemite looks at Elmer... ...Elmer looks back at Yosemite. Yosemite sights his target... ...and Elmer Fudd does the same. The wide-angle view of the gun barrels
is drawn separately.The sketches are composited with the computer-generated
basketball court to complete the shot.
© 1996 Warner Bros.


BMI Calculator
Easily calculate your Body Mass Index
Selected:
{{ weightSelected }}
Selected:
{{ heightSelected }}
Your BMI is:
{{ weightGroup }}
{{ bmi }}


metrics¶
Normalized Discount Cumulative Gain (NDCG)¶
-
class
cornac.metrics.
NDCG
(m=None)[source]¶ Normalized Discount Cumulative Gain.
Parameters: - m (int, optional, default: None) – The number of items in the top@m list, if None then all items are considered to compute NDCG.
- name (string, value: 'NDCG') – Name of the measure.
- type (string, value: 'ranking') – Type of the metric, e.g., “ranking”.
Normalized Cumulative Reciprocal Rank (NCRR)¶
-
class
cornac.metrics.
NCRR
(m=None)[source]¶ Normalized Cumulative Reciprocal Rank.
Parameters: - m (int, optional, default: None) – The number of items in the top@m list, if None then all items are considered to compute NDCG.
- name (string, value: 'NCRR') – Name of the measure.
- type (string, value: 'ranking') – Type of the metric, e.g., “ranking”.


Description: Remove a property for the set of matched elements.
The .removeProp()
method removes properties set by the .prop()
method.
With some built-in properties of a DOM element or window
object, browsers may generate an error if an attempt is made to remove the property. jQuery first assigns the value undefined
to the property and ignores any error the browser generates. In general, it is only necessary to remove custom properties that have been set on an object, and not built-in (native) properties.
Note: Do not use this method to remove native properties such as checked, disabled, or selected. This will remove the property completely and, once removed, cannot be added again to element. Use .prop()
to set these properties to false
instead.
.prop()
to set a DOM element property to anything other than a simple primitive value (number, string, or boolean) can cause memory leaks if the property is not removed (using .removeProp()) before the DOM element is removed from the document. To safely set values on DOM objects without memory leaks, use .data().
<!DOCTYPE html>


The popup is optomized for screen reader and keyboard only users.
Activate the Quote link to open the popup. The content will be inserted inline with the triggering element, and focus will automatically move to the beginning of the new content. Press Tab to set focus to the Close link and press Enter to close the popup, or press Escape to close the popup directly. When closed, focus will move back to the triggering element.


Collaborative software projects benefit when participants read code created by other participants. The objective of a coding style is to reduce the fatigue induced by unimportant formatting differences and differences in naming conventions. Although individual programmers will undoubtedly have preferences and habits that differ from the recommendations here, the benefits that flow from following these recommendations far outweigh the inconveniences. Published papers in journals are subject to similar stylistic and layout constraints, so such constraints are not new to the academic community.
Software written by the Ptolemy Project participants follows this style guide. Although many of these conventions are arbitrary, the resulting consistency makes reading the code much easier, once you get used to the conventions. We recommend that if you extend Ptolemy II in any way, that you follow these conventions. To be included in future versions of Ptolemy II, the code must follow the conventions.
In general, we follow the Sun Java Style guide (http://java.sun.com/docs/codeconv/). We encourage new developers to use Eclipse (http://www.eclipse.org) as their development platform. Eclipse includes a Java Formatter, and we have found that the Java Conventions style is very close to our requirements.
A template that follows these rules can be found in $PTII/doc/coding/templates/JavaTemplate.java , where $PTII is the location of your Ptolemy II installation. In addition, several useful tools are provided in the directories under $PTII/util/ to help enforce the standards.
A Java file has the structure shown in figure See Anatomy of a Java file.. The key points to note about this organization are:
/* One line description of the class. copyright notice @ProposedRating color (email of proposer) @AcceptedRating color (email of accepter) */ package name; imports, in alphabetical order; ////////////////////////////////////////////////////////////////////////// //// ClassName /** Class documentation. @author Author Name @version $Id: style.htm,v <IP_ADDRESS> 2007/01/06 19:42:09 cxh Exp $ @since Ptolemy N.M */ public class ClassName ... { constructors /////////////////////////////////////////////////////////////////// //// public variables //// public variables, in alphabetical order /////////////////////////////////////////////////////////////////// //// public methods //// public methods, in alphabetical order /////////////////////////////////////////////////////////////////// //// protected methods //// protected methods, in alphabetical order /////////////////////////////////////////////////////////////////// //// protected variables //// protected variables, in alphabetical order /////////////////////////////////////////////////////////////////// //// private methods //// private methods, in alphabetical order /////////////////////////////////////////////////////////////////// //// private variables //// private variables, in alphabetical order }
The key sections are explained below.
The copyright used in Ptolemy II is shown in figure See Copyright notice used in Ptolemy II.. This style of copyright is often referred to the community as a "BSD" copyright because it was used for the "Berkeley standard distribution" of Unix. It is much more liberal that the commonly used "GPL" or "Gnu Public License," which encumbers the software and derivative works with the requirement that they carry the source code and the same copyright agreement. The BSD copyright requires that the software and derivative work carry the identity of the copyright owner, as embodied in the lines:
Below is the copyright agreement for the Ptolemy II system. Version: $Id: style.htm,v <IP_ADDRESS> 2007/01/06 19:42:09 cxh Exp $ Copyright (c) 1995-2007 The Regents of the University of California. All rights reserved. Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following two paragraphs appear in all copies of this software. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
The copyright also requires that copies and derivative works include the disclaimer of liability in BOLD. It specifically does not require that copies of the software or derivative works carry the middle paragraph, so such copies and derivative works need not grant similarly liberal rights to users of the software.
The intent of the BSD copyright is to maximize the potential impact of the software by enabling uses of the software that are inconsistent with disclosing the source code or granting free redistribution rights. For example, a commercial enterprise can extend the software, adding value, and sell the original software embodied with the extensions. Economic principles indicate that granting free redistribution rights may render the enterprise business model untenable, so many business enterprises avoid software with GPL licenses. Economic principles also indicate that, in theory, fair pricing of derivative works must be based on the value of the extensions, the packaging, or the associated services provided by the enterprise. The pricing cannot reflect the value of the free software, since an informed consumer will, in theory, obtain that free software from another source.
Software with a BSD license can also be more easily included in defense or national-security related applications, where free redistribution of source code and licenses may be inconsistent with the mission of the software.
Ptolemy II can include other software with copyrights that are different from the BSD copyright. In general, we do not include software with the GNU General Public License (GPL) license, because provisions of the GPL license require that software with which GLP'd code is integrated also be encumbered by the GPL license. We make an exception for GPL'd code that is aggregated with Ptolemy II but not directly combined with Ptolemy II. For example cvs2cl.pl is a GPL'd Perl script that access the CVS database and generates a ChangeLog file. This script is not directly called by Ptolemy II, and we include it as a "mere aggregation" and thus Ptolemy II does not fall under the GPL. Note that we do not include GPL'd Java files that are compiled and then called from Ptolemy II because this would combine Ptolemy II with the GPL'd code and thus encumber Ptolemy II with the GPL.
Another GNU license is the GNU Library General Public License now known as the GNU Lesser General Public License (LGPL). We try to avoid packages that have this license, but we on occasion we have included them with Ptolemy II. The LGPL license is less strict than the GPL - the LGPL permits linking with other packages without encumbering the other package.
In general, it is best if you avoid GNU code. If you are considering using code with the GPL or LGPL, we encourage you to carefully read the license and to also consult the GNU GPL FAQ at http://www.gnu.org/licenses/gpl-faq.html.
We also avoid including software with proprietary copyrights that do not permit redistribution of the software.
The date of the copyright for newly created files should be the current year:
Copyright (c) 2007 The Regents of the University of California.
If a file is a copy of a previously copyrighted file, then the start date of the new file should be the same as that of the original file:
Copyright (c) 1999-2007 The Regents of the University of California.
Ideally, files should have at most one copyright from one institution. Files with multiple copyrights are often in legal limbo if the copyrights conflict. If necessary, two institutions can share the same copyright:
Copyright (c) 2007 The Ptolemy Institute and The Regents of the
Ptolemy II includes a copyright management system that will display the copyrights of packages that are included in Ptolemy II at runtime. Currently, URLs such as about: and about:copyright are handled specially. If, within Ptolemy, the user clicks on a link with a target URL of about:copyright , then we eventually invoke code within $PTII/ptolemy/actor/gui/GenerateCopyrights.java. This class searches the runtime environment for particular packages and generates a web page with the links to the appropriate copyrights if certain packages are found.
The imports section identifies the classes outside the current package on which this class depends. The package structure of Ptolemy II is carefully constructed so that core packages do not depend on more elaborate packages. This limited dependencies makes it possible to create derivative works that leverage the core but drastically modify or replace the more advanced capabilities.
By convention, we list imports by full class name, as follows:
import ptolemy.kernel.CompositeEntity;
import ptolemy.kernel.util.IllegalActionException;
import ptolemy.kernel.util.Locatable;
import ptolemy.kernel.util.NameDuplicationException;
in particular, we do not use the wildcards supported by Java, as in:
The reason that we discourage wildcards is that the full class names in import statements makes it easier find classes that are referenced in the code. If you use an IDE such as Eclipse, it is trivially easy to generate the import list in this form, so there is no reason to not do it.
Imports are ordered alphabetically by package first, then by class name, as shown above.
Good comments are essential to readable code. In Ptolemy II, comments fall into two categories, Javadoc comments, which become part of the generated documentation, and code comments, which do not. Javadoc comments are used to explain the interface to a class, and code comments are used to explain how it works.
Both Javadoc and code comments should be complete sentences and complete thoughts, capitalized at the beginning and with a period at the end. Spelling and grammar should be correct.
Javadoc is a program distributed with Java that generates HTML documentation files from Java source code files1. Javadoc comments begin with " /** " and end with " */ ". The comment immediately preceding a method, member, or class documents that method, member, or class. Ptolemy II classes include Javadoc documentation for all classes and all public and protected members and methods. Members and methods should appear in alphabetical order within their protection category (public, protected etc.) so that it is easy to find them in the Javadoc output.
When writing Javadoc comments, pay special attention to the first sentence of each Javadoc comment. This first sentence is used as a summary in the Javadocs. It is extremely helpful if the first sentence is a cogent and complete summary.
Javadoc comments can include embedded HTML formatting. For example, by convention, in actor documentation, we set in italics the names of the ports and parameters using the syntax
/** In this actor, inputs are read from the <i>input</i> port ... */
The Javadoc program gives extensive diagnostics when run on a source file. Our policy is to format the comments until there are no Javadoc warnings. Private members and methods need not be documented by Javadoc comments. The doccheck tool from http://java.sun.com/j2se/javadoc/doccheck/index.html gives even more extensive diagnostics in HTML format. We encourage developers to run doccheck and fix all warnings.
The class documentation is the Javadoc comment that immediately precedes the class definition line. It is a particularly important part of the documentation. It should describe what the class does and how it is intended to be used. When writing it, put yourself in the mind of the user of your class. What does that person need to know? In particular, that person probably does not need to know how you accomplish what the class does. She only needs to know what you accomplish.
A class may be intended to be a base class that is extended by other programmers. In this case, there may be two distinct sections to the documentation. The first section should describe how a user of the class should use the class. The second section should describe how a programmer can meaningfully extend the class. Only the second section should reference protected members or methods. The first section has no use for them. Of course, if the class is abstract, it cannot be used directly and the first section can be omitted.
Comments should include honest information about the limitations of a class.
Each class comment should also include the following javadoc tags:
The javadoc tags @Pt.ProposedRating and @Pt.AcceptedRating contain code rating information. Each tag includes the color (one of red , yellow , green , or blue ) and the cvs login of the person responsible for the proposed or accepted rating level, for example:
@Pt.ProposedRating blue ptolemy
@Pt.AcceptedRating green ptolemy
The intent of the code rating is to clearly identify to readers of the file the level of maturity of the contents. The Ptolemy Project encourages experimentation, and experimentation often involves creating immature code, or even "throw-away" code. Such code is red. We use a lightweight software engineering process documented in "Software Practice in the Ptolemy Project,"2 to raise the code to higher ratings. That paper documents the ratings a:
· Red code is untrusted code. This means that we have no confidence in the design or implementation (if there is one) of this code or design, and that anyone that uses it can expect it to change substantially and without notice. All code starts at red.
· Yellow code is code with a trusted design. We have a reasonable degree of confidence in the design, and do not expect it to change in any substantial way. However, we do expect the API to shift around a little during development.
· Green code is code with a trusted implementation. We have confidence that the implementation is sound, based on test suites and practical application of the code. If possible, we try not to release important code unless it is green.
· Blue marks polished and complete code, and also represents a firm commitment to backwards-compatibility. Blue code is completely reviewed, tested, documented, and stressed in actual usage.
We use a javadoc doclet at $PTII/doc/doclets/RatingTaglet.java to add the ratings to the javadoc output.
Constructor documentation usually begins with the phrase "Construct an instance that ..." and goes on to give the properties of that instance. Note the use of the imperative case. A constructor is a command to construct an instance of a class. What it does is construct an instance.
Method documentation needs to state what the method does and how it should be used. For example:
/** Mark the object invalid, indicating that when a method
* is next called to get information from the object, that
* information needs to be reconstructed from the database.
By contrast, here is a poor method comment:
/** Set the variable _valid to false.
While this certainly describes what the method does from the perspective of the coder, it says nothing useful from the perspective of the user of the class, who cannot see the (presumably private) variable _valid nor how that variable is used. On closer examination, this comment describes how the method is accomplishing what it does, but it does not describe what it accomplishes.
Here is an even worse method comment:
Note the use of the imperative case in all of the above comments. It is common in the Java community to use the following style for documenting methods:
/** Sets the expression of this variable.
* @param expression The expression for this variable.
*/
public void setExpression(String expression) {
...
}
We use instead the imperative case, as in
/** Set the expression of this variable.
* @param expression The expression for this variable.
*/
public void setExpression(String expression) {
...
}
The reason we do this is that our sentence is a well-formed, grammatical English sentence, while the usual convention is not (it is missing the subject). Moreover, calling a method is a command "do this," so it seems reasonable that the documentation say "Do this." The use of imperative case has a large impact on how interfaces are documented, especially when using the listener design pattern. For instance, the java.awt.event.ItemListener interface has the method:
/** Invoked when an item has been selected or deselected.
* The code written for this method performs the operations
* that need to occur when an item is selected (or deselected).
void itemStateChanged(ItemEvent e);
A naive attempt to rewrite this in imperative tense might result in:
/** Notify this object that an item has been selected or deselected.
void itemStateChanged(ItemEvent e);
However, this sentence does not capture what the method does. The method may be called in order to notify the listener, but the method does not "notify this object". The correct way to concisely document this method in imperative case (and with meaningful names) is:
/** React to the selection or deselection of an item.
void itemStateChanged(ItemEvent event);
The above is defining an interface (no implementation is given). To define the implementation, it is also necessary to describe what the method does:
/** React to the selection or deselection of an item by doing...
void itemStateChanged(ItemEvent event) { ... implementation ... }
Comments for base class methods that are intended to be overridden should include information about what the method generally does, plus information that a programmer may need to override it. If the derived class uses the base class method (by calling super.methodName() ), but then appends to its behavior, then the documentation in the derived class should describe both what the base class does and what the derived class does.
By convention, method names are set in the default font, but followed by empty parentheses, as in
/** The fire() method is called when ... */
The parentheses are empty even if the method takes arguments. The arguments are not shown. If the method is overloaded (has several versions with different argument sets), then the text of the documentation needs to distinguish which version is being used.
Other methods in the same class may be linked to with the {@link ...} Javadoc tag. For example, to link to a foo() method that takes a String:
* Unlike the {@link #foo(String)} method, this method ...
Methods and members in the same package should have an octothorpe (# sign) prepended. Methods and members in other classes should use the fully qualified class name:
{@link ptolemy.util.StringUtilities.substitute(String, String, String)}
Links to methods should include the types of the arguments.
To run Javadoc on the classes in the current directory, run make docs , which will create the HTML javadoc output in the doc/codeDoc subdirectory. To run Javadoc for all the common packages, run
The output will appear in $PTII/doc/codeDoc. Actor documentation can be viewed from within Vergil, right clicking on an actor and selecting View Documentation.
Methods should include Javadoc tags @param (one for each parameter), @return (unless the return type is void), and @exception (unless no exceptions are thrown). Note that we do not use the @throws tag, and that @returns is not a legitimate Javadoc tag, use @return instead.
The annotation for the arguments (the @param statement) need not be a complete sentence, since it is usually presented in tabular format. However, we do capitalize it and end it with a period.
Exceptions that are thrown by a method need to be identified in the Javadoc comment. An @exception tag should read like this:
* @exception MyException If such and such occurs.
Notice that the body always starts with "If", not "Thrown if", or anything else. Just look at the Javadoc output to see why. In the case of an interface or base class that does not throw the exception, use the following:
* @exception MyException Not thrown in this base class. Derived
* classes may throw it if such and such happens.
The exception still has to be declared so that derived classes can throw it, so it needs to be documented as well.
In general, the names of classes, methods and members should consist of complete words separated using internal capitalization3. Class names, and only class names, have their first letter capitalized, as in AtomicActor. Method and member names are not capitalized, except at internal word boundaries, as in getContainer(). Protected or private members and methods are preceded by a leading underscore "_" as in _protectedMethod().
Static final constants should be in uppercase, with words separated by underscores, as in INFINITE_CAPACITY. A leading underscore should be used if the constant is protected or private.
Package names should be short and not capitalized, as in "de" for the discrete-event domain.
In Java, there is no limit to name sizes (as it should be). Do not hesitate to use long names.
Nested statements should be indented by 4 characters, as in:
if (container != null) { Manager manager = container.getManager(); if (manager != null) { manager.requestChange(change); } }
Closing brackets should be on a line by themselves, aligned with the beginning of the line that contains the open bracket. Please avoid using the Tab character in source files. The reason for this is that code becomes unreadable when the Tab character is interpreted differently by different programs. Your text editor should be configured to react to the Tab key by inserting spaces rather than the tab character. To set up Emacs to follow the Ptolemy II indentation style, see $PTII/util/lisp/ptemacs.el. To set up Eclipse to follow the Ptolemy II indentation style, see the instructions in $PTII/doc/coding/eclipse.htm.
Long lines should be broken up into many small lines. The easiest places to break long lines are usually just before operators, with the operator appearing on the next line. Long strings can be broken up using the + operator in Java, with the + starting the next line. Continuation lines are indented by 8 characters, as in the throws clause of the constructor in figure See Anatomy of a Java file..
Use spaces around operators such as plus, minus, multiply, divide or equals signs, after semicolons and after keywords like if, else, for, do, while, try, catch and throws:
A number of exceptions are provided in the ptolemy.kernel.util package. Use these exceptions when possible because they provide convenient constructor arguments of type Nameable that identify the source of the exception by name in a consistent way.
A key decision you need to make is whether to use a compile-time exception or a run-time exception. A run-time exception is one that implements the RuntimeException interface. Run-time exceptions are more convenient in that they do not need to be explicitly declared by methods that throw them. However, this can have the effect of masking problems in the code.
The convention we follow is that a run-time exception is acceptable only if the cause of the exception can be tested for prior to calling the method. This is called a testable precondition. For example, if a particular method will fail if the argument is negative, and this fact is documented, then the method can throw a run-time exception if the argument is negative. On the other hand, consider a method that takes a string argument and evaluates it as an expression. The expression may be malformed, in which case an exception will be thrown. Can this be a run-time exception? No, because to determine whether the expression is malformed, you really need to invoke the evaluator. Making this a compile-time exception forces the caller to explicitly deal with the exception, or to declare that it too throws the same exception. In general, we prefer to use compile-time exceptions wherever possible.
When throwing an exception, the detail message should be a complete sentence that includes a string that fully describes what caused the exception. For example
throw IllegalActionException(this, "Cannot append an object of type: " + obj.getClass().getName() + " because " + "it does not implement Cloneable.");
Note that the exception not only gives a way to identify the objects that caused the exception, but also why the exception occurred. There is no need to include in the message an identification of the "this" object passed as the first argument to the exception constructor. That object will be identified when the exception is reported to the user.
If an exception is caught, be sure to use exception chaining to include the original exception. For example:
String fileName = foo(); try { // Try to open the file } catch (IOException ex) { throw new IllegalActionException(this, ex, Failed to open '" + fileName + "'"); }
Code cleaning is the act of homogenizing the coding style, looking for and repairing common problems. Fortunately, Eclipse includes a file formatter and a cleaner that fixes many common problems. Software that is to be formally released should be cleaned according to the guidelines set forth in $PTII/doc/coding/releasemgt.htm
Individual demonstrations should be in directories under a demo/ directory. The name of the directory, and the name of the model should match and both begin with capital letters. The demos should be capitalized so that it is possible to generate code for demonstrations. For example, the Butterfly demonstration is in sdf/demo/Butterfly/Butterfly.xml .
All other directories begin with lower case letters and most consist solely of lower case letters.
1. See http://java.sun.com/j2se/javadoc/writingdoccomments/ for guidelines from Sun Microsystems on writing Javadoc comments.
2.
J. Reekie, S. Neuendorffer, C. Hylands and E. A. Lee "Software Practice in the Ptolemy Project," Technical Report Series, GSRC-TR-1999-01, Gigascale Semiconductor Research Center, University of California, Berkeley, CA 94720, April 1999,
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/ptII/doc/coding/sftwareprac/index.htm


| Description: | Use the chrome.alarms module
to schedule code to run periodically
or at a specified time in the future. |
| Availability: | Google Chrome 22 |
| Permissions: | "alarms" |
| Learn more: | Event Pages |
In order to reduce the load on the user's machine, Chrome limits
alarms to at most once every 5 minutes but may delay them an arbitrary
amount more. That is, setting
$ref:[alarms.AlarmCreateInfo.delayInMinutes
delayInMinutes]
or
$ref:[alarms.AlarmCreateInfo.periodInMinutes
periodInMinutes]
to less than 5
will cause an
error. $ref:[alarms.AlarmCreateInfo.when when]
can be
set to less than 5 minutes after "now" but won't actually cause the
alarm to run for at least 5 minutes.
To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire.


Version notes
3.0.0 rc 2
- Background fetching and database writing of feeds (yes, such an important change is not expected between two release candidates versions, but the risk has been thoroughly pondered)
- Separated “Mark Read” and “Mark Unread” menu items for articles
- Rudimentary support of OPDS feeds (ebooks), like those provided by Calibre
- Fix an issue with number of unread articles caused by user deleting articles stored in OpenReader before having read them
- Spanish localization improvements, thanks to Juan Pablo Atienza Martinez
- Another fix for file:// URLs
- Fix relative links to enclosures
- Handle embedded images
<img src="data:..." ...>
- Multiple improvements and fixes on memory management
- Other cosmetic or UI fixes


Race to Dubai: Five players who can still end season as European No 1
by Ali StaffordThe European Tour season reaches its climax this week at the DP World Tour Championship, with five players still in the running to win the Race to Dubai.
Get the best prices and book a round at one of 1,700 courses across the UK & Ireland
location
Courses
View More Courses
Locations
View More Locations
No results found. Please try another search.
Search
Bernd Wiesberger arrives in Dubai top of the season-long standings and holds a 722.7-point cushion over nearest challenger Tommy Fleetwood, with Jon Rahm, Shane Lowry and Matt Fitzpatrick all still with a chance of ending the year as European No 1.
Race to Dubai standings (after Nedbank Golf Challenge)
| 1 | Bernd Wiesberger | 4,802.4 |
| 2 | Tommy Fleetwood | 4,079.7 |
| 3 | Jon Rahm | 3,898.3 |
| 4 | Shane Lowry | 3,613.8 |
| 5 | Matt Fitzpatrick | 3,320.9 |
Wiesberger has led since he followed up victories at the Made In Denmark and Scottish Open by winning the Italian Open last month, with the Austrian extending his advantage with a tied-third finish at the Nedbank Golf Challenge last week.
The seven-time European Tour winner's performance in South Africa ended the hopes of Rory McIlroy, sixth in the standings and trailing by more than the two million points available this week, while Fleetwood's dramatic victory saw him jump from 10th to second spot.
A win or solo second for Wiesberger at Jumeriah Golf Estates would be enough to guarantee Race to Dubai victory, regardless of other results, while anything less would take the situation out of his hands and give the other four contenders the chance to stake their claim.
Fleetwood would win the Race to Dubai for a second time with victory in Dubai, providing Wiesberger ends the week outside of the top two, while various permutations enable the Englishman to finish as low as tied-second and still move top of the standings.
Three-time Rolex Series winner Rahm - who won this event in 2017 - has to finish in a two-way tie for second or better to stay in the hunt, while Champion Golfer Lowry has to end no worse than outright runner-up.
2016 Dubai champion Fitzpatrick starts the week in fifth and needing a first win of the season to have any chance of moving into No 1 spot, although victory would only be enough if Fleetwood and Rahm outside the top two and Wiesberger ends the week lower than eighth.
The Rookie of the Year and Challenge Tour Graduate of the Year awards are also still up for grabs heading into the final event of the season, with Scotland's Robert MacIntyre - 11th in the standings - currently leading the race to win both honours.
Watch the DP World Tour Championship throughout the week live on Sky Sports Golf. Live coverage begins on Wednesday with the On the Range show, live from 11am on Sky Sports Golf and Sky Sports Main Event.


A Margherita Pizza with ripe tomatoes, mozzarella cheese, fresh basil, and extra-virgin olive oil !!
Tacos, medium-sized hand-sized corn or wheat tortilla wrapping topped with steak, beef, or chicken. I also like lettuce and tomatoes with a little sour cream !!
A caesar salad with romaine lettuce and croutons. Complete with olive oil, mushrooms, garlic, Parmesan cheese, and black pepper !!


Honor’s RM299 wireless earphones offer 18-hours of music playback
by Alexander WongDuring the launch of the Honor 9X, the Huawei sub-brand has also introduced the Honor Sport Pro in Malaysia. At first glance, it looks somewhat similar to the Huawei Freelance but this Bluetooth earphones use an EarPods-like earbud design and it’s priced more affordably at RM299.
The Honor Sport Pro is a neckband-type wireless earphones and it is offered in three colours – Phantom Red, Phantom Grey and Phantom Blue. It features 13mm drivers and the earbuds are magnetic which allows you to snap them together to put it on sleep mode. It is also smart enough to reconnect when you pull them apart.
Similar to the Huawei version, the Sport Pro boasts up to 18 hours of music playback on a single charge. If you need to charge the earphones, you can detach the three-button control panel to reveal a rather convenient USB-C head. A quick 5-minute charge is rated to provide up to 4 hours of music playback. If you’re using an Honor smartphone, it can support quick pairing by simply plugging it into your phone.
During the presentation, Honor claims that the Sport Pro is great for gaming with its ultra-low latency of 86ms. It’s not as low as Razer’s Hammerhead but it is significantly lower than Apple’s AirPods and BeatsX. Since it has “Sport” in the name, the earphones are also splashproof with a rating of IPX5.
The box also contains 6 pairs of ear tips for better fitting and a charging cable. The Honor Sport Pro will be on sale starting 28 November 2019. If you’re pre-order the Honor 9X, there’s also a promo where you could get the Honor Sport Pro for only RM0.99.
For those who prefer something more compact, the Honor FlyPods Lite is currently going for RM279.


Now that I‘ve crossed all the ts and dotted all the lower case js I can let everyone know: I‘m going to be working at Heroku starting this July!
I‘m very excited about this opportunity. There is so much to learn and also so much work to do making Heroku the world-class plaftorm that it is. I‘m going to be on the add-ons team, building out the functionality and interfaces that some of you will be using to provide your own services to Heroku customers. The add-ons are like an app marketplace – allowing your web app to consume other cloud services through Heroku.
I think Heroku‘s newest iteration, the “Cedar” stack, is the quantum leap forward for not merely hosting a web application, but allowing it to dynamically scale. The first iterations of the Heroku Platform ironed out deploying a Rails app to the cloud. With Cedar, we‘re working towards running any unix process with the same simplicity and scalability as our current applications.
That said, I‘ve begun putting my money where my mouth is and have started transitioning my sites to Heroku. First off, this site!
Stay tuned because in the meantime I will be posting an add-on I built to github after I get it up and running on Heroku‘s Cedar Platform!
c2


new Fluent
is used directly.
Althought it is not an error, it make harder identify which type of data this Fluent
should handle. By extending Fluent
to a child class you can, for instance,
declare @property
phpdoc to specific the Fluent
properties.


How To Play the Melody Game
Object of the Game
Correctly repeat a sequence of colors.
Instructions
- Turn on the game, and select the level and the number of rounds you would like to play. Level 1 is the slowest, and level 3 is the fastest.
- Press start to begin playing.
- Simon will display the first color.
- Repeat the color by pressing the same color.
- Simon will repeat the color and add a new color on each round.
- Continue to repeat the colors in the correct sequence.
- If you press an incorrect color in the sequence, Melody will buzz an error sound, and repeat the sequence again if strict mode has not been selected. If strict mode has been selected the game will end on an incorrect color press, and will restart with a new sequence.
- The game will continue until the rounds selected are over.
- The game speeds up as the sequence grows.
How to Win
To win the game, repeat the sequence of colors in the correct order, until the number of rounds are over.
Designed and coded by Atiya Haider


Programming Language Selector
Let us help you find what language suits your needs
Questions
What is your favorite animal?
Cat
Dog
Fish
Reptile
What is your favorite holiday?
Christmas
4th of July
Thanksgiving
Easter
What is your favorite color?
Red
Blue
Green
Other
What is your favorite Celebrity?
Leonardo Dicaprio
Selena Gomez
Chris Pratt
Other
What is your favorite Movie?
Action
Comedy
Thriller
Drama
What is your favorite food?


Device Name
Device String
Done
RestHome
Home
Icons made by
Smashicons
and others from
www.flaticon.com
is licensed by
CC 3.0 BY


factoryIsReady: boolean Indicates whether the factory is ready to be used to create instances of the associated template.