C syntax:
int phish_init(int *argc, char ***argv)
C examples:
phish_init(&argc,&argv);
C++ syntax:
void init(int& argc, char*& argv)
C++ examples:
phish::init(argc, argv);
Python syntax:
def init(argv)
Python examples:
import phish argv = phish.init(sys.argv)
Description:
This is a PHISH library function which can be called from a minnow application. In PHISH lingo, a "minnow" is a stand-alone application which makes calls to the PHISH library.
A PHISH program typically includes one or more schools of minnows, as specified in a PHISH input script. Each minnow in each school is an individual process. Locally, each minnow has a local-ID from 0 to Nlocal-1 within its school, where Nlocal is the number of minnows in the school. Globally, each minnow has a global-ID from 0 to Nglobal-1, where Nglobal is the total number of minnows in the net. The global-IDs are ordered by school, so that minnows within each school have consecutive IDs. These IDs enable the PHISH library to orchestrate communication of datums between minnows in different schools. E.g. when running the MPI version of the PHISH library, the global-ID corresponsds to the rank ID of an MPI process, used in MPI_Send() and MPI_Recv() function calls.
See the phish_query function for how a minnow can find out these values from the PHISH library.
The phish_init() function must be the first call to the PHISH library made by a minnow. Since it alters the command-line arguments passed to the minnow, it is typically the first executable line of a minnow program.
It's purpose is to initialize the library using special command-line arguments passed to the minnow when it was launched, typically by the the bait.py tool that parses a PHISH input script.
The two arguments to phish_init() are pointers to the number of command-line arguments, and a pointer to the arguments themselves as an array of strings. These are passed as pointers, because the PHISH library reads and removes the PHISH-specific arguments. It then returns the remaining minnow-specific arguments, which the minnow can read and process. As is standard with C programs, the returned value of argv includes argv[0] which is the name of the minnow executable.
Note that in the Python version of phish.init(), the full argument list is passed as an argument, and the truncated argument list is returned.
Following are some sample switches and arguments that the MPI version of the PHISH library looks for and processes. These are generated automatically by the bait.py tool when it processes a PHISH input script so you don't need to think about these arguments, but it may be helpful in understanding how PHISH works. Note that these arguments are normally invisible to the user; their format and number may be changed in future versions of PHISH.
The --phish-backend switch appears once, and is followed by the version of the PHISH library specified by bait.py. This allows the PHISH library to detect incompatible runtime environments, e.g. mixing minnows linked against the socket version of the PHISH library with minnows using the MPI version.
The --phish-minnow switch appears once. ID is the school ID in the PHISH input script. The Nlocal argument was explained above. Nprev is the total number of minnows in sets of minnows previous to this one. It is used to infer the local-ID value discussed above.
The --phish-memory switch changes a default setting within the PHISH library. There is a similar command for each keyword supported by the bait.py set command.
The --phish-memory value N sets the maximum size of the buffers used to send and receive datums. See the set command of the bait.py tool for more information on the settings of this switch.
The --phish-in switch appears once for every connection the minnow has with other minnows, where it is a receiver of datums. See the hook command in PHISH input scripts processed by the bait.py tool, for more information.
Sprocs, sfirst, and sport refer to the set of minnows sending to this minnow. They are respectively, the number of minnows in the set, the global ID of the first minnow in the set, and the output port used by those minnows. Rprocs, rfirst, and rport refer to the set of minnows receivng the datums, i.e. the set of minnows this minnow belongs to. They are respectively, the number of minnows in the set, the global ID of the first minnow in the set, and the input port used by those minnows. Style is the connection style, as specified by the hook command in the PHISH input script processed by the bait.py tool. E.g. style is a word like "single" or "hashed". If it is "subscribe", then extra info about the external host and its TCP port is appended to the style, e.g. "subscribe/www.foo.com:25".
The --phish-out switch appears once for every connection the minnow has with other minnows, where it is a sender of datums. See the hook command in PHISH input scripts processed by the bait.py tool, for more information.
Sprocs, sfirst, and sport refer to the set of minnows sending datums, i.e. the set of minnows this minnow belongs to. They are respectively, the number of minnows in the set, the global ID of the first minnow in the set, and the output port used by those minnows. Rprocs, rfirst, and rport refer to the set of minnows receivng the datums. They are respectively, the number of minnows in the set, the global ID of the first minnow in the set, and the input port used by those minnows. Style is the connection style, as specified by the hook command in the PHISH input script processed by the bait.py tool. E.g. style is a word like "single" or "hashed". If it is "publish", then extra info about the TCP port is appended to the style, e.g. "publish/25".
The PHISH library ignores any remaining arguments, returning them to to the minnow caller, including the name of the minnow executable in argv[0].
The phish_init() function also flags each specified input port and output port with a CLOSED status, instead of UNUSED. See the hook command for the bait.py tool for more info about communication ports. See the phish_input and phish_output functions for more info about port status.
The "C" binding to phish_init() returns a nonzero value if there were errors, otherwise zero. The "C++" binding to phish::init() throws an exception if there were errors.
Restrictions: none
Related commands:


public final class MathUtils
extends java.lang.Object
Math
.| Modifier and Type | Field and Description |
|---|---|
static double |
EPSILON
Smallest positive number such that 1 - EPSILON is not numerically equal to 1.
|
static double |
SAFE_MIN
Safe minimum, such that 1 / SAFE_MIN does not overflow.
|
static double |
TWO_PI
2 π.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
addAndCheck(int x,
int y)
Add two integers, checking for overflow.
|
static long |
addAndCheck(long a,
long b)
Add two long integers, checking for overflow.
|
static long |
binomialCoefficient(int n,
int k)
Returns an exact representation of the Binomial
Coefficient, "
n choose k ", the number of
k -element subsets that can be selected from an
n -element set. |
static double |
binomialCoefficientDouble(int n,
int k)
Returns a
double representation of the Binomial
Coefficient, "n choose k ", the number of
k -element subsets that can be selected from an
n -element set. |
static double |
binomialCoefficientLog(int n,
int k)
Returns the natural
log of the Binomial
Coefficient, "n choose k ", the number of
k -element subsets that can be selected from an
n -element set. |
static void |
checkOrder(double[] val,
int dir,
boolean strict)
Checks that the given array is sorted.
|
static int |
compareTo(double x,
double y,
double eps)
Compares two numbers given some amount of allowed error.
|
static double |
cosh(double x)
Returns the
hyperbolic cosine of x.
|
static double |
distance(double[] p1,
double[] p2)
Calculates the L2 (Euclidean) distance between two points.
|
static double |
distance(int[] p1,
int[] p2)
Calculates the L2 (Euclidean) distance between two points.
|
static double |
distance1(double[] p1,
double[] p2)
Calculates the L1 (sum of abs) distance between two points.
|
static int |
distance1(int[] p1,
int[] p2)
Calculates the L1 (sum of abs) distance between two points.
|
static double |
distanceInf(double[] p1,
double[] p2)
Calculates the L∞ (max of abs) distance between two points.
|
static int |
distanceInf(int[] p1,
int[] p2)
Calculates the L∞ (max of abs) distance between two points.
|
static boolean |
equals(double[] x,
double[] y)
Returns true iff both arguments are null or have same dimensions
and all their elements are
equals |
static boolean |
equals(double x,
double y)
Returns true iff both arguments are NaN or neither is NaN and they are
equal
|
static boolean |
equals(double x,
double y,
double eps)
Returns true iff both arguments are equal or within the range of allowed
error (inclusive).
|
static boolean |
equals(double x,
double y,
int maxUlps)
Returns true iff both arguments are equal or within the range of allowed
error (inclusive).
|
static long |
factorial(int n)
Returns n!.
|
static double |
factorialDouble(int n)
Returns n!.
|
static double |
factorialLog(int n)
Returns the natural logarithm of n!.
|
static int |
gcd(int p,
int q)
Gets the greatest common divisor of the absolute value of two numbers,
using the "binary gcd" method which avoids division and modulo
operations.
|
static long |
gcd(long p,
long q)
Gets the greatest common divisor of the absolute value of two numbers,
using the "binary gcd" method which avoids division and modulo
operations.
|
static int |
hash(double value)
Returns an integer hash code representing the given double value.
|
static int |
hash(double[] value)
Returns an integer hash code representing the given double array.
|
static byte |
indicator(byte x)
For a byte value x, this method returns (byte)(+1) if x >= 0 and
(byte)(-1) if x < 0.
|
static double |
indicator(double x)
For a double precision value x, this method returns +1.0 if x >= 0 and
-1.0 if x < 0.
|
static float |
indicator(float x)
For a float value x, this method returns +1.0F if x >= 0 and -1.0F if x <
0.
|
static int |
indicator(int x)
For an int value x, this method returns +1 if x >= 0 and -1 if x < 0.
|
static long |
indicator(long x)
For a long value x, this method returns +1L if x >= 0 and -1L if x < 0.
|
static short |
indicator(short x)
For a short value x, this method returns (short)(+1) if x >= 0 and
(short)(-1) if x < 0.
|
static int |
lcm(int a,
int b)
Returns the least common multiple of the absolute value of two numbers,
using the formula
lcm(a,b) = (a / gcd(a,b)) * b . |
static long |
lcm(long a,
long b)
Returns the least common multiple of the absolute value of two numbers,
using the formula
lcm(a,b) = (a / gcd(a,b)) * b . |
static double |
log(double base,
double x)
|
static int |
mulAndCheck(int x,
int y)
Multiply two integers, checking for overflow.
|
static long |
mulAndCheck(long a,
long b)
Multiply two long integers, checking for overflow.
|
static double |
nextAfter(double d,
double direction)
Get the next machine representable number after a number, moving
in the direction of another number.
|
static double |
normalizeAngle(double a,
double center)
Normalize an angle in a 2&pi wide interval around a center value.
|
static double[] |
normalizeArray(double[] values,
double normalizedSum)
Normalizes an array to make it sum to a specified value.
|
static java.math.BigInteger |
pow(java.math.BigInteger k,
java.math.BigInteger e)
Raise a BigInteger to a BigInteger power.
|
static java.math.BigInteger |
pow(java.math.BigInteger k,
int e)
Raise a BigInteger to an int power.
|
static java.math.BigInteger |
pow(java.math.BigInteger k,
long e)
Raise a BigInteger to a long power.
|
static int |
pow(int k,
int e)
Raise an int to an int power.
|
static int |
pow(int k,
long e)
Raise an int to a long power.
|
static long |
pow(long k,
int e)
Raise a long to an int power.
|
static long |
pow(long k,
long e)
Raise a long to a long power.
|
static double |
round(double x,
int scale)
Round the given value to the specified number of decimal places.
|
static double |
round(double x,
int scale,
int roundingMethod)
Round the given value to the specified number of decimal places.
|
static float |
round(float x,
int scale)
Round the given value to the specified number of decimal places.
|
static float |
round(float x,
int scale,
int roundingMethod)
Round the given value to the specified number of decimal places.
|
static double |
scalb(double d,
int scaleFactor)
Scale a number by 2scaleFactor.
|
static byte |
sign(byte x)
Returns the sign
for byte value
x . |
static double |
sign(double x)
Returns the sign
for double precision
x . |
static float |
sign(float x)
Returns the sign
for float value
x . |
static int |
sign(int x)
Returns the sign
for int value
x . |
static long |
sign(long x)
Returns the sign
for long value
x . |
static short |
sign(short x)
Returns the sign
for short value
x . |
static double |
sinh(double x)
Returns the
hyperbolic sine of x.
|
static int |
subAndCheck(int x,
int y)
Subtract two integers, checking for overflow.
|
static long |
subAndCheck(long a,
long b)
Subtract two long integers, checking for overflow.
|
public static final double EPSILON
public static final double SAFE_MIN
In IEEE 754 arithmetic, this is also the smallest normalized number 2-1022.
public static final double TWO_PI
public static int addAndCheck(int x, int y)
x
- an addendy
- an addendx+y
java.lang.ArithmeticException
- if the result can not be represented as an
intpublic static long addAndCheck(long a, long b)
a
- an addendb
- an addenda+b
java.lang.ArithmeticException
- if the result can not be represented as an
longpublic static long binomialCoefficient(int n, int k)
n choose k
", the number of
k
-element subsets that can be selected from an
n
-element set.
Preconditions:
0 <= k <= n
(otherwise
IllegalArgumentException
is thrown)long
. The
largest value of n
for which all coefficients are
< Long.MAX_VALUE
is 66. If the computed value exceeds
Long.MAX_VALUE
an ArithMeticException
is
thrown.n
- the size of the setk
- the size of the subsets to be countedn choose k
java.lang.IllegalArgumentException
- if preconditions are not met.java.lang.ArithmeticException
- if the result is too large to be represented
by a long integer.public static double binomialCoefficientDouble(int n, int k)
double
representation of the Binomial
Coefficient, "n choose k
", the number of
k
-element subsets that can be selected from an
n
-element set.
Preconditions:
0 <= k <= n
(otherwise
IllegalArgumentException
is thrown)double
. The
largest value of n
for which all coefficients are <
Double.MAX_VALUE is 1029. If the computed value exceeds Double.MAX_VALUE,
Double.POSITIVE_INFINITY is returnedn
- the size of the setk
- the size of the subsets to be countedn choose k
java.lang.IllegalArgumentException
- if preconditions are not met.public static double binomialCoefficientLog(int n, int k)
log
of the Binomial
Coefficient, "n choose k
", the number of
k
-element subsets that can be selected from an
n
-element set.
Preconditions:
0 <= k <= n
(otherwise
IllegalArgumentException
is thrown)n
- the size of the setk
- the size of the subsets to be countedn choose k
java.lang.IllegalArgumentException
- if preconditions are not met.public static int compareTo(double x, double y, double eps)
x
- the first numbery
- the second numbereps
- the amount of error to allow when checking for equalityequals(x, y, eps)
equals(x, y, eps)
&& x < yequals(x, y, eps)
&& x > ypublic static double cosh(double x)
x
- double value for which to find the hyperbolic cosinepublic static boolean equals(double x, double y)
x
- first valuey
- second valuepublic static boolean equals(double x, double y, double eps)
Two NaNs are considered equals, as are two infinities with same sign.
x
- first valuey
- second valueeps
- the amount of absolute error to allowpublic static boolean equals(double x, double y, int maxUlps)
x
- first valuey
- second valuemaxUlps
- (maxUlps - 1)
is the number of floating point
values between x
and y
.true
if there are less than maxUlps
floating
point values between x
and y
public static boolean equals(double[] x, double[] y)
equals
x
- first arrayy
- second arraypublic static long factorial(int n)
n
Factorial, the
product of the numbers 1,...,n
.
Preconditions:
n >= 0
(otherwise
IllegalArgumentException
is thrown)long
. The
largest value of n
for which n!
<
Long.MAX_VALUE is 20. If the computed value exceeds Long.MAX_VALUE
an ArithMeticException
is thrown.n
- argumentn!
java.lang.ArithmeticException
- if the result is too large to be represented
by a long integer.java.lang.IllegalArgumentException
- if n < 0public static double factorialDouble(int n)
n
Factorial, the
product of the numbers 1,...,n
as a double
.
Preconditions:
n >= 0
(otherwise
IllegalArgumentException
is thrown)double
. The
largest value of n
for which n!
<
Double.MAX_VALUE is 170. If the computed value exceeds
Double.MAX_VALUE, Double.POSITIVE_INFINITY is returnedn
- argumentn!
java.lang.IllegalArgumentException
- if n < 0public static double factorialLog(int n)
Preconditions:
n >= 0
(otherwise
IllegalArgumentException
is thrown)n
- argumentn!
java.lang.IllegalArgumentException
- if preconditions are not met.public static int gcd(int p, int q)
Gets the greatest common divisor of the absolute value of two numbers, using the "binary gcd" method which avoids division and modulo operations. See Knuth 4.5.2 algorithm B. This algorithm is due to Josef Stein (1961). Special cases:
gcd(Integer.MIN_VALUE, Integer.MIN_VALUE)
,
gcd(Integer.MIN_VALUE, 0)
and
gcd(0, Integer.MIN_VALUE)
throw an
ArithmeticException
, because the result would be 2^31, which
is too large for an int value.gcd(x, x)
, gcd(0, x)
and
gcd(x, 0)
is the absolute value of x
, except
for the special cases above.
gcd(0, 0)
is the only one which returns
0
.p
- any numberq
- any numberjava.lang.ArithmeticException
- if the result cannot be represented as a
nonnegative int valuepublic static long gcd(long p, long q)
Gets the greatest common divisor of the absolute value of two numbers, using the "binary gcd" method which avoids division and modulo operations. See Knuth 4.5.2 algorithm B. This algorithm is due to Josef Stein (1961). Special cases:
gcd(Long.MIN_VALUE, Long.MIN_VALUE)
,
gcd(Long.MIN_VALUE, 0L)
and
gcd(0L, Long.MIN_VALUE)
throw an
ArithmeticException
, because the result would be 2^63, which
is too large for a long value.gcd(x, x)
, gcd(0L, x)
and
gcd(x, 0L)
is the absolute value of x
, except
for the special cases above.
gcd(0L, 0L)
is the only one which returns
0L
.p
- any numberq
- any numberjava.lang.ArithmeticException
- if the result cannot be represented as a nonnegative long
valuepublic static int hash(double value)
value
- the value to be hashedpublic static int hash(double[] value)
value
- the value to be hashed (may be null)public static byte indicator(byte x)
x
- the value, a bytepublic static double indicator(double x)
NaN
if x
is
NaN
.x
- the value, a doublepublic static float indicator(float x)
NaN
if x
is NaN
.x
- the value, a floatpublic static int indicator(int x)
x
- the value, an intpublic static long indicator(long x)
x
- the value, a longpublic static short indicator(short x)
x
- the value, a shortpublic static int lcm(int a, int b)
Returns the least common multiple of the absolute value of two numbers,
using the formula lcm(a,b) = (a / gcd(a,b)) * b
.
Special cases:
lcm(Integer.MIN_VALUE, n)
and
lcm(n, Integer.MIN_VALUE)
, where abs(n)
is a
power of 2, throw an ArithmeticException
, because the result
would be 2^31, which is too large for an int value.lcm(0, x)
and lcm(x, 0)
is
0
for any x
.
a
- any numberb
- any numberjava.lang.ArithmeticException
- if the result cannot be represented as a nonnegative int
valuepublic static long lcm(long a, long b)
Returns the least common multiple of the absolute value of two numbers,
using the formula lcm(a,b) = (a / gcd(a,b)) * b
.
Special cases:
lcm(Long.MIN_VALUE, n)
and
lcm(n, Long.MIN_VALUE)
, where abs(n)
is a
power of 2, throw an ArithmeticException
, because the result
would be 2^63, which is too large for an int value.lcm(0L, x)
and lcm(x, 0L)
is
0L
for any x
.
a
- any numberb
- any numberjava.lang.ArithmeticException
- if the result cannot be represented as a nonnegative long
valuepublic static double log(double base, double x)
Returns the
logarithm
for base b
of x
.
Returns NaN
if either argument is negative. If
base
is 0 and x
is positive, 0 is returned.
If base
is positive and x
is 0,
Double.NEGATIVE_INFINITY
is returned. If both arguments
are 0, the result is NaN
.
base
- the base of the logarithm, must be greater than 0x
- argument, must be greater than 0public static int mulAndCheck(int x, int y)
x
- a factory
- a factorx*y
java.lang.ArithmeticException
- if the result can not be represented as an
intpublic static long mulAndCheck(long a, long b)
a
- first valueb
- second valuea * b
java.lang.ArithmeticException
- if the result can not be represented as an
longpublic static double nextAfter(double d, double direction)
If direction
is greater than or equal tod
,
the smallest machine representable number strictly greater than
d
is returned; otherwise the largest representable number
strictly less than d
is returned.
If d
is NaN or Infinite, it is returned unchanged.
d
- base numberdirection
- (the only important thing is whether
direction is greater or smaller than d)public static double scalb(double d, int scaleFactor)
If d
is 0 or NaN or Infinite, it is returned unchanged.
d
- base numberscaleFactor
- power of two by which d sould be multipliedpublic static double normalizeAngle(double a, double center)
This method has three main uses:
a = MathUtils.normalizeAngle(a, Math.PI);
a = MathUtils.normalizeAngle(a, 0.0);
angle = MathUtils.normalizeAngle(end, start) - start;
Note that due to numerical accuracy and since π cannot be represented exactly, the result interval is closed, it cannot be half-closed as would be more satisfactory in a purely mathematical view.
a
- angle to normalizecenter
- center of the desired 2π interval for the resultpublic static double[] normalizeArray(double[] values, double normalizedSum) throws java.lang.ArithmeticException, java.lang.IllegalArgumentException
Normalizes an array to make it sum to a specified value. Returns the result of the transformation
x |-> x * normalizedSum / sumapplied to each non-NaN element x of the input array, where sum is the sum of the non-NaN entries in the input array.
Throws IllegalArgumentException if normalizedSum
is infinite
or NaN and ArithmeticException if the input array contains any infinite elements
or sums to 0
Ignores (i.e., copies unchanged to the output array) NaNs in the input array.
values
- input array to be normalizednormalizedSum
- target sum for the normalized arrayjava.lang.ArithmeticException
- if the input array contains infinite elements or sums to zerojava.lang.IllegalArgumentException
- if the target sum is infinite or NaNpublic static double round(double x, int scale)
BigDecimal.ROUND_HALF_UP
method.x
- the value to round.scale
- the number of digits to the right of the decimal point.public static double round(double x, int scale, int roundingMethod)
BigDecimal
.x
- the value to round.scale
- the number of digits to the right of the decimal point.roundingMethod
- the rounding method as defined in
BigDecimal
.public static float round(float x, int scale)
BigDecimal.ROUND_HALF_UP
method.x
- the value to round.scale
- the number of digits to the right of the decimal point.public static float round(float x, int scale, int roundingMethod)
BigDecimal
.x
- the value to round.scale
- the number of digits to the right of the decimal point.roundingMethod
- the rounding method as defined in
BigDecimal
.public static byte sign(byte x)
x
.
For a byte value x, this method returns (byte)(+1) if x > 0, (byte)(0) if x = 0, and (byte)(-1) if x < 0.
x
- the value, a bytepublic static double sign(double x)
x
.
For a double value x
, this method returns
+1.0
if x > 0
, 0.0
if
x = 0.0
, and -1.0
if x < 0
.
Returns NaN
if x
is NaN
.
x
- the value, a doublepublic static float sign(float x)
x
.
For a float value x, this method returns +1.0F if x > 0, 0.0F if x =
0.0F, and -1.0F if x < 0. Returns NaN
if x
is NaN
.
x
- the value, a floatpublic static int sign(int x)
x
.
For an int value x, this method returns +1 if x > 0, 0 if x = 0, and -1 if x < 0.
x
- the value, an intpublic static long sign(long x)
x
.
For a long value x, this method returns +1L if x > 0, 0L if x = 0, and -1L if x < 0.
x
- the value, a longpublic static short sign(short x)
x
.
For a short value x, this method returns (short)(+1) if x > 0, (short)(0) if x = 0, and (short)(-1) if x < 0.
x
- the value, a shortpublic static double sinh(double x)
x
- double value for which to find the hyperbolic sinepublic static int subAndCheck(int x, int y)
x
- the minuendy
- the subtrahendx-y
java.lang.ArithmeticException
- if the result can not be represented as an
intpublic static long subAndCheck(long a, long b)
a
- first valueb
- second valuea-b
java.lang.ArithmeticException
- if the result can not be represented as an
longpublic static int pow(int k, int e) throws java.lang.IllegalArgumentException
k
- number to raisee
- exponent (must be positive or null)java.lang.IllegalArgumentException
- if e is negativepublic static int pow(int k, long e) throws java.lang.IllegalArgumentException
k
- number to raisee
- exponent (must be positive or null)java.lang.IllegalArgumentException
- if e is negativepublic static long pow(long k, int e) throws java.lang.IllegalArgumentException
k
- number to raisee
- exponent (must be positive or null)java.lang.IllegalArgumentException
- if e is negativepublic static long pow(long k, long e) throws java.lang.IllegalArgumentException
k
- number to raisee
- exponent (must be positive or null)java.lang.IllegalArgumentException
- if e is negativepublic static java.math.BigInteger pow(java.math.BigInteger k, int e) throws java.lang.IllegalArgumentException
k
- number to raisee
- exponent (must be positive or null)java.lang.IllegalArgumentException
- if e is negativepublic static java.math.BigInteger pow(java.math.BigInteger k, long e) throws java.lang.IllegalArgumentException
k
- number to raisee
- exponent (must be positive or null)java.lang.IllegalArgumentException
- if e is negativepublic static java.math.BigInteger pow(java.math.BigInteger k, java.math.BigInteger e) throws java.lang.IllegalArgumentException
k
- number to raisee
- exponent (must be positive or null)java.lang.IllegalArgumentException
- if e is negativepublic static double distance1(double[] p1, double[] p2)
p1
- the first pointp2
- the second pointpublic static int distance1(int[] p1, int[] p2)
p1
- the first pointp2
- the second pointpublic static double distance(double[] p1, double[] p2)
p1
- the first pointp2
- the second pointpublic static double distance(int[] p1, int[] p2)
p1
- the first pointp2
- the second pointpublic static double distanceInf(double[] p1, double[] p2)
p1
- the first pointp2
- the second pointpublic static int distanceInf(int[] p1, int[] p2)
p1
- the first pointp2
- the second pointpublic static void checkOrder(double[] val, int dir, boolean strict)
val
- Valuesdir
- Order direction (-1 for decreasing, 1 for increasing)strict
- Whether the order should be strictjava.lang.IllegalArgumentException
- if the array is not sorted.


FILM TITLE: ALL STARS DIRECTOR: Jean Van de Velde COUNTRY: Netherlands 1997 CINEMATOGRAPHY: Jules van den Steenhoven MUSIC: Fons Merkies CAST: Antonie Kamerling, Thomas Acda, Daniel Boissevain, Daphne Deckers, Isa Hoes, Ricky Koole, Frits Lambrechts, Danny de Munk, Raymi Sambo SUPER FEATURES: Nice film, with very funny moments.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The recent wave of films from the Netherlands, and some other parts of Europe, shows one thing that Hollywood has yet to learn. That one does not need massive budgets to make films, and that with some clever work, and well thought out acting, a small film can look much better than many high budget productions that show more gloss than dedication. ALL STARS is one such film. For all its obvious lack of a large budget, the film incorporates many funny moments into a very nice package, and manages to make the film very entertaining for anyone.
 As they approach their 500th game, and they are having a harder time fielding a complete team, we come to see that there are other problems that they all have individually. Many of them go way back to their days as youngsters. Others are results of not to early experiences.
The film, more than anything else, is a nice, gentle study of friendship, and what it has taken to keep these guys together for so long, despite their many directions, and work. But the film, while being sensitive to many of the characters never loses sight of its funny moments, and makes sure that everyone of the guys has a laugh, or enjoys a funny moment. Meanwhile, all this stuff is not fun for some, but it is not enough for all of them to break up each other's friendships, even when it may be adding some terrible stress to a few families that have gotten here along the way.
 One other has a "father" who used to be their coach. It turns out that he was adopted, and couldn't exactly leave the old man to go to games but had to. His girl friend is not any more inclined to understand their relationship, which is not revealed until the old man is dead. And then there is Bram, who has been gay all this time, and no one knew it, but he has not had the courage to tell any of them. His plight comes alive when he does not respond to a girl that likes him, but can not get a response out of him... it is one of the films finer moments, and so gently filmed, that it is hard for us, to dislike the film, its direction and style. And of course, one of the guys is unfaithful, etc, etc, and nearly ruins his own relationship to a woman that is pregnant and whom Bram happened to have liked when he was a kid.
There are few films that pack such a wallop of a story, that is, so many things to go after, and manages to keep things going for a long time, and never really bore the audience. It does so, at times, by crossing to moments of comedy .. like three of four of the guys have an awful time making it to the game, it is raining cats and dogs, and the referee drops the ball on the muddy pitch, and declares the game suspended. After all the trouble, justice is served by the weather. Like can be trying sometimes. But amidst the funny stuff of the away game at the "farm", one of the guys manages to get his mouth in trouble, and then some. All the stuff that we always look back and find funny and amusing when we look at it all later in life.
ALL STARS is far from a film that demands attention from the audience, but it has a sudden charm that attracts you to its story and plight of each character easily enough. it is shot with ease, nothing slick, or fancy here, just plain good camera work, and well designed use of the film, which might have suggested that these people had to do their work under the direst of needs and consequences, and the result is a charming film, that is very enjoyable.
The acting is rather nice, and each character is actually pretty well defined giving the idea that an ensemble has been developed and designed to prepare this thing for shooting. it's hard to tell if there are any stock characters here, as they are all different and have their own agendas.
GOOD FILM ENJOYABLE MOMENTS
3 of 5 GIBLOONS
Reviewed by Pedro Sena. Copyright (c) Pedro Sena 1998. All Rights Reserved.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Index of reports for Openstack
These documents reports some metrics about SQL requests played during the execution of any action done on OpenStack.
report_trace-create-and-delete-image.yaml.json.html
report_trace-report-boot-and-associate-floating-ip.yaml-f7a3b33f-d2e4-4c6c-8bf0-3782b7b675f8.json.html


Check out how many fizzes and buzzes go into 0!
fizz = divisible by 3 buzz = divisible by 5
fizzbuzz output:


WITNESS LIST Redistricting Committee April 5, 2001-4:00P Redistricting On: Alexander, George (Self) Barton, Congressman Joe (Self) Beckham, Rob (Abilene City Council) Besteiro, Jr., Raul A. (Brownsville Navigation District) Bledsoe, Gary W. (Texas NAACP) Burnham, Perry (City Council and City of Castle Hills) Calvert, Tommmy T. C. (Neighborhood First Alliance) Carrillo, Victor (Abilene City Council) DeLay, Congressman Tom (Self) Flores, Henry (William C. Velasquez Institute) Garcia, Mayor Hector F. (Cities of Watauga, N. Richland Hills, Richland Hill, Keller, Haltom City and Hurst) Garcia, Ross Omar (Self) Gee, Terry (Chinese Seniors Association of Houston) Gutierrez, Judith (Webb County) Harris, Vivian (South Houston Concerned Citizens Coalition; Harris COunty Democratic Chair, Precinct #319) Harrison, Cecile (Self) Hebert, J. Gerald (IMPAC 2000) Hernandez, Andrew (Self) Hernandez, Councilman Victor (City Council District One) Hightower-Pierson, Paula (Self) Hofeller, Thomas B. (Republican National Committee) Jackson, Councilwoman Teri (Self and City of Grand Prairie) Jefferson, Howard (Self) Jouett, Killeen Mayor Maureen J. (Mayors of Temple, Waco, Hamilton, Copperas Cove) Lichtman, Allan J. (IMPAC 2000) Longoria, Representative John (Self) Maldonado, Juan J. (Willie Velasquez Research Institute) Messbarger, Dick (Self) Miller, Geraldine (Self) Nunez, Anna (Self) Oldham, Dale (Republican National Committee) Owens, Bill (Self) Pate, A. J. (Self) Poindexter, John (Self) Ramirez, Ventura (Self) Rodriguez, Jose (Self and El Paso County) Ryan, Vince (Self) Sonnen, Connie (Self) Statler, Taylor County Commissioner Chuck (Self and Taylor County and Abilene Chamber of Commerce) Registering, but not testifying: On: Escobar, Felicia (National Council of La Raza) Haughey, Tom (Self and Texas Republican Chairman's Association) Howard, Donna (Common Cause of Texas) Kastrim, Deborah (Self) Masset, Royal (Self) Montgomery, Dan (Self) Ramos PhD., Vincent (MALDEF, LULAC)


Servlet API - Do not use SingleThreadModel in a Servlet class
javax.servlet.SingleThreadModel is a tag interface that a servlet can implement to transfer its re-entrance problem to the servlet engine. As such, javax.servlet.SingleThreadModel is part of the J2EE specification. The application server's servlet engine handles the servlet's re-entrance problem by creating separate servlet instances for each user. Because this causes a great amount of system overhead, javax.servlet.SingleThreadModel should be avoided.
Wrong
import javax.servlet.http.*;
import java.beans.*;
public class STM extends HttpServlet implements SingleThreadModel {
// some code here.
}
Tip: javax.servlet.SingleThreadModel has been used typically to protect updateable servlet instances in a multithreaded environment. The better idea is to avoid using servlet instance variables that are updated from the servlet's service method.
REFERENCE
IBM WebSphere Application Server Standard and Advanced Editions
by Harvey W. Gunther Date: September 7, 2000
http://www-4.ibm.com/software/webservers/appserv/ws_bestpractices.pdf


Latest Work
Fair Split Calculator
A simple ReactJS calculator that takes two earnings and determines the amount each should pay towards an inputed set of household bills.Scribe
A WordPress theme that excels as a writing tool. Built with [_s](http://underscores.me/), [Foundation](http://foundation.zurb.com/), and Sass.Phantom
A minimalist, responsive portfolio theme for Jekyll with Bootstrap.
Grocery Store Monopoly Exchange
A SPA that lists a directory of user inputed tickets from the grocery store Monopoly game to facilitate exchanges with friends & family built with JavaScript and Angular.
Calculator
A functional calculator that can perform basic operations built with JavaScript, jQuery, & Sass
Simon Game
The classic memory game built with JavaScript, jQuery, & Sass.


:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹. View these docs in other languages at electron/i18n.
The Electron framework lets you write cross-platform desktop applications using JavaScript, HTML and CSS. It is based on Node.js and Chromium and is used by the Atom editor and many other apps.
Follow @ElectronJS on Twitter for important announcements.
This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to<EMAIL_ADDRESS>Installation
To install prebuilt Electron binaries, use npm
.
The preferred method is to install Electron as a development dependency in your
app:
npm install electron --save-dev [--save-exact]
The --save-exact
flag is recommended for Electron prior to version 2, as it does not follow semantic
versioning. As of version 2.0.0, Electron follows semver, so you don't need --save-exact
flag. For info on how to manage Electron versions in your apps, see
Electron versioning.
For more installation options and troubleshooting tips, see installation.
Quick start
Clone and run the electron/electron-quick-start repository to see a minimal Electron app in action:
git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install
npm start
Resources for learning Electron
- electronjs.org/docs - all of Electron's documentation
- electron/electron-quick-start - a very basic starter Electron app
- electronjs.org/community#boilerplates - sample starter apps created by the community
- electron/simple-samples - small applications with ideas for taking them further
- electron/electron-api-demos - an Electron app that teaches you how to use Electron
- hokein/electron-sample-apps - small demo apps for the various Electron APIs
Programmatic usage
Most people use Electron from the command line, but if you require electron
inside
your Node app (not your Electron app) it will return the file path to the
binary. Use this to spawn Electron from Node scripts:
const electron = require('electron')
const proc = require('child_process')
// will print something similar to /Users/maf/.../Electron
console.log(electron)
// spawn Electron
const child = proc.spawn(electron)
Mirrors
Documentation Translations
Find documentation translations in electron/i18n.
Community
Info on reporting bugs, getting help, finding third-party tools and sample apps, and more can be found in the support document.
License
When using the Electron or other GitHub logos, be sure to follow the GitHub logo guidelines.


|
Fig. 1
|
XRD patterns and crystal/local structure descriptions of K 3 ... |
|
Fig. 2
|
Photoluminescence properties of K 3LuSi 2O 7:Eu 2+ phosphors ... |
|
Fig. 3
|
Thermal quenching properties of K 3LuSi 2O 7:Eu 2+ phosphor. ... |
|
Fig. 4
|
NIR application of K 3LuSi 2O 7:Eu based pc-LEDs. a Photogra ... |


Please make sure Zeroconf is enabled for any Mopidy servers in the same WiFi network as your device.
Then pull to refresh, or add a server manually.


Mzansi Super League 2019, Paarl Rocks vs Jozi Stars: Match preview, predicted XIs, key players and live telecast details
by Vinay ChhabariaWith an aim of registering their first victory of the season, the defending champions of Mzansi Super League, Jozi Stars will lock horns with the Paarl Rocks in the 13th match of the tournament. While the Stars are at the bottom position in the standings, the Paarl-based franchise holds the fourth rank with seven points in three matches.
The Stars and the Rocks have met thrice in the history of the league and the head-to-head record does not favour any of the two sides. Jozi Stars had defeated Paarl in their first meeting but the Rocks conquered them in the succeeding match. Their previous match had been abandoned due to rain.
This year, the Paarl Rocks will start as the favourites because they had trounced Cape Town Blitz by 86 runs in their season opener. However, Jozi Rocks had recently appointed the former South African batting coach Neil McKenzie as their new mentor and consultant so, they will enter the field with a fresh mindset.
Predicted XIs
Paarl Rocks
Despite the defeat against Tshwane Spartans in their previous match, Paarl Rocks may not alter their match squad for the match against Jozi Stars. Skipper Faf du Plessis will expect his men to pull off a better show this time around
Predicted XI: Henry Davids, Cameron Delport, James Vince, Faf du Plessis (c), Dwaine Pretorious, Mangaliso Mosehle, Isuru Udana, Hardus Viljoen, Bjorn Fortuin, Tabraiz Shamsi, Kerwin Mungroo
Jozi Stars
The fans of Jozi Stars will hope that Chris Gayle returns to form soon because he has scored only 46 runs in the first four matches. Also, his strike rate of 100.00 would be worrying the fans. However, the West Indian stalwart can be backed to come off good in this match. Since the Stars' bench strength is not that strong, there should be no changes in the playing XI.
Predicted XI : Chris Gayle, Reeza Hendricks, Temba Bavuma (c), Rassie van der Dussen, Sinethemba Qeshile, Daniel Christian, Simon Harmer, Gerald Coetzee, Kagiso Rabada, Aaron Phangiso, Duanne Olivier.
Key Players
Reeza Hendricks and captain Temba Bavuma will have to shoulder the responsibility of Jozi Stars' batting department while Aaron Phangiso will be the player to watch out for from their bowling attack.
From the Rocks, Henry Davids will have to continue his fine form with the bat whereas Tabraiz Shamsi will hold the key to Paarl's success with the ball.
When, where and how to watch?
Date: 22nd November 2019, Match 13
Time: 9.00 PM IST
Live Telecast: Sony ESPN, Sony ESPN HD


| Name | Description |
go_library | Build an assembly .a file |
go_binary | Link assemblies, produce executable binary |
go_image | Package a go binary as a docker image |
k8s_object | Create a shell script that pushes images to a docker registry and calls kubectl with yaml |
k8s_objects | Concat multiple yaml files, create a shell script that calls kubectl |


Data provided by Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE) using the coronavirus-tracker-api
Visualized using Chart.js


S-video on Timex Sinclair 2068
This is a video about an S-video modification for the Timex Sinclair 2068. S-video gives better picture quality than composite video because the black and white (luminance) information is transmitted separately from the colour (chrominance) information rather than being combined in the same signal and separated in the television. The design compromises in composite video date back to 1954 and the American NTSC colour television standard, basically the colour information was squeezed into the black and white picture as a series of fine dots. Using the same bandwidth for both signals meant that the colour standard would be compatible with black and white televisions using existing black and white television channels, but problems occur when trying to separate the two signals because it is impossible to separate them perfectly once they have been combined.
Two problems occur with composite video pictures which are attributable to the separation process. The first is unseparated chrominance information remaining in the luminance channel, visible in the final picture as a stationary or moving dot pattern and sometimes called "dot crawl". The second is unseparated luminance information remaining in the chrominance channel, and this can be seen as spurious colour fringes on vertical black and white transitions such as text.
In this video I demonstrate an S-video circuit for the TS2068 which had just been prototyped.
Switchable TS2068 / Spectrum ROM
In November 2013 I finished a switchable TS2068 / Spectrum ROM modification and implemented it on two TS2068s. It uses a 32K EPROM chip for the HOME ROM and a 16K EPROM chip for the EX ROM. The channel 2 / 3 switch on the underside of the case is re-purposed as a ROM select switch. It controls the upper address bit on the two EPROMs.
The Timex halves of the two EPROMs are completely standard TS2068 ROM images. The Spectrum half of the HOME EPROM is a very slightly modified version of the Spectrum ROM, modified to reset port 0xF4 and 0xFF on startup. The Spectrum half of the EX EPROM is a very slightly modified version of the Timex EX ROM, modified to jump to the START-NEW location in the Spectrum ROM on startup instead of the Timex HOME ROM location.
These modifications are necessary to ensure that the computer starts up every time reliably when in Spectrum mode. Unfortunately it is not possible to boot reliably on a TS2068 from a 100% exact Spectrum ROM.
These are the images for the EPROMs used in the switchable TS2068 modification.
The Timex halves of the two EPROMs are completely standard TS2068 ROM images. The Spectrum half of the HOME EPROM is a very slightly modified version of the Spectrum ROM, modified to reset port 0xF4 and 0xFF on startup. The Spectrum half of the EX EPROM is a very slightly modified version of the Timex EX ROM, modified to jump to the START-NEW location in the Spectrum ROM on startup instead of the Timex HOME ROM location.
These modifications are necessary to ensure that the computer starts up every time reliably when in Spectrum mode. Unfortunately it is not possible to boot reliably on a TS2068 from a 100% exact Spectrum ROM.
In the Spectrum 48K half of the 27256 EPROM image, the standard Spectrum 48K ROM is patched as follows:
11D0 3E 3F LD A, 0x3F 11D2 ED 47 LD I, A 11D4 00 NOP 11D5 00 NOP 11D6 00 NOP 11D7 00 NOP 11D8 00 NOP
becomes:
11D0 AF XOR A 11D1 D3 F4 OUT (0xF4), A 11D3 D3 FF OUT (0xFF), A 11D5 3E 3F LD A, 0x3F 11D7 ED 47 LD I, A
In the Spectrum 48K half of the 27128 EPROM image, the standard TS2068 EX ROM is patched as follows:
0057 C3 31 0D JP 0x0D31
becomes:
0057 C3 CB 11 JP 0x11CB
The motivation for putting a Spectrum 48K ROM in a Timex Sinclair 2068 is to be able to run Spectrum 48K software. Whereas there are probably less than 100 Timex Sinclair 2068 programs, there are more than 10,000 Spectrum 48K programs. The Spectrum 48K ROM is also somewhat faster than the Timex Sinclair 2068 ROM and has fewer bugs. It therefore provides a good platform for exploring the TS2068's extra video modes.
To perform the modification, the components connected to the channel 2 / 3 switch need to be removed and the switch re-used as a ROM select switch. Take the TS2068 apart by undoing the seven case screws on the underside of the machine and unplugging the keyboard membrane from its header on the PCB. There are two sizes of case screw so preserve where each screw went. Then undo the three screws holding the PCB onto the bottom half of the case and take out the PCB. Take the cover off the RF modulator shield and examine the inside.
Remove C46, R57 and R56 by desoldering them from the PCB and removing them with pliers. These three components are connected to the channel 2 side of the switch. and are in a line in the top left corner of the shield to the right of the solder pads for the switch itself. Leave C47 in - this will provide a useful anchor point to connect +5V to on the underside of the PCB (the solder side). Remove R28 and R24. These are the next two components down after C47. Finally, remove R58. This is the component to the left of the bottom pin of the channel switch.
Solder a link wire in the pads where C46 used to be. This connects the channel 2 side of the switch to GND. I used black plastic covered wire to indicate that this wire is at ground potential. On the underside of the PCB, solder another link wire between the side of C47 connected to the switch and a +5V point. This connects the channel 3 side of the switch to +5V. Looking at the underside of the PCB, it is the leg of C47 on the right. A suitable +5V point to use is the top leg of Q2 - this has a thick trace snaking away from it to the left and down.
Now the switch provides +5V or GND, the next step is to take this signal to the ROM sockets and reconfigure them for EPROMs instead of mask ROMs.
On the standard machine, jumpers W1 and W2 are fitted in the centre of the PCB. This connects MREQ# to CS# on the HOME ROM and ROMCS# to pin 27 of the HOME ROM. The mask ROM in the standard machine has an output enable pin at this location. The ROM is decoded by three signals, MREQ# connected to CS#, ROMCS# connected to OE1# and RD# connected to OE0#.
In the modified machine, a 27256 EPROM is used for the HOME ROM. Pin 27 becomes A14 which is connected to the channel 2 / 3 switch. ROMCS# is connected to CS# (pin 20) and MREQ# is connected to OE# (pin 22).
Remove jumpers W1 and W2 and solder a link wire between the bottom left pad and the top right pad. This connects ROMCS# on the bottom left to CS# (pin 20 of the HOME ROM) on the top right.
Solder a wire from the pole of the channel 2 / 3 switch to the bottom right jumper pad. This connects the new ROM select signal to A14 of the new HOME EPROM (pin 27).
On the underside of the PCB, cut the track between pins 26 and 27 of the EX ROM socket. On the component side of the PCB, cut the track leading from pin 26 of the EX ROM socket to the left. On the standard machine this carries RD# to pins 26 and 27 of the EX ROM. The track is best cut just below the text for C43 on the PCB, where it emerges between a pair of vias.
In the modified machine, a 27128 EPROM is used for the EX ROM. Solder a wire from pin 27 of the HOME ROM socket to pin 26 of the EX ROM socket. This connects the new ROM select signal to A13 of the new EX EPROM.
Solder a wire from pin 28 of the HOME ROM socket to pin 1 of the same socket. Solder a wire from pin 28 of the EX ROM socket to pin 1 of the same socket and to pin 27 of that socket. These wires carry +5V from pin 28 (Vcc) to pin 1 (Vpp) of the EPROMs and also to pin 27 of the EX EPROM (PGM#).
Next, cut the track above and to the right of the top right jumper pad. In the standard machine this carries RD# to pin 22 of the HOME ROM. Solder a wire from the top left jumper pad to pin 22 of the HOME ROM socket. This connects MREQ# to OE# of the new EPROM.
Now the machine is ready for the two EPROMs. Remove the original Timex mask ROMs from the two ROM sockets and install a 27256 EPROM programmed with the file "Switchable TS2068 27256.rom" into the HOME ROM socket. Install a 27128 EPROM programmed with the file "Switchable TS2068 27128.rom" into the EX ROM socket.
Test the machine at this point by connecting a power supply and a composite video display to the PCB and turn the power switch on. It should boot up in one of the two modes, Spectrum 48K or Timex Sinclair 2068, depending on which position the channel 2 / 3 switch is in. Spectrum 48K mode is the channel 2 position and Timex Sinclair 2068 mode is the channel 3 position. You can mark the case to this effect if you like.
Assuming all is well, put the PCB back in the lower half of the case, put the PCB screws back in, reconnect the keyboard and put the case screws back in. Enjoy your switchable Timex Sinclair 2068 in its original mode and in its new Spectrum 48K compatible mode.
TS2068 running with original Spectrum ROM
Part way through doing the switchable ROM mod on the first TS2068, before the EPROMs were ready, I fitted an original Spectrum ROM from an Issue Two Spectrum into the HOME ROM socket of the TS2068, just to see what the end result would be like. The EX ROM socket was empty. The computer would boot some of the time, sometimes into the normal boot screen and sometimes with a black screen. Other times it wouldn't boot at all.
This proved the necessity of the EPROMs; sometimes it was booting into HOME ROM space, other times into EX ROM space. When it did boot into HOME ROM space, sometimes the screen mode was set to the normal Spectrum mode with attributes, other times it was set to the alternate screen or one of the hi colour screens. It was sometimes possible to type OUT 255, 0 into BASIC without seeing the characters on the screen and get the normal screen mode, but it was easier just to keep power cycling the machine a few more times until it booted into the normal screen mode.
This video shows the TS2068 running with an original Spectrum ROM in the HOME ROM socket, playing Jet Set Willy.
Inside the Timex Sinclair 2068
Also while doing the switchable ROM mod, I made a short video showing the inside of the TS2068. The Issue Two Spectrum ROM can be seen in the HOME ROM socket and the EX ROM socket is empty.
16 colours on Timex Sinclair 2068
One of the surprises when learning about the TS2068 from a Spectrum user's point of view is the colour set. The Timex SCLD develops a different set of colours on its Y, U and V pins compared with the Spectrum ULA. The differences can be put down to differences in the NCR CMOS gate array pad driver circuitry compared with the Ferranti ULA pad drivers, or perhaps it wasn't seen as necessary to copy the Spectrum ULA colours exactly. The most noticeable difference is in bright black, which is quite a bit lighter than normal black on the TS2068, whereas on the Spectrum they are the same. The other colours are also significantly lighter, becoming pastel like in some cases. The Y signal on the TS2068 seems to be generated by a 3 bit digital to analogue converter, with equal steps between the 8 colours, and bright seems to be implemented as an extra LSB worth of voltage added across all the bright colours including black.


👋🏼 Hello! Thank you for stopping by.
😀 Please note that this is the fifth in a series of articles I am writing on Cognitive Biases. If you haven’t read the other four yet, I’d recommend you read them first. Links below:
Ok, let’s get started with this one.
Dwapar Yug, Dronacharya and the elephant
Mahabharata, the epic tale between the two groups of cousins, the Kauravas and the Pandavas, is a tale of a multitude of human desires, emotions and grit and vengeance. Many of its learnings are used in management, leadership and growth. Let’s start with one such small chronicle from this hell of a tale.
Without going into details, let me try and drive the point.
It is the time of the Kurukshetra War. After the death of Bheeshmacharya, Dronacharya becomes the commander-in-chief of the Kaurava army. Krishna knew that Dronacharya was formidable and with him in charge, it was impossible to defeat the Kauravas.
The only way to remove Dronacharya was to convince him that his son, Ashwathama, was dead. With his son gone, Dronacharya would give up and he could only then be killed. Krishna, the greatest trickster, devises a plan.
Ashwathama, who was considered one of the greatest warriors, was not easy to kill. Hence the trick!
As per Krishna’s plan, Bheema kills an elephant named Ashwathama after which Yudhisthir declares, ‘Ashwathama hatha (loudly), iti narova kunjarova (whispers)’. Dronacharya who heard this was able to gather only the first half of the sentence, and with Yudhisthir, who was the epitome of Dharma (righteousness), declaring such an event, Dronacharya believed it to be true and gave up himself in the war field, and was then taken down!
This, for me, is a classic case of the framing effect. Dronacharya placed enormous trust in Yudhisthir and believed that Yudhisthir would never make a false statement and when Yudhisthir called out that Ashwathama was dead, he instantaneously believed it. In fact, Yudhisthir did not make any false statement either, did he? It was just presented in a way that seemed so. It was cleverly designed (by Krishna) to ensure that it was interpreted in the way it was intended to.
That is how the framing effect works. It is not the information, but the way it is presented that does the trick. The trick here is to ‘frame’ someone.
This sounds too pre-historic, eh? Worry not, from the Dwapar Yug to the Kali Yug, the framing effect shines bright.
Kali Yug and the age of (mis)information
Look at some statements below.
- India has vaccinated only 3.1% of its population, a meagre number compared to the 41% vaccination rate in the US
- The number of vaccine doses given in India stands at 20.7Cr, a whopping 61% of the US population!
Or read how some similar yet strikingly different headlines would create extreme views in a readers mind:
- A staggering 20% of the Indian population is still reeling under the below poverty line (BPL)
- Positive signs for India as the population under BPL has seen a gradual decline from 40% in 2004 to 20% in 2015
- India continues its slump at the Olympics. Wins only 1 bronze
- India creates history. Karnam Malleswari becomes the first Indian woman to win an Olympic medal
- Out of 4, India is the worst team
- Indian team is the 4th best team in the world!
Interesting examples, but sound too far-fetched. How do they relate to me, hmmm?
Hold on!
Do you go well with memes?
Seems familiar? Been in that situation? I’d bet you did!
The classic tale of discount marketing
You are drawn to the discount ‘%’ more than the price itself. The discount % is perceived as saving, as a benefit. And the mind is tricked into believing that you are actually in for a good deal. A 50% off deal cannot be bad, right?
This trick is used in a myriad number of ways. Let’s see.
A shoe store displays 40% off. You get lured, you enter the store and try different shoes. However, you notice that the 40% off is only on a few shoes displayed at the corner, as part of the clearance sale, not on all the shoes. But having entered the store already you are reluctant to leave now. And inside the store, the sales agents are ready to entice you more, serve you more and make you feel like their hero. And you try more shoes. The chances are you end up buying a different shoe than what you anticipated when you entered. Happened with you?
Another example.
Two ice-cream boxes containing the same ingredients display their contents differently. The first box says ‘10% fat’, the second box says ‘90% fat-free!’. It is highly likely that, given a chance, you would choose the second box more often than the first one.
 They all make you feel bad for NOT using them; you may not realise that, but they do! And you want to avoid this ‘bad’ feeling and allow ourselves to be ‘framed’.
Framing Effect
We often draw different conclusions from the same information depending on how it is presented.
The framing effect perhaps is one of the most common tricks used by marketers, politicians, news agencies, influencers and not to forget — magicians. As the name itself says, it ‘frames’ the audience into believing what they see (or hear as it was in Dronacharya’s case), depending on how the information is presented. And based on the way information is presented, we draw different conclusions from it — to support a party or not, to buy a shoe or not, to trust a person or not — we do it almost all the time. You could draw a completely wrong conclusion and only realise it much later or not realise it at all! You could have drawn an entirely different conclusion had the information been presented in any different way.
Politicians and the art of framing
Some more examples 😀
- The government will glorify the fact that it was able to pave way for a cashless economy due to demonetization but will hide the fact that the currency in circulation, according to the RBI data, was ₹24.2 lakh crore in 2020 compared to ₹16.4 lakh crore in 2016. And also cover it under the rugs that as per the RBI data, about 99% of the invalidated money was returned to the banks. Remember flushing out black money was a prime objective of demonetization? But the government will never bring them to light themselves.
- The government will call for caution, solidarity and brotherhood among fellow people during these tough Covid times, but will underplay misgovernance and systemic failure at the topmost level.

What am I trying to say, anyway?
Anyway, coming to the point. The information you consume, from the people you know, from advertisements, from strangers on social media, from newspapers or any other media — they all bear a very high power to influence us. It can sway us away from one view to another extreme view, merely by the way information is presented.
People tend to present information that suits their narrative, in a way that doesn’t harm them but helps them. It is natural. It stems from the need for self-protection and preservation. People don’t give away their shortcomings as easily as they glorify their virtues.
In fact, the onus of identifying the shortcomings (or all the facts) is on the other person. This is prevalent in almost everything you do — purchasing a car, downloading an App, ordering food, looking for a match on matrimony, voting in an election, selecting an insurance plan — the list is endless.
In fact, ‘Caveat Emptor’, a Latin phrase, which can be loosely translated into English as ‘let the buyers beware’ is a law in commercial transactions. It places the onus on the buyer to perform due diligence before making a purchase and doesn’t necessarily hold the seller responsible for not disclosing everything — for a simple reason that it is impossible to state ‘everything’ about a product/service. For example, if you want to buy a car from me, I may NOT be able to give the entire history of the car, if it had any accident, how many times was the car taken for servicing, if the windshield is in perfect condition etc. It is your responsibility to check everything that you need to know before you make the payment. By law, the onus is on you while making a purchase.
And this rule, if not law, can be extended beyond commercial transactions. While consuming information, the onus is on the receiver to get the complete information. There always will be grey areas in the information presented and you need to be careful while you draw conclusions from the information presented as it is.
This happens all the time — from making new friends to planning a trip, from finding a partner to buying a new house, from choosing a college to starting a company. It is better to take a step back and look at the information from an objective eye by asking more questions and asking for more information. This is difficult and cannot be done all the time. But if not paid enough attention, this could take you for a ride.
Thank you for reading! 🙏🏼
👍🏼 ➡ If you liked it, please share it with others who might find it interesting!
💬 Also, please leave your comment or feedback below.


Developer with experience using programming skills to create and develop high utility inward and outward facing products.
Front End / Back End
HTML5
CSS3
JavaScript
Python
GIS
ArcMap
ArcPro
ArcGIS Online
QGIS
Other / APIs
Dojo
jQuery
JavaScript API for ArcGIS
ESRI Calcite
Git
Selenium WebDriver
Geographic Information Systems
Environmental Studies
Apart from being a web developer, I am an avid rock climber. I have 2 wonderful dogs to spend my days away with. In the past, I have performed in a collegiate circus as well as taught circus skills to children and adults. From my time in the circus, I have learned to perform and teach flying trapeze, russian bar, juggling, partner acrobatics, as well as learning to maintain and inspect circus equipment for safety standards.