text:
rnn consists of an array of layers.
each layer keeps an array of outputs?
dw accumulated going back.
each layer has an input.
rnn[i] may have an input rnn[j<i][t=0] or rnn[j][t>0]
which means rnn[j] needs to keep its output for all [t]
what happens when t is invalid?  (we are at T=1 and t=3 for some input)?
adder layers need more than one input.

rnn-forw:
start at rnn[i=1], loop rnn[i+=1]
how do we give initial inputs?
find out where to get x for each layer and call its forw with that x
how do we collect final outputs?

rnn-back:
we have to give x as well as dy
we find the x just like forw
which means each layer is responsible for its own output history
layers should not keep their own x?
should they manage their own y?
state-less layers?  forw computes y given x, nothing kept.  preallocated y can be passed.  or x overwritten.
can we allow any overwriting in rnn?  what if we need the x before overwriting?  do we ever?
back takes dy and x giving dx and accumulating dw.
who zeros dw?
who resets history?
do we have a time variable?
rnn-forw could pass in time.

what about add layers?

mathematically the rnn order does not matter.
so we actually have a set of nodes.
each node (except adder) points to a single parent node with a possible time delay.
multiple nodes can point to the same parent node (get their inputs from it) with identical or different delays.

what happens to overwriting layers?

so we could give all responsibility to nodes rather than rnn-forw.
they know their input.
rnn order does matter for serial computation order respecting dependencies.
rnn-forw can call layer-forw with a single time parameter.
input node can have all its ylist filled in the beginning.

or nodes don't keep anything, rnn-forw calls them with x and y,
rnn-back calls them with dy, x, and dx (do we need both x and dx? can
dx overwrite x? can dy and y share storage?
storage (other than parameters) is managed outside of the layers.
layers implemented as stateless functions.

dw accumulation?  resetting?  initback?

OPTION 1: rnn-forw manages storage, calls layers with pre-allocated x/y.
OPTION 2: layers manage storage, have history arrays, rnn-forw calls them with time.

OPTION 1 sounds better for now.

We should think of this top-down.

We have some sequence data: (x1,y1), (x2,y2), ...
where xi and yi are sequences of tokens (represented by one-hot or other vectors).

Shall we represent xi as a matrix, or as a vector of vectors?

How will batching work?

We process multiple xi together.  And propogate errors compared to yi.

What if xi's are of different length?  We can't resize the input matrix like we do
because the back phase does not start until all sequences in the batch are done.

This is similar to the situation in beam parser.

We can shrink the input batch as we move forward?

Let's replicate marjan's reversing experiment.

Claim: no architecture ever looks back more than one time step in forw.
Claim: you only look back if your input index is >= your index.
This will eliminate the time coordinate from the network description.
We still need the Add2 layer.
We can do the binary adder example.
or a language model.  both have well specified input/output at each step.

Classification problems have a bunch of dont-cares followed by one output.
Also the addition example from irnn paper.

Sequence mapping models have an encoding rnn and a decoding rnn
trained together.  Need special code for that.

There is no difference in the forward algorithm.  We just feed in a
sequence of x.  We evaluate using a subset of y.  We may need beam
search for evaluation.

Here is the adder:

[(Mmul(h), 0), 	# 1 takes input x
 (Mmul(h), 5), 	# 2 takes prev hidden state
 (Add2(), 1, 2), # 3 adds together
 (Bias(), 3),	 # 4 specify bias separately
 (Relu(), 4),  	# 5 this is the next hidden state
 (Mmul(y), 5),	# 6 computing output
 (Bias(), 6),	# 7 computing output
 (XentLoss(), 7),	# 8 last layer is output
]

Compare this to a regular single hidden layer feed forward net:
[Mmul(h), Bias(), Relu(), Mmul(y), Bias(), XentLoss()]

In fact if we make the default input the previous one or two layers
(keeping backward compatible) we only need to specify it when we have
to:

[Mmul(nh), (Mmul(h),5), Add2(), Bias(), Relu(), Mmul(ny), Bias(), XentLoss()]

OK: Barrett says he gets rid of the need to train an initial hidden
state by always feeding in the same start symbol.  The embedding of
the start symbol gets trained to give the initial hidden state.  This
means the input and output of the hidden-to-hidden unit are both 0.
We can adjust Add2 so if one of its inputs is nothing it just gives
the other one.  Same with Mul2 giving out zero.

### Can we have a single Net type?

What distinguishes rnn from fnn?
Both can be defined as a sequence of layers with associated input specs.
; Inputs should probably be defined with relative coordinates for easier cut-paste.
The default input spec is the previous layer(s) in sequence
; but even fnn's may require input specs if they have skip connections.

Difference 1: rnn's have recurrent connections (inputs from forw layers).
a. this makes no difference in forw calculation, both just keep track of the last output of each layer.
; this means rnn and fnn can have the same predict function.
; but not the same forw function, if rnn needs to remember stuff.
b. rnn's have to keep stuff around for bptt calculation, fnn's don't?
;; do they really?  or is this an efficiency issue only?
; fnn's can also do updates at the end of the sequence?
;; trivially yes, but at the expense of extra storage.
; rnn's can also do updates every time step?
;;; back calculations are additive.
;;; if your output goes to multiple places, their contribution to your dy adds up.
;;; instead of adding dy=dy1+dy2 and going back, can we do back(dy1) followed by back(dy2)?
;;;; this comes down to whether back is a linear function of dy:
; mmul, bias, mul2, add2: yes
; conv, pool: ?
; loss: we won't have multiple dy's coming into this one.
; actf: yes
;; sigm: dx = dy * y * (1-y)
;; tanh: dx = dy * (1+y) * (1-y)
;; relu: dx = dy * (y>0)
;;; so the answer seems yes, back(dy1+dy2)=back(dy1);back(dy2)
;;; even if the answer is yes, some layers require x/y for back calculation
;;; in rnn there is a contribution from y/dy at t=T all the way back to layers at t=1
;;; and this contribution requires all the intermediate x's to be kept even if we were doing back at each step.

; conclusion: yes, rnn's can do back every time step
;; however they still need to keep around x's until the end of the sequence.
;; and it would be less efficient then doing back(dy1+dy2), tracing every back path once.

; So even if we had the same Net type for rnn's and fnn's:
;; we would have to detect when a net is an rnn
;; we would have to use different forw functions for rnn-test vs rnn-train.

Difference 2: rnn's get fed sequence inputs.
; fnn's can also be fed sequence inputs: successive inputs do not effect the next time step.
; rnn's can also be fed non-sequence inputs: each input can be assumed the next in sequence, until a special end-of-sequence input (maybe nothing?).

Difference 3: rnn's wait until the end of the sequence before "back".

; important thing is dw, dy/dx is only necessary they support dw calculation.
; only bias, conv, and mmul have dw calculation.
;; any back path that does not lead to a bias/conv/mmul can be stopped.
;; any forw path that does not lead to an output can be stopped.

### Can we have reversible RNNs?

;;;; can the x's be recalculated using a reverse forw function?
;;;; no, add2 and mul2 lose information
; although we could have two outputs with two inputs and make them reversible
; however this will not prevent having to remember something for each time step of forw?
;;;; mmul loses information unless w is square.
;;;; bias is reversible.
;;;; tanh/sigm reversible, relu loses information.
;;;; i think it is worth thinking about reversible rnn's.

### Input format:

with rnn's we have the option to present forw with:
1. contiguous input (xdim, minibatch, time)
2. vs array input (vector of (xdim, minibatch))
since I am not keeping the other layer outputs contiguous #2 seems better.
barrett claimed #1 is more efficient but my copy! tests dont show much difference.
; if we consolidate rnn and fnn types we may need to have two different forw functions
; that interpret the input as a sequence of minibatches vs as a minibatch.
;; we could determine that from the type, i.e. Vector of Arrays vs a single Array.
; the rnn forw function further splits into predict vs train mode.

we dont want a low level forw function that takes the whole sequence?
it would take less memory to feed in each time step.
in other words we should take the t=1:T for loop outside the forw.
in predict mode, don't need to set/read r.h, so no need for time index.
in train mode we could keep an internal timer.
however we do need to keep input x[1:T] for back calculations.
so preserve using r.x, this also solves the problem of layers that overwrite their input.
and forw/back never take sequences!
back can simply accept dy=nothing for some time steps?
we need to feed x forwards and dy backwards in train.
no need to use subarrays for r.h.
but we need to reset t=0 at the start of each sequence
; actually that will automatically happen if back subtracts from r.t
should we still keep r.x separate from r.h?

### Can we have a recursive Net type?

; need to consolidate the types RNN, Net, and Layer.
; do we append or list when merging?
; say we use list

Have an abstract type Net.  It supports:
forw(nn,x)->y
back(nn,dy)->dx

We can put multiple nn's together, the resulting thing should also be an Net.
We should be able to use it as a primitive.

As soon as we have recurrent connections, we need to keep history.

This should work for all r::Net:
for n=1:N; r.y[n] = forw(r.f[n], r.y[r.inputs[n]]...; o...); end

Except primitive ops, which just implement their own forw.
; which will just work, due to type overriding.
Except when reset (x=nothing?) when we should set all r.y[:]=nothing.
; that is easy to implement
; for primitives we used nothing as zero matrix so not a good idea.
; have a reset function instead for rnns.
Except skip input ffnn's which have to be careful with overwriting layers.
; when freads > 1 and the first child overwrites, second will have the wrong input.
Except rnn's which have to store some history for back.
; does this work for embedded RNNs?

A Layer is a Net.
A RNN is a Net.
RNN consists of a list of Nets, and their input specs.

Net : RNN | Layer
RNN : List<Net>, Inputs

We don't need three types, we only need two:

Layer : Net | Mmul | ...
Net   : List<Layer>, Inputs

Layer is a bad name, Atom? Func? Node? Op? Fn? Primitive?
Caffe calls them Layer, Theano calls them Op.  Go with Op:

### Recursive Net type, Try 2:

Op : Net | Mmul | ...
Net: List<Op>, Inputs

Each Op supports:
forw(op,x)  -> y
back(op,dy) -> dx

Storage for y and dx:
- Either x and dy are overwritten
- Or internal storage resized and used (in which case it is overwritten next call)
- overwrites(op) tells us which.
- overwrites(net) has to figure it out from its components.
- in case of net, both overwriting and internal storage may be used, PrimOps use one or the other.
- PrimOps always overwrite dy? or only when x is overwritten?
;; seems the second: mmul,mul2,conv,pool allocate; bias,add2,actf,loss,drop overwrite (or pass without overwriting, which should be marked as overwrite)
;; when is dy used more than once?  only when there is more than one input: mul2 and add2.
;; so it is ok to assume dy always overwritten.
- overwrites(net) is true if any of its ops with input=0 overwrites.
- supporting multi-input Ops is tricky, add2 only overwrites its second argument.
;; we could just not overwrite, but it also passes dy back twice?  we pass dy and a copy of dy.
;; mul2 allocates dx1 and dx2, we could similarly use dy for one of them.

Overwriting is important in forw(net)
- if an r.y[i] is going to be overwritten but it is going to be used again, it needs to be copied to r.y[n].
- so if we just don't overwrite in add2, all will be simplified and forw is done.

Back:
- in ffnn's and PrimOps there is a forw and back after every input.
- in rnn's there is multiple forw followed by an equal number of back.
- we could also run multiple forw in ffnn's as long as we remember stuff for back.
- can we make PrimOps smarter to keep multiple x's or y's for training?
;; PrimOps that support multiple forw followed by multiple backs: that way Net does not have to remember anything.
;; there is two types of forw: predict and train.
;; for predict we don't have to remember anything, there is no back.
;; for train each Op can keep track of the stuff it needs for back.
;; should we copy or point?  always copy, everything can be overwritten?
;; each PrimOp that keeps state needs a timer t.  forw(train) increments, back decrements
;; forw(predict) does not touch timer t (do we need reset?)
;; back_reads_x: conv, pool, mmul, mul2
;; back_reads_y: actf, loss, pool

Can we really simplify RNNs?
forw simply calls forw of each op.
back simply calls back of each op in reverse.
everybody keeps track of t.
we don't need back_reads_x and back_reads_y.
do we have to have overwrites? can't we assume we always overwrite?
we could copy any x with multiple forwreads.

Can we use this for non-RNNs?
t would only be 1.
layers would store what they will need.
any unnecessary copying?
have to store y -> others may write on it.
possible extra storage of x -> if interm layer it was going to get overwritten, if first layer it is the original input, somebody else may read and overwrite.

Problem:
same input will be stored multiple times by different Ops.
Example:
- lstm needs x, h for mmul.x for 4 different mmul pairs.
- it needs i, f, o, c1, c, c2 for mul2.x.
- it needs i, f, o, c1, c2 for actf.y.
So the union is 8 cells.  If each unit copies we have 19.  We have shared references.

Can we keep reference counts?  Ops never copy, they always point, the increment reference count.
We don't overwrite if refcount > 0.
However this does not result in reuse?
It also does not solve the forw problem, i.e. future forw reads.

Forget it, Net has to keep track of stuff for back and present it to back(op) with specific x,y.
In which case we are using back(op) as a function, i.e. all inputs specified. Though output still allocated.

Since cells can be shared among ops, we can't rely on ops to do memory management.

### Recursive Net type, Try 3:

Op: Mmul | ...
Net: List<Op>, Inputs

Each Op supports:
forw(op,x,y)   -> y
back(op,dy,dx) -> dx

Ops do not allocate outputs or keep record of past inputs, they are memoryless functions.

However if Net is an Op and it needs memory for RNN!

What happens when a Net has a member that is a Net?  Who keeps the memory?

This argues for Nets not to be Ops, when a Net is a member of another, it should be spliced by the constructor.

There should be only one memory manager: implemented inside Net.

We can't have embedded Nets.  Nets cannot be Ops.  However they can be passed to constructors for other nets, which should splice them, so the resulting net is a simple sequence again.

Call them OP and NN?

Net constructor is basically a compiler.

So we are back to having r.y, r.Y, r.dy, etc.  Except the constructor should accept other nets and splice them.

The basic constructor should just do the splicing, fixing the indices.

Compiler should do memory allocation after receiving the first input (initforw)?

r.y should have the minimum number of required arrays, with sharing where possible.

r.y[n] should be passed as an option to forw.  can be shared where appropriate.

Remove all memory management from layers?

r.dy[i] will have to be allocated as well (initback), again with sharing where possible.

We will still keep stepwise forw and stepwise back.

NO: We need allocy(op,x) and forw(op,x;y=allocy(op,x)) or forw(op,x;y=x) supported for each op.
;; no need if we use resize
NO: forget about keeping and reusing l.y.
;; We can still have y=nothing as a keyword arg and use y=x or y=l.y if not specified.

We won't know the sizes unless we do a trial run, which we can after the first x.
OK: Or we can just assign size-0 KUdense everywhere and have layers resize as appropriate?
OK: We also need to resize appropriately?  should rnn do this or the ops? ops can do it.
In which case we don't need allocy except internally to an Op.

TODO: renames after testing:
RENAME: KUdense -> KUarray
DONE: Net -> MLP
DONE: RNN -> Net
DONE: Layer -> Op
DONE: predict=false -> train=true
DONE: RNN2 -> S2C

During construction and compilation we will know N but we wont know T.
So things with T dimensions: r.x, r.h need to be dynamically resized.
We can use KUarrays for those as well.

As we are growing r.h adding another column, we need to keep the same
pattern of shared arrays from the previous column.
rnn only takes care of sharing: we can keep track of yarray[n] and harray[n] indices.
or we can keep an example h to be concatenated.

r.t only kept track of by Net.
during train forw increments, back decrements.
during predict forw increments (so we know if we are in the beginning and don't use r.y from previous sentence).

what about r.x, do we need it?  do we copy?
treat it like another Op.
since we are modifying the list during Net construction why not add a data Op.
no input, (just like Rand ops), x output: point or copy?
just like other layers.
look at forwreads and backreads.
0 means no input, 1 means data input.
we'll have to perform index transformations anyway.

Net constructor: how to splice:
Initialize the net with the input layer (i.e. op=nothing, inputs=(0,))
If there is another net member remember it also has an empty input layer.
we need an index translation table.
what the user meant by j was the output of the j'th element of his list.
what the user meant by 0 was the input to the Net.
we need to turn j into the output index of the j'th element.
j'th element can be an Op or a Net.
j could be in the future.
can we first compute the translation table?

# allocate optimize output registers
# allocate optimize history registers
The following should be the code for forw:
r.output[n] = forw(r.op[n], r.inputs[n]...; y=r.output[n], o...)
But there is the issue of back pointers at t=1, represented by "nothing" inputs
We may have to keep the netinputs function.
(need two names, one for index transformation one for actual input gathering.)

Assumption: A Net cannot have multiple inputs.
In that case we cannot express LSTM easily, it has four multipliers.
Think again...
New design: inputs indicated by 0, -1 etc.
We use the wrap around convention, i.e. 0 means end-0, -1 means end-1
;; Alternatively just add to the end of list: 0 means n+1+0, -1 means n+1+1 etc.
;; when we concatenate the indices 0, -1 etc. point to the last few outputs
;; add2 and mul2 commutative so I guess it doesn't matter which convention for now.
so we can store the inputs at the end of h and y
and we can keep the convention y[n] is the output of op[n].
and we can get rid of the Data() layer.
We allow Net's to have multiple inputs as well.
Can we have the following convention:
- The first Op in a Net determines the number of inputs: ?
- The last Op in a Net determines the output: OK.

naming problems:
opin
opout
netin
netout
index vs array

We have problems with the nothings.

# Implement back
# test mnist

# back: state of r when back is called:
# time = T
# buffer[n] = last output of op[n]
# stack[n][1..T] = outputs of op[n] for t=1..T
# back gets dy (desired value of output[N])
# for n=N:-1:1
## find output and inputs of op[n] at time T
## some may be from T-1, look these up from stack

## stack for inputs separated?
## no stack read/write for direct forw/back?
## inputs and output contain register ids?
## build things around get/set registers?
## have a set of registers that is a subset of ops
## make some of these registers keep history
## use push/pop?
## do we ever need access to reg[n][t] and reg[n][t-1]?
# op[5][t] has inputs from op[3][t] and op[7][t-1]
# we are going back so op[7][t] has been processed, it is ok to pop
# push(r,n) will save the current value of reg[n] on stack
# pop(r,n) will pop the previous value of reg[n] from stack
# reg(r,n) returns the current contents of register n
# we never need to access the stack directly?
# does pop(r,n) copy to reg[n] or does reg[n] point to stack?
# is reg[n] a pointer to the top of the stack or actual storage?
# how do we deal with saving the inputs?

# all real storage is on the stack, there is no buffer
# when time increases some registers are pushed others overwritten
# so we need pushable registers with real storage
# reg(r,n) is just the top of stack(r,n)
# initially we have real space, i.e. stack is never empty
# when we push, stack increments its pointer
# net does not need to keep track of time, individual registers do

# can we have a single stack for all the registers?
# nobody keeps track of time, we hope push/pops balance
# where is the real storage?  still should be on stack and regs should just point.
# so we are pointing to and changing more than the top of the stack.
# where are the input registers pointing to?
# registers are all pointers!  none have real storage.
# input registers originally point to the last input.

net specifies which registers each op is going to use as input and output.
so before we do forw, we should point the input registers to the net input.
then we don't have to do anything special in forwinputs.

function forwinput(r::RNN, x, n)
    map(r.inputs[n]) do i               # return the input matrix or tuple of input matrices to produce r.output[n]
        i <= 0     ? x[1-i] :           # i <= 0 is used to indicate input x[1-i]
        i < n      ? r.output[i] :      # 0 < i < n are outputs from the current time slice
        r.time > 1 ? r.output[i] :	# i >= n are from the previous time slice if r.time > 1
        nothing                         # nothing represents zero matrix from r.time=0
    end
end

if we initialize registers to nothing, and copy the inputs, all will be fine and there will be no need for forwinput.

On the one hand we want reg[i]=nothing for uninitialized inputs
On the other hand we want reg[o]!=nothing for storage
Note that o==i is possible in which case we definitely want reg[o]==nothing initially
On the third hand we want to use the same storage for reg[o] from last minibatch
Keep an initial storage for each register?

###############
### I/O
###############

We need a good interface for models and data.  First data:

Earlier notes:
# Organization of the training set and training batches:
# D:dimensionality, I:instance, B:batch-instance, T:time
# In FFNN size(xtrain)=(D,I), size(xbatch)=(D,B) where D fastest
# In RNN size(xtrain)=(D,T,I) or xtrain=[(D,T1),(D,T2),...]
# i.e. we want each instance to be contiguous.
# In RNN size(xbatch)=(D,B,T) or xbatch=[(D,B1),(D,B2),...]
# i.e. we want each time-step to be contiguous.
# train->batch will need to do some shuffling

x[i][t][d1,d2,...] each instance and each token separate, default for rnn
x[d1,d2,...,i] this is the default minibatch for fnn
x[d...,i,t] possible minibatch for rnn?
x[d...,t,i] possible training set for rnn?

lowest level forw expects a single token: x[d...]
could also be a token-batch: x[d...,i]
this means if we have isbits(eltype(x)) we interpret it as a single token-batch.
this is consistent with fnn convention.
the time dimension is never embedded in a bits array.

if we are given x[t][d...,i] we interpret the first index as time.

if we are given x[i][t][d...,b] we interpret the first index as instance, second as time.

we can pull this off if fnn always sticks to bits arrays.

how do we test this:

(isbits(eltype(x))    ? first-type :
 isbits(eltype(x[1])) ? second-type :
 isbits(eltype(x[1][1])) ? third-type :
 error)

A = Union(Array{T<:Number}, Void)
B = Vector{A}
C = Vector{B}

We can distinguish Vector{Any} from the rest.
Specifying the bits arrays is more difficult there are too many types.
Low level forw can have a sanity check for eltype.
We can rename tforw -> forw(r,x::Vector{Any})

For forw(r,x[t][d...,i]) what is the expected output?
Loss: ok if training and y is provided but does not help predict.
also cannot compute loss after the fact unless we have access to outy array.
outy array: internal registers get overwritten, copying is expensive.
ask for external storage?
overwrite gold y and return loss?
return pointers to stack?

Low level forw(r,x) does not expect y, does not compute loss, returns internal storage.
For sequence forw we could be forgiven if we return internal storage since forw is
only supposed to be used internally and needs to be efficient.
This means we have to use the stack and construct a return Vector{Any} y array from internal storage.
- we don't know where in the stack stuff is stored.
- compiler may decide not to store the final out in stack.
- especially if train=false!

We copy external stuff in from input.  Makes sense if internal stuff got copied out.
Accept external storage with a keyword y parameter and overwrite if specified.
Predict works.
tforw works and passes the individual arrays to forw.
Do we return loss?  No, it is inefficient, not always necessary, and can be computed from the out y.
Do not return anything unless a y has been specified.

- train needs batching
- predict needs batching
- sequence of batches need to be distinguished from sequence of instances
- currently train calls forw, back and update, i.e. one minibatch.
- updating loss and norm is going to be a problem.
- gclip needs to go to update.
- if x is a vector it is assumed to be a time sequence.

- sequence training data comes in x[i][t][d...]
- batch turns it into x[i][t][d...,b]
- adding feeds into train x[i], i.e. x[t][d...,b]
- train passes this to forw, back
- forw takes it as a time sequence, runs init and passes x[d...,b] to forw1.

- mlp training data comes in as a block x[d...,i]
- old train batches this into x[i][d...,b]
- passes into forw/back x[d...,b]

- do we ever call train with x[i][d...]
- we might, expecting it to minibatch it like sequence.

- do we ever call train with x[t][d...]
- that is a single instance, probably not
- but x[t][d...,b] can be a batch?

- Array3 is always sequence data.
- Array1 is always block data. (if it is 1D it may be a single instance).
- Array2 is ambiguous.
- if x[i][d...] we need to batch into x[i/b][d...,b]
- if x[t][d...] it is a single instance. let's assume we don't call train with a single instance.
- if x[t][d...,i] we have already batched data, unlikely from the user.
- Disallow Array2?  Or interpret as x[i][d...]?  Or as x[i][d...,b]?

		block		sequence
instance	x[d...]		x[t][d...]
minibatch	x[d...,b]	x[t][d...,b]
dataset		x[d...,i]	x[i][t][d...]
dataset2	x[i][d...]

New language:

	* src/model/lstm2.jl: compiler args vs constructor args:
	lstm(10),x1,x2,y
	lstm(10),y,x1,x2
	y,lstm(10),x1,x2
	y=lstm(10)(x1,x2)
	y=lstm(x1,x2;h=10)
	Using the last convention with par the only exception.

# convention: subroutine constructors only take keyword args.
call these options to distinguish from parameters of the network.
# in machine code regular args are for the compiler, keyword args for constructor.
# par/rnd is the only exception, it has no regular input so dims can be regular args for readability.
par(n,0): convention: put 0 where the dimension is to be inferred from input.
# parameters, constants, and rand: all no-input ops
should we have par/rnd/con or should it all be options for par, i.e:
con is par with lr=0
rnd is par with rnd=f
how to specify an explicit value: val=array option?
if they were separate:
const: only sensible option is externally specified value: const([1]), const(1)
const will allow us to define things like 1-x, 0.5*x etc. without extra ops, using add, mul with smart broadcasting.
rnd: needs dimension, distribution and parameters, all except dimension can be keyword args.
it also needs test=false option.
subroutine constructors return quoted expressions.
these need to be compiled at some point maybe:
@net begin ... end: is a compiler: here is linear regression:

@net begin
    x = input()
    w = par(10,0)
    y = dot(w,x)
    b = par(0)
    z = add(b,y)
    r = qloss(z)	# use xloss/closs for cross-entropy loss?  should we make r optional here?
end

Do we need soft and softloss separately, can we combine them?  (soft is never used with any other loss and vice-versa)
We need to be careful and distinguish between ops that expect a gradient back vs ops that expect gold answers back.

Update is the part of the code that should be configurable.
Implement call-backs?

Where do we keep the matrices for adagrad, momentum etc?
forw/back don't care, these are for update only...
inside par, as usual?
is par going to write to registers out and dif?
we want to add a tmp register (replacing inc) but that is for transient values.

These are some big changes.  We need a plan, testing every step of the way.

### forw/back interface:
currently we have forw(l,x...;y=y)
we want to make y mandatory, get rid of on internal memory.
we can't have forw(l,x...,y)
option 1: forw(l,y,x...)
          back(l,dy,dx...)
if we are going to support a variable number of inputs, this seems to be the only way.
some dx may be nothing in which case they do not need computing.
back may need x/y or neither, these can be options?
option 2: forw(l,x,y) where x is a tuple, NO
option 3: forw(l,x1,x2,y) for two inputs, forw(l,x,y) for one, forw(l,y) for zero.
who initializes the weight matrices?  forw(par,y) does not know the size.
the user ops have to: forw(dot,x1,x2) during runtime.
but dot does not know which one if any is coming from par.
dot should also assume pre-initialized, and net should initialize before calling forw.

do we ever allow forw without y?  NO.
keyword args for back: x is a tuple?  when necessary.

option 2: forw(l,xy...) where the last of xy is picked up as the output.
          back(l,dy,dx...)

does forw/back return anything?
what if they need to set their output to nothing?
not possible with this setup.  they can fill output with zeros.

what is the cudnn calling convention?
alpha,src,beta,dest
bias,src
src,dest
usually destination at the end.
that is also the convention in blas.
axpy(alpha,x,y)
opposite of julia
A_mul_B!(C,A,B)
we'll just go with option 1.

## Size Inference:

par starts life as an (n,0) array.  initforw should have enough
information to figure out what should replace 0.  we should not leave
size inference and par init to ops, take care of it in the net.  this
is similar to broadcasting inference.  inferrer needs to know the op
that will use the par and the other inputs to that op.  similar size
inference can help compiler reuse registers more effectively.

## rethinking initout:

we still want to overwrite input where we can but we also want to
reuse earlier arrays if possible.  initout is also responsible for
initializing the par arrays.  par arrays can come in as
(1) size with zeros
(2) complete size
(3) actual array
par types store their own arr, diff, or do we use ones stored in the
net?  if both, then the net ones should be pointers.  but probably no
need.

ok, just use net.out and net.dif for par as well.  during comp just
store the dims, do not alloc.  accept actual array as well as rand
generator for init option (or have separate option).  during init we
alloc the actual array for par.  dif has to be sparse if input is
sparse.  actual dims depend on the operation for zero sizes.  eltype
is fixed throughout once given by the input.  if conflict with actual
par init array the input eltype wins.

infer eltype: easy, inputs win, single eltype throughout.
infer size: can do depending on op.
infer sparsity: also depends on input type and op.
infer sharing: can do after sizes are inferred.

do we do out/dif/tmp together?

can we have empty inputs and still init?
possibly, if pars are specified.

rnd does not come with an eltype, but par and con might.

sharing pattern is not the same for forw vs back?

initialization with arrays of par and con.

par(10,0) vs par(w) or par(init=w)
we have par(10,0; init=Gaussian(0,0.01))

call it p.out?  p.arr?  => p.arr or maybe p.init

par(x::Integer...; o...)=par(; dims=x, o...)
par(w::AbstractArray; o...)=par(; init=w, o...) vs par(; arr=w, o...)
all can set fields of par.
distinguish rand from init?  no.  init(par) can take care of both.

normal init should write to p.dims.

### size inference:
inputs are determined
par sizes are partly determined (with some zeros)
dot should be able to infer from x1=(n,0), x2=(a,b)
overwriters should copy their input sizes if fully determined
add/mul have to take into account broadcasting
who calls par.init?

dot,mul,add can do size inference with incomplete input sizes
dot => obvious
mul => scale vs elementwise
add => scale vs bias vs elementwise
let incomplete sizes be written to dims, then fixed.

in general do not change the ops when inferring size/type etc.
just create the registers with the correct size/type.

ISSUE:
who calls netinit?  is x enough?  cannot tell if y is sparse.
cannot complete infersparse for dif.
separate initforw and initback?

### calling convention
forw(op, y, x...):
- should we keep y optional?
- overwriting ops?
- calling convention for net?
back(op, dy, dx...)
- what if we want dx to point to dy?
- instead of copying?
loss(op, y, dy) or loss(op, dy, y)?

forw copying when no change?
back copying when no need?

change to forw(op, x..., y)
we can make y optional if we want to.

### sharing inference:
single tmp per size sufficient (necessary?)
forw_uses_tmp, back_uses_tmp?
each out0 has a read and write time.
first see if an input can be overwritten
next see if there is an array in garbage?
we know what each op reads and writes
we know what will be saved for back
overwrite the last read of possible
keep a stack of reads
every time something needs to be written go over the reads backwards
check whether each is available
size has to be write
not saved
not ever read again: until when?
not multi?
alloc if nothing available.
careful about read-before-write

### back sharing

1 --- a --- b --- N
considering overwriting b with a
b was read and possibly zeroed (if incr)
b is read only once
b may be written on in:

bw: 1..a-1, a, a+1..b-1, b, b+1..N

a is going to be read once (now)
a may be written in:

aw: 1..a-1, a, a+1..b-1, b, b+1..N

thinking as a cycle, b is free between read at b and first write
a is busy between first write (going back from the read) and (only) read
it is ok to share if aw1...ar is contained in br...bw1 cyclically going back

example: regular mlp, bw1=b+1, br=b, so b is free everywhere

also additional sharing (may be used in other than b)

can a or b write themselves?  if it is its own input.  in which case
read comes first, the write.
nowhere free or everywhere free?  nowhere free!

busy between first write and only read (going back)

"""
- do we need dif0?
- is the calling convention ok?
- tmp initialization
- no more params(r)
- do we ever want dx from the net? (for s2c type combos)
+ assume no dif0
- dy comes in, may be nothing, gets copied into dif[N]
- there is always a single output, a single dy
- other dif's are allocated but uninitialized
- computation always goes from dy[n] to dy[inputs[n]]
- could we ever have an uninitialized dy?
-- only if y[n] has not been an input for any y[n+k]
-- can be if y[n] has never been read or read by y[n-k]
-- if read by y[n-k] it will have dy set from prev iter except at t=T where dy=0
-- we can selectively zero those who need (unread and incr)
+ another reason for dif0 could be if we want dif to point to other things, i.e. add-back
- todo: back for scalar add, mul, check others
+ figure out dif sharing
- dif[n] is read once at iteration n, and dif[inputs[n]] are written to.
- dif[n] is free between the read and the first write.
- dif[n] is busy between the first write and the read.
+ todo: figure out sparse dw
- don't we need overwrites as well?  not all ops can overwrite! there is no point in sharing no-overwrite.
- can-overwrite: actf, add (to input 2), drop?, loss,
- no-overwrite: conv, dot, mul, pool
- n/a: input, par
- mul: can overwrite input 2 going forward in element-wise or scaled
-- going back we need both x[1] and x[2] so really no-forw-overwrite
-- back could possibly overwrite dy with dx2 but not worth the trouble
- add: can overwrite 1 or 2 going forw element-wise
-- only input 2 if bias or scalar add but the size will tell us
-- back does not read anything so no problem either way
- is overwrites == !back_reads_x?  yes, except for par and input for
which the question is invalid.  this may not be always true, sizes
have to match etc etc.
- is forw.overwrites == back.overwrites?
-- ow=true: actf:yes add=yes drop=? loss=yes
-- ow=fals: conv, dot, pool change size so no question, mul cannot.
-- most importantly we forgot: overwriting is good if it avoids
copying.
"""

## Interface issues:

op interface:
forw(op, x..., y)
back(op, dy, dx...; x, y)

net interface:
forw(net, x...; yout, ygold)
back(net, dy; dx)

gha_license_id: NOASSERTION


text:
---
layout: post
title: "React Native Text Size & Font Scaling"
category: React Native
---

<div class="image-wrapper">
  <img
    src="/images/posts/react-native-font-size-text-scaling.gif"
    alt="React Native Text Size & Font Scaling"
    width="300"
  />
</div>

In React Native, a default behavior of the `<Text>` Component is to respect the Text Size accessibility setting on iOS.

In a perfect world, your app would be 100% accessible and the UI would gracefully adapt to any text size. In reality, parts of your app's UI may break if the text size is adjusted. To disable this behavior on a `<Text>` Component, set it's `allowFontScaling` prop to `false`:

```html
<Text allowFontScaling={false}>
  Hi! I will not change. I don't respect settings.
</Text>
```

```html
<Text>
  Hi! I may change. By default, I respect the Text Size accessibility setting on iOS.
</Text>
```
_**Note:** Most icon fonts (like [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons)) are affected by font scaling. And last I checked, font scaling behavior isn’t present in the iOS Simulator; only physical devices. That makes this behavior easy to miss during development._

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
A RTAnnounceableObject is the root of the class hierarchy to have an announcer, useful to define event callbacks.

Instance Variables
	announcer:		<Object>

announcer
	- xxxxx

repository: dalehenrich/obex

gha_language: Smalltalk

repo_name: dalehenrich/obex


text:
# Serilog.CustomDestructurePolicy
![Nuget](https://img.shields.io/nuget/v/Serilog.CustomDestructurePolicy?style=flat-square) ![Nuget](https://img.shields.io/nuget/dt/Serilog.CustomDestructurePolicy?color=blue&style=flat-square)

Custom destructuring policy for serilog. What you can custom for destructuring:

1. Ignore property by certain rule
2. Mutate output value by certain rule

And currently it has builtin rule, you just need to configure during creating logger:

1. Ignore static property
2. Ignore compiler generated property
3. Mask property, useful for hide sensitive data like password
4. Fix for record destructuring

## Installation

Powershell

```powershell
Install-Package Serilog.CustomDestructurePolicy
```

dotnet cli

`dotnet add package Serilog.CustomDestructurePolicy`

## Usage

### Builtin Policies

```csharp
using Serilog.CustomDestructurePolicy;

record User(int Id, string Name, string Password, string Secret)
{
    public static int MaxAge = 60;
}

var logger = new LoggerConfiguration()
	.Destructure.ByCustomRules(rule =>
	{
        // ignore static property
		rule.IgnoreStatic();
        // ignore compiler generated
		rule.IgnoreGeneratedByCompiler();
        // ignore `EqualityContract` property
		rule.ByProperRecordProcessing();
        // replace all property named 'Password' with 3 asterisks (default: 5 asterisks)
		rule.Masking("***", new[] {"Password"});
        // ignore all properties named: Secret, Sensitive
		rule.Excluding("Secret", "Sensitive");
	}).CreateLogger();

logger.Information("User data {@User}", new User(1, "world", "my_password", "confidental"));
// printing:
// User data { Id: 1, Name: "world", Password: "***" }
```

### Custom Policy

Applying custom rule is the main feature of this extension. It can be combined with builtin policy as well. To exclude certain property matching rule, you can use this:

```csharp
var logger = new LoggerConfiguration()
	.Destructure.ByCustomRules(rule =>
	{
        // ignore readonly property
		rule.AddPolicy("exclude readonly", isExcluded: p => !p.CanWrite)
        // apply builtin policies
		rule.IgnoreGeneratedByCompiler()
            .ByProperRecordProcessing()
            .Masking("***", new[] {"Password"});
	}).CreateLogger();
```

or you can mutate the value like follows:

```csharp
// append 'Hello' for all 'Name' property which is not empty
rule.AddPolicy("add hello", (p, originalValue) =>
p.Name == nameof(Test.Name) && originalValue is string word && !string.IsNullOrWhiteSpace(word), originalValue => $"Hello {value}!");
```

This mutations are passing value from previous policy. So it can be combined like follows:

```csharp
bool IsStringNamePropertyName(PropertyInfo p, object value) => p.Name == nameof(Test.Name) && value is string word && !string.IsNullOrWhiteSpace(word);
rule
    // append 'Hello' for all 'Name' property which is not empty
    .AddPolicy("add hello", IsStringNamePropertyName, originalValue => $"Hello {originalValue}!")
    // add welcome message
    .AddPolicy("add welcome", IsStringNamePropertyName, originalValue => $"{originalValue} Welcome home");

// prints:
// User data { Id: 1, Name: "Hello world! Welcome home", Password: "my_password", Secret: "confidental" }
```
In case there is issue (such as the process stops at logging), you can enable debug mode using `SelfLog.Enable(msg => System.Diagnostics.Debug.WriteLine(msg));`. This is useful to trace problem. This extension logs which rule excludes or apply certain formatting.

## Inspiration

This extension is inspired by [masking.serilog](https://github.com/evjenio/masking.serilog) which issue with [record destructuring](https://github.com/evjenio/masking.serilog/issues/5) and the issue hasn't been resolved at the moment. Unfortunately, serilog doesn't support [multiple destructuring](https://github.com/serilog/serilog/issues/1581). It means, which destructor configured first, that policy will be applied. So creating new destructure policy extension will not solve the problem. Thus this extension create, the main goal of this extension is making as customizable as possible.


text:
[![Stories in Ready](https://badge.waffle.io/citizenlabsgr/openbudgetgr.svg?label=ready&title=Ready)](http://waffle.io/citizenlabsgr/openbudgetgr)
[![Build Status](https://travis-ci.org/citizenlabsgr/openbudgetgr.svg?branch=master)](https://travis-ci.org/citizenlabsgr/openbudgetgr)

# Open Budget Grand Rapids

**Slack:** #project-openbudgetgr

**Project Description:**
We are developing a way to better understand the budget process for the City of Grand Rapids. This will be the follow-up to the initial 2016 release of [openbudgetgr.org](http://openbudgetgr.org).

Our Open Budget project intends to promotes a deeper understanding of the city budget, so that citizens, officials, and other stakeholders can engage in more informed dialogue about how the City of Grand Rapids currently works and how it should in the future.

The Open Budget website is built using Node.js. The project is run locally on a computer. After acquiring and formatting the budget data properly you publish the website using Harp to compile the static files necessary for a Github posted website.

**Project Guide:**  [@allen](https://citizenlabs.slack.com/messages/@allen/)

**Maintainers (people with write access):**
* None at this time

**Data:**
- Source:
  - [Grand Rapids Open Data Portal](http://data.grcity.us/)  (2016 data)

### Getting started:  -- Outline each project will have it's own
* Browse our help wanted issues. See if there is anything that interests you.
* Core maintainers and project guides are responsible for reviewing and merging all pull requests. In order to prevent frustrations with your first PR we recommend you reach out to our core maintainers who can help you through your first PR.
* Updates to documentation or readme are greatly appreciated and make for a great first PR. They do not need to be discussed in advance and will be merged as soon as possible.

### Skills
- Documentation
- Data collection
- Data visualization
- Civic Engagement
- Design
- Javascript
- Jade
- Sass
- Bootstrap
- React

repository: carlvlewis/openbudgetgr

repo_name: carlvlewis/openbudgetgr


text:
# Rust-LV2's Atom handling library.

A library for reading and writing [LV2's](https://lv2plug.in/) Atom type system, used by [`rust-lv2`](https://crates.io/crates/lv2), a safe, fast, and ergonomic framework to create [LV2 plugins](http://lv2plug.in/) for audio processing, written in Rust.

LV2 has it's own type system to make data exchange between plugins as versatile and portable as possible. Basic integer and float types are supported as well as vectors, event sequences, and URID->Atom maps.

## Documentation

The original LV2 API (in the `C` programming language) is documented by ["the LV2 book"](https://lv2plug.in/book/). This book is in the process of being translated to Rust along with the development of `rust-lv2` [(link)](https://janonard.github.io/rust-lv2-book/) and describes how to properly use `rust-lv2`.

## Features

Like any other crate of `rust-lv2`, this crate has the optional `host` feature. Some of the types defined by some crates are only useful for testing or LV2 hosts. Since the goal of this framework is to provide an easy way to create plugins, these aren't necessary and therefore gated behind that feature.

## License

Licensed under either of

 * Apache License, Version 2.0
   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
 * MIT license
   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

branch_name: refs/heads/develop

gha_language: Rust


text:
# gdriver-go

Used for uploading files from a directory and its sub-directories to Google Drive.

## Setup
A `etc/client_secret.json` file will need to be created. Follow these instructions:

1. Use [this wizard](https://console.developers.google.com/start/api?id=drive) to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials.
2. On the Add credentials to your project page, click the Cancel button.
3. At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button.
4. Select the Credentials tab, click the Create credentials button and select OAuth client ID.
5. Select the application type Other, enter your desired name, and click the Create button.
6. Click OK to dismiss the resulting dialog.
7. Click the (Download JSON) button to the right of the client ID.
8. Move this file to your `etc/` directory and rename it to `client_secret.json`.

On first run, follow the instructions in the program to allow access to your Google Drive account.

repository: pjankovsky/gdriver-go

gha_language: Go

repo_name: pjankovsky/gdriver-go


text:
Played with Selenium.

Looked at [TestNG](http://testng.org).  Noticed how they use annotations to
earmark the tests and fixture methods.

Took another at [Junit 4.1](http://junit.org).  Played with it a bit in order
to try using annotations.  It was not so easy since they actually removed many
of the familiar trappings of JUnit 3.  Gone is the Swing `TestRunner`.  All
that is left is the text runner and now it is called
`org.junit.runner.JUnitCore`.  Go figure.

I remember being fairly disappointed that JUnit had gone the route of
annotations.  It makes life harder for tool makers.  :-)


text:
# Interface

The package provides and interface `\Astrotomic\Translatable\Contracts\Translatable` which describes the public API. It could be that the trait defines more public methods but they aren't part of the defined public API and won't force a new major release if changed or removed.

In addition to the interface we rely on the following methods which will, if changed or removed, also trigger a new major release.

## protected Interface

```php
interface TranslatableProtected
{
    // detect if a given translation attribute value is empty or not
    protected function isEmptyTranslatableAttribute(string $key, $value): bool;

    // save all attached translations
    protected function saveTranslations(): bool;
}
```

repository: Astrotomic/laravel-translatable

branch_name: refs/heads/main

gha_language: PHP

gha_license_id: MIT

repo_name: Astrotomic/laravel-translatable


text:
---
layout: post
title: "Simple CSS progressbar"
date: 2012-02-02 22:39
comments: true
categories: css html js
---
I thought about developing a fast and simple statusboard, that can e.g. display statistics from a webapplication. And of course, it needs all kinds of status-displays. Here is one, a simple progress-bar, that can also display peak levels (or reference levels).

So no more big words, here's the link:

[https://gist.github.com/82ed3d423969a2e6526f](https://gist.github.com/82ed3d423969a2e6526f) (Just use it if you like it)

repository: timbuchwaldt/blog

extension: markdown

repo_name: timbuchwaldt/blog


text:
---
layout: single
permalink: /commands.html
redirect_to:
  - http://docs.unrealcv.org/en/master/reference/commands.html
---
# The command system

Unreal Engine 4 has some built-in commands to help game development. These commands can be typed into a built-in console. Using these commands, a developer can profile the game performance and view debug information.  To invoke the built-in console of a game, type the ` key (the key above tab).

UnrealCV adds a set of commands useful for computer vision research. What is more, these UnrealCV commands can be used by an external program.

# Command cheatsheet

  This command list is growing and subject to change

[Contact us](/contact.html) to tell us what missing functions are useful for your project. We will consider to add it in the future release. This page is generated from UnrealCV automatically. To see the update-to-date help message.
Use {% include script.html key="ls.py" %} to generate the table below.

| URI                                                  | Description                                                |
|:-----------------------------------------------------|:-----------------------------------------------------------|
| vget /objects                                        | Get the name of all objects                                |
| vget /object/[obj_name]/color                        | Get the labeling color of an object (used in object instance mask)   |
| vset /object/[obj_name]/color [r] [g] [b]            | Set the labeling color of an object                        |
| vget /camera/[id]/location                           | Get camera location [x, y, z]                              |
| vget /camera/[id]/rotation                           | Get camera rotation [pitch, yaw, roll]                     |
| vset /camera/[id]/location [x] [y] [z]               | Set camera location [x, y, z]                              |
| vset /camera/[id]/rotation [pitch] [yaw] [roll]      | Set camera rotation [pitch, yaw, roll]                     |
| vget /camera/[id]/[viewmode]                         | Get [viewmode] from the [id] camera, for example: vget /camera/0/depth  |
| vget /camera/[id]/[viewmode] [filename]              | Same as the above, with an extra parameter for filename    |
| vset /viewmode [viewmode]                            | Set ViewMode to (lit, normal, depth, object_mask)          |
| vget /viewmode                                       | Get current ViewMode                                       |
| vget /unrealcv/status                                | Get the status of UnrealCV plugin                          |
| vget /unrealcv/help                                  | List all available commands and their help message         |

gha_language: CSS


text:
# jdnssec-tools

* http://www.verisignlabs.com/jdnssec-tools/
* https://github.com/dblacka/jdnssec-tools/wiki

Author: David Blacka<EMAIL_ADDRESS>
This is a collection of DNSSEC tools written in Java.  They are intended to be an addition or replacement for the DNSSEC tools that are part of BIND 9.

These tools depend upon DNSjava (http://www.xbill.org/dnsjava), the Jakarta Commons CLI and Logging libraries (https://commons.apache.org/proper/commons-cli), and Sun's Java Cryptography extensions.  A copy of each of these libraries is included in the distribution.  Currently, these tools use a custom version of the DNSjava library with minor modifications, which is provided.

See the "licenses" directory for the licensing information of this package and the other packages that are distributed with it.

Getting started:

1. Unpack the binary distribution:

        tar zxvf java-dnssec-tools-x.x.x.tar.gz

2. Run the various tools from their unpacked location:

        cd java-dnssec-tools-x.x.x
        ./bin/jdnssec-signzone -h

Building from source:

1. Unpack the source distribution, preferably into the same directory that the binary distribution was unpacked.

        tar zxvf java-dnssec-tools-x.x.x-src.tar.gz

2. Edit the build.properties file to suit your environment.
3. Run Ant (see http://ant.apache.org for information about the Ant build tool).

        ant

4. You can build the distribution tarballs with 'ant dist'.  You can run the tools directly from the build area (without building the jdnssec-tools.jar file) by using the ./bin/_jdnssec_* wrappers.

The source for this project is available in git on github: https://github.com/dblacka/jdnssec-tools

Source for the modified DNSjava library can be found on github as well: https://github.com/dblacka/jdnssec-dnsjava

---

Questions or comments may be directed to the author<EMAIL_ADDRESS>or sent to the<EMAIL_ADDRESS>mailing list (https://lists.verisignlabs.com/mailman/listinfo/dnssec).

gha_language: Java


text:
+++
title = "Creating IAM Policies"
chapter = false
weight = 20
+++

Before creating your website, the Lambda will need a certain IAM role and permission. This permits the Lambda's function
to assume the right identity at runtime, log into CloudWatch to aid with debugging, and to use the DynamoDB table defined in the previous step:

```typescript
const handlerRole = new aws.iam.Role("handler-role", {
    assumeRolePolicy: {
        Version: "2012-10-17",
        Statement: [{
            Action: "sts:AssumeRole",
            Principal: {
                Service: "lambda.amazonaws.com"
            },
            Effect: "Allow",
            Sid: "",
        }],
    },
});

const handlerPolicy = new aws.iam.RolePolicy("handler-policy", {
    role: handlerRole,
    policy: hits.arn.apply(arn => JSON.stringify({
        Version: "2012-10-17",
        Statement: [
            {
                Action: [
                    "dynamodb:UpdateItem",
                    "dynamodb:PutItem",
                    "dynamodb:GetItem",
                    "dynamodb:DescribeTable",
                ],
                Resource: arn,
                Effect: "Allow",
            },
            {
                Action: ["logs:*", "cloudwatch:*"],
                Resource: "*",
                Effect: "Allow",
            },
        ],
    })),
});
```

{{% notice info %}}
The `index.ts` file should now have the following contents:
{{% /notice %}}
```typescript
import * as AWS from "aws-sdk";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
import * as pulumi from "@pulumi/pulumi";

const hits = new aws.dynamodb.Table("hits", {
    attributes: [{ name: "Site", type: "S" }],
    hashKey: "Site",
    billingMode: "PAY_PER_REQUEST",
});

const handlerRole = new aws.iam.Role("handler-role", {
    assumeRolePolicy: {
        Version: "2012-10-17",
        Statement: [{
            Action: "sts:AssumeRole",
            Principal: {
                Service: "lambda.amazonaws.com"
            },
            Effect: "Allow",
            Sid: "",
        }],
    },
});

const handlerPolicy = new aws.iam.RolePolicy("handler-policy", {
    role: handlerRole,
    policy: hits.arn.apply(arn => JSON.stringify({
        Version: "2012-10-17",
        Statement: [
            {
                Action: [
                    "dynamodb:UpdateItem",
                    "dynamodb:PutItem",
                    "dynamodb:GetItem",
                    "dynamodb:DescribeTable",
                ],
                Resource: arn,
                Effect: "Allow",
            },
            {
                Action: ["logs:*", "cloudwatch:*"],
                Resource: "*",
                Effect: "Allow",
            },
        ],
    })),
});
```

repository: jaxxstorm/aws-modernization-with-pulumi

repo_name: jaxxstorm/aws-modernization-with-pulumi


text:
# quantum chemistry calculation workflow

Requirements:
- start with molecular coordinates
- calculate quantum mechanical wavefunction

1. Input molecular coordinates from file
2. Gather basis set from file and place on atoms
3. Calculate overlap (S), kinetic energy (T), nuclear-electron attraction (V) integrals
4. Calculate initial guess by diagonalizing H = T + V
5. Do SCF iterations: integral direct TEIs, solve HF equations...
6. ...
7. Profit!

# Plan post-2019-04-20

- [x] Find crate containing gamma function: `rgsl`?
- [x] Find crate containing n-dimensional array crate w/ eigendecomposition (`nalgebra`, `ndarray`)
- [ ] What format should input files be in (Conf, TOML, JSON? not YAML)
- [x] Read in JSON-formatted basis set definitions from EMSL
- [x] ~~How to store basis sets? Can we wrap https://github.com/MolSSI-BSE/basis_set_exchange (Python)?~~ Yes

repository: berquist/rchem

repo_name: berquist/rchem


text:
# iTunesBackupParser
A playground to play with iTunes backups plists.

Currently can parse Info.plist of iTunes backup and show:
- List of Apple IDs with their corresponding iTunes PurchaserIDs
- List of apps installed with each Apple ID

Sample output:
```
▿ 2 key/value pairs
  ▿ (2 elements)
    - key<EMAIL_ADDRESS>    - value:<PHONE_NUMBER>
  ▿ (2 elements)
    - key<EMAIL_ADDRESS>    - value:<PHONE_NUMBER>8
▿ 2 key/value pairs
  ▿ (2 elements)
    - key<EMAIL_ADDRESS>    ▿ value: 1 element
      - "Dicty - universal dictionary shell"
  ▿ (2 elements)
    - key<EMAIL_ADDRESS>    ▿ value: 3 elements
      - "7 Minute TV Workout"
      - "Ad Block Multi"
      - "Monzo Bank"
```

Served its purpose for me (radaring really hard to reproduce [bug](https://openradar.appspot.com/radar?id=4937807214673920) to Apple) so never went to wrap it up as a console utility.
If you're fancy to do this, PRs are most welcome.

repository: rshev/iTunesBackupParser

repo_name: rshev/iTunesBackupParser


text:
#### WebRTC Part of Screen Sharing Demos

1. [Realtime Chat](https://googledrive.com/host/0B6GWd_dUUTT8RzVSRVU2MlIxcm8/realtime-chat/)
2. [No-WebRTC Realtime Chat](https://googledrive.com/host/0B6GWd_dUUTT8RzVSRVU2MlIxcm8/realtime-chat/No-WebRTC-Chat.html)
3. [Part of Screen Sharing](https://googledrive.com/host/0B6GWd_dUUTT8RzVSRVU2MlIxcm8/part-of-screen-sharing/)
4. [Part of Screen Sharing using RTCDataChannel](https://googledrive.com/host/0B6GWd_dUUTT8RzVSRVU2MlIxcm8/part-of-screen-sharing/RTCDataChannel/)

=

#### Browser Support

WebRTC [Part of Screen Sharing using RTCDataChannel](https://googledrive.com/host/0B6GWd_dUUTT8RzVSRVU2MlIxcm8/part-of-screen-sharing/RTCDataChannel/) experiment works fine on following web-browsers:

| Browser        | Support           |
| ------------- |:-------------:|
| Firefox | [Stable](http://www.mozilla.org/en-US/firefox/new/) |
| Firefox | [Aurora](http://www.mozilla.org/en-US/firefox/aurora/) |
| Firefox | [Nightly](http://nightly.mozilla.org/) |
| Google Chrome | [Canary](https://www.google.com/intl/en/chrome/browser/canary.html) |

=

#### License

These WebRTC **Part of Screen Sharing** experiments are released under [MIT licence](https://www.webrtc-experiment.com/licence/) . Copyright (c) 2013 [Muaz Khan](https://plus.google.com/100325991024054712503).

repository: anshumanchatterji/WebRTC-Experiment

repo_name: anshumanchatterji/WebRTC-Experiment


text:
Pattern: Use of unsafe class

Issue: -

## Description

The class is unsafe, wrong usage can cause memory/resource leaks. This can for instance be fixed by adding proper cleanup in the destructor.

## Further Reading

* [Common Weakness Enumeration (CWE) - 398](https://cwe.mitre.org/data/definitions/398.html)

repository: Adroiti/docs-for-code-review-tools

repo_name: Adroiti/docs-for-code-review-tools


text:
---
indicator: 3.b.2
layout: indicator
permalink: /3-b-2/
sdg_goal: '3'
target_id: 3.b
published: true
target_name: >-
  Support the research and development of vaccines and medicines for the
  communicable and non‑communicable diseases that primarily affect developing
  countries, provide access to affordable essential medicines and vaccines, in
  accordance with the Doha Declaration on the TRIPS Agreement and Public Health,
  which affirms the right of developing countries to use to the full the
  provisions in the Agreement on Trade-Related Aspects of Intellectual Property
  Rights regarding flexibilities to protect public health, and, in particular,
  provide access to medicines for all

computation_definitions: >-
  <b> Data unavailable (Type4) </b>   <br>
  There are currently no national statistics (Type 1), international statistics (Type 2), or alternative national statistics (Type 3) available. The Data of Type 1, type 2, or type 3 can be also included in case of temporary unavailability.

indicator_name: >-
  Total net official development assistance to medical research and basic health
  sectors

indicator_definition: >-
  Gross disbursements of total ODA and other official flows to the medical research and basic health sectors of developing countries.

global_indicator_name: >-
  Total net official development assistance to medical research and basic health
  sectors

un_designated_tier: I
un_custodian_agency: Organisation for Economic Co-operation and Development (OECD)

goal_meta_link: 'https://unstats.un.org/sdgs/metadata/files/Metadata-03-0b-02.pdf'
goal_meta_link_text: 'https://unstats.un.org/sdgs/metadata/files/Metadata-03-0b-02.pdf'

goal_meta_local_link: 'https://kostat-sdg-kor.github.io/sdg-indicators/public/data/Metadata-03-0b-02_ENG.pdf'
goal_meta_local_link_text: 'https://kostat-sdg-kor.github.io/sdg-indicators/public/data/Metadata-03-0b-02_ENG.pdf'

reporting_status: notapplicable
data_non_statistical: false
graph_type: line
title: Untitled
data_show_map: false
source_active_1: true

source_organisation_1: Organisation for Economic Co-operation and Development (OECD)

# source_periodicity_1: Not applicable
source_active_2: true
source_active_3: false
source_active_4: false
source_active_5: false
source_active_6: false
---

repository: kostat-sdg-kor/sdg-data

gha_language: Shell

repo_name: kostat-sdg-kor/sdg-data


text:
# startup-community-test-1

There are many OpenSource project on git Repos site with MIT license which are like one treasure, so by writing some automatic team making scripts those project could be one startup and those who have good progress could have more consulting services. So I am trying to build one site to grab the MIT licence project from Git Repos sites and suggest one startup by using some of the FREE Startups tools said here: https://github.com/Ibexoft/awesome-startup-tools-list

The final result could be one community via the internet for startup teams working with it's digital money as it's revenue and one parameter as it's efficiency

## To Do:

1- find similar project for suggesting the

startups by scraping scripts

2- suggesting some competition by team building scripts like to-do lists and multiuser games!!

 2-1 Automatic team making by some sorting algorithms like seeing some video and answering some question

 2-2 giving users digital money by seeing some videos and participating on some challenges (exam, asking question and ... Find proper intelligence challenges!)

 2-3 finding wild strategies for human rations and try avoid those actions.

 2-3-1 find needed team job working and try to suggest some educational game method to increase the team power

 2-3-2 find some popular games and interjection their mechanism to increase teams capabilities for startup

3- Try to consider these terms on yours codes :
3-1-the time based of psychological time meaning

3-2- justice (codes are more justice!!)

3-3- ethics for strategies to findings the project (contact by project owner to give it's permission to be as startup)

3-4- failure situation of one startup:

 ## Related news:

1- [GitHub Enterprise](https://github.com/enterprise) is now free through Microsoft for Startups [(link)](https://github.blog/2020-02-13-github-enterprise-is-now-free-through-microsoft-for-startups/)

2- [How to use github for startup works ](https://dev.to/mesadhan/the-complete-dev-startup-organization-setup-with-github-44kk)


text:
# RSS Bot

This provides a simple bot that is able to publish RSS news articles into a chatroom, by consuming RSS feeds.  The RSS feeds are configurable by the members of the room.  As usual, type /help to get the bot to provide help information.  This is standalone, and just requires `application.yml` to run (no database needed).

Add the bot to a room (or 1-1 chat) and type /help to begin configuring your RSS feeds in Symphony.

## Some Screenshots

### Main Menu

![The Main Menu](images/menu.png)

Type help to get the menu

### Subscribed Feeds

![Subscribed Feeds](images/configure-streams.png)

Subscribe to multiple feeds in a single room

### News Articles

![Feed](images/feed.png)

News arrives into your room on a configurable schedule

### Filters

![Filters](images/filters.png)

You can filter in/out keywords from the news articles

### Add A New Feed

![Add](images/add.png)

Just drop in the URL of a feed to configure it.

## Other Features

### Schedule

You can set the schedule (in minutes) for each room the bot is in by typing '/every {x}'.

### Room-Admins Only

You can type '/makeAdminOnly' to permit only room admins to change the feeds.  '/notAdminOnly' will reverse this.

## Configuration

### Proxies

You can configure the bot to use proxies to collect the data. This follows the same format as `symphony-api-spring-boot-starter` e.g.

```
symphony:
  rss:
    proxies:
      - host: somehost.com
        port: 8080
      - host: <none>
      - host: someotherhost.com
        port: 8090
```

The RSS bot will initially try each proxy in turn to set up the feed, and then store the correct proxy with the feed for later use.

### Success / Failure Messages

You can customize the messages returned to the user when they set up an RSS Feed:

```
symphony:
  rss:
    successMessage: "Your RSS Feed Is Configured!"
    failureMessage: "Failed to set up - please talk to Pete"
```

### Observation Stream

To monitor the details of the RSS stream that have been set up, create an observation room, and add your support team to it.  Add the RSS bot to the room too, and configure the stream id in the `application.yml` file:

```
symphony:
  rss:
    observationStream: PfY25Q2nATxpHfVqkWMAkH///ogG8demdA==
```

## Things To Note

- In this example, we are using the chat-workflow module to define the "look" of the messages with the bot.
- We use the article messages themselves to track what has already been published in the room.
- The `FeedList` object is held in the room - this contains the details of the feeds you've subscribed to.
- We have custom Freemarker templates for the look of the articles and the feedlist.
- We're using Spring's Scheduling to download the feeds every hour.
- Every month, we pause the feed and send a message to the user asking them to resume it.  This stops the bot posting to rooms that aren't interested anymore.


text:
# Useful Linux Network Commmands

**Step 1:** Go to the Katacoda Ubuntu Playground

`https://katacoda.com/courses/ubuntu/playground`

**Step 2:** Execute the following commands. Have fun!

**COMMAND: ifconfig**

_ifconfig reports the IP Address and Hardware / MAC address information assigned to the network interface and also the MTU (Maximum transmission unit) size._

Example: `ifconfig`

* To read the manual page type, `man ifconfig`.
* To  get help type, `ifconfig --help`.

Example: `ping nbc.com`

* To read the manual page type, `man ping `.
* To  get help type, `ping --help`.

You'll get output similar to, but not exactly like the following:

```text
PING nbc.com (<IP_ADDRESS>) 56(84) bytes of data.
64 bytes from a2-21-41-34.deploy.static.akamaitechnologies.com (<IP_ADDRESS>): icmp_seq=1 ttl=59 time=11.2 ms
64 bytes from a2-21-41-34.deploy.static.akamaitechnologies.com (<IP_ADDRESS>): icmp_seq=2 ttl=59 time=11.3 ms
64 bytes from a2-21-41-34.deploy.static.akamaitechnologies.com (<IP_ADDRESS>): icmp_seq=3 ttl=59 time=11.5 ms
64 bytes from a2-21-41-34.deploy.static.akamaitechnologies.com (<IP_ADDRESS>): icmp_seq=4 ttl=59 time=11.3 ms
64 bytes from a2-21-41-34.deploy.static.akamaitechnologies.com (<IP_ADDRESS>): icmp_seq=5 ttl=59 time=11.1 ms
```

**COMMAND: traceroute**

_traceroute is a network utility that shows the number of hops taken to reach destination and also t0 determine packets traveling path_

This command requires that you in install, `traceroute`. To do the installlation, enter the following at the command line:

`apt update && apt install traceroute -y`

Once installed, execute the example.

Example: `traceroute -I nbc.com`

* To read the manual page type, `man traceroute `.
* To  get help type, `ping --traceroute `.

You'll get output similar to, but not exactly like the following:

```text
traceroute to nbc.com (<IP_ADDRESS>), 30 hops max, 60 byte packets
 1  <IP_ADDRESS> (<IP_ADDRESS>)  0.556 ms  0.535 ms  0.530 ms
 2  static.<IP_ADDRESS>.clients.your-server.de (<IP_ADDRESS>)  0.645 ms  0.653 ms  0.652 ms
 3  core22.fsn1.hetzner.com (<IP_ADDRESS>)  0.741 ms  0.743 ms  0.742 ms
 4  core1.fra.hetzner.com (<IP_ADDRESS>)  5.333 ms  5.344 ms  5.343 ms
 5  <IP_ADDRESS> (<IP_ADDRESS>)  10.048 ms  10.057 ms  10.057 ms
 6  xe-1-2-1.cr0-mil2.ip4.gtt.net (<IP_ADDRESS>)  23.408 ms  19.911 ms  19.858 ms
 7  ip4.gtt.net (<IP_ADDRESS>)  21.941 ms  23.573 ms  23.551 ms
 8  a2-22-32-148.deploy.static.akamaitechnologies.com (<IP_ADDRESS>)  19.823 ms  19.915 ms  19.912 ms
```

**COMMAND: netstat**

_netstat (Network Statistic) displays connection info, routing table information, etc..._

Example: `netstat -v`

* To read the manual page type, `man netstat `.
* To  get help type, `netstat --help`.

You'll get output similar to, but not exactly like the following:

```text
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 <IP_ADDRESS>:ssh         <IP_ADDRESS>:42704       ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ]         DGRAM                    9543     /run/systemd/journal/syslog
unix  2      [ ]         DGRAM                    50268    /run/user/0/systemd/notify
unix  2      [ ]         DGRAM                    9477     /run/systemd/notify
unix  3      [ ]         STREAM     CONNECTED     73987
unix  3      [ ]         DGRAM                    11564
unix  2      [ ]         DGRAM                    11486
unix  3      [ ]         STREAM     CONNECTED     13830    /run/containerd/containerd.sock
unix  3      [ ]         STREAM     CONNECTED     12841
unix  3      [ ]         STREAM     CONNECTED     12825    /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     14537
unix  3      [ ]         STREAM     CONNECTED     12842    /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     14538
unix  2      [ ]         STREAM     CONNECTED     11484
unix  3      [ ]         STREAM     CONNECTED     13828    /run/containerd/containerd.sock
unix  3      [ ]         STREAM     CONNECTED     73988
unix  3      [ ]         STREAM     CONNECTED     14502    /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     12824
unix  3      [ ]         STREAM     CONNECTED     13815
unix  3      [ ]         STREAM     CONNECTED     12622
unix  3      [ ]         STREAM     CONNECTED     12621
unix  3      [ ]         STREAM     CONNECTED     12623    /var/run/dbus/system_bus_socket
unix  3      [ ]         STREAM     CONNECTED     11075
unix  2      [ ]         STREAM                   50251
unix  3      [ ]         DGRAM                    11563
netstat: no support for `AF IPX' on this system.
netstat: no support for `AF AX25' on this system.
netstat: no support for `AF X25' on this system.
netstat: no support for `AF NETROM' on this system.
```
**COMMAND: dig**

_Dig (domain information groper) query DNS related information like A Record, CNAME, MX Record etc. This command mainly use to troubleshoot DNS related query._

Example: `dig www.github.com`

* To read the manual page type, `man dig `.
* To  get help type, `dig --help`.

Example `nslookup www.devops.com`

* To read the manual page type, `man nslookup `.
* To  get help type, `nslookup --help`.

You'll get output similar to, but not exactly like the following:

```text
Server:         <IP_ADDRESS>
Address:        <IP_ADDRESS>#53

Non-authoritative answer:
www.devops.com  canonical name = devops.com.
Name:   devops.com
Address: <IP_ADDRESS>
```

**COMMAND: route**

_route command also displays and manipulates ip routing table information._

Example `route`

* To read the manual page type, `man route `.
* To  get help type, `route --help`.

You'll get output similar to, but not exactly like the following:

```text
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         <IP_ADDRESS>      <IP_ADDRESS>         UG    0      0        0 ens3
<IP_ADDRESS>      *               <IP_ADDRESS>     U     0      0        0 ens3
<IP_ADDRESS>      *               <IP_ADDRESS>   U     0      0        0 docker0
```

**COMMAND: host**

_host correlates a domain name to an IP address in IPv4 or IPv6 format. You can also use it to query DNS records._

Example `host rollingstone.com`

* To read the manual page type, `man host `.
* To  get help type, `host --help`.

You'll get output similar to, but not exactly like the following:

```text
rollingstone.com has address <IP_ADDRESS>
rollingstone.com has address <IP_ADDRESS>
rollingstone.com has address <IP_ADDRESS>
rollingstone.com has address <IP_ADDRESS>
rollingstone.com mail is handled by 10 us-smtp-inbound-1.mimecast.com.
rollingstone.com mail is handled by 20 us-smtp-inbound-2.mimecast.com.
rollingstone.com mail is handled by 10 us-smtp-inbound-2.mimecast.com.
```

**COMMAND: arp**

_arp (Address Resolution Protocol) views contents of and adds content to the the kernel’s [ARP tables](http://www.pearsonitcertification.com/articles/article.aspx?p=2339639&seqNum=4)._

Example `arp -e`

* To read the manual page type, `man arp `.
* To  get help type, `arp --help`.

You'll get output similar to, but not exactly like the following:

```text
Address                  HWtype  HWaddress           Flags Mask            Iface
<IP_ADDRESS>               ether   02:42:2c:a6:1d:f4   C                     ens3
<IP_ADDRESS>              ether   06:fe:dd:72:0e:33   C                     ens3
<IP_ADDRESS>              ether   02:42:ac:11:00:31   C                     ens3
```

**COMMAND: hostname**

_hostname reports the actual host name of the machine_

Example `hostname `

* To read the manual page type, `man hostname `.
* To  get help type, `hostname --help`.

You'll get output similar to, but not exactly like the following:

`host01`


text:
# FACE CLASIFIER

The objective of the project is to use an Artificial Neural Network to classify between photos of two male subjects. We extracted features of the subject’s eyes, nose and mouth using Minimum Eigenvalue Algorithm to extract the corner points. Then, this information is reduced to a vector that will be used as an input for the Artificial Neural Network Training and Classification.

## How to use it?

Follow this steps:

1. Clone this repository.
2. Run the *main.m* file using *src* as the current folder in Matlab.
3. Chose the desired image from *img* folder.
4. Visualize the results.

## How is it structured?

In the general the program is divided in the following files and folders:

* [Data](data): Contains *Subject0.mat* & *Subject1.mat* Matlab databases that have the data of extracted features of the corresponding subject images.
* [Images](img): Contains the images used in this program it has two subfolders named *Subject0* and *Subject1* with two hundred image files that are photos of each subject.
  * NOTE: The original set of images are from the MIT and can be found [here](http://cbcl.mit.edu/software-datasets/heisele/facerecognition-database.html).
* [Output](out): with the *net.mat* file that is a Matlab database containing the ANN created by *neuralNetworkTraining.m* the folder also contains a net92.mat file that is a copy of Matlab database containing the best ANN obtained with 92.8% of accuracy.
* [Source Code](src): it has the following functions and scripts.
  * createFeatureDatabase.m: Matlab Script that creates Subject0.mat and Subject1.mat files using featureExtraction.m function iteratively over all the images of each subject.
  * *extractObject.m*: Matlab function that can extract the portion of an image containing a face, mouth or eyes.
  * *featureExtraction.m*: Matlab function that can calculate the features of one particular image.
  * *main.m*: Main Matlab Script that shows how the neural network can be used for classification.
  * *neuralNetworkTraining.m*: Matlab Script that creates, trains and saves the ANN.
  * *processImages.m*: Matlab Script that changes the format of the images from .pgm to .jpg and renames in ascendant order for each subject.

## How it works?

The program has 4 main stages, preprocessing, feature extraction, training and classification. This stages are described below.

### Preprocessing

The original images where converted from .pgm to .jpg extension. This change, along with the renaming makes the further processing easier and faster since iterations can be done in a straight way. We also eliminate some not needed information from the original files metadata.

### Feature extraction

This is made in the following way:

1.  First, we find the eyes, nose and mouth using the CascadeObjectDetector function from the vision toolbox of Matlab.
2.  Then, we extract the Minimum Eigenvalue corner points of each of this sections of the face.
3.  We combine this results in the original image.
4.  After this, we create a new image using this points and their Metric.
5.  We resize this image to 10 by 10 pixels in order to process less data in the training of the NN.
6.  The next thing to do is convert this matrix into a vector of 100 elements.
7.  The final vector will be the normalized version of the previous one that is calculated by dividing the vector by the maximum value of it.

### Training Neural Network

For training to be done properly we divide the data set in the following way:
* 70% (140 images of each subject) for training,
* 15% (30 images of each subject) for validation and,
* 15% (30 images of each subject) for testing.

We used 20 layers of hidden neurons in a Feed Forward Neural Network.

### Classification

We can test over any image of the dataset our trained NN to obtain a classification. The program will display your current image, its parts (eyes, nose and mouth) and the corner points along with the percentage of certainty of the classification.

## What results did we obtained?

We got a 92.8% overall accuracy in our best result. From the confusion matrix we can see that Subject0 will be classified correctly 94.5% of the times and 91% of the times for a Subject1.

## License

This work is under the [MIT License](LICENSE).

repository: MarianoOG/FaceClasifier

repo_name: MarianoOG/FaceClasifier


text:
# LaunchDarklyApi.DataExportDestinationsApi

All URIs are relative to *https://app.launchdarkly.com/api/v2*

Method | HTTP request | Description
------------- | ------------- | -------------
[**deleteDestination**](DataExportDestinationsApi.md#deleteDestination) | **DELETE** /destinations/{projectKey}/{environmentKey}/{destinationId} | Get a single data export destination by ID
[**getDestination**](DataExportDestinationsApi.md#getDestination) | **GET** /destinations/{projectKey}/{environmentKey}/{destinationId} | Get a single data export destination by ID
[**getDestinations**](DataExportDestinationsApi.md#getDestinations) | **GET** /destinations | Returns a list of all data export destinations.
[**patchDestination**](DataExportDestinationsApi.md#patchDestination) | **PATCH** /destinations/{projectKey}/{environmentKey}/{destinationId} | Perform a partial update to a data export destination.
[**postDestination**](DataExportDestinationsApi.md#postDestination) | **POST** /destinations/{projectKey}/{environmentKey} | Create a new data export destination

# **deleteDestination**
> deleteDestination(projectKey, environmentKey, destinationId, )

Get a single data export destination by ID

### Example
```javascript
var LaunchDarklyApi = require('launchdarkly-api');
var defaultClient = LaunchDarklyApi.ApiClient.instance;

// Configure API key authorization: Token
var Token = defaultClient.authentications['Token'];
Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.apiKeyPrefix = 'Token';

var apiInstance = new LaunchDarklyApi.DataExportDestinationsApi();

var projectKey = "projectKey_example"; // String | The project key, used to tie the flags together under one project so they can be managed together.

var environmentKey = "environmentKey_example"; // String | The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

var destinationId = "destinationId_example"; // String | The data export destination ID.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.deleteDestination(projectKey, environmentKey, destinationId, , callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **projectKey** | **String**| The project key, used to tie the flags together under one project so they can be managed together. |
 **environmentKey** | **String**| The environment key, used to tie together flag configuration and users under one environment so they can be managed together. |
 **destinationId** | **String**| The data export destination ID. |

### Return type

null (empty response body)

### Authorization

[Token](../README.md#Token)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

# **getDestination**
> Destination getDestination(projectKey, environmentKey, destinationId, )

Get a single data export destination by ID

### Example
```javascript
var LaunchDarklyApi = require('launchdarkly-api');
var defaultClient = LaunchDarklyApi.ApiClient.instance;

// Configure API key authorization: Token
var Token = defaultClient.authentications['Token'];
Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.apiKeyPrefix = 'Token';

var apiInstance = new LaunchDarklyApi.DataExportDestinationsApi();

var projectKey = "projectKey_example"; // String | The project key, used to tie the flags together under one project so they can be managed together.

var environmentKey = "environmentKey_example"; // String | The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

var destinationId = "destinationId_example"; // String | The data export destination ID.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getDestination(projectKey, environmentKey, destinationId, , callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **projectKey** | **String**| The project key, used to tie the flags together under one project so they can be managed together. |
 **environmentKey** | **String**| The environment key, used to tie together flag configuration and users under one environment so they can be managed together. |
 **destinationId** | **String**| The data export destination ID. |

### Return type

[**Destination**](Destination.md)

### Authorization

[Token](../README.md#Token)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

# **getDestinations**
> Destinations getDestinations()

Returns a list of all data export destinations.

### Example
```javascript
var LaunchDarklyApi = require('launchdarkly-api');
var defaultClient = LaunchDarklyApi.ApiClient.instance;

// Configure API key authorization: Token
var Token = defaultClient.authentications['Token'];
Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.apiKeyPrefix = 'Token';

var apiInstance = new LaunchDarklyApi.DataExportDestinationsApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getDestinations(callback);
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**Destinations**](Destinations.md)

### Authorization

[Token](../README.md#Token)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

# **patchDestination**
> Destination patchDestination(projectKey, environmentKey, destinationId, patchOnly)

Perform a partial update to a data export destination.

### Example
```javascript
var LaunchDarklyApi = require('launchdarkly-api');
var defaultClient = LaunchDarklyApi.ApiClient.instance;

// Configure API key authorization: Token
var Token = defaultClient.authentications['Token'];
Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.apiKeyPrefix = 'Token';

var apiInstance = new LaunchDarklyApi.DataExportDestinationsApi();

var projectKey = "projectKey_example"; // String | The project key, used to tie the flags together under one project so they can be managed together.

var environmentKey = "environmentKey_example"; // String | The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

var destinationId = "destinationId_example"; // String | The data export destination ID.

var patchOnly = [new LaunchDarklyApi.PatchOperation()]; // [PatchOperation] | Requires a JSON Patch representation of the desired changes to the project. 'http://jsonpatch.com/' Feature flag patches also support JSON Merge Patch format. 'https://tools.ietf.org/html/rfc7386' The addition of comments is also supported.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.patchDestination(projectKey, environmentKey, destinationId, patchOnly, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **projectKey** | **String**| The project key, used to tie the flags together under one project so they can be managed together. |
 **environmentKey** | **String**| The environment key, used to tie together flag configuration and users under one environment so they can be managed together. |
 **destinationId** | **String**| The data export destination ID. |
 **patchOnly** | [**[PatchOperation]**](PatchOperation.md)| Requires a JSON Patch representation of the desired changes to the project. 'http://jsonpatch.com/' Feature flag patches also support JSON Merge Patch format. 'https://tools.ietf.org/html/rfc7386' The addition of comments is also supported. |

### Return type

[**Destination**](Destination.md)

### Authorization

[Token](../README.md#Token)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

# **postDestination**
> Destination postDestination(projectKey, environmentKey, destinationBody)

Create a new data export destination

### Example
```javascript
var LaunchDarklyApi = require('launchdarkly-api');
var defaultClient = LaunchDarklyApi.ApiClient.instance;

// Configure API key authorization: Token
var Token = defaultClient.authentications['Token'];
Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Token.apiKeyPrefix = 'Token';

var apiInstance = new LaunchDarklyApi.DataExportDestinationsApi();

var projectKey = "projectKey_example"; // String | The project key, used to tie the flags together under one project so they can be managed together.

var environmentKey = "environmentKey_example"; // String | The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

var destinationBody = new LaunchDarklyApi.DestinationBody(); // DestinationBody | Create a new data export destination.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.postDestination(projectKey, environmentKey, destinationBody, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **projectKey** | **String**| The project key, used to tie the flags together under one project so they can be managed together. |
 **environmentKey** | **String**| The environment key, used to tie together flag configuration and users under one environment so they can be managed together. |
 **destinationBody** | [**DestinationBody**](DestinationBody.md)| Create a new data export destination. |

### Return type

[**Destination**](Destination.md)

### Authorization

[Token](../README.md#Token)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json


text:
# clue/qdatastream

[![CI status](https://github.com/clue/php-qdatastream/workflows/CI/badge.svg)](https://github.com/clue/php-qdatastream/actions)
[![installs on Packagist](https://img.shields.io/packagist/dt/clue/qdatastream?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/clue/qdatastream)

Lightweight PHP library that allows exchanging binary data with Qt programs (QDataStream)

**Table of contents**

* [Usage](#usage)
  * [Writer](#writer)
  * [Reader](#reader)
  * [QVariant](#qvariant)
  * [Types](#types)
* [Install](#install)
* [Tests](#tests)
* [License](#license)

## Usage

### Writer

The `Writer` class can be used to build a binary buffer string from the
structured data you write to it.

```php
$user = new stdClass;
$user->id = 10;
$user->active = true;
$user->name = 'Alice';

$writer = new Writer();
$writer->writeUInt($user->id);
$writer->writeBool($user->active);
$writer->writeQString($user->name);

$data = (string)$writer
file_put_contents('user.dat', $data);
```

See the [class outline](src/Writer.php) for more details.

### Reader

The `Reader` class can be used to read data from a binary buffer string.

```php
$data = file_get_contents('user.dat');
$reader = new Reader($data);

$user = new stdClass();
$user->id = $reader->readUInt();
$user->active = $reader->readBool();
$user->name = $reader->readQString();
```

See the [class outline](src/Reader.php) for more details.

### QVariant

The `QVariant` class can be used to encapsulate any kind of data with an
explicit data type. When writing a `QVariant` to a buffer, it will also
include its data type so that reading it back in can be done automatically
without having to know the data type in advance.

```php
$variant = new QVariant(100, Types::TYPE_USHORT);

$writer = new Writer();
$writer->writeQVariant($variant);

$data = (string)$writer;
$reader = new Reader($data);
$value = $reader->readQVariant();

assert($value === 100);
```

Additionally, you can use the `writeQVariant()` method without having to specify
the data type in advance and let this class "guess" an appropriate data
type for serialization and add this type information to the serialized data.
This works similar to JSON encoding and accepts primitive values of type `int`,
`bool`, `string`, `null` and nested structures or type `array` or instances of `stdClass`:

```php
$rows = [
    (object)[
        'id' => 10,
        'name' => 'Alice',
        'active' => true,
        'groups' => ['admin', 'staff']
    ]
];

$writer = new Writer();
$writer->writeQVariant($rows);

$data = (string)$writer;
$reader = new Reader($data);
$values = $reader->readQVariant();

assert(count($values) === 1);
assert($values[0]->id === 10);
assert($values[0]->groups[0] === 'admin');
```

Note that associative arrays and `stdClass` objects be will serialized as a "map",
while vector arrays will be serialized as a "list". In order to avoid confusion
between these similar data structures, using instances of `stdClass` is considered
the preferred method in this project.

See the [class outline](src/QVariant.php) for more details.

### Types

The `Types` class exists to work with different data types and offers a number
of public constants to work with explicit data types and is otherwise mostly
used internally only.

See the [class outline](src/Types.php) for more details.

## Install

The recommended way to install this library is [through Composer](https://getcomposer.org).
[New to Composer?](https://getcomposer.org/doc/00-intro.md)

This will install the latest supported version:

```bash
$ composer require clue/qdatastream:^0.8
```

See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

This project aims to run on any platform and thus does not require any PHP
extensions and supports running on legacy PHP 5.3 through current PHP 8+.
It's *highly recommended to use PHP 7+* for this project.

The `QString` and `QChar` types use the `ext-mbstring` for converting
between different character encodings.
If this extension is missing, then this library will use a slighty slower Regex
work-around that should otherwise work equally well.
Installing `ext-mbstring` is highly recommended.

## Tests

To run the test suite, you first need to clone this repo and then install all
dependencies [through Composer](https://getcomposer.org):

```bash
$ composer install
```

To run the test suite, go to the project root and run:

```bash
$ php vendor/bin/phpunit
```

## License

This project is released under the permissive [MIT license](LICENSE).

> Did you know that I offer custom development services and issuing invoices for
  sponsorships of releases and for contributions? Contact me (@clue) for details.

repository: clue/qdatastream

repo_name: clue/qdatastream


text:
# Marca-hypertext-highlight

Code highlighting for
[Marca-hypertext](https://github.com/sdangelo/marca-hypertext) based on
[highlight.js](https://highlightjs.org/).

I am too lazy to explain hows and whys.

## TODO

* splitElem() with begin and end;
* make line splitting optional?
* overlapping markup is painful... what to do?
* allow interfacing with other highlighters/parsers;
* use Marca as highlighters/parsers output rather than HTML?
* otherwise implement full list of HTML entities decoding?
* allow non-span elements in HTML output?
* browserification;
* more DRY;
* API review;
* documentation;
* tests.

license: ISC

repository: sdangelo/marca-hypertext-highlight

repo_name: sdangelo/marca-hypertext-highlight


text:
Projected births for Venezuela.

![Line chart that shows the number of people births in Venezuela from 1955 to 2020. After 2020 it shows the projected
number of births made by the United Nations. Points of interest: at the end of 2015 there were 2.9 million births in Venezuela,
in 2020 there were 2.6 million births in the country. The projection has 3 variants: high variant 3.6 million births by 2100,
medium variant 1.6 million births by 2100 and low variant 0.6 million births by 2100.](https://github.com/luisfrein/-30DayChartChallenge/blob/master/D28.Future/D28.Future.png)

repository: UN-AVT/kamino-source

repo_name: UN-AVT/kamino-source