Script moses
Moses: A utility-belt library for functional programming in Lua.
Functions
| each (list, f[, ...]) | Similar to pairs iterator. |
| eachi (list, f[, ...]) | Similar to ipairs iterator. |
| count (list[, value]) | Counts the number of occurences of a given value in a list. |
| countf (list, f[, ...]) | Same as count, but uses an iterator. |
| cycle (list, n) | Iterator to cycle through the contents of a list or a collection. |
| map (list, f[, ...]) | Maps function f on each key-value of a given collection. |
| reduce (list, f[, state]) | Reduces an entire collection. |
| reduceRight (list, f[, state]) | Reduces an entire collection. |
| mapReduce (list, f[, state]) | Reduces a collection while saving intermediate states. |
| mapReduceRight (list, f[, state]) | Reduces a collection while saving intermediate states. |
| include (list, item) | Looks for an object in a collection. |
| detect (list, item) | Looks for an object index in a collection. |
| contains (list, item) | Returns true if item is present in the list, false otherwise. |
| where (list, a) | Returns an array of values. |
| findWhere (list, a) | Returns a value. |
| select (list, f[, ...]) | Selects and extracts objects passing an iterator test. |
| reject (list, f[, ...]) | Clones a collection, rejecting objects passing an iterator test. |
| all (list, f[, ...]) | Tests if all objects in a collection passes an iterator test. |
| invoke (list, method[, ...]) | Invokes a method on each object in a collection. |
| pluck (list, a) | Extracts property-values from a collection of objects. |
| max (list[, iter[, ...]]) | Returns the maximum value in a collection. |
| min (list[, iter[, ...]]) | Returns the minimum value in a collection. |
| shuffle (list[, seed]) | Returns a shuffled copy of a given collection. |
| same (a, b) | Tests if two collections are the same. |
| sort (list[, comp]) | Sorts a collection. |
| toArray ([...]) | Converts a list of var_args to a collection. |
| groupBy (list, iter[, ...]) | Splits a collection into subsets. |
| countBy (list, iter[, ...]) | Groups objects in a collection and counts them. |
| size ([...]) | Counts the number of values in a collection. |
| containsKeys (list, other) | Checks if all the keys of other object exists in a list . |
| sameKeys (listA, listB) | Checks if both given lists have the same keys. |
| reverse (array) | Reverses values in a given array. |
| selectWhile (array, f[, ...]) | Collects values from a given array. |
| dropWhile (array, f[, ...]) | Collects values from a given array. |
| sortedIndex (array, the[, comp[, sort]]) | Returns the index at which a value should be inserted. |
| indexOf (array, the) | Returns the index of the given value in an array. |
| lastIndexOf (array, the) | Returns the last occurence index of a given value. |
| add (array, ...) | Adds all passed-in values at the top of an array. |
| push (array, ...) | Pushes all passed-in values at the end of an array. |
| pop (array) | Removes and returns the value at the top of a given array. |
| unshift (array) | Removes and returns the value at the end of a given array. |
| removeRange (array[, start[, finish]]) | Trims all values indexed within the range [start,finish] . |
| chunk (array, f[, ...]) | Iterates over an array chunking together. |
| slice (array[, start[, finish]]) | Slices values indexed within [start,finish] range. |
| first (array[, n]) | Returns the first N values in an array. |
| initial (array[, n]) | Returns all values in an array excluding the last N values. |
| last (array[, n]) | Returns the last N values in an array. |
| rest (array[, index]) | Trims all values before index. |
| compact (array) | Trims all falsy values. |
| flatten (array[, shallow]) | Flattens a nested array. |
| difference (array, another) | Returns values from an array not present in all passed-in args. |
| symmetric_difference (array, array2) | Performs a symmetric difference. |
| uniq (array[, isSorted[, iter[, ...]]]) | Produces a duplicate-free version of a given array. |
| union (...) | Returns the duplicate-free union of all passed in arrays. |
| intersection (array, ...) | Returns the intersection of all passed-in arrays. |
| zip (...) | Merges values of each of the passed-in arrays in subsets. |
| append (array, other) | Clones array and appends other to the result. |
| range (...) | Produce a flexible list of numbers. |
| invert (array) | Inverts key-value pairs. |
| concat (array[, sep[, i[, j]]]) | Concatenates values in a given array. |
| identity (value) | Returns the passed-in value. |
| once (f) | Returns a version of f that runs only once. |
| memoize (f[, hash]) | Memoizes a given function by caching the computed result. |
| after (f, count) | Returns a version of f that runs on the count-th call. |
| compose (...) | Composes functions. |
| wrap (f, wrapper) | Wraps f inside of the wrapper function. |
| times (n, iter, ...) | Runs iter function n times. |
| bind (f, v) | Binds v to be the first argument to function f . |
| bindn (f, ...) | Binds ... to be the N-first arguments to function f . |
| uniqueId ([template[, ...]]) | Generates a unique Id (unique for the current session). |
| keys (obj) | Returns the names of the object properties. |
| values (obj) | Returns the values of the object properties. |
| paired (obj) | Returns an array of key-values pairs |
| extend (destObj, ...) | Extends an object properties. |
| functions (obj) | Returns a sorted list of all methods names found in an object. |
| clone (obj[, shallow]) | Clones a given object properties. |
| tap (obj, f[, ...]) | Invokes interceptor with the object, and then returns object. |
| has (obj, key) | Checks if a given object implements a property. |
| pick (obj, ...) | Return a filtered copy of the object. |
| omit (obj, ...) | Return a filtered copy of the object. |
| template (obj, template) | Fills nil properties in an object with the given template object. |
| isEqual (objA, objB[, useMt]) | Performs an equality test between two objects. |
| result (obj, method[, ...]) | Invokes an object method. |
| isTable (t) | Checks if the given arg is an object (i.e a Lua table). |
| isCallable (obj) | Checks if the given arg is an callable. |
| isArray (obj) | Checks if the given arg is an array. |
| isEmpty (obj) | Checks if the given is empty. |
| isString (obj) | Checks if the given arg is a string. |
| isFunction (obj) | Checks if the given arg is a function. |
| isNil (obj) | Checks if the given arg is nil. |
| isFinite (obj) | Checks if the given arg is a finite number. |
| isNumber (obj) | Checks if the given arg is a number. |
| isNaN (obj) | Checks if the given arg is NaN (see Not-A-Number). |
| isBoolean (obj) | Checks if the given arg is a boolean. |
| isInteger (obj) | Checks if the given arg is an integer. |
| chain (value) | Returns a wrapped object. |
| obj:value () | Extracts the value of a wrapped object. |
| import ([context[, noConflict]]) | Imports all library functions into a context. |
Functions
- each (list, f[, ...])
-
Similar to pairs iterator. Calls function
f
on each key-value of a given collection.
Aliased asforEach
.Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
- eachi (list, f[, ...])
-
Similar to ipairs iterator. Calls function
f
only on values indexed with an integer key in a given collection. The array can be sparse, or map-like. Iteration will be performed from the lower integer key to the highest one.
Aliased asforEachi
.Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
- count (list[, value])
-
Counts the number of occurences of a given value in a list. Uses isEqual to compare objects.
Parameters:
- list table a collection
- value value a value to be searched in the list. If not given, defaults to size.
see also:
- countf (list, f[, ...])
-
Same as count, but uses an iterator. Provide a count for the number of values passing the test
f(key,value,...)
Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
see also:
- cycle (list, n)
-
Iterator to cycle through the contents of a list or a collection. Loops on each key-pairs of a given
list repeatedly
n
times or forever (ifn
is omitted). In casen
is lower or equal to 0, does nothing.
Aliased asloop
.Parameters:
- list table a collection
- n number a number of loops
Returns:
-
function
an iterator function returning a key-value pair from the passed-in list.
- map (list, f[, ...])
-
Maps function
f
on each key-value of a given collection. Collects and returns the outputs.
Aliased ascollect
.Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
Returns:
-
table
a table of results
- reduce (list, f[, state])
-
Reduces an entire collection. Folds from left to right to a single value,
with respect to a given iterator and an initial state.
The given function takes a state and a value, and returns a new state.
Aliased asinject
,foldl
.Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(state,value)
- state state an initial state of reduction. Defaults to the first value in the list.
Returns:
-
state
state a final state of reduction
- reduceRight (list, f[, state])
-
Reduces an entire collection. Folds from right to left to a single value,
with respect to a given iterator and an initial state.
The given function takes a state and a value, and returns a new state.
Aliased asinjectr
,foldr
.Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(state,value)
- state state an initial state of reduction. Defaults to the last value in the list.
Returns:
-
state
state a final state of reduction
- mapReduce (list, f[, state])
-
Reduces a collection while saving intermediate states.
Folds the collection from left to right to a single value,
with respect to a given iterator and an initial state.
The given function takes a state and a value, and returns a new state.
The function returns an array of intermediate states.
Aliased asmapr
Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(state,value)
- state state an initial state of reduction. Defaults to the last value in the list.
Returns:
-
table
an array of states
- mapReduceRight (list, f[, state])
-
Reduces a collection while saving intermediate states. It proceeds in reverse order,
folding the collection from right to left to a single value,
with respect to a given iterator and an initial state.
The given function takes a state and a value, and returns a new state.
The function returns an array of intermediate states.
Aliased asmaprr
Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(state,value)
- state state an initial state of reduction. Defaults to the last value in the list.
Returns:
-
table
an array of states
- include (list, item)
-
Looks for an object in a collection.
Aliased asany
,some
Parameters:
- list table a collection
- item object a value to be searched
Returns:
-
boolean
a boolean : true when found, false otherwise
- detect (list, item)
-
Looks for an object index in a collection.
Aliased asfind
,some
Parameters:
- list table a collection
- item object a value to be searched
Returns:
-
key
the object key or nil
- contains (list, item)
-
Returns true if item is present in the list, false otherwise.
Parameters:
- list table a collection
- item object a value to be searched
Returns:
-
boolean
true if present, otherwise false
- where (list, a)
-
Returns an array of values. Those are values from list containing all key-value pairs listed in
props
.Parameters:
- list table a collection
- a props set of properties
Returns:
-
table
an array of values containing all of the properties found in
props
. - findWhere (list, a)
-
Returns a value. This value should be the first value found in an array containing all key-value pairs listed in
props
.Parameters:
- list table a collection
- a props set of properties
Returns:
-
item
a value from the passed-in list
- select (list, f[, ...])
-
Selects and extracts objects passing an iterator test.
Aliased asfilter
Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
Returns:
-
table
the selected objects
- reject (list, f[, ...])
-
Clones a collection, rejecting objects passing an iterator test.
Aliased asdiscard
Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
Returns:
-
table
the remaining objects
- all (list, f[, ...])
-
Tests if all objects in a collection passes an iterator test.
Aliased asevery
Parameters:
- list table a collection
- f
function
an iterator function, prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
Returns:
-
boolean
true or false
- invoke (list, method[, ...])
-
Invokes a method on each object in a collection.
Parameters:
- list table a collection
- method
function
a function, prototyped as
f(object,...)
- ...
var_arg
Optional extra-args to be passed to function
method
Returns:
-
table
an array of results
- pluck (list, a)
-
Extracts property-values from a collection of objects.
Parameters:
Returns:
-
table
an array of values for the specified property
- max (list[, iter[, ...]])
-
Returns the maximum value in a collection. If an iterator is passed, it will
be used to extract the property value by which all objects will be ranked.
Parameters:
- list table a collection
- iter
function
an iterator function, prototyped as
iter(value,...)
, defaults to identity - ...
var_arg
Optional extra-args to be passed to function
iter
Returns:
-
value
the maximum property value found
- min (list[, iter[, ...]])
-
Returns the minimum value in a collection. If an iterator is passed, it will
be used to extract the property value by which all objects will be ranked.
Parameters:
- list table a collection
- iter
function
an iterator function, prototyped as
iter(value,...)
, defaults to identity - ...
var_arg
Optional extra-args to be passed to function
iter
Returns:
-
value
the minimum property value found
- shuffle (list[, seed])
-
Returns a shuffled copy of a given collection. If a seed is provided, it will
be used to init the random number generator.
Parameters:
- list table a collection
- seed number a seed
Returns:
-
table
a shuffled copy of the given collection
- same (a, b)
-
Tests if two collections are the same. I.e, they feature the same objects, but not
necessarily at the same keys
Parameters:
Returns:
-
boolean
true or false
- sort (list[, comp])
-
Sorts a collection. If a comparison function is given, it will be used to sort objects
Parameters:
- list table a collection
- comp
function
a comparison function prototyped as
comp(a,b)
, defaults to < operator.
Returns:
-
table
the given list, sorted.
- toArray ([...])
-
Converts a list of var_args to a collection.
Parameters:
- ... var_arg Optional variable number of arguments
Returns:
-
table
an array of all passed-in args
- groupBy (list, iter[, ...])
-
Splits a collection into subsets. Each subset feature objects grouped by the result of passing it through an iterator.
If iterator is a string instead of a function, groups by the property named by iterator on each of the values.
Parameters:
- list table a collection
- iter
function
an iterator function, prototyped as
iter(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
iter
Returns:
-
table
a new collection with items grouped by subsets
- countBy (list, iter[, ...])
-
Groups objects in a collection and counts them.
Parameters:
- list table a collection
- iter
function
an iterator function, prototyped as
iter(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
iter
Returns:
-
table
a new collection with subsets names and count
- size ([...])
-
Counts the number of values in a collection. If being passed more than one args
it will return the number of passed-in args.
Parameters:
- ... var_arg Optional variable number of arguments
Returns:
-
number
a size
- containsKeys (list, other)
-
Checks if all the keys of
other
object exists in alist
. It does not compares values. The test is not commutative, i.elist
may contains keys not existing inother
.Parameters:
Returns:
-
boolean
true or false
- sameKeys (listA, listB)
-
Checks if both given lists have the same keys. It does not compares values.
Parameters:
Returns:
-
boolean
true or false
- reverse (array)
-
Reverses values in a given array. The passed-in array should not be sparse.
Parameters:
- array table an array
Returns:
-
table
a copy of the given array, reversed
- selectWhile (array, f[, ...])
-
Collects values from a given array. The passed-in array should not be sparse.
This function collects values as long as they satisfy a given predicate.
Therefore, it returns on the first false test.
Aliased astakeWhile
Parameters:
- array table an array
- f
function
an iterator function prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
Returns:
-
table
a new table containing the first truthy values collected
- dropWhile (array, f[, ...])
-
Collects values from a given array. The passed-in array should not be sparse.
This function collects values as soon as they do not satisfy a given predicate.
Therefore it returns on the first true test.
Aliased asrejectWhile
Parameters:
- array table an array
- f
function
an iterator function prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
Returns:
-
table
a new table containing the first falsy values collected
- sortedIndex (array, the[, comp[, sort]])
-
Returns the index at which a value should be inserted. This returned index is determined so that it maintains the sort.
If a comparison function is passed, it will be used to determine the sort ranking of each
value, including the passed-in value.
Parameters:
- array table an array
- the value value to be inserted
- comp
function
an comparison function prototyped as
f(a,b)
, defaults to < operator - sort boolean whether or not to sort the passed-in array
Returns:
-
index
the index at which the passed-in value should be inserted
- indexOf (array, the)
-
Returns the index of the given value in an array. If the passed-in value exists
more than once in the array, it will return the index of the first occurence.
Parameters:
- array table an array
- the value value to be searched
Returns:
-
index
the index of the passed-in value or nil
- lastIndexOf (array, the)
-
Returns the last occurence index of a given value.
Parameters:
- array table an array
- the value value to be searched
Returns:
-
index
the index of the last occurence of the passed-in value or nil
- add (array, ...)
-
Adds all passed-in values at the top of an array. The latter args will come the
first in the given array.
Parameters:
- array table an array
- ... var_arg a variable number of arguments
Returns:
-
table
the passed-in array
- push (array, ...)
-
Pushes all passed-in values at the end of an array.
Parameters:
- array table an array
- ... var_arg a variable number of arguments
Returns:
-
table
the passed-in array
- pop (array)
-
Removes and returns the value at the top of a given array.
Aliased asshift
Parameters:
- array table an array
Returns:
-
value
the popped value
- unshift (array)
-
Removes and returns the value at the end of a given array.
Parameters:
- array table an array
Returns:
-
value
the popped value
- removeRange (array[, start[, finish]])
-
Trims all values indexed within the range
[start,finish]
.
Aliased asrmRange
Parameters:
- array table an array
- start index the lower bound index, defaults to the first index in the array.
- finish index the upper bound index, defaults to the array length.
Returns:
-
table
the passed-in array
- chunk (array, f[, ...])
-
Iterates over an array chunking together. Values are chunked on the basis of the return
value of
f(key,value,...)
. Consecutive elements which return the same value are chunked together. Leaves the first argument untouched if it is not an array.Parameters:
- array table an array
- f
function
an iterator function prototyped as
f(key,value,...)
- ...
var_arg
Optional extra-args to be passed to function
f
Returns:
-
table
a table of chunks (arrays).
- slice (array[, start[, finish]])
-
Slices values indexed within
[start,finish]
range.Parameters:
- array table an array
- start index the lower bound index, defaults to the first index in the array.
- finish index the upper bound index, defaults to the array length.
Returns:
-
table
a new array
- first (array[, n])
-
Returns the first N values in an array.
Aliased ashead
,take
Parameters:
- array table an array
- n number the number of values to be collected, defaults to 1.
Returns:
-
table
a new array
- initial (array[, n])
-
Returns all values in an array excluding the last N values.
Parameters:
- array table an array
- n number the number of values to be left, defaults to the array length.
Returns:
-
table
a new array
- last (array[, n])
-
Returns the last N values in an array.
Parameters:
- array table an array
- n number the number of values to be collected, defaults to the array length.
Returns:
-
table
a new array
- rest (array[, index])
-
Trims all values before index.
Aliased astail
Parameters:
- array table an array
- index index an index, defaults to 1
Returns:
-
table
a new array
- compact (array)
-
Trims all falsy values.
Parameters:
- array table an array
Returns:
-
table
a new array
- flatten (array[, shallow])
-
Flattens a nested array. Passing
shallow
will only flatten at the first single level.Parameters:
- array table an array
- shallow boolean specifies the flattening depth
Returns:
-
table
a new array, flattened
- difference (array, another)
-
Returns values from an array not present in all passed-in args.
Aliased aswithout
anddiff
Parameters:
Returns:
-
table
a new array
- symmetric_difference (array, array2)
-
Performs a symmetric difference. Returns values from
array
not present inarray2
and also values fromarray2
not present inarray
.
Aliased assymdiff
Parameters:
Returns:
-
table
a new array
- uniq (array[, isSorted[, iter[, ...]]])
-
Produces a duplicate-free version of a given array. Passing
isSorted
will provide a much faster version, but will produce the desired result if the array is properly sorted. Ifiter
is passed, it will be used to compute new values based on a transformation.
Aliased asunique
Parameters:
- array table an array
- isSorted
boolean
whether or not the passed-in array is already sorted, defaults to
false
- iter
function
an iterator function prototyped as
iter(key,value,...)
- ...
var_arg
Optional extra-args to be passed to
iter
function
Returns:
-
table
a new array
- union (...)
-
Returns the duplicate-free union of all passed in arrays.
Parameters:
- ... var_arg a variable number of arrays arguments
Returns:
-
table
a new array
- intersection (array, ...)
-
Returns the intersection of all passed-in arrays.
Each value in the result is present in each of the passed-in arrays.
Parameters:
- array table an array
- ... var_arg a variable number of array arguments
Returns:
-
table
a new array
- zip (...)
-
Merges values of each of the passed-in arrays in subsets.
Only values at the same position in the initial array are merged.
Parameters:
- ... var_arg a variable number of array arguments
Returns:
-
table
a new array
- append (array, other)
-
Clones
array
and appendsother
to the result.Parameters:
Returns:
-
table
a new array
- range (...)
-
Produce a flexible list of numbers. If one positive value is passed, will count from 0 to that value,
with a default step of 1. If two values were passed, will count from the first one to the second one, with the
same default step of 1. A third passed value will be considered a step value.
Aliased as countParameters:
- ... var_arg a variable list of numbers
Returns:
-
table
a new array of numbers
- invert (array)
-
Inverts
key-value
pairs. Keys becomes values, while values becomes keys.
Aliased asmirror
Parameters:
- array table a given array
Returns:
-
table
a new array
- concat (array[, sep[, i[, j]]])
-
Concatenates values in a given array. Handles booleans as well. If
sep
string is passed, it will be used as a separator. Optionali
andj
will only concatenate values within[i,j]
range.
Aliased asjoin
Parameters:
- array table a given array
- sep
string
a separator string, defaults to
''
. - i number the starting index, defaults to 1.
- j number the final index, defaults to the array length.
Returns:
-
string
a string
- identity (value)
-
Returns the passed-in value. Used internally as a default iterator.
Parameters:
- value arg a value
Returns:
-
arg
the passed-in value
- once (f)
-
Returns a version of
f
that runs only once. Successive calls will makef
keep yielding the same answer, no matter what the passed-in arguments are. Can be used to init variables as well.Parameters:
- f function a function
Returns:
-
function
a new function
- memoize (f[, hash])
-
Memoizes a given function by caching the computed result.
Useful for speeding up slow-running functions. If function
hash
is passed, it will be used to compute unique keys from args passed tohash
for results caching.
Aliased ascache
Parameters:
- f function a function
- hash function a hash function, defaults to identity
Returns:
-
function
a new function
- after (f, count)
-
Returns a version of
f
that runs on thecount-th
call. Useful when dealing with asynchronous tasks.Parameters:
- f function a function
- count
number
the number of calls before
f
answers
Returns:
-
function
a new function
- compose (...)
-
Composes functions. Each passed-in function consumes the return value of the function that follows.
In math terms, composing the functions
f
,g
, andh
producesf(g(h(...)))
.Parameters:
- ... var_arg a variable number of functions
Returns:
-
function
a new function
- wrap (f, wrapper)
-
Wraps
f
inside of thewrapper
function. It passesf
as the first argument towrapper
. This allows the wrapper to execute code before and afterf
runs, adjust the arguments, and execute it conditionally.Parameters:
- f
function
a function to be wrapped, prototyped as
f(...)
- wrapper
function
a wrapper function, prototyped as
wrapper(f,...)
Returns:
-
function
a new function
- f
function
a function to be wrapped, prototyped as
- times (n, iter, ...)
-
Runs
iter
functionn
times. Collects the results of each run and returns them in an array.Parameters:
- n
number
the number of times
iter
should be called - iter
function
an iterator function, prototyped as
iter(i,...)
- ...
var_arg
extra-args to be passed to
iter
function
Returns:
-
table
an array of results
- n
number
the number of times
- bind (f, v)
-
Binds
v
to be the first argument to functionf
. As a result, callingf(...)
will result tof(v,...)
.Parameters:
- f function a function
- v arg an argument
Returns:
-
function
a function, prototyped as
f(v,...)
- bindn (f, ...)
-
Binds
...
to be the N-first arguments to functionf
. As a result, callingf(a1,a2,...,aN)
will result tof(...,a1,a2,...,aN)
.Parameters:
- f function a function
- ... var_arg a variable numer of arguments
Returns:
-
function
a function, prototyped as
f(v,...)
- uniqueId ([template[, ...]])
-
Generates a unique Id (unique for the current session). If given a sring template
will use this template for output formatting. Otherwise, if template is a function,
will compute an output running
template(id,...)
.
Aliased asuId
.Parameters:
- template string or function either a string or a function
- ... var_arg a variable numer of arguments to be passed to template , in case it is a function.
Returns:
-
id
a formatted Id
- keys (obj)
-
Returns the names of the object properties.
Parameters:
- obj table an object
Returns:
-
table
an array
- values (obj)
-
Returns the values of the object properties.
Parameters:
- obj table an object
Returns:
-
table
an array
- paired (obj)
-
Returns an array of key-values pairs
Parameters:
- obj table an object
Returns:
-
table
an array
- extend (destObj, ...)
-
Extends an object properties. It copies all of the properties of extra passed-in objects
over to the destination object, and returns the destination object.
The last object in
...
will override properties of the same name in the previous oneParameters:
- destObj table a destination object
- ... var_arg a variable number of array arguments
Returns:
-
table
the destination object extended
- functions (obj)
-
Returns a sorted list of all methods names found in an object. If the given object
has a metatable implementing an
__index
field pointing to another table, will also recurse on this table.
Aliased asmethods
.Parameters:
- obj table an object
Returns:
-
table
an array of methods names
- clone (obj[, shallow])
-
Clones a given object properties. If
shallow
is passed will also clone nested array properties.Parameters:
- obj table an object
- shallow boolean whether or not nested array-properties should be cloned, defaults to false.
Returns:
-
table
a clone of the passed-in object
- tap (obj, f[, ...])
-
Invokes interceptor with the object, and then returns object.
The primary purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
Parameters:
- obj table an object
- f
function
an interceptor function, should be prototyped as
f(obj,...)
- ... vararg Extra-args to be passed to interceptor function
Returns:
-
table
the passed-in object
- has (obj, key)
-
Checks if a given object implements a property.
Parameters:
- obj table an object
- key key a key property to be checked
Returns:
-
boolean
true or false
- pick (obj, ...)
-
Return a filtered copy of the object. The returned object will only have
the whitelisted properties.
Aliased aschoose
.Parameters:
- obj table an object
- ... var_arg a variable number of string keys
Returns:
-
table
the filtered object
- omit (obj, ...)
-
Return a filtered copy of the object. The returned object will not have
the blacklisted properties.
Aliased asdrop
.Parameters:
- obj table an object
- ... var_arg a variable number of string keys
Returns:
-
table
the filtered object
- template (obj, template)
-
Fills nil properties in an object with the given template object. Pre-existing
properties will be preserved.
Aliased asdefaults
.Parameters:
Returns:
-
table
the passed-in object filled
- isEqual (objA, objB[, useMt])
-
Performs an equality test between two objects.
Can compare strings, functions (by reference), nil, booleans. Compares tables by reference or by component-values.
Comparing objects, if
useMt
is passed, the equality operator==
will be used if one of the given objects has a metatable implementingmt.__eq
Parameters:
- objA table an object
- objB table another object
- useMt
boolean
whether or not
mt.__eq
should be used, defaults to false.
Returns:
-
boolean
true or false
- result (obj, method[, ...])
-
Invokes an object method. It passes the object itself as the first argument. if
method
is not callable, will returnobj[method]
.Parameters:
- obj table an object
- method
string
a string key to index in object
obj
. - ...
var_arg
Optional extra-args to be passed to
method
Returns:
-
value
the returned value of
method(obj,...)
call - isTable (t)
-
Checks if the given arg is an object (i.e a Lua table).
Parameters:
- t object a value to be tested
Returns:
-
boolean
true or false
- isCallable (obj)
-
Checks if the given arg is an callable. Assumes
obj
is callable if it is either a function or a table having a metatable implementing__call
metamethod.Parameters:
- obj object an object
Returns:
-
boolean
true or false
- isArray (obj)
-
Checks if the given arg is an array. Assumes
obj
is an array if is a table with integer numbers starting at 1.Parameters:
- obj object an object
Returns:
-
boolean
true or false
- isEmpty (obj)
-
Checks if the given is empty. If
obj
is a string, will return true if#obj==0
. Otherwise, ifobj
is a table, will return whether or not this table is empty.Parameters:
- obj object an object
Returns:
-
boolean
true or false
- isString (obj)
-
Checks if the given arg is a string.
Parameters:
- obj object an object
Returns:
-
boolean
true or false
- isFunction (obj)
-
Checks if the given arg is a function.
Parameters:
- obj object an object
Returns:
-
boolean
true or false
- isNil (obj)
-
Checks if the given arg is nil.
Parameters:
- obj object an object
Returns:
-
boolean
true or false
- isFinite (obj)
-
Checks if the given arg is a finite number.
Parameters:
- obj object a number
Returns:
-
boolean
true or false
- isNumber (obj)
-
Checks if the given arg is a number.
Parameters:
- obj object a number
Returns:
-
boolean
true or false
- isNaN (obj)
-
Checks if the given arg is NaN (see Not-A-Number).
Parameters:
- obj object a number
Returns:
-
boolean
true or false
- isBoolean (obj)
-
Checks if the given arg is a boolean.
Parameters:
- obj object a boolean
Returns:
-
boolean
true or false
- isInteger (obj)
-
Checks if the given arg is an integer.
Parameters:
- obj object a number
Returns:
-
boolean
true or false
- chain (value)
-
Returns a wrapped object. Calling library functions as methods on this object
will continue to return wrapped objects until obj:value is used. Can be aliased as
_(value)
.Parameters:
- value value a value to be wrapped
Returns:
-
object
a wrapped object
- obj:value ()
-
Extracts the value of a wrapped object. Must be called on an chained object (see chain).
Returns:
-
value
the value previously wrapped
- import ([context[, noConflict]])
-
Imports all library functions into a context.
Parameters:
- context
table
a context. Defaults to
_G
(global environment) when not given. - noConflict boolean Skips function import in case its key exists in the given context
Returns:
-
table
the passed-in context
- context
table
a context. Defaults to


A light source positioned directly above the scene, with color fading from
the sky color to the ground color.
This light cannot be used to cast shadows.
const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );
scene.add( light );
[example:webgl_animation_skinning_blending animation / skinning / blending ]
[example:webgl_lights_hemisphere lights / hemisphere ]
[example:misc_controls_pointerlock controls / pointerlock ]
[example:webgl_loader_collada_kinematics loader / collada / kinematics ]
[example:webgl_loader_stl loader / stl ]
[page:Integer skyColor] - (optional) hexadecimal color of the sky. Default
is 0xffffff.
[page:Integer groundColor] - (optional) hexadecimal color of the ground.
Default is 0xffffff.
[page:Float intensity] - (optional) numeric value of the light's
strength/intensity. Default is `1`.
Creates a new [name].
See the base [page:Light Light] class for common properties.
The light's sky color, as passed in the constructor. Default is a new [page:Color] set to white (0xffffff).
The light's ground color, as passed in the constructor. Default is a new [page:Color] set to white (0xffffff).
Read-only flag to check if a given object is of type [name].
This is set equal to [page:Object3D.DEFAULT_UP] (0, 1, 0), so that the light shines from the top down.
See the base [page:Light Light] class for common methods.
Copies the value of [page:.color color], [page:.intensity intensity] and [page:.groundColor groundColor] from the [page:Light source] light into this one.
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]


L ader
Loading
Loading
Loading
L ading
Load ng
Load ng
Loading
Load ng
Load ng
Loading
Loading
×
HTML
Copy
CSS
Copy


Welcome to the cloud marketplace project. We’re building a prototype to explore a new idea: a digital marketplace for Software as a Service (SaaS), built for government technology teams, that goes beyond discovery to procurement. This is a project of the Technology Transformation Service (TTS) Office of Acquisition.


Author's personal copy
BioSystems
109 (2012) 243–
261
Contents
lists
available
at
SciVerse
ScienceDirect
BioSystems
j o u r n a
l
h
o
m e
p a
g
e :
w w w . e l s e v i e r . c o m / l o c a t e / b i o s y s t e m s
Morphogenetic
ﬁelds
in
embryogenesis,
regeneration,
and
cancer:
Non-local
control
of
complex
patterning
Michael
Levin ∗
Department
of
Biology,
and
Center
for
Regenerative
and
Developmental
Biology,
Tufts
University,
200
Boston
Ave.,
Medford,
MA
02155,
USA
a
r
t
i
c
l
e
i
n
f
o
Article
history:
Received
15
March
2012
Received
in
revised
form
12
April
2012
Accepted
12
April
2012
Keywords:
Morphogenesis
Regeneration
Development
Cancer
Embryogenesis
Bioelectricity
a
b
s
t
r
a
c
t
Establishment
of
shape
during
embryonic
development,
and
the
maintenance
of
shape
against
injury
or
tumorigenesis,
requires
constant
coordination
of
cell
behaviors
toward
the
patterning
needs
of
the
host
organism.
Molecular
cell
biology
and
genetics
have
made
great
strides
in
understanding
the
mechanisms
that
regulate
cell
function.
However,
generalized
rational
control
of
shape
is
still
largely
beyond
our
cur-
rent
capabilities.
Signiﬁcant
instructive
signals
function
at
long
range
to
provide
positional
information
and
other
cues
to
regulate
organism-wide
systems
properties
like
anatomical
polarity
and
size
control.
Is
complex
morphogenesis
best
understood
as
the
emergent
property
of
local
cell
interactions,
or
as
the
outcome
of
a
computational
process
that
is
guided
by
a
physically
encoded
map
or
template
of
the
ﬁnal
goal
state?
Here
I
review
recent
data
and
molecular
mechanisms
relevant
to
morphogenetic
ﬁelds:
large-scale
systems
of
physical
properties
that
have
been
proposed
to
store
patterning
information
during
embryogenesis,
regenerative
repair,
and
cancer
suppression
that
ultimately
controls
anatomy.
Placing
special
emphasis
on
the
role
of
endogenous
bioelectric
signals
as
an
important
component
of
the
mor-
phogenetic
ﬁeld,
I
speculate
on
novel
approaches
for
the
computational
modeling
and
control
of
these
ﬁelds
with
applications
to
synthetic
biology,
regenerative
medicine,
and
evolutionary
developmental
biology.
© 2012 Elsevier Ireland Ltd. All rights reserved.
1.
Introduction
and
Scope
“Thus,
beyond
all
questions
of
quantity
there
lie
questions
of
pattern,
which
are
essential
for
the
understanding
of
Nature.”
–
Alfred
North
Whitehead
(1934)
1.1.
A
Question
of
Pattern
Embryonic
development
results
when
a
single
cell
(the
fertilized
egg)
reliably
self-assembles
a
highly
complex
pattern
appropri-
ate
to
its
species.
This
process
is
known
as
morphogenesis—the
establishment
and
creation
of
3-dimensional
anatomy.
During
later
life,
multicellular
creatures
must
maintain
their
pattern—an
active
process
of
morphostasis
that
works
to
maintain
the
whole
while
individual
tissues
age
or
are
removed
by
traumatic
injury.
Some
organisms
replace
large-scale
structures
during
adulthood,
illus-
trating
the
remarkable
plasticity
and
dynamic
control
of
shape
by
biological
systems.
For
example,
salamanders
can
regenerate
eyes,
limbs,
lower
jaws,
hearts,
and
portions
of
the
brain.
The
active
process
of
maintaining
a
complex
morphology
may
likewise
be
relevant
to
suppression
of
cancerous
disorganization
in
favor
of
∗ Tel.:
+1
617
627
6161;
fax:
+1
617
627
6121.
address:
<EMAIL_ADDRESS>cellular
activities
that
are
aligned
within
the
morphological
needs
of
the
host
organism.
A
true
understanding
of
the
signals
underlying
this
process
would
enable
rational
control
of
growth
and
form,
giving
rise
to
regenerative
medicine
applications
that
correct
damage
done
by
birth
defects,
degenerative
disease,
cancer,
traumatic
injury,
and
even
aging.
Similarly,
a
mature
understanding
of
the
origin
and
regulation
of
shape,
including
its
genetic
and
epigenetic
aspects,
would
deepen
our
understanding
of
evolvability
(Gilbert
et
al.,
1996;
Goodwin,
1994)
and
have
untold
beneﬁts
for
the
nascent
ﬁeld
of
synthetic
biology—the
bioengineering
of
functional
artiﬁ-
cial
systems
using
principles
and
building
blocks
abstracted
from
the
biological
world
(Davies,
2008).
Deciphering
and
learning
to
control
shape
is
thus
arguably
the
fundamental
problem
of
biology
and
medicine.
Modern
molecular
cell
biology
and
genetics
have
made
great
strides
in
uncovering
the
mechanisms
guiding
cell
behavior.
However,
major
questions
still
remain
about
the
ways
in
which
the
activities
of
individual
cells
are
orchestrated
and
coordinated
to
result
in
large-scale
pattern
and
its
regulation
(Beloussov,
2010;
Gilbert
and
Sarkar,
2000).
This
review
will
discuss
classical
and
recent
data
bearing
on
the
mor-
phogenetic
ﬁeld
as
a
construct
that
encapsulates
key
properties
of
instructive
growth
and
patterning
control.
Particular
focus
is
placed
on
endogenous
bioelectrical
signals
as
the
physical
embodiment
of
the
morphogenetic
ﬁeld.
0303-2647/$
–
see
front
matter ©
2012 Elsevier Ireland Ltd. All rights reserved.
http://dx.doi.org/10.1016/j.biosystems.2012.04.005


A super fast, persistable, thread safe in-memory cache for iOS and Android.
Check the API documentation for details.
View Docs
com.suparnatural.core.cache


--- layout: post status: publish published: true title: Letter to CXOs author: display_name: Tomas Restrepo login: tomasr email<EMAIL_ADDRESS>url: http://winterdom.com/ author_login: tomasr author_email<EMAIL_ADDRESS>author_url: http://winterdom.com/ wordpress_id: 70 wordpress_url: http://winterdom.com/2006/05/lettertocxos date: '2006-05-09 16:46:03 +0000' date_gmt: '2006-05-09 16:46:03 +0000' categories: - Personal tags: [] comments: [] ---
Just found this post by Pamela Slim called "Open letter to CEOs, COOs, CIOs and CFOs across the corporate world". Had quite a few laughs over it, but I would've laughed harder if I hadn't already witnessed these kind of things in our side of the world happening. Check out also the followup.


Scratch Science
How fast are you?
Measure your reaction time!
Label It!
Build your own quiz to help people learn! Label the parts of a flower, an animal, or whatever you like.


Final Project Style Guide
Normal Colors
Dark Mode Colors
Fonts
I have chosen to use the following fonts for my site:
- Nato Sans
- Noto Serif
Elevator Pitch
Movie theaters have been a staple in communities for years. A few movie theater chains have populated the market but they are all virtually identical. That’s why its time for the movie theater industry to evolve with CinemaCity Now what makes CinemaCity different than other movie theaters? Most movie theaters get revenue from showcasing new movies and while CinemaCity will do this too, We plan on diversifying how we earn money at CinemaCity, mainly by making it easy and common to rent out a movie theater for a private show. Imagine this, you are a fan of movie theaters and love to go there to watch the newest movie. The only problem is that new movies only come out every once in a while, so you don’t feel like going to the theaters unless there’s a new movie playing. What if you could go to the movies more often to rewatch your favorite movie, or to watch the latest episode of your favorite tv show. CinemaCity can even be used to get a group of friends together to watch any sport or event that you want. This way we can bring in casual customers who come to watch a new movie but we can increase how much money we get from more committed customers. CinemaCity is the future of movie theaters.
Purpose Statement
The purpose of the CinemaCity website is to increase revenue. By increasing our online presence, we will be able to reach more customers and consumers and persuade them to pick our movie theater. Ticket sales will increase due to this website Another purpose of the CinemaCity website is to share information with our customers. If our website has details about our services and deals that we offer consumers will have more information about why CinemaCity is the right choice for their movie theater needs; movie ticket and concessions prices will increase as more people visit our website and learn about our company.
Audience Statement
We will have multiple target audience is middle class families. People who work decent jobs and decent hours but need a break and an excuse to get out of the house that will also keep the kids entertained. We will also target teenagers who need an activity to do with their friends. They can come to the movies on weekends when they want to relax. Ultimately these groups are missing one thing; excitement in their lives! Sure, people can watch whatever they want on their phones or TVs but going to the movie theaters is an experience and has a memory attached to the movie they watch.
Misson Statement
The mission of CinemaCity is to provide a location for the community to be entertained. To escape to far off places and learn about great stories with their friends and family all from the comfort of their own community. One of CinemaCity’s top priorities is to provide a safe and comfortable location for people to take a break from the demands of life.  Memories of Friday nights spent with friends all while watching their favorite movie or an afternoon spent with family.
Persona and Scenario Ideas
User Persona
Name: Steve
Age: 24
Motivation: Enjoys movies and wants to watch one on the weekend
Goal: Get a group of friends together to watch a movie
Technology ability: comfortable with using technology
Scenario
-Matt opens the website of CinemaCity to see what movies are playing.
-He finds one he likes and clicks on it to see when the showtimes are.
-Matt finds a time that works for him and clicks on it to reserve a ticket for him and his friends


| DOSE: |
4 hits |
oral |
LSD |
(blotter / tab) |
| |
1 repeated |
smoked |
Cannabis |
|
June 3, 2007
As I write this I feel somewhat disillusioned as to what the core nature of reality and existence really is. Will it ever truly be explained? Should it be explained? Life, god, purpose, all these things come to mind when thinking of my experience this drug, and my condition forever afterward. I first took this drug at a party at my house at the beginning of 2007. I was bored and there was nothing to do, so when somebody asked “hey you wanna try some LSD?” naturally I said “yes, yes of course I do.” I had never tried acid before in my life and didn’t know what was in store for me on this night of all nights. The night the universe tore itself apart, and reality ceased to be.
All I had to go on was what I had heard from friends and what I had seen in movies. Fear and Loathing in Las Vegas, is a good example. I bought four hits for seven bucks each and took them all at once. The first few minutes I remember looking up at my digital clock display and wondering how long until it would kick in. Every minute brought along a fierce and sudden increase in the intensity of the drug. There were a lot of people around and things were happening that I wasn’t sure of. At first it seemed the world had turned into a scene from The Nightmare Before Christmas. Then someone came to the party with a bottle of vodka, I wasn’t in the state of mind to refuse alcohol so I ended up drinking half the bottle without hesitation.
As the booze went into effect I lost coherency and a grip on reality. I think I blacked out the whole night. I was told the next day that I was running around the house without my shirt on, yelling colors and names at people and babbling incoherently and occasionally falling asleep. At one point I remember being given a cooked chicken strip and throwing it on the ground because I thought it was turning into part of my hand. I also remember sitting on my couch and looking off into the distance and hearing helicopters and police sirens and seeing evening horizon colors: it was much like a glitch that happens in the Grand Theft Auto videogame series in which the player falls through part of the ground and is floating in an alternate world made of only sky and horizon, yet you can still hear the cops and helicopters chasing you around. The last thing I remember was tearing my shirt off and being scared because my body shape had changed and the hair on my chest was gone.
Early the next morning I remember not waking, but coming down enough to realize what was happening. I was screaming for my brother to save me. Then I was thrashing around in my bed trying to puke and basically going out of my mind. I saw an alternate reality in which I was an old sick pervert who preyed on young girls; everything was dark except for blue flashes of lightning, much like a scene from a David Lynch movie. Then I remembered something my friend told me: just breathe, relax, breathe deep and slowly. So that’s what I did and it worked. Then the trip was more easy to handle. I saw palm trees all around me and could hear the beating of drums I could hear the sounds of a beach shore line. I then saw a blue glowing apparition of the god Shiva smiling down on me. Then I felt like I was climbing out of a cave made of pillows and blankets. I opened my eyes and saw my glowing alarm clock and it turned into many clocks, melting like a Salvador Dhali painting.
I slowly came down little by little. By the time the sun started to rise I thought I was dead or in a coma, I thought the ambulance noises I heard were real and that maybe I was at the hospital in a bed with my family waiting for me to wake up. I walked around the house wondering if what I was seeing was a construct of my imagination. I sat down on a couch next to a sleeping friend and watched his body morph into a skeleton. I looked up at the time to see if it was constant. It was, except it seemed to be running faster than usual. It felt as if I was god and [not that I wanted to be] the universe was repairing itself for me. I felt like if I was in an elaborate program designed to simulate life, and I had broken or caused a glitch in the program by taking the acid. The next day everything was near normalcy again except that the colors seemed more vibrant and television programs had little differences caused by hallucinations.
Ok now fast forward about three months. After a long time of being restless and generally bored again I felt like a little medicine was in store for me. It was in the cards, so to speak.  The next day I received a good amount of marijuana and smoked it all day and most of the night. I had some spliffs, some kief, and a buttload of doobies. A lot of smoke, but still nothing wrong until… the next day, Sunday now.
The night before I started feeling funny and had to go to sleep. I woke up feeling really out of it, almost like I had been doing acid. I didn’t think much of it and decided to smoke some more weed. I actually thought the weed would help, maybe to numb out the fear and paranoia of a bad episode. After the first few hits a felt worse than ever, I tried to sleep it off. Things became progressively more and more intense.
Whenever I would close my eyes I could see millions of little lights floating around at high speed. They were Red, Yellow, and Blue in color. I guess since those are the very basic colors, they seemed very important at the time. I saw the face of God represented by the millions of colorful lights. Next things got freaky, I started seeing dead relatives and historical figures back from the afterlife coming in through my walls trying to communicate with me. Every few minutes I would endure some new type of horrific torture. I have been shot, stabbed, electrocuted, suffocated, crushed, frozen, burned, hung by a noose, stoned by rocks, and drowned. I have spoken to Shiva, Rasputin, Jesus Christ, Adolf Hitler, Bob Marley, Che Guevara, Ghandi, Hunter S. Thompson and Leonardo DaVinci among others.
At one point I thought I was Benjamin Franklin and that the electrical socket was the source of lightning and that I would be struck by lightning. I saw myself on my death bed, I saw myself being born, I saw all of my past lives and my future lives. I felt as though I had died, or as if in some past life I had let a son or daughter of mine die. I cried so hard and screamed in agony for the loss of life. Then I would scream in anger at myself. Sometimes I would laugh maniacally for the righteous truths which I had been revealed. Toward the end I was gripping on to songs and television programs and movies which agreed with what I was going through to help understand what was happening. I saw the resurrection of the Messiah, I saw the end of time itself.
My younger brother had to look after me to make sure I didn’t hurt myself or anyone else. Several times I would see cuts forming on my fingers and blood spilling out and I could feel the pain so clearly that I thought it was real, I felt like it wouldn’t make a difference if I actually did slit my wrists or electrocuted myself just to end the pain and the insanity. Eventually my parents returned home from their trip, they had gone on another weekend trip, and when they arrived and saw me in this state they were shocked and alarmed. The ambulance was called and I ended up in the emergency room at the hospital.
After talking to some doctors and my own personal assessment I am pretty confident that the marijuana triggered the psychosis, or “flashback.” I am a psychiatric patient, and had been told many times before to beware of marijuana. Never in my life had I experienced a bad trip from marijuana, but with the added bonus of LSD everything changed. I can no longer use any drug whatsoever, I can’t use money, and I am constantly being watched to make sure it doesn’t happen again. My life may never be the same. What was once an exquisite escape by means of marijuana has turned into a dangerous maneuver thanks to LSD. I don’t recommend it to anyone especially those with psychological problems.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Reset
Please enter email address to reset password
Reset
{{this.time}}s
Reset
A confirmation email has been sent to your email
({{this.is_email}})
.Please confirm it.
Confirm


About Me
Hi! I’m Chelsea Nicholls and I am currently a student at the University of Birmingham Full-Stack Web Development Coding Bootcamp. I will be graduating in August 2021 with an excellent understanding of both front-end and back-end web development. I currently have a proficient knowledge in HTML and CSS and by the end of the course will have an in-depth understanding of JavaScript and the MERN stack.
I graduated from University with a degree in Forensic Psychology and had realised that it was not the field that I wanted to go into. I had really enjoyed the data analysis and problem-solving side of the degree and I decided I wanted a more technical career. Fast forward to the start of the pandemic and I found an online course which taught the basics of HTML, CSS and JavaScript. I immediately fell in love and knew this was the career path for me. I love that web development is a field that is always expanding and there is always something new to learn. I plan to continue to expand my knowledge of varying languages after I have completed the bootcamp.
I have a variety of other interests including cooking, walking and anything true crime related – podcasts, documentaries, YouTube videos! I love to travel and explore new places, meet new people and embrace new cultures.
Contact Me
Front-End Projects
Sights & Sounds
Sights & Sounds allows you to easily find events and venues, based on your selected location. You can then save the ones you are interested in to your wishlist and - Voila! Your weekend plans are already looking a lot more exciting! Created using HTML, CSS, JavaScript and jQuery and gathering information from Foursquare Places API and Ticketmaster API.
Code Quiz
A challenging quiz to test your knowledge of code! Dynamically rendered HTML displays each question after the previous question has been answered. Created with HTML, CSS and JavaScript.
Back-End Projects
Codemon
A full stack tech blog where users can sign up, log in and create posts, comment on others posts and edit and delete their own contributions. Created with HTML, CSS, JavaScript, jQuery, Handlebars, Express, Node.js, Sequelize and Bootstrap.
 DishUp provides users the ability to easily search for food, using a range of possible filters for dietary requirements and intolerances. These meals can be saved to meal plans on the user profile, so they can be easily referred back to in the future. Created with HTML, CSS, JavaScript, jQuery, Handlebars, Express, Node.js, Sequelize and Bootstrap.


Search spaces in NASLib¶
Neural Architecure Search consists of 3 building blocks: - Search space (cell, hierarchical, …) - Optimization - Evaluation
Here we will conver the first part: Search spaces.
This is not a general instruction on seach spaces but rather a walk-through how they are realized in NASLib. Therefore it is also not indeted to execute this notebook but rather see it as a extensive comment why whay is happening where.
This will be done using the implementation of the darts search space. The complete file is in naslib/search_spaces/darts/graph.py
.
DARTS Search space definition¶
[1]:
class DartsSearchSpace(Graph):
OPTIMIZER_SCOPE = [
"n_stage_1",
"n_stage_2",
"n_stage_3",
"r_stage_1",
"r_stage_2",
]
QUERYABLE = False
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-02ee2b8882ee> in <module>
----> 1 class DartsSearchSpace(Graph):
2
3 OPTIMIZER_SCOPE = [
4 "n_stage_1",
5 "n_stage_2",
NameError: name 'Graph' is not defined
NASLib uses the concept of scopes
to differentiate instances of the same graph. For example in darts we have one reduction cell, that is used at three stages of the macro graph. To be able to properly set the channels at each stage, we give each copy a different scope later.
The scopes in OPTIMIZER_SCOPE
are later used by optimizers to determine which graphs they can manipulate to perform the search. E.g. this does usually not include the macro graph but all cells.
The flag QUERYABLE indicates if there is an interface to one of the tabular NAS benchmarks which could be used to query achitecture metrics such as train accuracy or inference time. The available metrics are defined in search_spaces/core/query_metrics
and implemented in the function query()
below.
[2]:
def __init__(self):
super().__init__()
self.channels = [16, 32, 64]
self.num_classes = self.NUM_CLASSES if hasattr(self, 'NUM_CLASSES') else 10
__init__
cannot take any parameters due to the way networkx
is implemented. If we want to change the number of classes set a static attribute NUM_CLASSES
before initializing the class. Default is 10 as for cifar-10.
the channels are used later when setting the primitive operations at the cell edges.
[3]:
# Normal cell first
normal_cell = Graph()
normal_cell.name = "normal_cell" # Use the same name for all cells with shared attributes
# Input nodes
normal_cell.add_node(1)
normal_cell.add_node(2)
# Intermediate nodes
normal_cell.add_node(3)
normal_cell.add_node(4)
normal_cell.add_node(5)
normal_cell.add_node(6)
# Output node
normal_cell.add_node(7)
# Edges
normal_cell.add_edges_from([(1, i) for i in range(3, 7)]) # input 1
normal_cell.add_edges_from([(2, i) for i in range(3, 7)]) # input 2
normal_cell.add_edges_from([(3, 4), (3, 5), (3, 6)])
normal_cell.add_edges_from([(4, 5), (4, 6)])
normal_cell.add_edges_from([(5, 6)])
# Edges connecting to the output are always the identity
normal_cell.add_edges_from([(i, 7, EdgeData().finalize()) for i in range(3, 7)]) # output
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-829f4c346cc8> in <module>
1 # Normal cell first
----> 2 normal_cell = Graph()
3 normal_cell.name = "normal_cell" # Use the same name for all cells with shared attributes
4
5 # Input nodes
NameError: name 'Graph' is not defined
We use the API from networkx to create nodes and edges. The connectivity follows the definition from the darts paper. Note that the node indices must be integers and start with 1.
At each edge sits an EdgeData
object. This is used to store informations at the edge, e.g. the op
which is used when passing data from node to node. It can be finalized to avoid later manipulation. This is required to the edges connecting to the output nodes in darts, as they are set constant to the Identity operation (skip connection) and will not be part of the architecture search.
Up to this point, the op at the edges is set to Identity
(definition in search_spaces/core/primitives.py
). The combine operation (comb_op
) at nodes is set to sum
by default. This can be changed later.
[4]:
# Reduction cell has the same topology
reduction_cell = deepcopy(normal_cell)
reduction_cell.name = "reduction_cell"
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-4-ffbec2ad55dc> in <module>
1 # Reduction cell has the same topology
----> 2 reduction_cell = deepcopy(normal_cell)
3 reduction_cell.name = "reduction_cell"
NameError: name 'deepcopy' is not defined
As the reduction cell and the normal cell share the topology, we can just deepcopy them. Make sure to set a unique name for unique graphs, as NASLib uses the name (amongst others) to differentiate between copys of the same graph and copies of other graphs.
[5]:
#
# Makrograph definition
#
self.name = "makrograph"
self.add_node(1) # input node
self.add_node(2) # preprocessing
self.add_node(3, subgraph=normal_cell.set_scope("n_stage_1").set_input([2, 2]))
self.add_node(4, subgraph=normal_cell.copy().set_scope("n_stage_1").set_input([2, 3]))
self.add_node(5, subgraph=reduction_cell.set_scope("r_stage_1").set_input([3, 4]))
self.add_node(6, subgraph=normal_cell.copy().set_scope("n_stage_2").set_input([4, 5]))
self.add_node(7, subgraph=normal_cell.copy().set_scope("n_stage_2").set_input([5, 6]))
self.add_node(8, subgraph=reduction_cell.copy().set_scope("r_stage_2").set_input([6, 7]))
self.add_node(9, subgraph=normal_cell.copy().set_scope("n_stage_3").set_input([7, 8]))
self.add_node(10, subgraph=normal_cell.copy().set_scope("n_stage_3").set_input([8, 9]))
self.add_node(11) # output
self.add_edges_from([(i, i+1) for i in range(1, 11)])
self.add_edges_from([(i, i+2) for i in range(2, 9)])
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-5-98a98a29019c> in <module>
2 # Makrograph definition
3 #
----> 4 self.name = "makrograph"
5
6 self.add_node(1) # input node
NameError: name 'self' is not defined
Here happen several things. Graphs can be at nodes (were they are conceptually similar to the combine operation) or at edges. In the darts search space they sit only at nodes, in other search spaces they sit at the edges.
When they sit at nodes, they have to be set as subgraph
. copy()
creates a somewhat shallow copy of the graph. This I explain later. set_scope()
set the scope for the graph and if specified also for all child graphs as graphs can be nested. set_input()
is used to route the input from the incoming edges at the node to the input node of the subgraph. E.g. in case of macro node 5, the input to its subgraph will come from macro node 3 and 4. This is also the order in which the input
will be assigned to the input nodes of the subgraph. In case of macro node 3, the two inputs are defines as [2, 2]
. This is a hacky way to dublicate the output of macro node 2 although there is only one edge. The input will be dublicated in that case.
[6]:
#
# Operations at the makrograph edges
#
self.num_in_edges = 4
reduction_cell_indices = [5, 8]
channel_map_from, channel_map_to = channel_maps(reduction_cell_indices, max_index=11)
self._set_makrograph_ops(channel_map_from, channel_map_to, max_index=11, affine=False)
self._set_cell_ops(reduction_cell_indices)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-6-a3bdc157193c> in <module>
2 # Operations at the makrograph edges
3 #
----> 4 self.num_in_edges = 4
5 reduction_cell_indices = [5, 8]
6
NameError: name 'self' is not defined
Now we are ready to set the primitives at the cell edges and the operations required for the macro graph edges. This could not be done earlier because currently the primitives have to created with the correct number of channels. And this changes for each stage.
channel_maps
is just a function to get two dics which contain the corrent index of self.channels
for every macro graph node.
Now we’ll look at the other functions.
[7]:
def _set_makrograph_ops(self, channel_map_from, channel_map_to, max_index, affine=True):
# pre-processing
# In darts there is a hardcoded multiplier of 3 for the output of the stem
stem_multiplier = 3
self.edges[1, 2].set('op', ops.Stem(self.channels[0] * stem_multiplier))
# edges connecting cells
for u, v, data in sorted(self.edges(data=True)):
if u > 1 and v < max_index:
C_in = self.channels[channel_map_from[u]]
C_out = self.channels[channel_map_to[v]]
if C_in == C_out:
C_in = C_in * stem_multiplier if u == 2 else C_in * self.num_in_edges # handle Stem
data.set('op', ops.ReLUConvBN(C_in, C_out, kernel_size=1, affine=affine))
else:
data.set('op', FactorizedReduce(C_in * self.num_in_edges, C_out, affine=affine))
# post-processing
_, _, data = sorted(self.edges(data=True))[-1]
data.set('op', ops.Sequential(
nn.AdaptiveAvgPool2d(1),
nn.Flatten(),
nn.Linear(self.channels[-1] * self.num_in_edges, self.num_classes))
)
This function set the operation at the macro graph edges, as in darts they are not Identity but are used to do some pre-procesing of the output of the previous nodes.
The output of the Stem is multiplied with 3 as it is in the darts code.
There are two ways to set attributes at edges in NASLib. The first one is to directly access the edge via networkx api. This is done here for setting the stem in set('op', ops.Stem(), shared=False)
where 'op'
is the name of the attribute and ops.Stem()
its value. This is similar to a dict, but can later be accessed also as an attribute of the edge like edges[1, 2].op
.
The advantage of this method is it is easy. The disatvantage is it is not recursive, i.e. it must be done manually for each copy of the graph in case of a private attribute.
Private attributes of edges are not shared between copies of the graph, i.e. they are deepcopied when creating copies of a graph. If we set shared=True
in set()
, then the attribute is shared. This means the attribute will be added for the edge at each copy of the graph as a shallow copy.
The same is done for reduction cells in the next section. Because darts does concatenate the output of the intermediate nodes at the last output node of the cells, the output dimension of each cell is 4 times the channel. This is considered here: else C_in * self.num_in_edges
. How we actually set the combine op in this node is shown in the next code snipped.
The postprocessing at the last edge (connecting to the output node of the macro graph) is set the same way.
[8]:
def _set_cell_ops(self, reduction_cell_indices):
# normal cells
stages = ["n_stage_1", "n_stage_2", "n_stage_3"]
for scope, c in zip(stages, self.channels):
self.update_edges(
update_func=lambda current_edge_data: _set_cell_ops(current_edge_data, c, stride=1),
scope=scope,
private_edge_data=True
)
# reduction cells
# stride=2 is only for some edges, that's why we have to do it this way
for n, c in zip(reduction_cell_indices, self.channels[1:]):
reduction_cell = self.nodes[n]['subgraph']
for u, v, data in reduction_cell.edges.data():
stride = 2 if u in (1, 2) else 1
if not data.is_final():
reduction_cell.edges[u, v].update(_set_cell_ops(data, c, stride))
#
# Combining operations
#
for _, cell in sorted(self.nodes('subgraph')):
if cell:
cell.nodes[7]['comb_op'] = channel_concat
Here we are setting the primitives for all cells which are in the macro graph.
In order to not do this manually for each cell (op
must be private, otherwise its weights are shared), NASLib provides an api for that. It is graph.update_edges(update_func, scope, private_edge_data)
.
update_func
is a function provided by the user. It is applied to every edge for every graph in the scope. Only if the edge is flagged as final,update_func
is not applied.scope
is a string or a list of strings which must match the scope defined at the graphs we want to update.private_edge_data
specifies whether the function given asupdate_func
is going to add/change private attributes or shared ones. This is needed in order to not set the same attribute multiple times (shallow copy, mentioned above).
We had to wait with setting the primitives at the cells because they require the number of channels they expect (amongst others possibly). Now that we have placed all cells correctly we can update them using their scope. Here we use the function _set_cell_ops
which is presented in the next snipped (bottom of the file).
Unfortunately, we cannot use the same logic for the reduction cells. This is because by definition of the reduction cell, stride=2
is only set on edges connecting input and intermediate nodes. We plan to add functionality to handle this case also via update_edges()
, stay tuned.
Last but not least we set the combine operation as cannel_concat
for each cell. As this is not channel dependent, we could have also done it earlier, when defining the cell. However, if comb_op
is channel dependent, this is currently the way to go. This could also be done using update_nodes()
, which we will see later.
[9]:
def _set_cell_ops(current_edge_data, C, stride):
C_in = C if stride==1 else C//2
current_edge_data.set('op', [
ops.Identity() if stride==1 else FactorizedReduce(C_in, C, affine=False),
ops.Zero(stride=stride),
ops.MaxPool1x1(3, stride, C_in, C, affine=False),
ops.AvgPool1x1(3, stride, C_in, C, affine=False),
ops.SepConv(C_in, C, kernel_size=3, stride=stride, padding=1, affine=False),
ops.SepConv(C_in, C, kernel_size=5, stride=stride, padding=2, affine=False),
ops.DilConv(C_in, C, kernel_size=3, stride=stride, padding=2, dilation=2, affine=False),
ops.DilConv(C_in, C, kernel_size=5, stride=stride, padding=4, dilation=2, affine=False),
])
Pretty straight-forward.
Hooks¶
Now that we have the search space defined, one could think we are ready to go. And technically we are. We can use this search space, give it an optimizer and, boom, get the result.
But unfortunatly we are not. This is due to the fact that for evaluation we are not quite using that search space. Insead we change it, to get better performance, meet the restrictions of previous work or other reasons.
This is why NASLib offerst hooks to handle these cases.
Prepare discretization¶
[10]:
def prepare_discretization(self):
self.update_nodes(_truncate_input_edges, scope=self.OPTIMIZER_SCOPE, single_instances=True)
In darts some things are done, before the architecture can be discretized, i.e. determine exactly one op for each edge (and not e.g. a list, as it was defined above). First thing is that input edges are truncated to two incoming edges for each intermediate node for each cell. Second, the Zero op can never be picked for discretization.
This is done in the next snippet using the NASLib function update_nodes
which works in a similar fashion as update_edges
but is much more powerfull.
[11]:
def _truncate_input_edges(node, in_edges, out_edges):
k = 2
if len(in_edges) >= k:
if any(e.has('alpha') or e.is_final() for _, e in in_edges):
# We are in the one-shot case
for _, data in in_edges:
if data.is_final():
return # We are looking at an out node
data.alpha[1] = -float("Inf") # Zero op should never be max alpha
sorted_edge_ids = sorted(in_edges, key=lambda x: max(x[1].alpha), reverse=True)
keep_edges, _ = zip(*sorted_edge_ids[:k])
for edge_id, edge_data in in_edges:
if edge_id not in keep_edges:
edge_data.delete()
else:
# We are in the discrete case (e.g. random search)
for _, data in in_edges:
assert isinstance(data.op, list)
data.op.pop(1) # Remove the zero op
if any(e.has('final') and e.final for _, e in in_edges):
return
else:
for _ in range(len(in_edges) - k):
in_edges[random.randint(0, len(in_edges)-1)][1].delete()
The function given to update_nodes
must accept three parameters: node
, in_edges
, and out_edges
. - node
is a tuple (int, dict) containing the index and the attributes of the current node. - in_edges
is a list of tuples with the index of the tail of the edge and its EdgeData. - `out_edges is a list of tuples with the index of the head of the edge and its EdgeData.
Prepare evaluation¶
The second hook is a way to change the optimal discrete architecture before running the evaluation on it, i.e. deteriminig the final performance of that architecture. In DARTS, this is used to expand the macro graph to 6 cells at each stage instead of only two, and increase the channels by a factor of 2.25.
[12]:
def prepare_evaluation(self):
self._expand()
# Operations at the edges
self.channels = [36, 72, 144]
reduction_cell_indices = [9, 16]
channel_map_from, channel_map_to = channel_maps(reduction_cell_indices, max_index=23)
self._set_makrograph_ops(channel_map_from, channel_map_to, max_index=23, affine=True)
# Taken from DARTS implementation
# assuming input size 8x8
self.edges[22, 23].set('op', ops.Sequential(
nn.ReLU(inplace=True),
nn.AvgPool2d(5, stride=3, padding=0, count_include_pad=False), # image size = 2 x 2
nn.Conv2d(self.channels[-1] * self.num_in_edges, 128, 1, bias=False),
nn.BatchNorm2d(128),
nn.ReLU(inplace=True),
nn.Conv2d(128, 768, 2, bias=False),
nn.BatchNorm2d(768),
nn.ReLU(inplace=True),
nn.Flatten(),
nn.Linear(768, self.num_classes))
)
self.update_edges(
update_func=_double_channels,
scope=self.OPTIMIZER_SCOPE,
private_edge_data=True
)
prepare_evaluation()
is always called after the graph was discretized. Here we first expand the graph (see next snippet), then again set the macro graph operations as described already above.
The evalutaion in darts is performed using auxiliary towers (adding a second loss to some intermediate output of the network). This is what is set at the edge (22, 23).
Last but not least, we double (a little more actually) the channels for each primitive at each edge in the scope (see snippet after the next one).
[13]:
def _expand(self):
# shift the node indices to make space for 4 more nodes at each stage
# and the auxiliary logits
mapping = {
5: 9,
6: 10,
7: 11,
8: 16,
9: 17,
10: 18,
11: 24, # 23 is auxiliary
}
nx.relabel_nodes(self, mapping, copy=False)
# fix edges
self.remove_edges_from(list(self.edges()))
self.add_edges_from([(i, i+1) for i in range(1, 22)])
self.add_edges_from([(i, i+2) for i in range(2, 21)])
self.add_edge(22, 23) # auxiliary output
self.add_edge(22, 24) # final output
to_insert = [] + list(range(5, 9)) + list(range(12, 16)) + list(range(19, 23))
for i in to_insert:
normal_cell = self.nodes[i-1]['subgraph']
self.add_node(i, subgraph=normal_cell.copy().set_scope(normal_cell.scope).set_input([i-2, i-1]))
for i, cell in sorted(self.nodes(data='subgraph')):
if cell:
if i == 3:
cell.input_node_idxs = [2, 2]
else:
cell.input_node_idxs = [i-2, i-1]
We use again networkx functionality to expand the graph and make space for additional cells at each stage. Because of that we have to reset the edges. Then we can add the nodes in the gaps using the free indices and set their input indices as described above for the search space.
[14]:
def _double_channels(current_edge_data):
init_params = current_edge_data.op.init_params
if 'C_in' in init_params:
init_params['C_in'] = int(init_params['C_in'] * 2.25)
if 'C_out' in init_params:
init_params['C_out'] = int(init_params['C_out'] * 2.25)
if 'affine' in init_params:
init_params['affine'] = True
current_edge_data.set('op', current_edge_data.op.__class__(**init_params))
Unfortunately, in NASLib we cannot use native torch.nn.Module
as operations. This is because of several reasons: - We need to make sure, that we find any subgraphs nested in an op, as it is the case for the hierarchical search space. - We might need to change some attributes of the op which were stored there earlier (this is the case here) - We might need a dedicated name for each op in care we want to make use of tabular benchmarks and query the performance of an architecture.
More than one output¶
If the model should be trained with an auxiliary head for evaluation, this head must be added to the architecture. The way this is currently done is by adding an intermediate output to the macro graph (the output from node 23).
This is required because when passing data through the graph logits = awesome_architecture(x)
NASLib is only returning the output of the last node. However, for auxiliary towers (and maybe other applications of NAS) we actually need more than one output. These potential outputs are stored at the graph dictionary as out_from_
followed by the node index. For auxiliary towers, this is realizes defining an additional function auxiliary_logits
in this case, which returns this intermediate
output and allows the evaluation pipeline to handle it accordingly.
[15]:
def auxilary_logits(self):
return self.graph['out_from_23']
Querying¶
NASLib offers an interface to tabular benchmarks like Nas-Bench 201.
The optimizer or evaluation pipeline can access performance metrics via awesome_architecture.query(metric, dataset)
. All possible metrics are defined in search_spaces/core/query_metrics.py
and listed in the next snippet. The dataset is the datset string which is privided by the tabular benchmark.
[16]:
def query(self, metric=None, dataset=None):
# nasbench 301 query logic
File "<ipython-input-16-b626a3389080>", line 2
# nasbench 301 query logic
^
SyntaxError: unexpected EOF while parsing


Sign In
History
Recent
Register
Home
Owner Register
Email:
Username:
Password:
Confirm Password:
First Name:
Last Name:
Steet Address:
City:
State:
Zip Code:
Country:
Contact Us
About Us
Sign In


Conway's Game of Life
Muttaqee
Controls
Start
Stop
Step
Randomize
Reset
Randomize density:
0.5
Step interval (ms):
500
Grid Settings
Size:
20
Edge evaluation
Dead
Live
Toroidal
Neighbor Rules
Radius:
1
Loneliness threshold:
2
Overpopulation threshold:
3
Generation minimum:
3
Generation maximum:
3


Minimax with Alpha Beta Pruning Chess AI
Restart
Select Difficulty:
Normal
Hard
Super Hard
Super Duper Hard
Note: You have to press the button after selecting the difficulty
Update Difficulty
Current Difficulty: Hard
Status:


{% extends "base.html" %} {% load compress i18n %} {% block meta_title %} {% trans "Privacy Policy" %} {% endblock %} {% block content %}
Maintaining your trust and confidence is one of our highest priorities. We respect your right to keep your personal information confidential and understand your desire to avoid unwanted solicitations. A recent law change requires us (along with banks, brokerage houses, and other financial institutions) to disclose our Privacy Policy to you – which we are more than happy to do. We hope that by taking a few minutes to read it, you will have a better understanding of what we do with the information you provide us and how we keep it private and secure.
We collect certain personal information about you – but only when that information is provided by you or is obtained by us with your authorization. We use that information to prepare your personal income tax returns and may also provide various tax and financial planning services to you at your request.
Examples of sources from which we collect information include:
As a general rule, we do not disclose personal information about our clients or former clients to anyone. However, to the extent permitted by law and any applicable state Code of Professional Conduct, certain nonpublic information about you may be disclosed in the following situations:
Except as otherwise described in this notice, we restrict access to nonpublic personal information about you to employees of our firm and other parties who must use that information to provide services to you. Their right to further disclose and use the information is limited by the policies of out firm, applicable law, our Code of Professional Conduct, and nondisclosure agreements where appropriate. We also maintain physical, electronic, and procedural safeguards in compliance with applicable laws and regulations to guard your personal information from unauthorized access, alteration, or premature destruction.
Thank you for allowing us to serve your accounting, tax, and financial planning needs.  We hope you view our firm as your most trusted advisor and we will work to continue earning your trust. Please call us if you have any questions or if we can be of further service.


Double-O Bike Light Review
I backed the Double-O bike light Kickstarter project and use them for a while now. This is my verdict:
TL:TR Highly functional light with clever features, some teething problems
If you like to ride through the unlit woods at night, Double-O isn't for you, but that would.
It is a commuter light with a rather clever design.
The rubber band to fix the light at the bike works and it more efficient to produce, but the magnet solution has a way bigger cool factor. Also: When there's no pipe (read saddle stem) available or you want to fix it at your pannier rack, the rubber isn't the best fit. Eventually Double-O might release the fixtures design files, so I can print one for my purpose.
I haven't found a solution, but I'm contemplating using a rubber ring around battery and latch or hold the pieces in place using a little dense sponge rubber.
TL:TR Highly functional light with clever features, some teething problems
If you like to ride through the unlit woods at night, Double-O isn't for you, but that would.
It is a commuter light with a rather clever design.
The Good
- It is huge.  That alone improves visibility quite a bit.
- Two of the 3 light modes are what you would expect: blinking and steady. The third one I haven't seen elsewhere: the odd and even numbered LED blink alternate. This is quite clever. Someone looking at it (that's: the other traffic participants) sees something moving, creating similar attention as blinking, but for the rider it is a steady light since the same number of LED is on at any given time.
- The case is sturdy and the threaded cover that you use to screw it open and close (to change batteries) reliably keeps moisture out (trust me, my environment has plenty of that
- The rubber band mechanism and the rubberised back making fixing the light at a handlebar or a seat stem very fast and reliable. My package even included a set of spare rubbers
- Locking the lights with your bike lock works as advertised (but someone could steal the batteries if they get what it hanging there)
- The low power LED lights make the batteries last quite long
The Bad
The original specifications proposed to use USB chargable fixed batteries and a magnetic fix for the light. The rechargable option was abandoned in favour of longer lasting standard batteries (and rechargeable battery in the Kickstarter delivery). While I generally understand the design decision for a general market offering, I would have found USB charging suiting my personal style (I'm used to have a zoo to be charged after my rides: The Garmin, the Bluetooth entertainment, the phone and the helmet).The rubber band to fix the light at the bike works and it more efficient to produce, but the magnet solution has a way bigger cool factor. Also: When there's no pipe (read saddle stem) available or you want to fix it at your pannier rack, the rubber isn't the best fit. Eventually Double-O might release the fixtures design files, so I can print one for my purpose.
The Ugly
The battery holding mechanism (see the picture above) is flimsy. For a hipster ride that might be sufficient, but in a little rugged environment where I ride (kerbstone jumps, potholes, very uneven surface, the occasional trail) the vibrations make the batteries move, in my case even to the extend of bending the electrical contract latches. The batteries loose contact and the light goes off (or won't switch on).I haven't found a solution, but I'm contemplating using a rubber ring around battery and latch or hold the pieces in place using a little dense sponge rubber.
Posted by Stephan H Wissel on 10 January 2015 | Comments (2) | categories: After hours Cycling


{% extends "layout.html" %} {% block page_title %} Choose your card type - Payment - Anti-money laundering registration - GOV.UK {% endblock %} {% block content %} {% include "includes/phase_banner_research.html" %} Choose your card type This section is: Payment Choose your card type Visa debit Mastercard debit Visa Mastercard {% endblock %}
This section is: Payment


Form validation
Username (required)
Email
ZIP code
Your age (required, min. 14)
Password (required)
(see
here
other password patterns.)
Retype password
Message
This is your message
I accept the terms and conditions (required)
Alpha
Alpha Num
Alpha Dash
Regex
Not Regex
URL
File
Date
After Date
After or Equal Date
Before Date
Before or Equal Date
Date Equals
Between
Different 1
Different 2
Same 1
Same 2
Ends With
Starts With
GT1
GT2
GT3
LT1
LT2
LT3
In (Status)
Not In (Animal)
Conditional
Yes
No
Required If Conditional = Yes
Required Unless Conditional = No
Required with Conditional 1
Required with Conditional 2
Required with Conditional 3
Required with 1,2,3
Required with all 1,2,3
Required without 1,2,3
Required without all 1,2,3


The BubbleTree can be used to display hierarchical (spending) data in an interactive visualization. The setup is easy and independent from the OpenSpending platform. However, there is an optional integration module to connect with data from the OpenSpending API.
BubbleTree depends on the following JS libraries
The constructor of the bubble chart takes just one argument, the configuration object which contains all settings that can be set. This section will cover all available configuration variables.
Example:
new BubbleTree.Loader({
data: treeObj,
container: '#bubbletree'
});
The BubbleTree expects the data in a linked tree structure. The core element in the tree are nodes which must at least consist of the properties label and amount:
rootNode = {
label: "Total budget",
amount: 1000000
}
The child nodes then are (recursivly) inserted within the children array.
rootNode = {
label: "Total budget",
amount: 1000000,
children: [{
label: "Health",
amount: 650000
}, {
label: "Government",
amount: 350000
}]
}
You can also give the nodes unique identifier by setting the id property.
node = {
id: "gov"
label: "Government",
amount: 350000
}
Another way to identify the nodes is to assign them to a taxonomy by setting the taxonomy and name properties.
node = {
taxonomy: "cofog",
name: "05.3",
label: "Government",
amount: 350000
}
You need to tell the BubbleTree at which point in the container HTML the visualization should be inserted. To do this, simply set the container property in configuration. The container can be either a HTML DOM node or a jQuery selector String
Note: The container element must be defined in the HTML page, the BubbleTree won't create it itself.
bubbleType - defines what class is used to render the bubbles. Possible values are plain, icon, donut. Can be either a String if the same type should be used for all bubbles or an array of strings if different bubble types should be used for different tree levels.
config.bubbleType = 'plain'
config.bubbleType = ['donut', 'icon', 'donut'];
It is possible to change the default display properties of each bubble by setting up bubble styles. Bubble styles can be defined once for each taxonomy (e.g. COFOG) or for individual node ids. By now, you can use bubble styles to change the colors that come out of the API or to set up icon images for the bubbleType "icon". bubbleStyles* - Object that holds bubble style declarations, grouped into taxonomies.
Example:
config.bubbleStyles = {
'cofog': BubbleTree.Styles.Cofog,
'itb-function': BubbleTree.Styles.ItbFunction,
};
There are two reserved words, that can't be used as taxonomy ids: id and name. Both are used to directly apply styles to bubbles which don't belong to any taxonomy. In the following example, a color is defined for the node with the id "root". Also, all nodes with the name "italy-toscana" will get the color #dd333.
config.bubbleStyles = {
'id: {
'root: { color: '#cccccc' }
},
'name': {
'italy-toscana': { color: '#dd3333' }
}
}
If you want to connect the BubbleTree with OpenSpending data you might want to use the Aggregator class.
new Aggregator({
apiUrl: "http://org/api",
dataset: "cra",
drilldowns: ["cofog1", "cofog2"],
cuts: ['year:2008'],
breakdown: 'region',
callback: function(data) {
new BubbleTree.Loader({
data: data,
container: '#bubbletree'
});
}
});
The following config variables can be used to change the data source:
For local testing purposes you can also use locally cached api call results by setting the localApiCache property.
In the current implementation, tooltips are not part of the BubbleTree. Instead, the visualization provides a simple API for adding custom tooltips.
initTooltip - function that will initialize the tooltip for a given bubble.
function initTooltip(node, bubble) {
}
The tooltip event handler can be set with the tooltipCallback property in the configuration (see above). The event handler must handle both the tooltip show and hide events. See index.html for an example implementation.
The following event properties are available
The icons are stored in /icons/ folder in standard SVG format. However, there are some specifications to ensure that the visualization can use the icons correctly.
The icon filenames are arbitrary. The mapping between taxonomies and icons is done at JavaScript side by defining the bubbleStyle property in the configuration (see above), which is a three level nested dictionary
Please see index.html and style.cofog.js for a working example.


First of all, what is JUnit? JUnit is Java provided library to automate your unit tests cases. A project can have million lines of code and probably thousand methods, Just to make sure that the methods are behaving same as what they suppose to be, we write unit test cases for those methods. This keeps your project bug safe with future edits on method.
Let’s quickly jump into JUnit configuration. Add following lines in pom.xml
Basics of JUnit.
Common annotations.
@Test - Used to decorate method which will considered a test case. @ParameterizedTest - Run a test method multiple times with different parameter.
@ParameterizedTest
@ValueSource(strings = { “racecar”, “radar”, “ssoss” })
void palindromes(String candidate) {
assertTrue(StringUtils.isPalindrome(candidate));
}
@TestMethodOrder and @Order(n) - TestMethodOrder is class decorator and makes the class test run in a order, @Order is a method decorator and tell the order of the method by numeric values.
@BeforeEach and @AfterEach - Methods decorator, makes methods to be called before and after of each method. @BeforeAll and @AfterAll - Methods decorator, makes methods to be called before and after of each test class.
@Tag - Helps to tag method and later helps to filter the test methods with the use of runner. You can see the example above.
@Disabled - Disable the class or method in the test runner.
Assertions
Assertion checks the conditions and throws assert exception which in the end fails the Junit test case. If none of the asserts in the test case throws assert exception that test case will be marked pass.
assertTrue(method1(),”fail msg”) // will pass if method return true.
assertFalse(method1(),”fail msg”) // will pass if method return false.
assertNull(obj,”fail msg”) // will pass if obj is null
assertNotNull(obj,”fail msg”) // will pass if obj is not null
fail(“fail msg”) // Throw assert error with msg.
JUnit 5 has “fail msg” as last parameter, It accepts a supplier interface as well for lazy initialization.
AssertAll // for grouping multiple asserts and combining message.
assertIterableEquals //Will match each record of two iterable(ArrayList, linked list etc)
Assumption
Assumption helps in writing conditional Junit test case. Test cases can be skipped if assumption is not matched. If test case assumption is not met, test case will be aborted and skipped.


About Shanghai
Shanghai, referred to as "Shanghai", is a provincial administrative region, municipality directly under the central government, a national central city, a megacity of the people's Republic of China, China's international economic, financial, trade, shipping, scientific and technological innovation center, and a national logistics hub. The city has 16 districts with a total area of 6340.5 square kilometers. In 2019, there are 24.2814 million permanent residents, 14.5043 million registered permanent residents and 9.7771 million foreign permanent residents.
Shanghai is located in the east of China, the estuary of the Yangtze River and the East China Sea. It connects Jiangsu and Zhejiang provinces in the north and West. It is bounded by 120 ° 52 ′ - 122 ° 12 ′ E and 30 ° 40 '- 31 ° 53 ′ n. During the Warring States period, Shanghai was the fiefdom of Chun Shen Jun, so it was also called Shen. In the Jin Dynasty, because fishermen created fishing tool "Hu", the place where the river flows into the sea was called "Du", so the area along the lower reaches of Songjiang River was called "hudu", and later changed to "Hu", so Shanghai was referred to as "Hu".
In 2019, Shanghai's GDP will reach 3815.532 billion yuan, an increase of 6% over the previous year in terms of comparable prices. On December 15, 2019, it was listed in the top 10 Chinese city brands of the Chinese Academy of social sciences.


--- layout: post title: Trackback test date: 2006-06-06 11:34:00.000000000 +02:00 type: post parent_id: '0' published: true password: '' status: publish categories: - humble thoughts tags: [] meta: {} author: login: stmaarten email<EMAIL_ADDRESS>display_name: stmaarten first_name: '' last_name: '' ---
RR.org is changing. See for more information: http://religionresearch.org/?p=3


Various examples of Bootstrap styling applied to Sphinx constructs. You can view the source of this page to see the specific reStructuredText used to create these examples.
This is a first level heading (h1
).
The Sphinx Bootstrap Theme uses Bootstrap styling for inline code text
and
multiline
code text
Here’s an included example with line numbers.
1 2 3 4 5 6 7 8 9 10 11 12 | """Sphinx bootstrap theme."""
import os
VERSION = (0, 4, 9)
__version__ = ".".join(str(v) for v in VERSION)
__version_full__ = __version__
def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = os.path.abspath(os.path.dirname(__file__))
return [cur_dir]
|
It also works with existing Sphinx highlighting:

Hello World

def hello():
"""Greet."""
return "Hello World"
/**
* Greet.
*/
function hello(): {
return "Hello World";
}
The Sphinx Bootstrap Theme uses the Bootstrap alert
classes for Sphinx
admonitions.
Note
This is a note.
Warning
This is a warning.
Danger
This is danger-ous.
I have footnoted a first item [1] and second item [2].
Footnotes
| [1] | My first footnote. |
| [2] | My second footnote. |
Icons are different in Bootstrap 2 and 3, so you will only see an icon below for the version of Bootstrap that we used to build these docs.
The following template HTML:

translates to a neat star:
The following template HTML:

translates to a neat star:
Here are some examples of Sphinx
tables. The Sphinx Bootstrap
Theme removes all Sphinx docutils
classes and replaces them with the
default Bootstrap table
class. You can add additional table classes
using the Sphinx cssclass::
directive, as demonstrated in the following
tables.
A “bordered” grid table:
| Header1 | Header2 | Header3 | Header4 |
|---|---|---|---|
| row1, cell1 | cell2 | cell3 | cell4 |
| row2 ... | ... | ... | |
| ... | ... | ... |
which uses the directive:
.. cssclass:: table-bordered
A simple “striped” table:
| H1 | H2 | H3 |
|---|---|---|
| cell1 | cell2 | cell3 |
| ... | ... | ... |
| ... | ... | ... |
which uses the directive:
.. cssclass:: table-striped
And a “hoverable” table:
| H1 | H2 | H3 |
|---|---|---|
| cell1 | cell2 | cell3 |
| ... | ... | ... |
| ... | ... | ... |
which uses the directive:
.. cssclass:: table-hover
An example Python function.
format_exception
(etype, value, tb[, limit=None])¶Format the exception with a traceback.
| Parameters: |
|
|---|---|
| Return type: | list of strings |
An example JavaScript function.
MyAnimal
(name[, age])¶| Arguments: |
|
|---|


|
Bullet Collision Detection & Physics Library
|
EmptyAlgorithm is a stub for unsupported collision pairs. More...
#include <btEmptyCollisionAlgorithm.h>
Classes | |
| struct | CreateFunc |
Public Member Functions | |
| btEmptyAlgorithm (const btCollisionAlgorithmConstructionInfo &ci) | |
| virtual void | processCollision (const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut) |
| virtual btScalar | calculateTimeOfImpact (btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut) |
| virtual void | getAllContactManifolds (btManifoldArray &manifoldArray) |
| Public Member Functions inherited from btCollisionAlgorithm | |
| btCollisionAlgorithm () | |
| btCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo &ci) | |
| virtual | ~btCollisionAlgorithm () |
Public Attributes | |
| btEmptyAlgorithm::CreateFunc | ATTRIBUTE_ALIGNED |
Additional Inherited Members | |
| Protected Attributes inherited from btCollisionAlgorithm | |
| btDispatcher * | m_dispatcher |
EmptyAlgorithm is a stub for unsupported collision pairs.
The dispatcher can dispatch a persistent btEmptyAlgorithm to avoid a search every frame.
Definition at line 26 of file btEmptyCollisionAlgorithm.h.
| btEmptyAlgorithm::btEmptyAlgorithm | ( | const btCollisionAlgorithmConstructionInfo & | ci | ) |
Definition at line 18 of file btEmptyCollisionAlgorithm.cpp.
|
virtual |
Implements btCollisionAlgorithm.
Definition at line 27 of file btEmptyCollisionAlgorithm.cpp.
|
inlinevirtual |
Implements btCollisionAlgorithm.
Definition at line 35 of file btEmptyCollisionAlgorithm.h.
|
virtual |
Implements btCollisionAlgorithm.
Definition at line 23 of file btEmptyCollisionAlgorithm.cpp.
| btEmptyAlgorithm::CreateFunc btEmptyAlgorithm::ATTRIBUTE_ALIGNED |