text:
---
layout: post
title: Understanding Stein's paradox
date: 2021-1-2
description: An intuitive explanation of the James-Stein estimator.
categories: machine-learning
image:
  feature: constellations3.jpg
---

## The paradox

Stein's paradox is among the most surprising results in statistics.  The basic
idea is easily stated, but it is difficult to understand how it could possibly
be true.  The premise is this: suppose that I have a Gaussian distribution with
a variance of unity and some mean which I don't tell you.  I then draw a single
sample from this distribution, give it to you, and ask you to guess the mean.
What do you do?  Well, you don't have a lot of information to go on here, so
you just guess that the mean is the number I gave you.  This is a good guess!
(We will make the notion of a "good guess" a little more precise later on.)

No big surprise there.  Now we play again, but this time, my distribution is a
*two*-dimensional Gaussian.  The covariance is the identity matrix (so this is
equivalent to sampling from two independent one-dimensional Gaussians).  But
again I have not told you the mean (which is now a two-dimensional vector).
Once more I draw a single sample from the distribution, hand it over to you,
and ask you to guess the mean.  You simply guess that the mean is the sample I
have given you.  Once more you have guessed well!

Now we do the same thing in three dimensions.  I draw a single sample, hand it
over to you, and ask you to guess the mean.  Just as before, you guess that the
mean is the sample I gave you.  But this is no longer a good guess!  Stein's
paradox is that if we play this game in three dimensions or more, a better
guess is to say that the mean is this:

$$
\hat{\mu} = \textrm{ReLU} \left(1 - \frac{D - 2}{|\mathbf{x}|^2} \right)
\mathbf{x},
$$

where $$D$$ is the dimensionality of the Gaussian, and $$\mathbf{x}$$ is the
sample drawn from the distribution.  This is the so-called "James-Stein
estimator."

Who would have thought!  What is going on here?

## What makes a guess good?

Before we go on, we should clarify exactly what we mean by a "good guess."  We
are trying to do what is called "parameter estimation" in statistics --- based
on a sample from a distribution, we want to infer some underlying parameter (or
parameters) of the distribution.  (In this case the parameter we are interested
in is the mean.)  In order to quantify how good or bad our estimate is we
choose a function called a "loss function."  There is some freedom in choosing
a loss function, but the mean squared error is a common choice and has a lot of
valuable properties.  Stein's paradox assumes that we are using the mean
squared error.  So if we guess that the mean is $$\hat{\mu}$$ and the true
value of the mean is $$\mu$$, then the loss is

$$
\mathcal{L} = |\hat{\mu} - \mu|^2.
$$

Now, of course, we need some rule to go from the sample $$\mathbf{x}$$ to the
estimate $$\hat{\mu}$$.  This rule is just a function of some kind, say,
$$f(\mathbf{x})$$.  This function has the special name of an "estimator."  We
can choose whatever function we want here.  Our original guess was to just use
$$f(\mathbf{x}) = \mathbf{x}$$.  But another choice here is to say
$$f(\mathbf{x}) = \mathbf{x} + 7$$, or $$f(\mathbf{x}) = \sin(\mathbf{x}) /
\mathbf{x}^{71}$$, or even just $$f(\mathbf{x}) = 31$$.  It doesn't take much
imagination to see that there are an infinite number of possible choices.  But
presumably some of these choices are better than others.  How do we know which
ones are good?

Statisticians use the concept of *risk* for this purpose.  Risk is simply the
expected value of your loss function.  One thing that can be a little confusing
is that the risk is a function of *both* your choice of estimator *and* the
true value of the parameter itself.  So in the original game where you're
guessing the mean of a one-dimensional Gaussian, the risk will be a function of
whatever rule you decide to use and the actual, unknown value of the mean.

The fact that the risk is a function of the true value of the parameter makes
things a little tricky.  If you're trying to decide between two estimators, you
might find that one estimator works better for certain values that the
parameter can take, and the other works better for others.    Our original
estimator was $$\hat{\mu} = x$$.  But another, perfectly valid, estimator is
$$\hat{\mu} = 7$$.  In other words we ignore the sample entirely and say that
the mean is 7 no matter what.  Generally this doesn't seem like a smart thing
to do.  But if the mean turns out to actually be pretty close to 7, on average
this will be the better guess!  Specifically, the risk of our initial estimator
is

$$
\begin{eqnarray}
\mathcal{R}_{x} & = & \mathbb{E} \left[ \left(x - \mu \right)^2 \right] \\
& = & \frac{1}{\sqrt{2\pi}} \int (x - \mu)^2 e^{-(x-\mu)^2 / 2} \, dx \\
& = & 1.
\end{eqnarray}
$$

And the risk on our second, dumb estimator is

$$
\begin{eqnarray}
\mathcal{R}_{\textrm{dumb}} & = & \mathbb{E} \left[ \left(7 - \mu\right)^2
\right] \\
& = & \frac{1}{\sqrt{2\pi}}\int (7 - \mu)^2 e^{-(x - \mu)^2 / 2} \, dx \\
& = & (7 - \mu)^2.
\end{eqnarray}
$$

As long as the true mean, $$\mu$$, happens to be between 6 and 8, the dumb
estimator of just saying 7 actually has lower risk!

Based on this example it might seem that we're stuck.  Since we don't know the
true value of the mean, we can't generally say if one estimator is better than
another.  And indeed this is often the case.  But there are certain situations
where this is not true.  If we have two estimators and one of them has a lower
risk *for any possible value the parameter can take*, we can say that one is
definitively better than the other.  In statistical parlance, we say that the
worse estimator is "inadmissable."

In more precise terms, Stein's paradox states that in three dimensions or more,
the naive estimator (just guessing that the mean is $$\mathbf{x}$$) is
inadmissable because the risk of the James-Stein estimator is lower for any
possible mean I could choose.

## What is the James-Stein estimator doing?

Before we can understand *why* the James-Stein estimator gives you a better
guess than the naive estimator $$\textbf{x}$$, we should understand *what*
exactly it's doing.  The idea is that we take the naive guess $$\textbf{x}$$
and then we scale it towards the origin by some amount.  The factor by which we
scale it is:

$$
\textrm{ReLU}\left(1 - \frac{D - 2}{| \textbf{x}|^2} \right).
$$

The ReLU function simply takes the maximum of its argument and zero, so this
scale factor will be either positive or zero.  Let's suppose that it's
positive.  In this case we scale it towards the origin more if the magnitude of
the sample is smaller and less if it is lower.  In the limit of $$|\textbf{x}|
\to \infty$$ we don't change it at all and our guess reduces to the naive
estimator $$\textbf{x}$$.

In the other limit, if $$|\textbf{x}|$$ is very small, then the ReLU function
will kick in and just set the scale factor to zero.    And all else being equal we will shrink our estimate more in higher
dimensional spaces than in lower dimensional spaces.

So that is what the James-Stein estimator is doing.  Why does it work?  Before
we can answer that we need to take a quick detour.

## Samples in high dimensional spaces

High dimensional spaces are counterintuitive.  One of the counteruintitive
properties of high dimensional distributions is this: a sample from a symmetric
high dimensional distirbution is highly likely to be further from the origin
than the mean.  Specifically, for an isotropic $$D$$-dimensional Gaussian, the
difference between the average distance to a sample and the distance to the
mean grows as $$\sim$$$$\sqrt{D}$$.

It's a little strange to put it this way, but isn't so surprising with a little
bit of thought.  Even in two dimensions we can see that this is the case just
by drawing it:

{% include image name="circle-origin.png" %}

The shaded area of the circle is less than half the area, so we are less likely
to choose a sample closer to the origin than the mean.  What perhaps makes this
counterintuitive is that in two dimensions a fairly large fraction of the
circle is still shaded.  But as the dimensionality increases, this fraction
decreases exponentially.  Once the dimensionality is even moderately large we
are highly unlikely to sample a point in this shaded region.

One caveat here is that this effect decreases the larger the mean is.  You can
imagine that as we move the circle further away from the origin, the shaded
fraction gets closer and closer to ½.  So long as the mean is sufficiently
large, the probability of sampling a point closer to the origin than the mean
can be close to ½ even in high dimensional spaces; it just requires a very
large mean.  We can start to see here the connection to the James-Stein
estimator, which also gets very close to the naive estimator $$\mathbf{x}$$ as
the mean (and hence $$|\mathbf{x}|$$) gets very large.

What we are doing by shrinking the estimate towards the origin is correcting
for the tendency of the typical sample to be slightly further away from the
origin than the mean.  This correction allows us to reduce the overall risk of
the estimate. [[^6]]

## How arbitrary is the origin, really?

Stein's paradox is particularly strange because there are actually two
counterintuitive things going on:

1. The origin is arbitrary, so why does moving your estimate towards the origin
   help?
2. Why does this not work in one or two dimensions?

Let's take a look at the first of these.  A central principle in physics is
that of relativity --- coordinate systems are arbitrary, so the laws of physics
must be valid in all of them.  Surely this is also true in statistics as well.
We can choose the origin to be wherever we like, so it cannot contain any
information.  But this sensible assertion is false.  Statistics is not physics.

If we truly had no information about the mean, what value would the sample
have?  If it could really be *anything* then presumably its value would be
exceedingly large.  After all, there are a lot of numbers, almost all of them
are too big to write down, and the mean could be absolutely *any* of them.  But
if we pick a sample and find that its distance from the origin is 3.72 there
must be something fishy going on.  Clearly we have, in fact, managed to embed
*some* information in our choice of coordinate system.  The only reason we have
gotten out sensible values in our sample is because we have some prior as to
where the mean is expected to be.

In fact, in the limit of no information $$| \mathbf{x} |$$ will be infinitely
large and the James-Stein estimator will reduce to the naive estimator,
$$\mathbf{x}$$.  So it was our clever choice of origin that smuggled
information into our estimator and allowed us to do better than the naive
estimate.

It's important to distinguish between the *direction* of the origin and the
*distance* between the origin and the mean.  The direction of the origin is
unimportant.  In fact, we could shrink our estimate in any direction and we
would still get the benefits of the James-Stein estimator.  The
important thing is the distance between the origin and the mean --- this is
what has encoded some prior information that we can exploit to make a better
prediction.

## The bias-variance tradeoff

The way the James-Stein estimator works can be understood by looking at the
bias-variance tradeoff.  The bias-variance tradeoff states that the risk of an
estimator can be decomposed into two components: a constant "bias" term, which
reflects how far off the average value of the estimate is from the correct
value; and an unbiased "variance" term, which accounts for the randomness of
the sample.

The naive estimator $$\textbf{x}$$ is unbiased but has a high variance.  One
reason that Stein's paradox seems unnatural is that we tend to confuse unbiased
estimators with estimators that minimize risk.  But in high dimensional spaces,
samples from an isotropic Gaussian encompass a tremendous volume.  Although our
naive estimate is unbiased it has very high variance.

What the James-Stein estimator does is scale the overall distribution towards
the origin, thereby shrinking the volume of the distribution (and hence its
variance), at the cost of introducing a little bit of bias.  Although the
estimator is now biased its overall risk is lower.

## Deriving the James-Stein estimator geometrically

At this point we have some idea as to why shrinking the estimate towards the
origin could be helpful, but we haven't yet figured out why the specific form
of the James-Stein estimator seems to work.  To do this we'll follow an
argument presented by [Brown & Zhao (2012)][1].

Remember that the direction of the coordinate system is arbitrary.  So let's
rotate into a new one where one axis points directly toward the mean, and the
other $$D - 1$$ axes are pointed in arbitrary (orthogonal) directions.  (Of
course, *you* can't do this because you don't know where the true mean is.  But
*I* do, and I've decided to help you out.)  In this coordinate system the mean
is just $$(|\mu|, 0, \ldots, 0)$$.  Let's write the sample in this coordinate
system as $$(\zeta_1, \zeta_2, \ldots, \zeta_D)$$.

The loss for our guess can now be broken into two orthogonal components: one
component, $$(\zeta_1 - |\mu|)^2$$, which tells us how far off our estimate is
from the true value when it's projected onto the correct direction of the mean;
and a second component, $$\sum_{i=2}^D \zeta_i^2$$, which tells us how far off
our estimate is from this correct direction.  Let's call this second component
the "residual" component and define it as

$$
\rho \equiv \sqrt{\sum_{i = 2}^D \zeta_i^2}.
$$

Our underlying distribution is isotropic, so rotating the coordinate system
doesn't change the fact that each coordinate $$\zeta_i$$ is a sample from an
independent one-dimensional Gaussian with unit variance.  And if $$i > 1$$ then
the mean of this distribution is zero as well.  $$\rho$$ therefore follows a
[$$\chi$$ distribution][3] with $$D - 1$$ degrees of freedom.

Let's suppose that we've gone and chosen a sample from our distribution and by
good fortune $$\zeta_1$$ happens to be exactly equal to $$|\mu|$$.  In general
the rest of the $$\zeta_i$$ in the sample won't be exactly zero and so $$\rho$$
will be positive.  If we plot $$\zeta_1$$ on the $$x$$-axis and $$\rho$$ on the
$$y$$-axis, the situation will look like this:

{% include image name="SteinsTriangle-1.png" %}

The sample from our distribution is the point at the top right of the triangle.
If we just use this sample as our estimate of the mean then the loss of this
estimate will simply be the squared distance between the point and the bottom
right corner of the triangle, or $$\rho^2$$.

### How *can* we transform the sample?

We only have two points in this problem: the origin, and the sample
$$\textbf{x}$$.  By symmetry this means that the only way by which we can make
an estimate is to choose a point somewhere on the line between the origin and
$$\textbf{x}$$. [[^5]] In other words, you don't actually know what direction
any of the $$\zeta_i$$ are in so you can't simply move your guess down the
right side of the triangle to reduce $$\rho$$.  The only direction you are
allowed to move your sample is along the hypoteneuse of this triangle.

### How *should* we transform the sample?

The beauty of the James-Stein estimator is that even though we are constrained
to move the sample along the hypoteneuse, we can nevertheless reduce the
distance between our guess and the true mean by shrinking it until the
direction between our guess and the mean is perpendicular to the hypoteneuse.

{% include image name="SteinsTriangle-2.png" %}

Some simple geometry reveals that this new point is located at:

$$
\left(1 - \frac{\rho}{|\mu|^2 + \rho^2} \right) \textbf{x} = \left(1 -
\frac{\rho}{|\textbf{x}|^2} \right) \textbf{x}
$$

This is looking like the beginnings of the James-Stein estimator!

What exactly is $$\rho$$?  Unfortunately $$\rho$$ is random variable, but let's
represent it by some central point of its distribution.  Now $$\rho$$ follows a
$$\chi$$ distribution with $$D - 1$$ degrees of freedom and the mode of this
distribution is $$D - 2$$.  So if we simply represent this distribution by its
mode, our estimator becomes

$$
\left(1 - \frac{D - 2}{|\textbf{x}|^2} \right) \textbf{x},
$$

which is the James-Stein estimator without the ReLU.

To be clear, this is a very hand-wavey argument.  Representing the entire
distribution by a single point is not particularly sophisticated, and there is
no special reason to choose to use the mode instead of the mean or median
except that it happens to give an answer that corrseponds to the James-Stein
estimator. [[^2]]

### Can we derive the James-Stein estimator rigorously?

Given how hand-wavey this argument was, you might wonder whether it's possible
to rigorously derive the James-Stein estimator by explicitly calculating the
risk given the Gaussian and $$\chi$$ distributions, and then finding the
function that minimizes the risk using the calculus of variations.  However
this approach will not work.  The reason is that the James-Stein optimizer does
not actually minimize the risk!  In fact, despite its fame, the James-Stein
estimator is itself inadmissible.

As we'll see below, we can improve our estimator by wrapping it in a ReLU
function.  But the ReLU function introduces some difficulties, because there is
a very general theorem which states that any admissible estimator must be a
Bayes estimator for some prior, or the limit of Bayes estimators. [[^1]]  This
ends up implying that the estimator must be a smooth function and the ReLU
function is not smooth.  So while the James-Stein estimator beats the naive
estimator $$\textbf{x}$$, there exists some other estimator which beats it!

### Recovering the ReLU

There is one last piece to tackle: the ReLU function.  Where does that come
from?

The ReLU has no effect on our estimate as long as $$|\textbf{x}| \geq D - 2$$.
This will generally be the case if $$|\mu|$$ is large.  But if $$|\mu|$$ is
small, then some of the points sampled will have $$|\textbf{x}| < D - 2$$.  If
we were to just use the same scaling we derived above, we would reflect our
estimate through the origin and make it negative!  This estimate has a worse
loss than an estimate at the origin.

The reason for this is that once we have shrunk the sample all the way down to
the origin we have already traded away all the variance for bias.  In other
words, we started with an estimate that had no bias and high variance, and
ended up with an estimate that had high bias and no varaiance.  But if we were
to keep going past the origin, we'd continue to increase the bias but would
start to increase the variance as well!  This is strictly worse than keeping
our estimate at the origin, so we are better off clamping the estimate at zero
with a ReLU function.

## Why does Stein's paradox not hold in two dimensions?

Let's now turn to the second counterintuitive property of Stein's paradox:
what's so special about three dimensions?  It is not hard to see why the
James-Stein estimator doesn't help in one dimension --- we arrived at the
James-Stein estimator by separating the sample into two components, one along
the direction to the true mean, and the other as a residual component
perpendicular to the first.  But in one dimension there is no residual
component!  By shrinking your estimate towards the origin you introduce some
bias, but this is not counterbalanced by the reduction in variance.

But what about the two dimensional case?  Here again we unfortunately must wave
our hands.  In the two dimensional case we do, in fact, reduce the variance by
shrinking our estimate towards the origin, just not by enough to offset the
bias we introduce.  While the orthogonal component, $$\rho$$, is not
identically zero as it was in the one-dimensional case, it is strongly bunched
up close to zero in the two dimensional case.  The idea of the James-Stein
estimator is to note that a certain proportion of a sample's magnitude is due
to a component orthogonal to the mean and to shrink the estimate to reduce that
othogonal component somewhat.  But if the magnitude of the orthogonal component
is too small, this won't always work.  There are some values of the mean for
which the James-Stein estimator is better, but others where it is worse.  It is
not the better estimator no matter what.

### A digression on random walks

As an aside, there is a [deep correspondence][2] found by Lawrence Brown
between random walks and the admissibility of the naive estimator,
$$\textbf{x}$$.  Brown showed that the naive estimator is admissible if and
only if a random walk returns to the origin an infinite number of times.
Random walks in one or two dimensions do this, but random walks in three or
more dimensions do not.  At a high level this is because the random walk drifts
away from the origin at a rate linear in the dimensionality of the space, but
the volume subtended by the origin at a fixed distance decays exponentially
with dimension.  In one or two dimensions the volume subtended by the origin is
large enough that you are guaranteed to eventually make your way back to it.
But in higher dimensions, the volume subtended is smaller, so that as time
progresses you are less and less likely to make your back and the probability
approaches zero even in the limit of an infinite number of steps.

While rigorously proving this correspondance is non-trivial, both problems have
at their core a comparison between the distance between a point and the origin
and the volume of the unit sphere in the space.

## There be dragons far from the origin

So that, at a high level, is why the James-Stein estimator works.  We've been
focused in this post on the simplest form of Stein's paradox, which is a bit of
a toy problem.  But the artificiality of the problem shouldn't befog us as to
the significance of these ideas.  The artificiality eases the analysis, but in
fact the concepts that Stein's paradox illustrates run much deeper through
statistics and machine learning.

As we discussed earlier on, while we usually don't think that there is anything
special about our choice of origin, we do neveretheless use it to smuggle in
some priors, even if those priors are weak and we perhaps do so unwittingly.
This is also true of machine learning models, maybe even more so.  For most
machine learning models the origin really *is* special.  For example, at the
origin most garden-variety neural networks will exhibit particularly simple
behavior --- they will output all zeros indpendent of the input. [[^3]]  Any
movement away from this special point will introduce complexity into the
functional behavior of the model.  Neural networks are, of course, non-linear,
so it is not always true that points further from the origin in parameter space
are more complicated, but it is *generally* true.

Most ML practitioners appreciate that techniques like L2 regularization have
the effect of making models simpler, and therefore less likely to overfit.  But
Stein's paradox dramatically illustrates the relationship between the risk of
an estimate and the dimensionality of the space --- in high dimensional spaces
there is *much* more volume further away from the origin than closer to it.  We
are oftentimes better off introducing bias in order to reduce variance because
in high dimensional spaces shrinking a small amount towards the origin reduces
an *enormous* volume of parameter space.  In other words, for a large machine
learning model, there are *vastly* more ways to overfit than there are to
underfit so we should bias our models towards underfitting because that is a
simpler problem to solve than overfitting.  (Or maybe to put it another way,
underfitting is a small number of problems, whereas overfitting is a stupendous
number of problems.)

This phenomenon can manifest itself during neural network training.  Suppose we
have converged on a local minimum in the loss landscape after training with
some varaint of stochastic gradient descent.  At convergence there will be
equality between the stochastic component of SGD, for which the random walk is
causing the parameters to drift away from the minimum, and the true gradient,
which is pushing the parameters towards the minimum. [[^4]]  At this point the
neural network is wandering on some high-dimensional ellipsoid around the
minumum.  But by the nature of high dimensional spaces, the neural network will
*always* be further from the origin than the minimum, and therefore on the side
of too much complexity.  Thus this converged model will always slightly
overfit.

The further the model recedes from the origin, the more inexplicable its
functional behavior can become.  The moral of this story is that far from the
origin there be dragons, and in a high dimensional space, moving just a little
further away from the origin introduces lots and lots of dragons.  The
James-Stein estimator advises you to stay close to the origin to keep your risk
down and the dragons at bay.

----

## Footnotes

[^1]:
    A Bayes estimator is determined by a particular choice of prior.  A "limit
    of Bayes estimators" is found by taking the limit of the Bayes estimators
    found from a sequence of priors as the sequence tends to infinity.

[^2]:
    The median and mean of the $$\chi$$ distribtion are more complicated but
    are asymptotically equal to the mode in the limit of a large number of
    degrees of freedom.  But the asymptotic limit does not help you prove the
    case for $$D = 3$$.

    In fact Brown & Zhao (2012) chose to use the mean instead and derive a
    $$(D - 1) / |\textbf{x}|^2$$ term instead of $$(D - 2) / |\textbf{x}|^2$$
    as we do from the mode.  They then argue that the extra $$-1 /
    |\textbf{x}|^2$$ is due to the variance in $$\zeta_1$$.  I am not fully
    convinced of this argument; it seems to me that once one has represented
    the entire distribution by a central point one is already waving one's
    hands.

[^3]:
    Of course the origin is not the only point that exhibits this behavior.  I
    speculate that if we shrank to any point for which the model had functional
    simplicity we would observe the same benefits as shrinking towards the
    origin.

[^4]:
    Learning rate decay also mitigates this issue.

[^5]:
    While there's nothing stopping us from choosing some other random
    direction, this adds no new information and so is effectively the same as
    choosing a different origin.

[^6]:
    It's important to note that this does not imply that our original estimate
    is biased.  In fact the naive estimator is unbiased and shrinking it
    towards the origin introduces bias.  It is the distance of the naive
    estimator from the origin that is biased high.  But by correcting for
    *this* bias we happen to reduce the risk.

[1]: https://projecteuclid.org/download/pdfview_1/euclid.ss/1331729980

[2]: http://stat.wharton.upenn.edu/~lbrown/Papers/1971b%20Admissible%20estimators,%20recurrent%20diffusions,%20and%20insoluble%20boundary%20value%20problems.pdf

[3]: https://en.wikipedia.org/wiki/Chi_distribution

gha_language: Jupyter Notebook


text:
## Description

Broadcast (emit) messages to the server. By default, it sends to the 'message' topic.

## Usage

**Basic Usage**:
```javascript
import { from } from 'rxjs';
import { send, ws } from '@bottlenose/rxws';

const messagesToSend$ = from([
  {body: 'data'},
  {body: 'more data'},
]);
const ws$ = ws({url: 'wss://mysite.com'});
const messages$ = ws$.pipe(
  send(messagesToSend$)
);

messages$.subscribe(); // this will attempt to send the messages to the server
```

## API
```typescript
send(
  messagesToSend$<Observable>,
  topic<String> = 'message'
)
```

### Since
1.0

### Parameters
* `messagesToSend$<Observable>`: An Observable containing messages that will be sent to the server (whenever a message is emitted)
* `topic<String>`: The topic to which the events should be published. Defaults to `'message'`.

### Options
None

### Returns
`{topic<String>,message<Any>}`

license: MIT

repository: buccaneerai/bottlenose

branch_name: refs/heads/dev

extension: md

gha_language: JavaScript

gha_license_id: NOASSERTION

license_type: permissive

repo_name: buccaneerai/bottlenose


text:
Building with CMake {#build-cmake}
===
<!--
 Note: License header cannot be first, as doxygen does not generate
 cleanly if it before the '==='
-->
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
[TOC]

## Quick start:

  Building and testing Log4cxx on a Unix platform with packaged APR and APR-Util.

  Make sure cmake 3.13+, g++ and make are available, install or
  build apr 1.x, apr-util 1.x, gzip and zip.

Linux example:
~~~
$ apt-get install build-essential libapr1-dev libaprutil1-dev gzip zip
$ cd apache-Log4cxx-x.x.x
$ mkdir build
$ cd build
$ ccmake ..
$ make
$ sudo make install
~~~

Windows Example:
Building and testing Log4cxx on a Microsoft Windows with APR, Expat and APR-Util built from source
extracted into apr-1.7.4, libexpat(from github) and apr-util-1.6.3 in %HOMEPATH%/Libraries.

~~~
$ cd %HOMEPATH%/Libraries
$ cmake -S libexpat/expat -B buildtrees/expat -DCMAKE_INSTALL_PREFIX=%HOMEPATH%/Libraries/installed
$ cmake --build buildtrees/expat --target install --config Release
$ cmake -S apr-1.7.4 -B buildtrees/apr -DCMAKE_INSTALL_PREFIX=%HOMEPATH%/Libraries/installed
$ cmake --build buildtrees/apr --target install --config Release
$ set CMAKE_PREFIX_PATH=%HOMEPATH%/Libraries/installed
$ cmake -S apr-util-1.6.3 -B buildtrees/apr-util -DCMAKE_INSTALL_PREFIX=%HOMEPATH%/Libraries/installed
$ cmake --build buildtrees/apr-util --target install --config Release
$ cmake -S apache-Log4cxx-x.x.x -B buildtrees/Log4cxx -DCMAKE_INSTALL_PREFIX=%HOMEPATH%/Libraries/installed
$ cmake --build buildtrees/Log4cxx --target install --config Release
~~~

## CMake options

| Option                 | Usage |
|------------------------|-------|
| -DLOG4CXX_WCHAR_T=no   | Enable wchar_t API methods, choice of yes (default), no.                                    |
| -DLOG4CXX_UNICHAR=yes  | Enable UniChar API methods, choice of yes, no (default).                                    |
| -DLOG4CXX_CFSTRING=yes | Enable CFString API methods, requires Mac OS/X CoreFoundation, choice of yes, no (default). |
| -DBUILD_TESTING=off    | Do not build tests.  Tests are built by default                                             |
| -DBUILD_SHARED_LIBS=off| Build Log4cxx as a static library. A dynamically linked Log4cxx library is built by default. Any compilation unit that includes a Log4cxx header must define LOG4CXX_STATIC.             |
| -DAPU_STATIC=yes       | Link to the APR-Util static library. By default, the Log4cxx shared library is linked to the APR-Util shared library. If BUILD_SHARED_LIBS=off, the static APR-Util library is used.     |
| -DAPR_STATIC=yes       | Link to the APR static library. By default, the Log4cxx shared library is linked to the APR shared library. If BUILD_SHARED_LIBS=off, the static APR library is always used.        |
|-DLOG4CXX_TEST_PROGRAM_PATH=path| An extra path to prepend to the PATH for test programs.  Log4cxx requires zip, sed, and grep on the PATH in order for the tests to work properly.                          |
| -DPREFER_BOOST=on      | Prefer the Boost version of dependent libraries over standard library |
| -DLOG4CXX_QT_SUPPORT=ON | Enable QString API and log4cxx::qt namespace methods, requires QtCore, choice of ON, OFF (default).                   |

# Platform specific notes:

## Mac OS/X:

APR and APR-Util are provided by the platform in Mac OS/X 10.5 and iODBC in 10.4.

cmake can be installed by typing "brew install cmake".

## Debian:

APR, APR-Util, openssl, gzip and zip may be installed by:

~~~
$ sudo apt-get install libssl-dev libapr1-dev libaprutil1-dev gzip zip
~~~

CMake can be built from source by typing:

~~~
$ wget https://github.com/Kitware/CMake/releases/download/v3.27.2/cmake-3.27.2.tar.gz
$ tar xf cmake-3.27.2.tar.gz
$ cd cmake-3.27.2
$ ./bootstrap
$ make
$ sudo make install
~~~

## FreeBSD:

APR, APR-Util, gzip and zip may be installed from the ports collection by:

~~~
$ cd /usr/ports/archivers/zip
$ make
$ make install
$ cd /usr/ports/archivers/gzip
$ make
$ make install
$ cd /usr/ports/devel/apr
$ make
$ make install
~~~

## Windows:

The easiest way to get dependencies installed is to use vcpkg(for APR/expat), and msys2 for the command-line
utilities(zip, grep, sed).

Msys2 can be downloaded from: https://www.msys2.org/
By default, this will be installed under C:\\msys2, so you can add that to the build PATH by setting
LOG4CXX_TEST_PROGRAM_PATH=C:/msys64/usr/bin in your build settings.

For vcpkg, follow the directions at https://github.com/microsoft/vcpkg#quick-start-windows and then install
the dependencies needed using `vcpkg install apr apr-util`.

# Using Log4cxx in a CMake build

A log4cxxConfig.cmake and log4cxxConfigVersion.cmake is installed to allow use of find_package()
in your CMakeLists.txt.

Below are example cmake commands that compile and link "myApplication" with Log4cxx.

~~~
find_package(log4cxx 0.11)
add_executable(myApplication myMain.cpp)
target_include_directories(myApplication PRIVATE $<TARGET_PROPERTY:log4cxx,INTERFACE_INCLUDE_DIRECTORIES>)
target_link_libraries( myApplication PRIVATE log4cxx)
~~~

branch_name: refs/heads/master


text:
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
[![Twitter Follow](https://img.shields.io/twitter/follow/strimziio.svg?style=social&label=Follow&style=for-the-badge)](https://twitter.com/strimziio)

# Strimzi UI

This repository contains the Strimzi UI and its implementation.
Strimzi UI provides a way for managing Strimzi and Kafka clusters (+ other components) deployed by it using a graphical user interface.

## Getting started

This UI uses `npm` to provide dependency management. If you wish to develop the UI, you will need:

- [npm version 6.4.1 or later](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- [node 10.15.0 or later](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)

Once these prerequisites are met, all required dependencies to build and run the UI can be downloaded by running the following command:

```
npm install
```

If you run into any issues while working in this repo, please check out [the troubleshooting guide](#troubleshooting).

### Helpful commands

`npm` scripts are provided for common tasks. These include:

- `npm run start` - runs the UI in development mode
- `npm run build` - builds the UI
- `npm run clean` - deletes the build/generated content directories
- `npm run lint` - lints the codebase. See [`Linting`](./docs/Linting.md) for the individual linting steps

## Implementation documentation

Further details around how this UI is implemented can be found below:

- [Architecture](./docs/Architecture.md)
- [Build](./docs/Build.md)
- [Linting](./docs/Linting.md)

### Known issues

#### `Signed-off-by` reported as not included in commit, when it is included

When making a commit, your commit message may look as follows:

```
feat: new feature

- adds feature X

Signed-off-by: Matthew <matthew@domain>

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      <date>
#
# On branch X
# Changes to be committed:
#	modified:   file
```

but this is rejected by commitlint:

```
husky > commit-msg (node v10.15.0)
⧗   input: feat: new feature

- adds feature X

Signed-off-by: Matthew <matthew@domain>
✖   message must be signed off [signed-off-by]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
```

This is due to [this bug](https://github.com/conventional-changelog/commitlint/issues/1809), where comments are parsed/not ignored. While this issues exists, you can work around this by removing all comments from your message, ie:

```
feat: new feature

- adds feature X

Signed-off-by: Matthew <matthew@domain>

```

repository: ajborley/strimzi-ui

repo_name: ajborley/strimzi-ui


text:
    Bid Generator

Table of contents
-----------------

* [Introduction](#introduction)
* [Development](#development)
* [Deployment](#deployment)

Introduction
------------

Welcome to the CAFF Farm to Cafeteria Bid Generator. This repository contains an application written in Ruby on Rails.

Development
------------

### MacOS Dependencies

You will need the following packages on your system:

* Postgres
* Ruby 3.0
* Node 14
* Libvips

You can install all of these dependencies with [Homebrew](https://brew.sh):

```bash
$ brew install postgres ruby node yarn vips
```

### Setting up Rails

In order to start the application locally, you will need to copy the `.env.example` file to `.env` and configure your database:

```bash
$ cp .env.example .env
$ bin/rails db:setup
```

You can then start the Bid Generator application by using the Heroku CLI:

```bash
$ heroku local
```

Alternatively, you can start the Rails server directly:

```bash
$ bin/rails server
```

The Bid Generator application will then be visible at [http://localhost:3000].

Deployment
----------

The Bid Generator relies on the following external services:

* Postgres
* Redis
* Amazon S3
* Amazon CloudFormation
* Amazon Simple Queue Service
* Amazon Simple Email Service

### Amazon Web Services

You will need an AWS account.

The Bid Generator uses the CloudFormation service to automate deployment. To create a CloudFormation stack of your own, you can click this button:

[![Launch Stack](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?templateURL=https://example-us-east-1.s3.amazonaws.com/stack.yml)

### Heroku

The production instance of Bid Generator is currently deployed to [Heroku](https://heroku.com).

To create your own hosted instance, you can click this button:

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/CAFF-F2C/bid-generator)

You will need to enter the following environment variables, accessible inside of the CloudFormation stack created above, under the Outputs tab:

* AWS_REGION
* AWS_ACCESS_KEY_ID
* AWS_SECRET_ACCESS_KEY
* BUCKET_NAME
* CDN_HOST
* DEFAULT_QUEUE_URL

repository: jparr/bid-generator

branch_name: refs/heads/main

gha_license_id: MIT

repo_name: jparr/bid-generator


text:
---
layout:     post
title:      Welcome to the blog
date:       2017-04-30
summary:    Get to know the man behind the page, and what to expect from future posts
minutes:    1
---

Hello, traveller, it seems you've stumbled upon my blog. Firstly, welcome! Secondly, you're a little early, there's not much to see here just yet, but like most I have high hopes and dreams of writing some quality blog posts for the community. How well this will play out I'm not sure, but here we are. It's a start, right?

So, a little about me. My name is Sam Turrell and I'm currently based in York, UK. I am primarily a frontend web developer, but am also fairly well versed in backend development using the Laravel PHP framework.

![netsells](/images/netsells-logo.jpg)

I'm currently the Lead Frontend Developer at a digital agency called [netsells](https://netsells.co.uk), and I love my job and the people I work with. We are currently located in the center of York, UK. We produce a range of high quality digital content, including bespoke web applications, mobile apps and general marketing and design.

Outside of my development life (in the rare moments I have free time), I enjoy gaming on my PS4, primarily racers and First Person Shooters. I'm also a big movie and TV fan and I enjoy anything Marvel/DC Comics related.

You may be wondering what I, a humble web developer, can offer you, the gracious reader, in order for you to want to return here and peruse my ~~quality~~ content? Well, I hope to cover a range of topics of interest to me, and hopefully to you. Obviously as a developer my main focus will be commentary on the web development eco-system, covering tools, packages, languages and general news.

So, please stick around if any of the above interests you. Feel free to get in touch on any of my web platforms, but I think twitter is pretty great. You can tweet me at [@SamTurrellDev](http://twitter.com/SamTurrellDev) for general development chat, or [@SamTurrell](http://twitter.com/SamTurrell) for more personal babbling.

So without further ado, let's get this show on the road. Wubba lubba dub dub.


text:
---
layout: card
title: "Agents"
---

The Lagotto software includes a number of agents. Most agents require a user account with the service. Agents collect information about works, contributors, publishers, and their relations to each other.

### Sources

In previous versions of the Lagotto software `agents` were called `sources`. Starting with version 5.0, `agents` collect information that is then stored in `sources`.

### Groups

Agents and sources are grouped based on what they add via the deposits API:

* relations
* results (relations where the subject is not specific, e.g. download counts)
* contributions
* publishers

### Relations
* [Twitter](/docs/twitter_search)
* [Nature Blogs](/docs/nature)
* [Research Blogging](/docs/researchblogging)
* [ScienceSeeker](/docs/scienceseeker)
* [Wordpress.com](/docs/wordpress)
* [Wikipedia](/docs/wikipedia)
* [Reddit](/docs/reddit)
* [OpenEdition](/docs/openedition)
* [CiteULike](/docs/citeulike)
* [CrossRef](/docs/crossref)
* [PubMed Central Citations](/docs/pubmed)
* [Europe PMC Citations](/docs/pmceurope)
* [DataCite](/docs/datacite)
* [Europe PMC Database Citations](/docs/pmceuropedata)
* [F1000Prime](/docs/f1000)
* [PLOS Comments](/docs/plos_comments)

### Results
* [PubMed Central Usage Stats](/docs/pmc)
* [Copernicus](/docs/copernicus)
* [Facebook](/docs/facebook)
* [Mendeley](/docs/mendeley)
* [Scopus](/docs/scopus)
* [Web of Science](/docs/wos)
* [PLOS Usage Stats](/docs/counter)
* [PLOS Figshare Usage Stats](/docs/figshare)

### Retired
* [Biod](/docs/biod)
* [Bloglines](/docs/bloglines)
* [Connotea](/docs/connotea)
* [Postgenomic](/docs/postgenomic)

Please use the [Issue Tracker](https://github.com/lagotto/lagotto/issues) for questions or feedback regarding agents.

## Creating a new agent
Basically, each of the APIs that Lagotto is calling will be defined as an **agent**. Lagotto provides a number of services to each agent to help it get what it needs. Note the samples provided at [http://github.com/lagotto/lagotto/tree/master/app/models/agents](http://github.com/lagotto/lagotto/tree/master/app/models/agents).

repository: rivimey/alm

gha_language: Ruby

repo_name: rivimey/alm


text:
# Neural Language Model

done as an assignment of Introduction of Natural Language Processing course, NLP | Spring 2021

## how to run :
upload datasets on drive and run the notebook on google colab.

## Average Perplexities

Kneser Training: 3.5826378214803802

Kneser Testing:<PHONE_NUMBER>788799

Kneser Validation:<PHONE_NUMBER>9185324

Witten Training: 2.710249953959174

Witten Testing: 21873464.425774388

Witten Validation: 20906925.301411595

LSTM Training = 14879.11386069286

LSTM Testing  = 39688.13258867951

LSTM Validation = 21781.48651231239

## Analysis

The first thing to mention is that the perplexity calculated in LSTM is much different from the one in the other two statistical methods. This is probably because of a difference in how it's calculated. https://stackoverflow.com/questions/59209086/calculate-perplexity-in-pytorch was used as a reference. Also an important thing to note is how similar training is to Testing and validation. The reason for this is also unclear, and some parameter tuning was done. It is possible the model is underfitting, however it starts to overfit on other cases. A possible way to resolve this is by doing a grid search.

Note that only a subset was taken for the Statistical LM due to the running time.

For the Statistical LMs, we get a large difference between testing and training/validation. This is understandable, due to how OOV words are dealt with, vastly increasing the perplexity.

repository: veeral-agarwal/Neural-Language-Model

repo_name: veeral-agarwal/Neural-Language-Model


text:
<properties
   pageTitle="Navigate and select VM images | Microsoft Azure"
   description="Learn how to determine the publisher, offer, and SKU for images when creating an Azure virtual machine with the Resource Manager deployment model."
   services="virtual-machines"
   documentationCenter=""
   authors="squillace"
   manager="timlt"
   editor=""
   tags="azure-resource-manager"
   />

<tags
   ms.service="virtual-machines"
   ms.devlang="na"
   ms.topic="article"
   ms.tgt_pltfrm="command-line-interface"
   ms.workload="infrastructure"
   ms.date="12/08/2015"
   ms.author="rasquill"/>

# Navigate and select Azure virtual machine images with Windows PowerShell and the Azure CLI

> [AZURE.NOTE] Azure has two different deployment models for creating and working with resources:  [Resource Manager and classic](../resource-manager-deployment-model.md).  This article covers using the Resource Manager deployment model, which Microsoft recommends for most new deployments instead of the classic deployment model.

## Table of commonly used images

| PublisherName                        | Offer                                 | Sku                         |
|:---------------------------------|:-------------------------------------------|:---------------------------------|:--------------------|
| OpenLogic                        | CentOS                                     | 7                                |
| OpenLogic                        | CentOS                                     | 7.1                              |
| CoreOS                           | CoreOS                                     | Beta                             |
| CoreOS                           | CoreOS                                     | Stable                           |
| MicrosoftDynamicsNAV             | DynamicsNAV                                | 2015                             |
| MicrosoftSharePoint              | MicrosoftSharePointServer                  | 2013                             |
| Microsoft                        | Oracle-Database-12c-Weblogic-Server-12c    | Standard                         |
| Microsoft                        | Oracle-Database-12c-Weblogic-Server-12c    | Enterprise                       |
| MicrosoftSQLServer               | SQL2014-WS2012R2                           | Enterprise-Optimized-for-DW      |
| MicrosoftSQLServer               | SQL2014-WS2012R2                           | Enterprise-Optimized-for-OLTP    |
| Canonical                        | UbuntuServer                               | 12.04.5-LTS                      |
| Canonical                        | UbuntuServer                               | 14.04.2-LTS                      |
| MicrosoftWindowsServer           | WindowsServer                              | 2012-Datacenter                  |
| MicrosoftWindowsServer           | WindowsServer                              | 2012-R2-Datacenter               |
| MicrosoftWindowsServer           | WindowsServer                              | 2008-R2-SP1 |
| MicrosoftWindowsServer           | WindowsServer                              | Windows-Server-Technical-Preview |
| MicrosoftWindowsServerEssentials | WindowsServerEssentials                    | WindowsServerEssentials          |
| MicrosoftWindowsServerHPCPack    | WindowsServerHPCPack                       | 2012R2                           |

## Azure CLI

> [AZURE.NOTE] This article describes how to navigate and select virtual machine images, using a recent installation of either the Azure CLI or Azure PowerShell. As a prerequisite, you would need to change to the Resource Manager mode. With the Azure CLI, enter that mode by typing `azure config mode arm`.

The easiest and quickest way to locate an image to use either with `azure vm quick-create` or to create a resource group template file is to call the `azure vm image list` command and pass the location, the publisher name (it's not case-sensitive!), and an offer -- if you know the offer. For example, the following list is only a short example -- many lists are quite long -- if you know that "Canonical" is a publisher for the "UbuntuServer" offer.

    azure vm image list westus canonical ubuntuserver
    info:    Executing command vm image list
    warn:    The parameter --sku if specified will be ignored
    + Getting virtual machine image skus (Publisher:"canonical" Offer:"ubuntuserver" Location:"westus")
    data:    Publisher  Offer         Sku          Version          Location  Urn
    data:    ---------  ------------  -----------  ---------------  --------  --------------------------------------------------
    data:    canonical  ubuntuserver  12.04-DAILY  12.04.201504201  westus    canonical:ubuntuserver:12.04-DAILY:12.04.201504201
    data:    canonical  ubuntuserver  12.04.2-LTS  12.04.201302250  westus    canonical:ubuntuserver:12.04.2-LTS:12.04.201302250
    data:    canonical  ubuntuserver  12.04.2-LTS  12.04.201303250  westus    canonical:ubuntuserver:12.04.2-LTS:12.04.201303250
    data:    canonical  ubuntuserver  12.04.2-LTS  12.04.201304150  westus    canonical:ubuntuserver:12.04.2-LTS:12.04.201304150
    data:    canonical  ubuntuserver  12.04.2-LTS  12.04.201305160  westus    canonical:ubuntuserver:12.04.2-LTS:12.04.201305160
    data:    canonical  ubuntuserver  12.04.2-LTS  12.04.201305270  westus    canonical:ubuntuserver:12.04.2-LTS:12.04.201305270
    data:    canonical  ubuntuserver  12.04.2-LTS  12.04.201306030  westus    canonical:ubuntuserver:12.04.2-LTS:12.04.201306030
    data:    canonical  ubuntuserver  12.04.2-LTS  12.04.201306240  westus    canonical:ubuntuserver:12.04.2-LTS:12.04.201306240

The **Urn** column will be the form you pass to `azure vm quick-create`.

Often, however, you don't yet know what is available. In this case, you can navigate images by discovering publishers first by using `azure vm image list-publishers` and responding to the location prompt with a data center location you expect to use for your resource group. For example, the following lists all image publishers in the West US location (pass the location argument by lowercasing and removing spaces from the standard locations)

    azure vm image list-publishers
    info:    Executing command vm image list-publishers
    Location: westus
    + Getting virtual machine image publishers (Location: "westus")
    data:    Publisher                                       Location
    data:    ----------------------------------------------  --------
    data:    a10networks                                     westus
    data:    aiscaler-cache-control-ddos-and-url-rewriting-  westus
    data:    alertlogic                                      westus
    data:    AlertLogic.Extension                            westus

These lists can be quite long, so the example list above is just a snippet. Let's say that I noticed that Canonical is, indeed, an image publisher in the West US location. You can now find their offers by calling `azure vm image list-offers` and pass the location and the publisher at the prompts, like the following example:

    azure vm image list-offers
    info:    Executing command vm image list-offers
    Location: westus
    Publisher: canonical
    + Getting virtual machine image offers (Publisher: "canonical" Location:"westus")
    data:    Publisher  Offer         Location
    data:    ---------  ------------  --------
    data:    canonical  UbuntuServer  westus
    info:    vm image list-offers command OK

Now we know that in the West US region, Canonical publishes the **UbuntuServer** offer on Azure. But what SKUs? To get those, you call `azure vm image list-skus` and respond to the prompt with the location, publisher, and offer that you have discovered.

    azure vm image list-skus
    info:    Executing command vm image list-skus
    Location: westus
    Publisher: canonical
    Offer: ubuntuserver
    + Getting virtual machine image skus (Publisher:"canonical" Offer:"ubuntuserver" Location:"westus")
    data:    Publisher  Offer         sku          Location
    data:    ---------  ------------  -----------  --------
    data:    canonical  ubuntuserver  12.04-DAILY  westus
    data:    canonical  ubuntuserver  12.04.2-LTS  westus
    data:    canonical  ubuntuserver  12.04.3-LTS  westus
    data:    canonical  ubuntuserver  12.04.4-LTS  westus
    data:    canonical  ubuntuserver  12.04.5-LTS  westus
    data:    canonical  ubuntuserver  12.10        westus
    data:    canonical  ubuntuserver  14.04-beta   westus
    data:    canonical  ubuntuserver  14.04-DAILY  westus
    data:    canonical  ubuntuserver  14.04.0-LTS  westus
    data:    canonical  ubuntuserver  14.04.1-LTS  westus
    data:    canonical  ubuntuserver  14.04.2-LTS  westus
    data:    canonical  ubuntuserver  14.10        westus
    data:    canonical  ubuntuserver  14.10-beta   westus
    data:    canonical  ubuntuserver  14.10-DAILY  westus
    data:    canonical  ubuntuserver  15.04        westus
    data:    canonical  ubuntuserver  15.04-beta   westus
    data:    canonical  ubuntuserver  15.04-DAILY  westus
    info:    vm image list-skus command OK

With this information, you can now find exactly the image you want by calling the original call at the top.

    azure vm image list westus canonical ubuntuserver 14.04.2-LTS
    info:    Executing command vm image list
    + Getting virtual machine images (Publisher:"canonical" Offer:"ubuntuserver" Sku: "14.04.2-LTS" Location:"westus")
    data:    Publisher  Offer         Sku          Version          Location  Urn
    data:    ---------  ------------  -----------  ---------------  --------  --------------------------------------------------
    data:    canonical  ubuntuserver  14.04.2-LTS  14.04.201503090  westus    canonical:ubuntuserver:14.04.2-LTS:14.04.201503090
    data:    canonical  ubuntuserver  14.04.2-LTS  14.04.20150422   westus    canonical:ubuntuserver:14.04.2-LTS:14.04.20150422
    data:    canonical  ubuntuserver  14.04.2-LTS  14.04.201504270  westus    canonical:ubuntuserver:14.04.2-LTS:14.04.201504270
    info:    vm image list command OK

Now you can choose precisely the image you want to use. To create a virtual machine quickly by using the URN information, which you just found, or to use a template with that URN information, see [Using the Azure CLI for Mac, Linux, and Windows with Azure Resource Manager](xplat-cli-azure-resource-manager.md).

### Video walkthrough

This video demonstrates the above steps using the CLI.

[AZURE.VIDEO resource-groups-vm-searching-cli]

## PowerShell

With PowerShell, type `Switch-AzureMode AzureResourceManager`. See [Using Azure CLI with Resource Manager](xplat-cli-azure-resource-manager.md) and [Using Azure PowerShell with Azure Resource Manager](../powershell-azure-resource-manager.md) for more complete update and configuration details.

> [AZURE.NOTE] With Azure PowerShell modules above 1.0, the `Switch-AzureMode` cmdlet was removed. With that version and more recent, please replace the commands below with the `Azure` portion replaced with `AzureRm`. If you are using Azure PowerShell modules below 1.0, you will use the below commands but you must first `Switch-AzureMode AzureResourceManager`.

When creating a new virtual machine with Azure Resource Manager, in some cases you need to specify an image with the combination of the following image properties:

- Publisher
- Offer
- SKU

For example, these values are needed for the **Set-AzureVMSourceImage** PowerShell cmdlet or with a resource group template file in which you must specify the type of virtual machine to be created.

If you need to determine these values, you can navigate the images to determine these values:

1. List the image publishers.
2. For a given publisher, list their offers.
3. For a given offer, list their SKUs.

To do this in PowerShell, first switch to the Resource Manager mode of Azure PowerShell.

	Switch-AzureMode AzureResourceManager

For the first step above, list the publishers with these commands.

	$locName="<Azure location, such as West US>"
	Get-AzureVMImagePublisher -Location $locName | Select PublisherName

Fill in your chosen publisher name and run these commands.

	$pubName="<publisher>"
	Get-AzureVMImageOffer -Location $locName -Publisher $pubName | Select Offer

Fill in your chosen offer name and run these commands.

	$offerName="<offer>"
	Get-AzureVMImageSku -Location $locName -Publisher $pubName -Offer $offerName | Select Skus

From the display of the **Get-AzureVMImageSku** command, you have all the information you need to specify the image for a new virtual machine.

Here is an example.

	PS C:\> $locName="West US"
	PS C:\> Get-AzureVMImagePublisher -Location $locName | Select PublisherName

	PublisherName
	-------------
	a10networks
	aiscaler-cache-control-ddos-and-url-rewriting-
	alertlogic
	AlertLogic.Extension
	Barracuda.Azure.ConnectivityAgent
	barracudanetworks
	basho
	boxless
	bssw
	Canonical
	...

For the "MicrosoftWindowsServer" publisher:

	PS C:\> $pubName="MicrosoftWindowsServer"
	PS C:\> Get-AzureVMImageOffer -Location $locName -Publisher $pubName | Select Offer

	Offer
	-----
	WindowsServer

For the "WindowsServer" offer:

	PS C:\> $offerName="WindowsServer"
	PS C:\> Get-AzureVMImageSku -Location $locName -Publisher $pubName -Offer $offerName | Select Skus

	Skus
	----
	2008-R2-SP1
	2012-Datacenter
	2012-R2-Datacenter
	Windows-Server-Technical-Preview

From this list, copy the chosen SKU name, and you have all the information for the **Set-AzureVMSourceImage** PowerShell cmdlet or for a resource group template file that requires you to specify the publisher, offer, and SKU for an image.

### Video walkthrough

This video demonstrates the above steps using PowerShell.

[AZURE.VIDEO resource-groups-vm-searching-posh]

<!--Image references-->
[5]: ./media/markdown-template-for-new-articles/octocats.png
[6]: ./media/markdown-template-for-new-articles/pretty49.png
[7]: ./media/markdown-template-for-new-articles/channel-9.png
[8]: ./media/markdown-template-for-new-articles/copytemplate.png

<!--Reference style links - using these makes the source content way more readable than using inline links-->
[gog]: http://google.com/
[yah]: http://search.yahoo.com/
[msn]: http://search.msn.com/

repository: wacncontent/MooncakePortal

repo_name: wacncontent/MooncakePortal


text:
# CreateJS Lab
Playground for testing CreateJS

## Getting Started
* Make sure you have installed the following node.js modules in global:
  * grunt
  * bower
* Do `npm install` to automatically install all required node modules for this project
* Do `bower install` to automatically install JavaScript libraries (including CreateJS library)

## Grunt task
This project uses grunt for managing tasks (e.g starting local web server for testing).

Do `grunt -h` to see the list of available tasks.

repository: abiyasa/createjs-lab

repo_name: abiyasa/createjs-lab


text:
## Java Client

The Java client is the most full featured client. It is offered both with Hazelcast and Hazelcast Enterprise.

### Java Client Overview

The main idea behind the Java client is to provide the same Hazelcast functionality by proxying each operation through a Hazelcast node.
It can access and change distributed data, and it can listen to distributed events of an already established Hazelcast cluster from another Java application.

### Java Client Dependencies

You should include two dependencies in your classpath to start using the Hazelcast client: `hazelcast.jar` and `hazelcast-client.jar`.

After adding these dependencies, you can start using the Hazelcast client as if you are using the Hazelcast API. The differences are discussed in the below sections.

If you prefer to use maven, add the following lines to your `pom.xml`.

```xml
<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>hazelcast-client</artifactId>
    <version>$LATEST_VERSION$</version>
</dependency>
<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>hazelcast</artifactId>
    <version>$LATEST_VERSION$</version>
</dependency>
```

### Getting Started with Client API

The first step is configuration. You can configure the Java client declaratively or programmatically. We will use the programmatic approach throughout this tutorial. Please refer to the [Java Client Declarative Configuration section](#java-client-declarative-configuration) for details.

```java
ClientConfig clientConfig = new ClientConfig();
clientConfig.getGroupConfig().setName("dev").setPassword("dev-pass");
clientConfig.getNetworkConfig().addAddress("<IP_ADDRESS>", "<IP_ADDRESS>:5702");
```

The second step is to initialize the HazelcastInstance to be connected to the cluster.

```java
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
```

*This client interface is your gateway to access all Hazelcast distributed objects.*

Let's create a map and populate it with some data.

```java

IMap<String, Customer> mapCustomers = client.getMap("customers"); //creates the map proxy

mapCustomers.put("1", new Customer("Joe", "Smith"));
mapCustomers.put("2", new Customer("Ali", "Selam"));
mapCustomers.put("3", new Customer("Avi", "Noyan"));

```

As a final step, if you are done with your client, you can shut it down as shown below. This will release all the used resources and will close connections to the cluster.

```java

client.shutdown();

```

### Java Client Operation modes

The client has two operation modes because of the distributed nature of the data and cluster.

#### Smart Client

In smart mode, clients connect to each cluster node. Since each data partition uses the well known and consistent hashing algorithm, each client can send an operation to the relevant cluster node, which increases the overall throughput and efficiency. Smart mode is the default mode.

#### Dummy Client

For some cases, the clients can be required to connect to a single node instead of to each node in the cluster. Firewalls, security, or some custom networking issues can be the reason for these cases.

In dummy client mode, the client will only connect to one of the configured addresses. This single node will behave as a gateway to the other nodes. For any operation requested from the client, it will redirect the request to the relevant node and return the response back to the client returned from this node.

### Fail Case Handling

There are two main failure cases you should be aware of, and configurations you can perform to achieve proper behavior.

#### Client Connection Failure

While the client is trying to connect initially to one of the members in the `ClientNetworkConfig.addressList`, all the members might be not available. Instead of giving up, throwing an exception and stopping the client, the client will retry as many as `connectionAttemptLimit` times. Please see the [Connection Attempt Limit section](#connection-attempt-limit).

The client executes each operation through the already established connection to the cluster. If this connection(s) disconnects or drops, the client will try to reconnect as configured.

#### Retry-able Operation Failure

While sending the requests to related nodes, operation can fail due to various reasons. For any read-only operation, you can have your client retry sending the operation by enabling `redoOperation`. Please see the [Redo Operation section](#redo-operation).

The number of retries is given with the property `hazelcast.client.request.retry.count` in `ClientProperties`. The client will resend the request as many as RETRY-COUNT, then it will throw an exception. Please see the [Client Properties section](#client-properties).

### Supported Distributed Data Structures

Most of the Distributed Data Structures are supported by the client. Please check for the exceptions for the clients in other languages.

As a general rule, you configure these data structures on the server side and access them through a proxy on the client side.

#### Map

You can use any [Distributed Map](#map) object with the client, as shown below.

```java
Imap<Integer, String> map = client.getMap(“myMap”);

map.put(1, “Ali”);
String value= map.get(1);
map.remove(1);
```

Locality is ambiguous for the client, so `addEntryListener` and `localKeySet` are not supported. Please see the [Distributed Map section](#map) for more information.

#### MultiMap

A MultiMap usage example is shown below.

```java
MultiMap<Integer, String> multiMap = client.getMultiMap("myMultiMap");

multiMap.put(1,”ali”);
multiMap.put(1,”veli”);

Collection<String> values = multiMap.get(1);
```

`addEntryListener`, `localKeySet` and  `getLocalMultiMapStats` are not supported because locality is ambiguous for the client. Please see the [Distributed MultiMap section](#multimap) for more information.

#### Queue

A sample usage is shown below.

```java
IQueue<String> myQueue = client.getQueue(“theQueue”);
myQueue.offer(“ali”)
```

`getLocalQueueStats` is not supported because locality is ambiguous for the client. Please see the [Distributed Queue section](#queue) for more information.

#### Topic

`getLocalTopicStats` is not supported because locality is ambiguous for the client.

#### Other Supported Distributed Structures

The distributed data structures listed below are also supported by the client. Since their logic is the same in both the node side and client side, you can refer to their sections as listed below.

- [Replicated Map](#replicated-map-beta)
- [MapReduce](#mapreduce)
- [List](#list)
- [Set](#set)
- [IAtomicLong](#iatomiclong)
- [IAtomicReference](#iatomicreference)
- [ICountDownLatch](#icountdownlatch)
- [ISemaphore](#isemaphore)
- [IdGenerator](#idgenerator)
- [Lock](#lock)

### Client Services

Below services are provided for some common functionalities on the client side.

#### Distributed Executor Service

The distributed executor service is for distributed computing. It can be used to execute tasks on the cluster on a designated partition or on all the partitions. It can also be used to process entries. Please see the [Distributed Executor Service section](#executor-service) for more information.

```java
IExecutorService executorService = client.getExecutorService("default");
```

After getting an instance of `IExecutorService`, you can use the instance as the interface with the one provided on the server side. Please see the [Distributed Computing chapter](#distributed-computing) chapter for detailed usage.

![image](images/NoteSmall.jpg) ***NOTE:*** *This service is only supported by the Java client.*

#### Client Service

If you need to track clients and you want to listen to their connection events, see the example code below.

```java
final ClientService clientService = client.getClientService();
final Collection<Client> connectedClients = clientService.getConnectedClients();

clientService.addClientListener(new ClientListener() {
    @Override
    public void clientConnected(Client client) {
	//Handle client connected event
    }

    @Override
    public void clientDisconnected(Client client) {
      //Handle client disconnected event
    }
});
```

#### Partition Service

You use partition service to find the partition of a key. It will return all partitions. See the example code below.

```java
PartitionService partitionService = client.getPartitionService();

//partition of a key
Partition partition = partitionService.getPartition(key);

//all partitions
Set<Partition> partitions = partitionService.getPartitions();
```

#### Lifecycle Service

Lifecycle handling performs the following:

- checks to see if the client is running,
- shuts down the client gracefully,
- terminates the client ungracefully (forced shutdown), and
- adds/removes lifecycle listeners.

```java
LifecycleService lifecycleService = client.getLifecycleService();

if(lifecycleService.isRunning()){
    //it is running
}

//shutdown client gracefully
lifecycleService.shutdown();

```

### Client Listeners

You can configure listeners to listen to various event types on the client side. You can configure global events not relating to any distributed object through [ListenerConfig](#listenerconfig). You should configure distributed object listeners like map entry listeners or list item listeners through their proxies. You can refer to the related sections under each distributed data structure in this reference manual.

### Client Transactions

Transactional distributed objects are supported on the client side. Please see the [Transactions chapter](#transactions) on how to use them.

### Network Configuration Options

```java
ClientConfig clientConfig = new ClientConfig();
ClientNetworkConfig networkConfig = clientConfig.getNetworkConfig();
```

#### Address List
Address List is the initial list of cluster addresses to which the client will connect. The client uses this list to find an alive node. Although it may be enough to give only one address of a node in the cluster (since all nodes communicate with each other), it is recommended that you give all the nodes’ addresses.

If the port part is omitted, then 5701, 5702, and 5703 will be tried in random order.

```java
clientConfig.getNetworkConfig().addAddress("<IP_ADDRESS>", "<IP_ADDRESS>:5703");
```

You can provide multiple addresses with ports provided or not as seen above. The provided list is shuffled and tried in random order.

Default value is *localhost*.

#### Smart Routing

`setSmartRouting` defines whether the client mode is smart or dummy.

```java
//sets client to dummy client mode
clientConfig.getNetworkConfig().setSmartRouting(false);
```
The default is *smart client* mode.

#### Redo Operation

`setRedoOperation` enables/disables redo-able operations as described in [Retry-able Operation Failure](#retry-able-operation-failure).

```java
//enables redo
clientConfig.getNetworkConfig().setRedoOperation(true);
```
Default is *disabled*.

#### Connection Timeout

`setConnectionTimeout` is the timeout value in milliseconds for nodes to accept client connection requests.

```java
//enables redo
clientConfig.getNetworkConfig().setConnectionTimeout(1000);
```

The default value is *5000* milliseconds.

#### Connection Attempt Limit

While the client is trying to connect initially to one of the members in the `ClientNetworkConfig.addressList`, all members might be not available. Instead of giving up, throwing an exception and stopping the client, the client will retry as many as `ClientNetworkConfig.connectionAttemptLimit` times.

```java
//enables redo
clientConfig.getNetworkConfig().setConnectionAttemptLimit(5);
```

Default value is *2*.

#### Connection Attempt Period

`etConnectionAttemptPeriod` is the duration in milliseconds between the connection attempts defined by `ClientNetworkConfig.connectionAttemptLimit`.

```java
//enables redo
clientConfig.getNetworkConfig().setConnectionAttemptPeriod(5000);
```

Default value is *3000*.

#### Client Socket Interceptor

![](images/enterprise-onlycopy.jpg)

Following is a client configuration to set a socket intercepter. Any class implementing `com.hazelcast.nio.SocketInterceptor` is a socket Interceptor.

```java
public interface SocketInterceptor {

    void init(Properties properties);

    void onConnect(Socket connectedSocket) throws IOException;
}
```

`SocketInterceptor` has two steps. First, it will be initialized by the configured properties. Second, it will be informed just after the socket is connected using `onConnect`.

```java
SocketInterceptorConfig socketInterceptorConfig = clientConfig
               .getNetworkConfig().getSocketInterceptorConfig();

MyClientSocketInterceptor myClientSocketInterceptor = new MyClientSocketInterceptor();

socketInterceptorConfig.setEnabled(true);
socketInterceptorConfig.setImplementation(myClientSocketInterceptor);
```

If you want to configure the socket connector with a class name instead of an instance, see the example below.

```java
SocketInterceptorConfig socketInterceptorConfig = clientConfig
            .getNetworkConfig().getSocketInterceptorConfig();

MyClientSocketInterceptor myClientSocketInterceptor = new MyClientSocketInterceptor();

socketInterceptorConfig.setEnabled(true);

//These properties are provided to interceptor during init
socketInterceptorConfig.setProperty("kerberos-host","kerb-host-name");
socketInterceptorConfig.setProperty("kerberos-config-file","kerb.conf");

socketInterceptorConfig.setClassName(myClientSocketInterceptor);
```

Please see the [Socket Interceptor section](#socket-interceptor) for more information.

#### Client Socket Options

You can configure the network socket options using `SocketOptions`. It has the following methods.

- `socketOptions.setKeepAlive(x)`: Enables/disables the *SO_KEEPALIVE* socket option. The default value is `true`.

- `socketOptions.setTcpNoDelay(x)`: Enables/disables the *TCP_NODELAY* socket option. The default value is `true`.

- `socketOptions.setReuseAddress(x)`: Enables/disables the *SO_REUSEADDR* socket option. The default value is `true`.

- `socketOptions.setLingerSeconds(x)`: Enables/disables *SO_LINGER* with the specified linger time in seconds. The default value is `3`.

- `socketOptions.setBufferSize(x)`: Sets the *SO_SNDBUF* and *SO_RCVBUF* options to the specified value in KB for this Socket. The default value is `32`.

```java
SocketOptions socketOptions = clientConfig.getNetworkConfig().getSocketOptions();
socketOptions.setBufferSize(32);
socketOptions.setKeepAlive(true);
socketOptions.setTcpNoDelay(true);
socketOptions.setReuseAddress(true);
socketOptions.setLingerSeconds(3);
```

#### Client SSL

![](images/enterprise-onlycopy.jpg)

You can use SSL to secure the connection between the client and the nodes. Please see the [Client SSLConfig section](#client-sslconfig) on how to configure it.

#### Configuration for AWS

The example declarative and programmatic configurations below show how to configure a Java client for connecting to a Hazelcast cluster in AWS.

Declarative Configuration:

```xml
<aws enabled="true">
  <!-- optional default value is false -->
  <inside-aws>false</inside-aws>
  <access-key>my-access-key</access-key>
  <secret-key>my-secret-key</secret-key>
  <!-- optional, default is us-east-1 -->
  <region>us-west-1</region>
  <!-- optional, default is ec2.amazonaws.com. If set, region shouldn't be set
    as it will override this property
  -->
  <host-header>ec2.amazonaws.com</host-header>
  <!-- optional -->
  <security-group-name>hazelcast-sg</security-group-name>
  <!-- optional -->
  <tag-key>type</tag-key>
  <!-- optional -->
  <tag-value>hz-nodes</tag-value>
</aws>
```

Programmatic Configuration:

```java
ClientConfig clientConfig = new ClientConfig();
ClientAwsConfig clientAwsConfig = new ClientAwsConfig();
clientAwsConfig.setInsideAws( false )
               .setAccessKey( "my-access-key" )
               .setSecretKey( "my-secret-key" )
               .setRegion( "us-west-1" )
               .setHostHeader( "ec2.amazonaws.com" )
               .setSecurityGroupName( ">hazelcast-sg" )
               .setTagKey( "type" )
               .setTagValue( "hz-nodes" );
clientConfig.getNetworkConfig().setAwsConfig( clientAwsConfig );
HazelcastInstance client = HazelcastClient.newHazelcastClient( clientConfig );
```

![image](images/NoteSmall.jpg) ***NOTE:*** *If the *`inside-aws`* parameter is not set, the private addresses of nodes will always be converted to public addresses. Also, the client will use public addresses to connect to the nodes. In order to use private addresses, set the *`inside-aws`* parameter to *`true`*. Also note that, when connecting outside from AWS, setting the *`inside-aws`* parameter to *`true`* will cause the client to not be able to reach the nodes.*

#### Load Balancer

`LoadBalancer` allows you to send operations to one of a number of endpoints (Members). Its main purpose is to determine the next `Member` if queried.  It is up to your implementation to use different load balancing policies. You should implement the interface `com.hazelcast.client.LoadBalancer` for that purpose.

If the client is configured in smart mode, only the operations that are not key-based will be routed to the endpoint that is returned by the `LoadBalancer`. If the client is not a smart client, `LoadBalancer` will be ignored.

To configure client load balance, please see the [Load Balancer Config section](#loadbalancerconfig) and [Java Client Declarative Configuration section](#java-client-declarative-configuration).

### Client Near Cache
Hazelcast distributed map has a Near Cache feature to reduce network latencies. Since the client always requests data from the cluster nodes, it can be helpful for some of your use cases to configure a near cache on the client side.
The client supports the same Near Cache that is used in Hazelcast distributed map.

### Client SSLConfig

![](images/enterprise-onlycopy.jpg)

If you want SSL enabled for the client-cluster connection, you should set `SSLConfig`. Once set, the connection (socket) is established out of an SSL factory defined either by a factory class name or factory implementation. Please see the `SSLConfig` class in the `com.hazelcast.config` package at the JavaDocs page of the [Hazelcast Documentation](http://www.hazelcast.org/documentation/) web page.

### Java Client Configuration

You can declare the Hazelcast Java client declaratively or programmatically.

#### Java Client Declarative Configuration

You can configure the Java client using an XML configuration file.
Below is a generic template for a declarative configuration.

```xml

<hazelcast-client xsi:schemaLocation=
    "http://www.hazelcast.com/schema/client-config hazelcast-client-config-3.3.xsd"
                  xmlns="http://www.hazelcast.com/schema/client-config"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <!--Cluster name to connect-->
    <group>
        <name>GROUP_NAME</name>
        <password>GROUP_PASS</password>
    </group>

    <!--client properties-->
    <properties>
        <property name="hazelcast.client.connection.timeout">10000</property>
        <property name="hazelcast.client.retry.count">6</property>
    </properties>

    <!--Network configuration details-->
    <network>
        <cluster-members>
            <!--initial cluster members to connect-->
            <address><IP_ADDRESS></address>
            <address><IP_ADDRESS></address>
        </cluster-members>

        <smart-routing>true</smart-routing>
        <redo-operation>true</redo-operation>

        <socket-interceptor enabled="true">
            <!--socket-interceptor configuration details-->
        </socket-interceptor>

        <aws enabled="true" connection-timeout-seconds="11">
            <!--AWS configuration details-->
        </aws>
    </network>

    <!--local executor pool size-->
    <executor-pool-size>40</executor-pool-size>

    <!--security credentials configuration-->
    <security>
        <credentials>com.hazelcast.security.UsernamePasswordCredentials</credentials>
    </security>

    <listeners>
        <!--listeners-->
    </listeners>

    <serialization>
        <!--serialization configuration details-->
    </serialization>

    <proxy-factories>
        <!--ProxyFactory configuration details-->
    </proxy-factories>

    <!--load balancer configuration-->
    <!-- type can be "round-robin" or "random" -->
    <load-balancer type="random"/>

    <near-cache name="mapName">
        <!--near cache configuration details of a map-->
    </near-cache>

</hazelcast-client>
```

#### Java Client Programmatic Configuration

Using the configuration API, you can configure a `ClientConfig` as required. Please refer to the related sections and JavaDocs for more information.

##### ClientNetworkConfig

`ClientNetworkConfig` includes the configuration options listed below, which are explained in the [Network Configuration Options section](#network-configuration-options).

* addressList
* smartRouting
* redoOperation
* connectionTimeout
* connectionAttemptLimit
* connectionAttemptPeriod
* SocketInterceptorConfig
* SocketOptions
* SSLConfig
* ClientAwsConfig

##### GroupConfig
Clients should provide a group name and password in order to connect to the cluster.
You can configure them using `GroupConfig`, as shown below.

```java
clientConfig.setGroupConfig(new GroupConfig("dev","dev-pass"));
```

##### LoadBalancerConfig
The following code example shows the programmatic configuration of your load balancer.

```java
clientConfig.setLoadBalancer(yourLoadBalancer);
```

##### ClientSecurityConfig

In the cases where the security established with `GroupConfig` is not enough and you want your clients connecting securely to the cluster, you can use `ClientSecurityConfig`. This configuration has a `credentials` parameter to set the IP address and UID. Please see `ClientSecurityConfig.java` in our code.

##### SerializationConfig

For the client side serialization, use Hazelcast configuration. Please refer to the [Serialization chapter](#serialization).

##### ListenerConfig
You can configure global event listeners using `ListenerConfig` as shown below.

```java
ClientConfig clientConfig = new ClientConfig();
ListenerConfig listenerConfig = new ListenerConfig(LifecycleListenerImpl);
clientConfig.addListenerConfig(listenerConfig);
```

```java
ClientConfig clientConfig = new ClientConfig();
ListenerConfig listenerConfig = new ListenerConfig("com.hazelcast.example.MembershipListenerImpl");
clientConfig.addListenerConfig(listenerConfig);
```

You can add three types of event listeners.

- LifecycleListener
- MembershipListener
- DistributedObjectListener

***RELATED INFORMATION***

*Please refer to Hazelcast JavaDocs and see LifecycleListener, MembershipListener and DistributedObjectListener in `com.hazelcast.core` package.*
<br></br>

##### NearCacheConfig
You can configure a Near Cache on the client side by providing a configuration per map name, as shown below.

```java
ClientConfig clientConfig = new ClientConfig();
CacheConfig nearCacheConfig = new NearCacheConfig();
nearCacheConfig.setName("mapName");
clientConfig.addNearCacheConfig(nearCacheConfig);
```

You can use wildcards can be used for the map name, as shown below.

```java
nearCacheConfig.setName("map*");
nearCacheConfig.setName("*map");
```

##### ClassLoader
You can configure a custom `classLoader`. It will be used by the serialization service and to load any class configured in configuration, such as event listeners or ProxyFactories.

##### ExecutorPoolSize
Hazelcast has an internal executor service (different from the data structure *Executor Service*) that has threads and queues to perform internal operations such as handling responses. This parameter specifies the size of the pool of threads which perform these operations laying in the executor's queue. If not configured, this parameter has the value as **5 \* *core size of the client*** (i.e. it is 20 for a machine that has 4 cores).

##### Client Properties

There are some advanced client configuration properties to tune some aspects of Hazelcast Client. You can set them as property name and value pairs through declarative configuration, programmatic configuration, or JVM system property. Please see the [Advanced Configuration Properties section](#advanced-configuration-properties) to learn how to set these properties.

The table below lists the client configuration properties with their descriptions.

Property Name | Default Value | Type | Description
:--------------|:---------------|:------|:------------
`hazelcast.client.heartbeat.timeout`|300000|string|Timeout for the heartbeat messages sent by the client to members. If no messages pass between client and member within the given time via this property in milliseconds, the connection will be closed.
`hazelcast.client.heartbeat.interval`|10000|string|The frequency of heartbeat messages sent by the clients to the members.
`hazelcast.client.max.failed.heartbeat.count`|3|string|When the count of failed heartbeats sent to the members reaches this value, the cluster is deemed as dead by the client.
`hazelcast.client.request.retry.count`|20|string|The retry count of the connection requests by the client to the members.
`hazelcast.client.request.retry.wait.time`|250|string|The frequency of the connection retries.
`hazelcast.client.event.thread.count`|5|string|The thread count for handling incoming event packets.
`hazelcast.client.event.queue.capacity`|1000000|string|The default value of the capacity of executor that handles incoming event packets.

### Sample Codes for Client

Please refer to [Client Code Samples](https://github.com/hazelcast/hazelcast-code-samples/tree/master/clients).

repository: totalkyos/altassian

repo_name: totalkyos/altassian


text:
---
layout: post
categories: Publications
tags: ["pubs-2020", ieee-cog, game-design, procedural-content-generation, computational-creativity]
paper: true
hidden: true

pubid: cook2020software
type: inproceedings
title: "Software Engineering For Automated Game Design"
author: Cook, Michael
booktitle: IEEE Conference on Games (CoG)
year: 2020
pages: 487--494
puburl: "https://ieeexplore.ieee.org/document/9231750"
abstract: "As we develop more assistive and automated game design systems, the question of how these systems should be integrated into game development workflows, and how much adaptation may be required, becomes increasingly important. In this paper we explore the impact of software engineering decisions on the ability of an automated game design system to understand a game's codebase, generate new game code, and evaluate its work. We argue that a new approach to software engineering may be required in order for game developers to fully benefit from automated game designers."
venue: ieee cog

---

* content
{:toc}

gha_language: HTML


text:
# web-cfw-loader
Fusee Launcher, in a browser!

# Description
This is a port of [fusee-launcher](https://github.com/reswitched/fusee-launcher) to JavaScript using WebUSB. This appears to work on Linux, Android (unrooted), OSX and ChromeOS. Windows support is still extremely unstable and it seems to only work on sometimes.

# Try it out
Either use a web server to host the files (must be on https, because of the fact that WebUSB is new technology and therefore has a lot of security restrictions) or you can try it [here](https://webcfw.sdsetup.com/).

# Contribute to this project
If you want to add a new translation or update/add a payload, see [CONTRIBUTING](https://github.com/AtlasNX/web-cfw-loader/blob/master/CONTRIBUTING.md).

# Credits
- [**ElijahZAwesome**](https://github.com/ElijahZAwesome): For originally maintaining this repository.
- [**falquinho**](https://github.com/falquinho): For his Bootstrap layout.
- All those who actively contribute to the repository.

# Forked
This is a fork of [web-fusee-launcher](https://github.com/atlas44/web-fusee-launcher).

repository: VanishingTacos/web-cfw-loader

repo_name: VanishingTacos/web-cfw-loader


text:
[Delta Lab](https://links.deltalab.ai/website) | [Twitter](https://links.deltalab.ai/twitter) | [LinkedIn](https://links.deltalab.ai/linkedin)

---

# Numerical optimization class

- Omar Trejo
- January, 2015

This code was developed for the Numerical Optimization class that I attended at
ITAM during 2015. The class was imparted by Dr. Zeferino Parada. The main topic
is constrained numerical optimization.

The main resource for the class was:

- [Nocedal & Wright - Numerical Optimization (2006)](http://www.springer.com/us/book/9780387303031)

---

> "We are the people we have been waiting for."

repository: otrenav/numerical-optimization-class

repo_name: otrenav/numerical-optimization-class


text:
---
permalink: /about/
title: About
excerpt: State Of The Art is a community of free creators
---

Hello stranger, since you found this site I want to tell you a little about this project.

In a few words: **State Of The Art project is created to change the IT world.**

Blog posts are trying to explain this in a little bit more free way, you can [see them here](/blog/).

## Our Plans

We'll check how it will go - we have a number of interesting projects, like:
* 3D Scanner - for the future AR/VR instagram
* Peer-to-Peer Social Network application - to make sure your info will be yours
* Guitarists software - to compete GuitarPro
* Car multimedia and control system
* ... and so many others

## Our Codex

Codex is required to describe our behavior in different situations and make sure we will
follow the best practices. It doesn't mean it will never change - but hopefully all the
changes will be added for good.

1. *Open Source* - all our projects are open sourced and anyone can join to help.
2. *Automation* - we believe automation is a greater good and we have to automate everything.
3. *Privacy* - all our applications or services should protect the user privacy and don't
allow anyone (including us) but the user to use this information.
4. *Quality* - our projects are fun and we're trying to make them better with each line of
code.
5. *Publicity* - there is no way to sign any NDA, because that will lead to hidden
manipulations and will not allow to public the available information.

## Overall

And we want to test our philosophy using this project, prepare new rules, automate it and
finally make sure - everyone can do something useful & can realize themself as the real
creators.

This project is about open source and we are spending all the money to pay our developers,
so it will be nice if you can buy our software or use donate buttons to support us.

Thank you!


text:
# docker_elastic_curator
Curator is a elasticsearch index management tool. This repo to be created for deleting index automatically after a duration.

## How to use
```
chmod +x run.sh
docker build -t maxent/curator:4.2.1 ./
```

## in kubernetes

After the image generated, I put it onto my private registry. So I can use this in my kubernetes rc like below.

You should pay attention to the environment variable `ELASTICSEARCH_HOST`, the value based on SkyDNS.

If you did not have SkyDNS configured, you can hard code it. eg. `<IP_ADDRESS>`

```
apiVersion: v1
kind: ReplicationController
metadata:
  name: curator
  namespace: kube-system
  labels:
    k8s-app: curator
    version: v1
spec:
  replicas: 1
  selector:
    k8s-app: curator
    version: v1
  template:
    metadata:
      labels:
        k8s-app: curator
        version: v1
    spec:
      containers:
      - image: maxcd03-kube1.chinacloudapp.cn/maxent/curator:4.2.1
        name: curator
        env:
        - name: ELASTICSEARCH_HOST
          value: elasticsearch-logging
        - name: DELETE_INDEX_DAYS_OLDER_THAN
          value: "7"
        - name: INTERVAL_IN_HOURS
          value: "24"
```


text:
# Simple Node Analytics
Simple web analytics to better understand user interaction and behaviour. Client and server are written in Javascript. All tracking results and events are written to a database by a simple Node.js service. Right now, there are no plans to build a fancy analytics dashboard.

## Client
The analytics client has a modular structure and can be configured for multiple trackers:

- **click**: Simple click tracking for buttons and other interactive elements. Activated with the attribute `data-click="my-click-event"`.
- **observer**: Examines whether a specific element in the viewport is visibly thought for examining the scroll depth. Activated with the attribute `data-observer="my-element-is-visible-event"`.
- **timer**: records how much time a user spends on the site. The timer pauses on * blur * events and continues on * focus * events. Activated with the attribute `data-timer=my-timer-event"`.
- **custom**: Space for custom Javascript events that generate a tracking request.

Include the client library in the head of your HTML:

```html
<script src="http://localhost:3010/build/client.bundle.js"></script>
```

Initialize the analytics suite with all trackers:

```javascript
analytics.init({
  serviceUrl: 'http://localhost:3010/track',
  projectId: 'demo',
  tracker: {
    click: true,
    observer: true,
    timer: true,
    custom: true
  }
});
```

## Server
The Analytics service accepts tracking requests and stores them in a MongoDB collection.

```
$ node server
```

For each request, the value for the corresponding tracking key and device is incremented. Here's an example of getting headers on desktop devices:

```javascript
{
  "_id" : ObjectId("5b179f0e8fd447fe98595b14"),
  "project" : "demo",
  "device" : "desktop",
  "key" : "observer-0-header",
  "value" : 2231
}
```

Exporting analytics data from a MongoDB collection to JSON is done by using the `mongoexport` command:

```
$ mongoexport --db analytics --collection demo --out ./demo.json --jsonArray
```

MongoDB could be easily swapped for another database like PostgreSQL.

## Roadmap

**Client**
- Plugin: Devices, sizes
- Plugin: Errors, exceptions
- Plugin: Geolocations
- Plugin: Load times
- Plugin: Custom events

**Service**
- Config file for analytics service (MongoDB, port, ...)
- Command line interface, e.g. `simple-node-analytics -p 3100`
- Friendly errors (no database, port in use, ...)
- Protected API for retrieving analytics data

repository: stekhn/simple-node-analytics

repo_name: stekhn/simple-node-analytics


text:
# EE - Extended Essay

Just a small collection of notebooks related to recent EEs. Some validation of data.

## Determination of Ascorbic Acid (Vitamin C) in different fruits

The antioxidizing properties of Vitamin C are well known. The project is a good oportunity for the student to learn about the history, the effect and the practice in a science laboratory to determine reliable data.

In this specific case the student determined values that were too high. Let's start with some sample concentration various fruits. What results should we expect? Looking at labels of juice in the supermarket we can see values like 10 mg/100ml for apple juice, mixed pinapple juice has 30 mg/200ml and orange juice 20 mg/100ml. Further concentrations are well known and pulished multiple times, for example by USDA ([link](https://fdc.nal.usda.gov/)).

| Fruit                             | Apple | Orange | Pear |
|-----------------------------------|:-----:|:------:|:----:|
| Concentration Katy (g/cm³)        |  2.59 |  8.24  | 2.53 |
| Converted concentration (mg/100g) |  259  |   824  |  253 |
| Reference concentration (mg/100g) |  4.6  |  53.2  |  4.3 |

The Jupyter notebook [Katy_EE.ipynb](Katy_EE.ipynb) contains the findings from November 2019. Visualization looks like this:

![Three graphs](katy_values.png)

## Determination of phosphate in different soils

Here we need a molybdate complex and a spectrometer to measure the absorbance.

The results:

## Effect of glass fascade on building temperature and energy costs

It's a great idea from Derrick to investigate the challenges of glass fascades in sunny countries like Vietnam. How much energy is needed for A/C on a building like [Landmark 81](https://en.wikipedia.org/wiki/Landmark_81)? Can you save 723 tons of CO2 per day with different materials? He conducted his own experiment and got some interesting results:

![temperature change](EE_glass-fascade-data.png)

The data is consistent!

repository: kreier/labs

repo_name: kreier/labs