text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="next" href="Bigarray.Array1.html">
<link rel="Up" href="Bigarray.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Barray" rel="Chapter" href="Barray.html">
<link title="Barray_slice" rel="Chapter" href="Barray_slice.html">
<link title="Barraylabels" rel="Chapter" href="Barraylabels.html">
<link title="Bbool" rel="Chapter" href="Bbool.html">
<link title="Bchar" rel="Chapter" href="Bchar.html">
<link title="Bfloat" rel="Chapter" href="Bfloat.html">
<link title="Bformat" rel="Chapter" href="Bformat.html">
<link title="Bfun" rel="Chapter" href="Bfun.html">
<link title="Bhash" rel="Chapter" href="Bhash.html">
<link title="Bhashtbl" rel="Chapter" href="Bhashtbl.html">
<link title="Bheap" rel="Chapter" href="Bheap.html">
<link title="Bint" rel="Chapter" href="Bint.html">
<link title="Bint64" rel="Chapter" href="Bint64.html">
<link title="Blist" rel="Chapter" href="Blist.html">
<link title="Blistlabels" rel="Chapter" href="Blistlabels.html">
<link title="Bmap" rel="Chapter" href="Bmap.html">
<link title="Bopt" rel="Chapter" href="Bopt.html">
<link title="Bord" rel="Chapter" href="Bord.html">
<link title="Bpair" rel="Chapter" href="Bpair.html">
<link title="Bparse" rel="Chapter" href="Bparse.html">
<link title="Brandom" rel="Chapter" href="Brandom.html">
<link title="Bref" rel="Chapter" href="Bref.html">
<link title="Bresult" rel="Chapter" href="Bresult.html">
<link title="Bset" rel="Chapter" href="Bset.html">
<link title="Bstring" rel="Chapter" href="Bstring.html">
<link title="Bvector" rel="Chapter" href="Bvector.html">
<link title="Sequence" rel="Chapter" href="Sequence.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Bytes" rel="Chapter" href="Bytes.html">
<link title="BytesLabels" rel="Chapter" href="BytesLabels.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalFormat" rel="Chapter" href="CamlinternalFormat.html">
<link title="CamlinternalFormatBasics" rel="Chapter" href="CamlinternalFormatBasics.html">
<link title="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Sort" rel="Chapter" href="Sort.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><title>Bigarray.Genarray</title>

 Up
 Next

Module Bigarray.Genarray

module Genarray: sig .. end

type ('a, 'b, 'c) t

The type Genarray.t is the type of big arrays with variable
     numbers of dimensions.  Any number of dimensions between 1 and 16
     is supported.

     The three type parameters to Genarray.t identify the array element
     kind and layout, as follows:

the first parameter, 'a, is the OCaml type for accessing array
       elements (float, int, int32, int64, nativeint);

the second parameter, 'b, is the actual kind of array elements
       (float32_elt, float64_elt, int8_signed_elt, int8_unsigned_elt,
       etc);

the third parameter, 'c, identifies the array layout
       (c_layout or fortran_layout).

     For instance, (float, float32_elt, fortran_layout) Genarray.t
     is the type of generic big arrays containing 32-bit floats
     in Fortran layout; reads and writes in this array use the
     OCaml type float.

val create : ('a, 'b) Bigarray.kind ->
       'c Bigarray.layout -> int array -> ('a, 'b, 'c) t

Genarray.create kind layout dimensions returns a new big array
     whose element kind is determined by the parameter kind (one of
     float32, float64, int8_signed, etc) and whose layout is
     determined by the parameter layout (one of c_layout or
     fortran_layout).  The dimensions parameter is an array of
     integers that indicate the size of the big array in each dimension.
     The length of dimensions determines the number of dimensions
     of the bigarray.

     For instance, Genarray.create int32 c_layout [|4;6;8|]
     returns a fresh big array of 32-bit integers, in C layout,
     having three dimensions, the three dimensions being 4, 6 and 8
     respectively.

     Big arrays returned by Genarray.create are not initialized:
     the initial values of array elements is unspecified.

     Genarray.create raises Invalid_argument if the number of dimensions
     is not in the range 1 to 16 inclusive, or if one of the dimensions
     is negative.

val num_dims : ('a, 'b, 'c) t -> int

Return the number of dimensions of the given big array.

val dims : ('a, 'b, 'c) t -> int array

Genarray.dims a returns all dimensions of the big array a,
     as an array of integers of length Genarray.num_dims a.

val nth_dim : ('a, 'b, 'c) t -> int -> int

Genarray.nth_dim a n returns the n-th dimension of the
     big array a.  The first dimension corresponds to n = 0;
     the second dimension corresponds to n = 1; the last dimension,
     to n = Genarray.num_dims a - 1.
     Raise Invalid_argument if n is less than 0 or greater or equal than
     Genarray.num_dims a.

val kind : ('a, 'b, 'c) t -> ('a, 'b) Bigarray.kind

Return the kind of the given big array.

val layout : ('a, 'b, 'c) t -> 'c Bigarray.layout

Return the layout of the given big array.

val get : ('a, 'b, 'c) t -> int array -> 'a

Read an element of a generic big array.
     Genarray.get a [|i1; ...; iN|] returns the element of a
     whose coordinates are i1 in the first dimension, i2 in
     the second dimension, ..., iN in the N-th dimension.

     If a has C layout, the coordinates must be greater or equal than 0
     and strictly less than the corresponding dimensions of a.
     If a has Fortran layout, the coordinates must be greater or equal
     than 1 and less or equal than the corresponding dimensions of a.
     Raise Invalid_argument if the array a does not have exactly N
     dimensions, or if the coordinates are outside the array bounds.

     If N > 3, alternate syntax is provided: you can write
     a.{i1, i2, ..., iN} instead of Genarray.get a [|i1; ...; iN|].
     (The syntax a.{...} with one, two or three coordinates is
     reserved for accessing one-, two- and three-dimensional arrays
     as described below.)

val set : ('a, 'b, 'c) t -> int array -> 'a -> unit

Assign an element of a generic big array.
     Genarray.set a [|i1; ...; iN|] v stores the value v in the
     element of a whose coordinates are i1 in the first dimension,
     i2 in the second dimension, ..., iN in the N-th dimension.

     The array a must have exactly N dimensions, and all coordinates
     must lie inside the array bounds, as described for Genarray.get;
     otherwise, Invalid_argument is raised.

     If N > 3, alternate syntax is provided: you can write
     a.{i1, i2, ..., iN} <- v instead of
     Genarray.set a [|i1; ...; iN|] v.
     (The syntax a.{...} <- v with one, two or three coordinates is
     reserved for updating one-, two- and three-dimensional arrays
     as described below.)

val sub_left : ('a, 'b, Bigarray.c_layout) t ->
       int -> int -> ('a, 'b, Bigarray.c_layout) t

Extract a sub-array of the given big array by restricting the
     first (left-most) dimension.  Genarray.sub_left a ofs len
     returns a big array with the same number of dimensions as a,
     and the same dimensions as a, except the first dimension,
     which corresponds to the interval [ofs ... ofs + len - 1]
     of the first dimension of a.  No copying of elements is
     involved: the sub-array and the original array share the same
     storage space.  In other terms, the element at coordinates
     [|i1; ...; iN|] of the sub-array is identical to the
     element at coordinates [|i1+ofs; ...; iN|] of the original
     array a.

     Genarray.sub_left applies only to big arrays in C layout.
     Raise Invalid_argument if ofs and len do not designate
     a valid sub-array of a, that is, if ofs < 0, or len < 0,
     or ofs + len > Genarray.nth_dim a 0.

val sub_right : ('a, 'b, Bigarray.fortran_layout) t ->
       int -> int -> ('a, 'b, Bigarray.fortran_layout) t

Extract a sub-array of the given big array by restricting the
     last (right-most) dimension.  Genarray.sub_right a ofs len
     returns a big array with the same number of dimensions as a,
     and the same dimensions as a, except the last dimension,
     which corresponds to the interval [ofs ... ofs + len - 1]
     of the last dimension of a.  No copying of elements is
     involved: the sub-array and the original array share the same
     storage space.  In other terms, the element at coordinates
     [|i1; ...; iN|] of the sub-array is identical to the
     element at coordinates [|i1; ...; iN+ofs|] of the original
     array a.

     Genarray.sub_right applies only to big arrays in Fortran layout.
     Raise Invalid_argument if ofs and len do not designate
     a valid sub-array of a, that is, if ofs < 1, or len < 0,
     or ofs + len > Genarray.nth_dim a (Genarray.num_dims a - 1).

val slice_left : ('a, 'b, Bigarray.c_layout) t ->
       int array -> ('a, 'b, Bigarray.c_layout) t

Extract a sub-array of lower dimension from the given big array
     by fixing one or several of the first (left-most) coordinates.
     Genarray.slice_left a [|i1; ... ; iM|] returns the 'slice'
     of a obtained by setting the first M coordinates to
     i1, ..., iM.  If a has N dimensions, the slice has
     dimension N - M, and the element at coordinates
     [|j1; ...; j(N-M)|] in the slice is identical to the element
     at coordinates [|i1; ...; iM; j1; ...; j(N-M)|] in the original
     array a.  No copying of elements is involved: the slice and
     the original array share the same storage space.

     Genarray.slice_left applies only to big arrays in C layout.
     Raise Invalid_argument if M >= N, or if [|i1; ... ; iM|]
     is outside the bounds of a.

val slice_right : ('a, 'b, Bigarray.fortran_layout) t ->
       int array -> ('a, 'b, Bigarray.fortran_layout) t

Extract a sub-array of lower dimension from the given big array
     by fixing one or several of the last (right-most) coordinates.
     Genarray.slice_right a [|i1; ... ; iM|] returns the 'slice'
     of a obtained by setting the last M coordinates to
     i1, ..., iM.  If a has N dimensions, the slice has
     dimension N - M, and the element at coordinates
     [|j1; ...; j(N-M)|] in the slice is identical to the element
     at coordinates [|j1; ...; j(N-M); i1; ...; iM|] in the original
     array a.  No copying of elements is involved: the slice and
     the original array share the same storage space.

     Genarray.slice_right applies only to big arrays in Fortran layout.
     Raise Invalid_argument if M >= N, or if [|i1; ... ; iM|]
     is outside the bounds of a.

val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit

Copy all elements of a big array in another big array.
     Genarray.blit src dst copies all elements of src into
     dst.  Both arrays src and dst must have the same number of
     dimensions and equal dimensions.  Copying a sub-array of src
     to a sub-array of dst can be achieved by applying Genarray.blit
     to sub-array or slices of src and dst.

val fill : ('a, 'b, 'c) t -> 'a -> unit

Set all elements of a big array to a given value.
     Genarray.fill a v stores the value v in all elements of
     the big array a.  Setting only some elements of a to v
     can be achieved by applying Genarray.fill to a sub-array
     or a slice of a.

val map_file : Unix.file_descr ->
       ?pos:int64 ->
       ('a, 'b) Bigarray.kind ->
       'c Bigarray.layout -> bool -> int array -> ('a, 'b, 'c) t

Memory mapping of a file as a big array.
     Genarray.map_file fd kind layout shared dims
     returns a big array of kind kind, layout layout,
     and dimensions as specified in dims.  The data contained in
     this big array are the contents of the file referred to by
     the file descriptor fd (as opened previously with
     Unix.openfile, for example).  The optional pos parameter
     is the byte offset in the file of the data being mapped;
     it defaults to 0 (map from the beginning of the file).

     If shared is true, all modifications performed on the array
     are reflected in the file.  This requires that fd be opened
     with write permissions.  If shared is false, modifications
     performed on the array are done in memory only, using
     copy-on-write of the modified pages; the underlying file is not
     affected.

     Genarray.map_file is much more efficient than reading
     the whole file in a big array, modifying that big array,
     and writing it afterwards.

     To adjust automatically the dimensions of the big array to
     the actual size of the file, the major dimension (that is,
     the first dimension for an array with C layout, and the last
     dimension for an array with Fortran layout) can be given as
     -1.  Genarray.map_file then determines the major dimension
     from the size of the file.  The file must contain an integral
     number of sub-arrays as determined by the non-major dimensions,
     otherwise Failure is raised.

     If all dimensions of the big array are given, the file size is
     matched against the size of the big array.  If the file is larger
     than the big array, only the initial portion of the file is
     mapped to the big array.  If the file is smaller than the big
     array, the file is automatically grown to the size of the big array.
     This requires write permissions on fd.

     Array accesses are bounds-checked, but the bounds are determined by
     the initial call to map_file. Therefore, you should make sure no
     other process modifies the mapped file while you're accessing it,
     or a SIGBUS signal may be raised. This happens, for instance, if the
     file is shrunk.

     This function raises Sys_error in the case of any errors from the
     underlying system calls.  Invalid_argument or Failure may be
     raised in cases where argument validation fails.


text:
template<typename ComponentType, typename... Bases> struct SubArray;
namespace poi
{
    namespace ss
    {
        namespace formula
        {
            namespace eval
            {
typedef ::SubArray< ::poi::ss::formula::eval::ValueEval, ::java::lang::ObjectArray > ValueEvalArray;
            } // eval
        } // formula
    } // ss
} // poi

template<typename T>
static T* npc(T* t)
{
    if(!t) throw new ::java::lang::NullPointerException();
    return t;
}

poi::ss::formula::functions::Var3or4ArgFunction::Var3or4ArgFunction(const ::default_init_tag&)
    : super(*static_cast< ::default_init_tag* >(0))
{
    clinit();
}

poi::ss::formula::functions::Var3or4ArgFunction::Var3or4ArgFunction()
    : Var3or4ArgFunction(*static_cast< ::default_init_tag* >(0))
{
    ctor();
}

poi::ss::formula::eval::ValueEval* poi::ss::formula::functions::Var3or4ArgFunction::evaluate(::poi::ss::formula::eval::ValueEvalArray* args, int32_t srcRowIndex, int32_t srcColumnIndex)
{
    switch (npc(args)->length) {
    case int32_t(3):
        return evaluate(srcRowIndex, srcColumnIndex, (*args)[int32_t(0)], (*args)[int32_t(1)], (*args)[int32_t(2)]);
    case int32_t(4):
        return evaluate(srcRowIndex, srcColumnIndex, (*args)[int32_t(0)], (*args)[int32_t(1)], (*args)[int32_t(2)], (*args)[int32_t(3)]);
    }

    return ::poi::ss::formula::eval::ErrorEval::VALUE_INVALID();
}

extern java::lang::Class *class_(const char16_t *c, int n);

java::lang::Class* poi::ss::formula::functions::Var3or4ArgFunction::class_()
{
    static ::java::lang::Class* c = ::class_(u"org.apache.poi.ss.formula.functions.Var3or4ArgFunction", 54);
    return c;
}

java::lang::Class* poi::ss::formula::functions::Var3or4ArgFunction::getClass0()
{
    return class_();
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Diagnostics;
using Eto.Forms;
using System.ComponentModel;
using System.Linq.Expressions;

namespace Eto.Forms
{
	/// <summary>
	/// Helper to turn a property changed event to an EventHandler for binding
	/// </summary>
	/// <remarks>
	/// Use <see cref="Binding.AddPropertyEvent"/> and <see cref="Binding.RemovePropertyEvent"/> to access
	/// this functionality.
	/// </remarks>
	class PropertyNotifyHelper
	{
		public string PropertyName { get; private set; }

		public event EventHandler<EventArgs> Changed;

		public PropertyNotifyHelper(INotifyPropertyChanged obj, string propertyName)
		{
			PropertyName = propertyName;
			obj.PropertyChanged += obj_PropertyChanged;
		}

		public void Unregister(object obj)
		{
			var notifyObject = obj as INotifyPropertyChanged;
			if (notifyObject != null)
				notifyObject.PropertyChanged -= obj_PropertyChanged;
		}

		void obj_PropertyChanged(object sender, PropertyChangedEventArgs e)
		{
			if (e.PropertyName == PropertyName)
			{
				if (Changed != null)
					Changed(sender, EventArgs.Empty);
			}
		}

	}

}


text:
/**
 * Created by albertin on 02/07/14.
 */

var defaultController = {
    getOne: function getOneUid(req, res, next) {
        // get a product from db and respond
    },
    createOne: function getOneUid(req, res, next) {
        // create a product in db and respond
    }
};
module.exports = defaultController;


text:
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Diagnostics.Contracts;

namespace BusterWood.Mapper
{
    /// Renames some of the fields in a source <param name="reader"/> using the <param name="newNames"/>
    public class RenamingDbDataReader : DelegatingDbDataReader
    {
        readonly string[] namesByOrdinal;
        readonly Dictionary<string, int> ordinalsByName;

        /// Renames some of the fields in a source <param name="reader"/> using the <param name="newNames"/>
        public RenamingDbDataReader(DbDataReader reader, IReadOnlyDictionary<int, string> newNames, CommandBehavior commandBehavior) : base (reader, commandBehavior)
        {
            Contract.Requires(reader != null);
            Contract.Requires(newNames != null);
            namesByOrdinal = new string[reader.FieldCount];
            ordinalsByName = new Dictionary<string, int>(newNames.Count);
            foreach (var pair in newNames)
            {
                namesByOrdinal[pair.Key] = pair.Value;
                ordinalsByName[pair.Value] = pair.Key;
            }
        }

        /// Renames some of the fields in a source <param name="reader"/> using the <param name="newNames"/>
        public RenamingDbDataReader(DbDataReader reader, IReadOnlyDictionary<string, string> newNames, CommandBehavior commandBehavior) : base(reader, commandBehavior)
        {
            Contract.Requires(reader != null);
            Contract.Requires(newNames != null);
            namesByOrdinal = new string[reader.FieldCount];
            ordinalsByName = new Dictionary<string, int>(newNames.Count);
            foreach (var pair in newNames)
            {
                var i = reader.GetOrdinal(pair.Key);
                namesByOrdinal[i] = pair.Value;
                ordinalsByName[pair.Value] = i;
            }
        }

        public override string GetName(int i) => namesByOrdinal[i] ?? base.GetName(i);

        public override int GetOrdinal(string name)
        {
            int i;
            return ordinalsByName.TryGetValue(name, out i) ? i : base.GetOrdinal(name);
        }

    }

}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>common.config</groupId>
		<artifactId>pom.base</artifactId>
		<version>0.0.1-SNAPSHOT</version>
		<relativePath>../common.config/pom.base</relativePath>
	</parent>
	<groupId>prj.saxon.demo</groupId>
	<artifactId>saxon.demo</artifactId>

	<dependencies>
		<!-- https://mvnrepository.com/artifact/net.sf.saxon/Saxon-HE -->
		<dependency>
			<groupId>net.sf.saxon</groupId>
			<artifactId>Saxon-HE</artifactId>
			<version>9.7.0-7</version>
		</dependency>

	</dependencies>
</project>


text:
<!doctype html>
<html>
  <head>
  </head>
  <style>
    body {
    /* Ubicación de la imagen */
    background-image: url(img/remo_jugador_DOS.jpg);

    /* Nos aseguramos que la imagen de fondo este centrada vertical y
      horizontalmente en todo momento */
    background-position: center center;

    /* La imagen de fondo no se repite */
    background-repeat: no-repeat;

    /* La imagen de fondo está fija en el viewport, de modo que no se mueva cuando
       la altura del contenido supere la altura de la imagen. */
    background-attachment: fixed;

    /* La imagen de fondo se reescala cuando se cambia el ancho de ventana
       del navegador */
    background-size: cover;

    /* Fijamos un color de fondo para que se muestre mientras se está
      cargando la imagen de fondo o si hay problemas para cargarla  */
    background-color: #464646;
  }
  </style>
  <body>
  </body>

<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.8/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script>

  var socket = io();
  var acc;

  window.ondeviceorientation = function(event) {
    alpha = Math.round(event.alpha);
    beta = Math.round(event.beta);
    gamma = Math.round(event.gamma);
    acc = [alpha, beta, gamma];

  }

  setInterval(function(){ socket.emit('acc1', acc); }, 50);

  window.addEventListener('touchstart', function(event) {

        socket.emit('click', true);

  });

</script>

</html>


text:
First of all, **thank you** for contributing, **you are awesome**!

Here are a few rules to follow in order to ease code reviews, and discussions before
maintainers accept and merge your work.

As library follows the next standards: [PSR-0](http://www.php-fig.org/psr/psr-0/), [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), [PSR-4](http://www.php-fig.org/psr/psr-4/). You also MUST follow them.

You SHOULD follow the [Symfony Coding Standards](http://symfony.com/doc/current/contributing/code/standards.html).
If you don't know about any of them, you should really read the recommendations.
You can use a helpful tool [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) with a last version of [Symfony standards](https://github.com/escapestudios/Symfony2-coding-standard).
Or you can use a [PHP-CS-Fixer](http://cs.sensiolabs.org/) tool to fix all coding style issues.

You SHOULD write documentation.

Please, write [commit messages that make sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), and [rebase your branch](http://git-scm.com/book/en/Git-Branching-Rebasing) before submitting your Pull Request.

One may ask you to [squash your commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) too. This is used to "clean" your Pull Request before merging it (we don't want commits such as `fix tests`, `fix 2`, `fix 3`, etc.).

Thank you!


text:
namespace SoftServe.ITA.PrompterPro.WebApplication.Hubs
{
    public enum ScreenResolution
    {
        Small = 0,
        Medium = 1,
        Large = 2
    }
}


text:
Vuex non ti obbliga a seguire nessuna convenzione per quanto riguarda la struttura del codice però ci sono dei principi che possono essere utili e vale la pena tenere in considerazione:

1. Lo stato dell'Applicazione è conservato in uno store, il quale è un singolo oggetto.

2. L'unico modo di mutare lo stato è quello di inviare una mutation allo store.

3. Le mutation sono sincrone, l'unico effetto che devono avere è quello di mutare uno stato.

4. Possiamo esporre uno strato più complesso di API tramite le action. Le action possono incapsulare mutation e codice asincrono ma il fine ultimo di una action dev'essere sempre quello che attivare una mutation.

5. I Componenti usano i getter per prelevare gli stati dallo store e chiamano le azioni per mutarli.

La cosa interessante delle mutation, action e getter in Vuex è il fatto che **sono tutte funzioni javascript**. Se seguirete queste piccole regolette sarà più facile interscambiare la logica tra progetti che utilizzano VuexT. Di seguito sono mostrate delle strutture di base per i vostri progetti in Vuex.

### Progetto Semplice

Quando si parla di applicazioni semplici possiamo definire **store** e **actions** in due file separati:

``` bash
.
├── index.html
├── main.js
├── components
│   ├── App.vue
│   └── ...
└── vuex
    ├── store.js     # file per lo store
    └── actions.js   # file per le action
```

Per un esempio pratico potete rivedere [L'esempio del Contatore](https://github.com/vuejs/vuex/tree/master/examples/counter) oppureß [L'esempio TodoMVC](https://github.com/vuejs/vuex/tree/master/examples/todomvc).

Alternativamente potete anche suddividere le mutation in un file a se stante.

### Medium to Large Project

Per tutte quelle applicazioni di medie o grosse dimensioni la struttura di Vuex può differire rispetto a quella vista precedentemente. Per esempio la suddivisione del codice in moduli atomici per ogni vario stato da monitorare (molto simile alla logica degli store in Flux o ai reducers in Redux), ognuno dei quali si occupa di uno specifico dominio nella vostra applicazione ecco un esempio di struttura:

``` bash
├── index.html
├── main.js
├── api
│   └── ... # api request
├── components
│   ├── App.vue
│   └── ...
└── vuex
    ├── actions.js        # Tutte le azioni
    ├── store.js          # Qui assembliamo i moduli
    ├── mutation-types.js # costanti globali
    └── modules
        ├── cart.js       # lo stato e le mutation per il carrello
        └── products.js   # lo stato e le mutation per i prodotti
```

Un modulo, di solito, assomiglia a qualcosa del tipo:

``` js
// vuex/modules/products.js
import {
  RECEIVE_PRODUCTS,
  ADD_TO_CART
} from '../mutation-types'

// stato iniziale
const state = {
  all: []
}

// mutations
const mutations = {
  [RECEIVE_PRODUCTS] (state, products) {
    state.all = products
  },

  [ADD_TO_CART] (state, productId) {
    state.all.find(p => p.id === productId).inventory--
  }
}

export default {
  state,
  mutations
}
```

Ed in vuex/store.js, possiamo assemblare tutti i moduli:

``` js
// vuex/store.js
import Vue from 'vue'
import Vuex from '../../../src'
// importiamo i moduli
import cart from './modules/cart'
import products from './modules/products'

Vue.use(Vuex)

export default new Vuex.Store({
  // combiniamoli
  modules: {
    cart,
    products
  }
})
```

Lo stato iniziale di `cart` verrà legato alla root dell'albero degli stati in modo tale da ottenere `store.state.cart`. In aggiunta **tutte le mutation sono definite in un sub modulo e ricevono solo lo stato associato a tale sub modulo**. Questo significa che il modulo `cart` riceverà sempre `store.state.cart` come primo argomento.

L'albero degli stati, e la sua root, non possono essere rimpiazzati all'interno dei moduli. Per esempio questo codice non funzionerà:

``` js
const mutations = {
  SOME_MUTATION (state) {
    state = { ... }
  }
}
```

Invece questo codice contiene la logica giusta per gestire gli alberi di ogni sub modulo:

``` js
const mutations = {
  SOME_MUTATION (state) {
    state.value = { ... }
  }
}
```

Dato che tutti i moduli esportano semplici funzioni ed oggetti javascript essi sono facili da testare e mantenere ma, soprattutto, possono essere aggiornati tramite "hot-reload". Ovviamente la guida descritta sopra è solo un indicazione di come dovrebbe essere strutturata un'applicazione tramite Vuex. Potete usare qualsiasi struttura voi riteniate adeguata.

Si noti che non ci sono action nei moduli, questo perchè una singola azione può attivare differenti mutation in differenti moduli. E' sempre una buona idea separare le action dall'implementazione dei moduli.

Per un esempio concreto potete rivedere [il Carrello della Spesa in Vuex](https://github.com/vuejs/vuex/tree/master/examples/shopping-cart).


text:
  Project Name: Custom Profile Script
   * Date:2014.11.13
   * Created by: Lightnet
   * Link:https://github.com/Lightnet/customprofilescript
   * license: MIT
   * Type: Package

  Check for more information on readme.txt file.

  Programs:
    * Name: Atom
      * Link: https://atom.io/
    * Name: Nodejs
      * Link: http://nodejs.org/

  Stage: Prototype

  Information: This is just a prototype build. To learn the basic of the atom package api.
  Custom Profile Script is a buddy helper that do some random actions on the screen. It will display 2D/3D model character on the atom window area limited by border window.

The package will be open source. Since I am trying to get some basic idea how the API works.


text:
package plugins;

import java.io.File;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import whitebox.geospatialfiles.ShapeFile;
import whitebox.geospatialfiles.shapefile.attributes.DBFField;
import whitebox.geospatialfiles.shapefile.attributes.DBFWriter;
import whitebox.geospatialfiles.shapefile.PointsList;
import whitebox.geospatialfiles.shapefile.ShapeType;
import whitebox.geospatialfiles.shapefile.ShapefilePoint;
import whitebox.interfaces.WhiteboxPlugin;
import whitebox.interfaces.WhiteboxPluginHost;
import whitebox.interfaces.InteropPlugin;

/**
 * This tool can be used to import vector files that were created using the Terrain Analysis System (TAS).
 * @author Dr. John Lindsay email: jlindsay@uoguelph.ca
 */
public class ImportTASVector implements WhiteboxPlugin, InteropPlugin {

    private WhiteboxPluginHost myHost = null;
    private String[] args;
    /**
     * Used to retrieve the plugin tool's name. This is a short, unique name containing no spaces.
     * @return String containing plugin name.
     */
    @Override
    public String getName() {
        return "ImportTASVector";
    }
    /**
     * Used to retrieve the plugin tool's descriptive name. This can be a longer name (containing spaces) and is used in the interface to list the tool.
     * @return String containing the plugin descriptive name.
     */
    @Override
    public String getDescriptiveName() {
        return "Import TAS Vector (.vtr)";
    }
    /**
     * Used to retrieve a short description of what the plugin tool does.
     * @return String containing the plugin's description.
     */
    @Override
    public String getToolDescription() {
        return "Imports a TAS vector file (.vtr)";
    }
    /**
     * Used to identify which toolboxes this plugin tool should be listed in.
     * @return Array of Strings.
     */
    @Override
    public String[] getToolbox() {
        String[] ret = {"IOTools"};
        return ret;
    }
    /**
     * Sets the WhiteboxPluginHost to which the plugin tool is tied. This is the class
     * that the plugin will send all feedback messages, progress updates, and return objects.
     * @param host The WhiteboxPluginHost that called the plugin tool.
     */
    @Override
    public void setPluginHost(WhiteboxPluginHost host) {
        myHost = host;
    }
    /**
     * Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface.
     * @param feedback String containing the text to display.
     */
    private void showFeedback(String message) {
        if (myHost != null) {
            myHost.showFeedback(message);
        } else {
            System.out.println(message);
        }
    }
    /**
     * Used to communicate a return object from a plugin tool to the main Whitebox user-interface.
     * @return Object, such as an output WhiteboxRaster.
     */
    private void returnData(Object ret) {
        if (myHost != null) {
            myHost.returnData(ret);
        }
    }
    private int previousProgress = 0;
    private String previousProgressLabel = "";
    /**
     * Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
     * @param progress Float containing the progress value (between 0 and 100).
     */
    private void updateProgress(String progressLabel, int progress) {
        if (myHost != null && ((progress != previousProgress)
                || (!progressLabel.equals(previousProgressLabel)))) {
            myHost.updateProgress(progressLabel, progress);
        }
        previousProgress = progress;
        previousProgressLabel = progressLabel;
    }
    /**
     * Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
     * @param progress Float containing the progress value (between 0 and 100).
     */
    private void updateProgress(int progress) {
        if (myHost != null && progress != previousProgress) {
            myHost.updateProgress(progress);
        }
        previousProgress = progress;
    }
    /**
     * Sets the arguments (parameters) used by the plugin.
     * @param args An array of string arguments.
     */
    @Override
    public void setArgs(String[] args) {
        this.args = args.clone();
    }
    private boolean cancelOp = false;
    /**
     * Used to communicate a cancel operation from the Whitebox GUI.
     * @param cancel Set to true if the plugin should be canceled.
     */
    @Override
    public void setCancelOp(boolean cancel) {
        cancelOp = cancel;
    }

    private void cancelOperation() {
        showFeedback("Operation cancelled.");
        updateProgress("Progress: ", 0);
    }
    private boolean amIActive = false;
    /**
     * Used by the Whitebox GUI to tell if this plugin is still running.
     * @return a boolean describing whether or not the plugin is actively being used.
     */
    @Override
    public boolean isActive() {
        return amIActive;
    }

    /**
     * Used to execute this plugin tool.
     */
    @Override
    public void run() {
        amIActive = true;

        RandomAccessFile rIn = null;
        ByteBuffer buf;

        String inputFilesString = null;
        String[] vectorFiles;
        double x, y, north, south, east, west;
        double z;
        float minValue, maxValue;
        float featureValue;
        int numVertices;
        byte classValue, numReturns, returnNum;
        int a, n, loc, featureNum = 1;
        int progress = 0;
        int numPoints = 0;
        ShapeType shapeType = ShapeType.POINT;

        // get the arguments
        if (args.length <= 0) {
            showFeedback("Plugin parameters have not been set.");
            return;
        }
        inputFilesString = args[0];

        // check to see that the inputHeader and outputHeader are not null.
        if ((inputFilesString.length() <= 0)) {
            showFeedback("One or more of the input parameters have not been set properly.");
            return;
        }

        try {

            vectorFiles = inputFilesString.split(";");
            int numVectorFiles = vectorFiles.length;
            long numPointsInFile = 0;

            //LASReader.PointRecord point;
            //PointRecColours pointColours;
            for (int j = 0; j < numVectorFiles; j++) {

                String fileName = vectorFiles[j];

                // See if the data file exists.
                File file = new File(fileName);
                if (!file.exists()) {
                    return;
                }
                long fileLength = file.length();
                if (fileLength > Integer.MAX_VALUE) {
                    showFeedback("File is too large!");
                }

                // read in the header data and see what type of data this file contains
                buf = ByteBuffer.allocate((int)fileLength);

                rIn = new RandomAccessFile(fileName, "r");

                FileChannel inChannel = rIn.getChannel();

                inChannel.position(0);
                inChannel.read(buf);

                buf.order(ByteOrder.LITTLE_ENDIAN);
                buf.rewind();

                minValue = buf.getFloat(0);
                maxValue = buf.getFloat(4);
                north = Math.max(buf.getDouble(8), buf.getDouble(16));
                south = Math.min(buf.getDouble(8), buf.getDouble(16));
                east = Math.max(buf.getDouble(24), buf.getDouble(32));
                west = Math.min(buf.getDouble(24), buf.getDouble(32));

                // The following code finds the shapeType and assumes that all
                // of the features in the file are the same type, which is not
                // necessarily the case.
                loc = 40;
                do {
                    numVertices = buf.getInt(loc);
                    featureValue = buf.getFloat(loc + 4);
                    if (numVertices == 1) {
                        shapeType = ShapeType.POINT;
                    } else {
                        shapeType = ShapeType.POLYLINE;
                    }
                    break;
                } while (loc < fileLength);

                // create the new shapefile
                String outputFile = fileName.replace(".vtr", ".shp");
                File outfile = new File(outputFile);
                if (outfile.exists()) {
                    outfile.delete();
                }

                // set up the output files of the shapefile and the dbf
                ShapeFile output = new ShapeFile(outputFile, shapeType);

                DBFField fields[] = new DBFField[2];

                fields[0] = new DBFField();
                fields[0].setName("FID");
                fields[0].setDataType(DBFField.DBFDataType.NUMERIC);
                fields[0].setFieldLength(10);
                fields[0].setDecimalCount(0);

                fields[1] = new DBFField();
                fields[1].setName("VALUE");
                fields[1].setDataType(DBFField.DBFDataType.NUMERIC);
                fields[1].setFieldLength(10);
                fields[1].setDecimalCount(3);

                String DBFName = output.getDatabaseFile();
                DBFWriter writer = new DBFWriter(new File(DBFName)); /*
                 * this DBFWriter object is now in Syc Mode
                 */

                writer.setFields(fields);

                progress = (int)((j + 1) * 100d / numVectorFiles);
                updateProgress("Loop " + (j + 1) + " of " + numVectorFiles + ":", progress);

                buf.rewind();
                loc = 40;

                if (shapeType == ShapeType.POINT) {
                    do {
                        numVertices = buf.getInt(loc);
                        featureValue = buf.getFloat(loc + 4);
                        x = buf.getFloat(loc + 8) + west;
                        y = buf.getFloat(loc + 12) + south;

                        whitebox.geospatialfiles.shapefile.Point wbGeometry = new whitebox.geospatialfiles.shapefile.Point(x, y);
                        output.addRecord(wbGeometry);

                        Object[] rowData = new Object[2];
                        rowData[0] = new Double(featureNum);
                        rowData[1] = new Double(featureValue);
                        writer.addRecord(rowData);
                        loc += 8 + numVertices * 8;
                        featureNum++;
                    } while (loc < fileLength);
                } else {
                    ArrayList<ShapefilePoint> pnts = new ArrayList<ShapefilePoint>();

                    int[] parts = {0};
                    do {
                        pnts.clear();
                        numVertices = buf.getInt(loc);
                        featureValue = buf.getFloat(loc + 4);
                        int startingByte = loc + 8;
                        for (a = 0; a < numVertices; a++) {
                            x = buf.getFloat(startingByte + a * 8) + west;
                            y = buf.getFloat(startingByte + a * 8 + 4) + south;
                            pnts.add(new ShapefilePoint(x, y));
                        }

                        PointsList pl = new PointsList(pnts);
                        whitebox.geospatialfiles.shapefile.PolyLine wbGeometry = new whitebox.geospatialfiles.shapefile.PolyLine(parts, pl.getPointsArray());
                        output.addRecord(wbGeometry);

                        Object[] rowData = new Object[2];
                        rowData[0] = new Double(featureNum);
                        rowData[1] = new Double(featureValue);
                        writer.addRecord(rowData);

                        loc += 8 + numVertices * 8;
                        featureNum++;
                    } while (loc < fileLength);
                }

                output.write();
                writer.write();

            }

            returnData(vectorFiles[0].replace(".vtr", ".shp"));

        } catch (OutOfMemoryError oe) {
            myHost.showFeedback("An out-of-memory error has occurred during operation.");
        } catch (Exception e) {
            myHost.showFeedback("An error has occurred during operation. See log file for details.");
            myHost.logException("Error in " + getDescriptiveName(), e);
        } finally {
            updateProgress("Progress: ", 0);
            if (rIn != null) {
                try {
                    rIn.close();
                } catch (Exception e) {
                }
            }

            // tells the main application that this process is completed.
            amIActive = false;
            myHost.pluginComplete();
        }
    }

    /**
     * Used to retrieve the necessary extensions.
     * @return String containing the extensions.
     */
    @Override
    public String[] getExtensions() {
        return new String[]{ "txt" };
    }

    /**
     * Used to retrieve the file type name.
     * @return String containing the file type name.
     */
    @Override
    public String getFileTypeName() {
        return "ArcGIS ASCII Grid";
    }

    /**
     * Used to check if the file is raster format.
     * @return Boolean true if file is raster format.
     */
    @Override
    public boolean isRasterFormat() {
        return true;
    }

    /**
     * Used to retrieve the interoperable plugin type.
     * @return
     */
    @Override
    public InteropPlugin.InteropPluginType getInteropPluginType() {
        return InteropPlugin.InteropPluginType.exportPlugin;
    }
}

//    // this is only used for debugging the tool
//    public static void main(String[] args) {
//        ImportTASVector itv = new ImportTASVector();
//        args = new String[1];
//        args[0] = "/Users/johnlindsay/Documents/Teaching/GEOG2420/Fall 2012/Labs/Lab4/Data/Feature2.vtr";
//        itv.setArgs(args);
//        itv.run();
//
//    }


text:
require 'qtapp/printer'
require 'pp'

module Qtapp::Printer
  class PrettyPrint < Base
    def print(*args)
      color = Qtapp::Crazy.colors.sample
      Qtapp::Crazy.crazy_line(color)
      pp *args
      Qtapp::Crazy.crazy_line(color)
    end
  end
end


text:
Use PeopleSalesWH
GO
PRINT '<<< USING PeoplesSalesWH >>>'
PRINT ''

DECLARE @SPName VarChar(100)
SET @SPName = 'vw_People'
IF NOT EXISTS(SELECT * FROM sysobjects WHERE [name] = @SPName)
  BEGIN
	DECLARE @SQL VarChar(1000)
	SET @SQL = 'CREATE VIEW ' + @SPName + ' AS select * from sysobjects'
	EXECUTE(@SQL)
  END
PRINT 'Updating View ' + @SPName
GO

ALTER VIEW vw_People AS
SELECT
	p.PersonID
	,p.PersonIDSOR AS PersonIDSystemOfRecord
	,p.FirstName
	,p.LastName
	,p.EffectiveDateID
	,d.CalendarDate AS EffectiveDate
FROM People p
INNER JOIN MasterDates d
	ON p.EffectiveDateID = d.DateID


text:
.class final enum Lcom/google/common/cache/LocalCache$EntryFactory$1;
.super Lcom/google/common/cache/LocalCache$EntryFactory;
.source "LocalCache.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/google/common/cache/LocalCache$EntryFactory;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x4008
    name = null
.end annotation

# direct methods
.method constructor <init>(Ljava/lang/String;I)V
    .locals 1

    .prologue
    .line 438
    const/4 v0, 0x0

    invoke-direct {p0, p1, p2, v0}, Lcom/google/common/cache/LocalCache$EntryFactory;-><init>(Ljava/lang/String;ILcom/google/common/cache/LocalCache$1;)V

    return-void
.end method

# virtual methods
.method newEntry(Lcom/google/common/cache/LocalCache$Segment;Ljava/lang/Object;ILcom/google/common/cache/LocalCache$ReferenceEntry;)Lcom/google/common/cache/LocalCache$ReferenceEntry;
    .locals 1
    .param p3, "hash"    # I
    .param p4    # Lcom/google/common/cache/LocalCache$ReferenceEntry;
        .annotation runtime Ljavax/annotation/Nullable;
        .end annotation
    .end param
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<K:",
            "Ljava/lang/Object;",
            "V:",
            "Ljava/lang/Object;",
            ">(",
            "Lcom/google/common/cache/LocalCache$Segment",
            "<TK;TV;>;TK;I",
            "Lcom/google/common/cache/LocalCache$ReferenceEntry",
            "<TK;TV;>;)",
            "Lcom/google/common/cache/LocalCache$ReferenceEntry",
            "<TK;TV;>;"
        }
    .end annotation

    .prologue
    .line 442
    .local p1, "segment":Lcom/google/common/cache/LocalCache$Segment;, "Lcom/google/common/cache/LocalCache$Segment<TK;TV;>;"
    .local p2, "key":Ljava/lang/Object;, "TK;"
    .local p4, "next":Lcom/google/common/cache/LocalCache$ReferenceEntry;, "Lcom/google/common/cache/LocalCache$ReferenceEntry<TK;TV;>;"
    new-instance v0, Lcom/google/common/cache/LocalCache$StrongEntry;

    invoke-direct {v0, p2, p3, p4}, Lcom/google/common/cache/LocalCache$StrongEntry;-><init>(Ljava/lang/Object;ILcom/google/common/cache/LocalCache$ReferenceEntry;)V

    return-object v0
.end method


text:
import jpype
import os, os.path

WRAPPERS = {
		"void" : ( "java/lang/Void", 'V', 'return', None, None),
		"byte" : ( "java/lang/Byte", 'B', 'ireturn', "iload", "byteValue()B"),
		"short" : ( "java/lang/Short", 'S', 'ireturn', "iload", "shortValue()S"),
		"int" : ( "java/lang/Integer", 'I', 'ireturn', "iload", "intValue()I"),
		"long" : ( "java/lang/Long", 'J', 'lreturn', "lload", "longValue()L"),
		"float" : ( "java/lang/Float", 'F', 'freturn', "fload", "floatValue()F"),
		"double" : ( "java/lang/Double", 'D', 'dreturn', "dload", "doubleValue()D"),
		"char" : ( "java/lang/Character", 'C', 'ireturn', "iload", "charValue()C"),
		"boolean" : ( "java/lang/Boolean", 'Z', 'ireturn', "iload", "booleanValue()Z"),
		}

def classGen( ) :
	global Modifier
	root = os.path.abspath( os.path.dirname( __file__ ) )
	cp = os.path.abspath(root+"/../../build-support/jasmin.jar;"+root+"/../../_bin;"+root+"/../../_classgen")
	jpype.startJVM( jpype.getDefaultJVMPath( ), "-ea", "-Djava.class.path=%s"%cp)

	Modifier = jpype.JClass( "java.lang.reflect.Modifier" )

	try :
		# base = jpype.JClass("javax.swing.JFrame")
		base = jpype.JClass( "java.lang.Object" )
		intf = [ jpype.JClass( "java.lang.Comparable" ),
				 #jpype.JClass("javax.swing.CellEditor"),
		]

		try :
			result = generateClass( "com.darkwolf.jpype.classgen.TestClass", base, intf, "../../_classgen" );

			dumpClassInformation( result );
		except :
			import traceback
			traceback.print_exc( )

	finally :
		jpype.shutdownJVM( )

def generateClass(name, base, intf, outRootDir) :
	slashName = name.replace('.', '/')
	slashBaseName = base.__javaclass__.getName().replace('.', '/')
	slashIntfNames = map(lambda x : x.__javaclass__.getName().replace('.', '/'), intf)

	methods = getAllMethods(base, intf)

	lines = []
	lines += startClass(slashName, slashBaseName, slashIntfNames)
	lines += createFields()
	lines += createStaticInit(slashName, methods)
	lines += createConstructor(slashName, slashBaseName, methods)
	for i in range(len(methods)) :
		m = methods[i]
		lines += createMethod(i, slashName, m);

	lines.append("")
	bytes = saveClass(slashName, outRootDir, lines);

	return defineClass(name, bytes)

def createMethod(ndx, name, m) :
	argumentCount = len(m.parameterTypes)
	Modifier = jpype.java.lang.reflect.Modifier
	access = "public"
	if Modifier.isSynchronized(m.modifiers) :
		access += " synchronized"

	exceptions = map(lambda x : x.__javaclass__.getName().replace('.', '/'), m.exceptionTypes)

	res = [
		".method %s %s%s" % (access, m.name, getSignature(m))
	]

	for i in exceptions :
		res.append("    .throws %s" % i)

	res += [
		"    .limit stack %d" % (argumentCount+10),
		"    .limit locals %d" % (argumentCount+3),
		"    ; Have we checked this method before?",
		"    aload_0",
		"    getfield %s/_jpype_checked Ljava/util/BitSet;" % name,
		"    %s" % getIPush(ndx),
		"    invokevirtual java/util/BitSet/get(I)Z",
		"    ifne Label3",
		"",
		"    ; If we're here, we havent checked before",
		"    ; Set the checked bit",
		"    aload_0",
		"    getfield %s/_jpype_checked Ljava/util/BitSet;" % name,
		"    %s" % getIPush(ndx),
		"    iconst_1",
		"    invokevirtual java/util/BitSet/set(IZ)V",
		"",
		"    ; check with the PythonCaller",
		"    aload_0",
		"    getfield %s/_jpype_overloaded Ljava/util/BitSet;" % name,
		"    %s" % getIPush(ndx),
		"    aload_0",
		"    getfield %s/_jpype_target J" % name,
		'    ldc "%s"' % m.name,
		"    invokestatic jpype/PythonMethodCaller/hasMethod/(JLjava/lang/String;)Z",
		"    invokevirtual java/util/BitSet/set(IZ)V",
		"",
		"    ; if the method is overloaded ...",
		"Label3:",
		"    aload_0",
		"    getfield %s/_jpype_overloaded Ljava/util/BitSet;" % name,
		"    %s" % getIPush(ndx),
		"    invokevirtual java/util/BitSet/get(I)Z",
		"    ifne Label4",
		"",
		"    ; If here, the is NO overload",
	]

	params = m.parameterTypes
	if Modifier.isAbstract(m.modifiers) :
		res += [
			"    ; The method is Abstract and MUST be overloaded ... thrown an exception",
			"    new java/lang/NoSuchMethodError",
			"    dup",
			'    ldc "%s"' % m.name,
			"    invokenonvirtual java/lang/NoSuchMethodError/<init>(Ljava/lang/String;)V",
			"    athrow",
		]
	else:
		res += [
			"    ; Call super",
			"    aload_0"
		]
		for i in range(len(params)) :
			param = params[i]
			if WRAPPERS.has_key(param.__javaclass__.getName()) :
				res.append("    %s %d" % (WRAPPERS[param.__javaclass__.getName()][3], i+1))
			else:
				res += [
					"    aload %d" % (i+1),
					"    checkcast %s" % param.__javaclass__.getName().replace('.', '/')
				]

		res+= [
			"    invokenonvirtual %s/%s%s" % (m.getDeclaringClass().__javaclass__.getName().replace('.', '/'), m.name, getSignature(m)),
			"    goto Label0",
			"",
			]

	res+= [
		"    ; Prepare the call to Python Caller",
		"Label4:",
		"    ; Put the target",
		"      aload_0",
		"      getfield %s/_jpype_target J" % name,
		"    ; load the method name",
		'      ldc "%s"' % m.name,
		"    ; load the args",
		"      %s" % getIPush(len(params)),
		"      anewarray java/lang/Object",
	]
	for i in range(len(params)) :
		param = params[i]
		res += [
			"      dup",
			"      %s" % getIPush(i)
		]
		if WRAPPERS.has_key(param.__javaclass__.getName()) :
			res += [
				"      new %s" % WRAPPERS[param.__javaclass__.getName()][1],
				"      dup",
				"      %s %d" % (WRAPPERS[param.__javaclass__.getName()][3], i+1),
				"      invokenonvirtual %s/<init>(%s)V" % (WRAPPERS[param.__javaclass__.getName()][1], WRAPPER[param.__javaclass__.getName()][0]),
			]
		else:
			res += [
				"      aload %d" % (i+1),
			]
		res += [
			"      aastore",
			"",
			]
	res += [
		"    ; Load the args array",
		"      getstatic %s/_java_param_types [[Ljava/lang/Class;" % name,
		"      %s" % getIPush(ndx),
		"      aaload"
		"",
		"    ; Load the return type array",
		"      getstatic %s/_java_return_types [Ljava/lang/Class;" % name,
		"      %s" % getIPush(ndx),
		"      aaload"
		"",
		"    ; Call the Python Caller",
		"      invokestatic jpype/PythonMethodCaller/invoke(JLjava/lang/String;[Ljava/lang/Object;[Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object;",
	]

	if m.returnType.__javaclass__.isPrimitive() :
		t = WRAPPERS[m.returnType.__javaclass__.getName()]
		if t[4] is not None :
			res.append("      checkcast %s" % t[0])
			res.append("      invokevirtual %s/%s" % (t[0], t[4]))
	else:
		res.append("      checkcast %s" % m.returnType.__javaclass__.getName().replace('.', '/'))

	if m.returnType.__javaclass__.getName() == "void" :
		res.append("      pop")

	res.append("Label0:")
	if WRAPPERS.has_key(m.returnType.__javaclass__.getName()) :
		res.append("    %s" % WRAPPERS[m.returnType.__javaclass__.getName()][2])
	else:
		res.append("    areturn")

	res += [
		".end method",
		"",
		]

	return res

def defineClass(name, bytes) :
	JPypeClassLoader = jpype.JClass("org.darkwolf.jpype.classgen.JPypeClassLoader")
	cl = JPypeClassLoader(name, bytes)
	return cl.loadClass(name)

def saveClass(name, outRootDir, lines) :
	outFileName = outRootDir+"/"+name
	parentDir = os.path.split(outFileName)[0]
	if not os.path.exists(parentDir) :
		os.makedirs(parentDir)

	f = open(outFileName+".j", "w+")
	for i in lines :
		print >> f, i
	f.close()

	src = "\n".join(lines)

	ClassFile = jpype.JClass("jasmin.ClassFile")
	ByteArrayInputStream = jpype.java.io.ByteArrayInputStream
	ByteArrayOutputStream = jpype.java.io.ByteArrayOutputStream
	FileOutputStream = jpype.java.io.FileOutputStream

	bytes = jpype.java.lang.String(src).getBytes()
	bais = ByteArrayInputStream(bytes)

	try :
		cf = ClassFile()
		cf.readJasmin(bais, name, True)
	except jpype.java.lang.ArrayIndexOutOfBoundsException.PYEXC, ex :
		print ex.stacktrace()

	fout = FileOutputStream(outFileName+".class")
	cf.write(fout)
	fout.close()

	fout = ByteArrayOutputStream()
	cf.write(fout)
	bytes = fout.toByteArray()
	fout.close()

	return bytes

def createStaticInit(name, methods) :
	return [
		".method static <clinit>()V",
		"    .limit stack 7",
		"    .limit locals 1",
		".catch java/lang/Exception from Label1 to Label2 using Label2",
		"Label1:",
	] + createArgTypesArray(name, methods) + createReturnTypesArray(name, methods) + [
		"    goto Label3",
		"Label2:",
		"    astore_0",
		".var 0 is ex Ljava/lang/Exception; from Label4 to Label3",
		"Label4:",
		"    aload_0",
		"    invokevirtual java/lang/Exception/printStackTrace()V",
		"Label3:",
		"    return",
		".end method",
		"",
	]

def createConstructor(name, superName, methods) :
	return [
		".method public <init>(J)V",
		"    .limit stack 4",
		"    .limit locals 3",
		"    ; Store the target",
		"    aload_0",
		"    lload 1",
		"    putfield %s/_jpype_target J" % name,
		"    ; Call super",
		"    aload_0",
		"    invokenonvirtual %s/<init>()V" % superName,
		"    ; Create the checked bitset",
		"    aload_0",
		"    new java/util/BitSet",
		"    dup",
		"    %s" % getIPush(len(methods)),
		"    invokespecial java/util/BitSet/<init>(I)V",
		"    putfield %s/_jpype_checked Ljava/util/BitSet;" % name,
		"    ; Create the overloaded bitset",
		"    aload_0",
		"    new java/util/BitSet",
		"    dup",
		"    %s" % getIPush(len(methods)),
		"    invokespecial java/util/BitSet/<init>(I)V",
		"    putfield %s/_jpype_overloaded Ljava/util/BitSet;" % name,
		"    return",
		".end method",
		""
	]

def createArgTypesArray(name, methods) :
	res = [
		"    ;",
		"    ; Create the parameter types array",
		"    ;",
		"    %s" % getIPush(len(methods)),
		"    anewarray [Ljava/lang/Class;",
	]
	for i in range(len(methods)) :
		m = methods[i]
		res += [
			"    ; Method %d : %s%s" % (i, m.name, getSignature(m)),
			"      dup",
			"      %s" % getIPush(i),
			]

		argTypes = m.parameterTypes

		res += [
			"      %s" % getIPush(len(argTypes)),
			"      anewarray Ljava/lang/Class;",
			]
		for j in range(len(argTypes)) :
			res += [
				"      ; Argument %d" % j,
				"        dup",
				"        %s" % getIPush(j),
			]
			if argTypes[j].__javaclass__.isPrimitive() :
				res.append("        getstatic %s/TYPE Ljava/lang/Class;" % WRAPPER[argTypes[j].__javaclass__.getName()])
			else:
				res += [
				'        ldc "%s"' % argTypes[j].__javaclass__.getName(),
				'        invokestatic java/lang/Class/forName(Ljava/lang/String;)Ljava/lang/Class;'
				]
			res.append("        aastore")
		res.append("      aastore")
	res.append("    putstatic %s/_jpype_param_types [[Ljava/lang/Class;" % name )
	return res

def createReturnTypesArray(name, methods) :
	res= [
		"    ;",
		"    ; Create the Return types array",
		"    ;",
		"    %s" % getIPush(len(methods)),
		"    anewarray java/lang/Class",
	]

	for i in range(len(methods)) :
		m = methods[i]
		returnType = m.returnType.__javaclass__
		res += [
			"    ; Method %d : %s%s" % (i, m.name, getSignature(m)),
			"      dup",
			"      %s" % getIPush(i),
		]

		if returnType.isPrimitive() :
			res.append( "      getstatic %s/TYPE Ljava/lang/Class;" % WRAPPERS[returnType.getName()][0] )
		else :
			res += [
				'      ldc "%s"' % returnType.getName(),
				'      invokestatic java/lang/Class/forName(Ljava/lang/String;)Ljava/lang/Class;'
				]
		res.append("      aastore")
	res.append("    putstatic %s/_jpype_return_types [Ljava/lang/Class;" % name)
	return res

def getAllMethods(base, interfaces) :
	methods = {}

	extractMethods(base.__javaclass__, methods);
	for i in interfaces :
		extractMethods(i.__javaclass__, methods);

	return methods.values()

def createFields() :
	# TODO change the public to private ...
	return [
		".field public _jpype_target J",
		".field public _jpype_checked Ljava/util/BitSet;",
		".field public _jpype_overloaded Ljava/util/BitSet;",
		".field public static final _jpype_return_types [Ljava/lang/Class;",
		".field public static final _jpype_param_types [[Ljava/lang/Class;",
		""
	]

def startClass(name, base, intf) :
	return [
	".class %s" % name,
	".super %s" % base,
	] + map(lambda x : ".implements %s" % x, intf) + [""]

def extractMethods(type, methods) :
	myMethods = type.getDeclaredMethods()

	for m in myMethods :
		modifiers = m.modifiers
		if Modifier.isFinal(modifiers) or Modifier.isStatic(modifiers) :
			continue;

		if not (Modifier.isPublic(modifiers) or Modifier.isProtected(modifiers)) :
			continue;

		sig = getSignature(m);
		if methods.has_key(sig) :
			continue

		methods[sig] = m

	superIntf = type.getBaseInterfaces();
	for i in superIntf :
		extractMethods(superIntf[i], methods);

	if type.getName() != 'java.lang.Object' and not type.isInterface():
		extractMethods(type.getBaseClass(), methods)

def getSignature(m) :
	sb = [ "(" ]
	args = m.parameterTypes
	for i in range(len(args)) :
		if WRAPPERS.has_key(args[i].__javaclass__.getName()) :
			sb.append(WRAPPERS[args[i].__javaclass__.getName()][1])
		elif args[i].__javaclass__.isArray() :
			sb.append(args[i].__javaclass__.getName())
		else:
			sb.append("L"+args[i].__javaclass__.getName().replace(".", "/")+";")
	sb.append(")")
	if WRAPPERS.has_key(m.returnType.__javaclass__.getName()) :
		sb.append(WRAPPERS[m.returnType.__javaclass__.getName()][1])
	elif m.returnType.__javaclass__.isArray() :
		print 'type', m.returnType.__javaclass__.getName(), 'is an array type'
		sb.append(m.returnType.__javaclass__.getName())
	else:
		print 'type', m.returnType.__javaclass__.getName(), 'is an object type'
		sb.append("L"+m.returnType.__javaclass__.getName().replace(".", "/")+";")

	return "".join(sb)

def getIPush(v) :
	if v < 6 :
		return "iconst_%d" % v
	elif v < 255 :
		return "bipush %d" % v
	else:
		return "sipush %d" % v

def dumpClassInformation(c) :
	if c is None :
		return

	print "Information regarding class " + c.__javaclass__.getName()
	print "    Base class = "+c.__javaclass__.getBaseClass().getName()
	intf = c.__javaclass__.getBaseInterfaces()
	for i in intf :
		print "    Intf = "+i.getName()

	for i in dir(c) :
		print i

	print '    Methods :'
	for i in c.__javaclass__.getDeclaredMethods() :
		print i

	print '    Return types :'
	for i in c._jpype_return_types :
		print "       ", i

	print '    Param types :'
	for i in c._jpype_param_types :
		print "       ", i

if __name__ == '__main__' :
	classGen( )


text:
{% extends 'happenings/middle.html' %}
{% load staticfiles happenings_tags %}
{% block content %}

{% if cal_error %}
    {{ cal_error }}
{% endif %}

{% if not show_events %}
Event Calendar
{% endif %}

    {{ calendar|safe }}

{% if show_events %}

    {% if cal_category and cal_tag %}
        Events in category {{ cal_category }}
        with tag = {{ cal_tag }}
    {% elif cal_category %}
        Events in {{ cal_category }}
    {% elif cal_tag %}
        Events with tag = {{ cal_tag }}
    {% else %}
        Events
    {% endif %}

For {{ month_and_year }}

{% include 'happenings/partials/event_list.html' %}
{% endif %}

{% endblock content %}


text:
/**
 * External dependencies
 */
import { __ } from '@googleforcreators/i18n';

const DOCS_URL = 'https://wp.stories.google/docs/best-practices/';

const KEYS = {
  EMBED_WEB_STORIES: 'embedWebStories',
};

export const TIPS = {
  [KEYS.EMBED_WEB_STORIES]: {
    title: __('Embed Web Stories', 'web-stories'),
    /* TODO #7212 `figureSrcImg` and `figureAlt` are temporary until
    we get an animation. Once we have the animation then these
    attributes should be removed. */
    figureSrcImg: 'images/help-center/story_embed_module_1',
    figureAlt: __('Graphic showing embed functionality', 'web-stories'),
    description: [
      __(
        'When you create a new post in WordPress, you can embed any of your Stories. Learn more',
        'web-stories'
      ),
    ],
    href: DOCS_URL,
  },
};


text:
'use strict';

const models = require('./index');

/**
 * The profile of an orchestrator and its available versions.
 *
 */
class OrchestratorVersionProfile {
  /**
   * Create a OrchestratorVersionProfile.
   * @member {string} orchestratorType Orchestrator type.
   * @member {string} orchestratorVersion Orchestrator version (major, minor,
   * patch).
   * @member {boolean} default Installed by default if version is not
   * specified.
   * @member {array} upgrades The list of available upgrade versions.
   */
  constructor() {
  }

  /**
   * Defines the metadata of OrchestratorVersionProfile
   *
   * @returns {object} metadata of OrchestratorVersionProfile
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'OrchestratorVersionProfile',
      type: {
        name: 'Composite',
        className: 'OrchestratorVersionProfile',
        modelProperties: {
          orchestratorType: {
            required: true,
            serializedName: 'orchestratorType',
            type: {
              name: 'String'
            }
          },
          orchestratorVersion: {
            required: true,
            serializedName: 'orchestratorVersion',
            type: {
              name: 'String'
            }
          },
          default: {
            required: true,
            serializedName: 'default',
            type: {
              name: 'Boolean'
            }
          },
          upgrades: {
            required: true,
            serializedName: 'upgrades',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'OrchestratorProfileElementType',
                  type: {
                    name: 'Composite',
                    className: 'OrchestratorProfile'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = OrchestratorVersionProfile;


text:
var buffer = new ArrayBuffer()
var dataView = new DataView(buffer, 0, undefined)

assert(dataView.byteLength === 0);


text:
#include "tensorflow/compiler/xla/service/cpu/xfeed_manager.h"

#include "tensorflow/core/platform/logging.h"

namespace xla {
namespace cpu {
namespace runtime {

void XfeedManager::Reset() {
  infeed()->Reset();
  outfeed()->Reset();
}

void XfeedQueueManager::Reset() {
  tensorflow::mutex_lock l(mu_);
  CHECK(current_buffer_ == nullptr);
  for (auto buffer : enqueued_buffers_) {
    buffer->Done();
  }
  enqueued_buffers_.clear();
}

void XfeedQueueManager::EnqueueBuffers(
    tensorflow::gtl::ArraySlice<XfeedBuffer*> buffers) {
  tensorflow::mutex_lock l(mu_);
  bool was_empty = enqueued_buffers_.empty();
  for (XfeedBuffer* b : buffers) {
    enqueued_buffers_.push_back(b);
  }
  if (was_empty && !buffers.empty()) {
    // This has the potential to suffer from the notified thread
    // immediately trying and failing to acquire mu_, but seems
    // preferable to the alternative of notifying outside the lock
    // on every enqueue.
    cv_.notify_one();
  }
}

XfeedBuffer* XfeedQueueManager::BlockingDequeueBuffer() {
  tensorflow::mutex_lock l(mu_);
  while (enqueued_buffers_.empty()) {
    cv_.wait(l);
  }
  CHECK(current_buffer_ == nullptr);
  current_buffer_ = enqueued_buffers_.front();
  enqueued_buffers_.pop_front();
  return current_buffer_;
}

void XfeedQueueManager::ReleaseCurrentBuffer(int32 length, void* data) {
  tensorflow::mutex_lock l(mu_);
  CHECK(current_buffer_ != nullptr);
  CHECK_EQ(length, current_buffer_->length());
  CHECK_EQ(data, current_buffer_->data());
  current_buffer_->Done();
  current_buffer_ = nullptr;
}

}  // namespace runtime
}  // namespace cpu
}  // namespace xla


text:
package com.amazonaws.services.simpleemail.model;

import javax.annotation.Generated;

/**
 *
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum BounceType {

    DoesNotExist("DoesNotExist"),
    MessageTooLarge("MessageTooLarge"),
    ExceededQuota("ExceededQuota"),
    ContentRejected("ContentRejected"),
    Undefined("Undefined"),
    TemporaryFailure("TemporaryFailure");

    private String value;

    private BounceType(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    }

    /**
     * Use this in place of valueOf.
     *
     * @param value
     *        real value
     * @return BounceType corresponding to the value
     *
     * @throws IllegalArgumentException
     *         If the specified value does not map to one of the known values in this enum.
     */
    public static BounceType fromValue(String value) {
        if (value == null || "".equals(value)) {
            throw new IllegalArgumentException("Value cannot be null or empty!");
        }

        for (BounceType enumEntry : BounceType.values()) {
            if (enumEntry.toString().equals(value)) {
                return enumEntry;
            }
        }

        throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
    }
}


text:
/*
* ErikLib Button
* 2012 (c) Erik Svensson <erik.public@gmail.com>
* Licensed under the MIT license.
*/

#include "Button.h"
#include <Arduino.h>

Button::Button(const uint8_t pin, const uint32_t timeout)
	: btnPin(pin)
	, btnState(Button::High)
	, btnTimeout(timeout)
	, btnTime(millis())
{
	btnState = digitalRead(btnPin) << 4;
}

uint8_t Button::Check(const uint32_t t)
{
	uint8_t result = btnState & 0x0f;
	uint8_t state = digitalRead(btnPin);
	uint8_t newState = btnState >> 4;
	if (state == newState) {
	  if (t >= (btnTime + btnTimeout)) {
	    result = newState;
	    if (btnState != newState) {
	      result = newState == Button::High ? Button::Rising : Button::Falling;
	    }
	    btnState = (btnState & 0xf0) | newState;
	  }
	}
	else {
	  btnTime = t;
	  btnState = (btnState & 0x0f) | state << 4;
	}
	return result;
}

uint8_t Button::Check()
{
	return Check(millis());
}


text:
export default function (d) {
    return d;
}


text:
<?php
namespace Jehon\Maintenance\Lib;

use \Exception;

require_once(__DIR__ . "/../../../autoload.php");

global $maintenance;

function getParameter($name, $default = null) {
	if (array_key_exists($name, $_REQUEST)) {
		return $_REQUEST[$name];
	} else {
		if ($default === null) {
			throw new Exception("Could not get key $name");
		} else {
			return $default;
		}
	}
}


text:
title: Resources
permalink: /resources/
---

### List of resources


text:
var _ = require('underscore');
var express = require('express');
var config = require('../../config/secrets').get();
var User = require('../../shared/user');

module.exports = function(app, roles) {
  app = app || express();

  // Create access rules for each of the permissions
  _.each(_.keys(User.permissions), function(permission) {
    roles.use(permission, function(req) {
      if (req.user) {
        var user = new User(req.user);
        if (user.can(permission)) return true;
      }
    });
  });

  // Admins have all privileges
  roles.use(function(req) {
    if (req.user) {
      var user = new User(req.user);
      if (user.is('admin')) return true;
    }
  });

  // Allow all for adminParty
  roles.use(function(req) {
    if (config.adminParty) return true;
  });

  return roles;
};


text:
comments: true
date: 2013-08-18 00:02:48+00:00
layout: post
slug: lets-make-a-deal
title: Let's Make a Deal
wordpress_id: 3
categories:
- Stats
---

Recently I've been studying a lot of statistics, particularly Bayesian inference, which tells you how to update your beliefs when you get new information. One of the fun brain teasers you often read about is called the [Monty Hall problem.](http://en.wikipedia.org/wiki/Monty_Hall_problem) I'll let you read the wikipedia article.

Anyway, it is not obvious that the best strategy is to switch. You can prove it mathematically, but sometimes that doesn't always help people get it.

Fortunately, I have children.

One lazy day I decided we'd play this game, only with cups and a penny instead of doors and a fabulous prize. I also needed a screen (so the kids couldn't see where I hid the coin) and a six-sided die, to randomly choose a cup to hide the coin under. As a recovering D&D player, both of these were readily available.

First, I just let the kids guess which cup the coin was under. We did it 12 times, and they guessed right exactly 4 times: 33%, just like you'd expect! Then I told them about the Monty Hall problem, and that I wanted them to switch every time.

Here's what I realized: if you automatically switch, then the only time you lose is _when you initially guess right_. In other words, you only lose 33% of the time.

So if you've ever scratched your head over the solution to this problem, try it yourself! It only takes a few minutes, and if you have kids, they'll get a kick out of it too.

And let me know if you know what to feed a goat.


text:
typedef struct
{
    int cannyThresh;
    int blockSize;
} ParamBag;

enum struct Channels
{
    BLUE = 0,
    GREEN = 1,
    RED = 2,
    GRAY = 3,
    H = 0,
    S = 1,
    V = 2,
    ALL = 4,
};

class TransformImage
{
protected:
    Mat _image;
    Mat _enhanced;
    Mat _buf;

    gpu::GpuMat g_image;
    vector<gpu::GpuMat> g_oneChannel;
    gpu::GpuMat g_enhanced;
    gpu::GpuMat g_buf; //bufffer for different operations
    Channels _channel;
    vector<Vec4i> _hierarchy;

    vector<vector<Point>> _contours;
    inline void MakeSafe() { g_enhanced.copyTo(g_buf); }

public:
    // Split into 3 channels (unless it's grey - then need to use another func)
    // stores one of them in the "enhanced"
    gpu::GpuMat& GetOneChannelImages(Channels channelEnhanced)
    {
        assert(channelEnhanced != Channels::GRAY);

        gpu::split(g_image, g_oneChannel);
        g_oneChannel[(int) channelEnhanced].copyTo(g_enhanced);
        _channel = channelEnhanced;

        return g_enhanced;
    }

    gpu::GpuMat& GetGrayChannelImage()
    {
        _channel = Channels::GRAY;
        gpu::cvtColor(g_image, g_enhanced, COLOR_BGR2GRAY);
        return g_enhanced;
    }

    // apply Gaussian Pyramid scale times
    gpu::GpuMat& PyramidDown(int scale = 1)
    {
        gpu::GpuMat buffer;
        g_image.copyTo(buffer);

        for (int i = scale; i > 0; i--, g_enhanced.copyTo(buffer))
        {
            gpu::pyrDown(buffer, g_enhanced);
        }

        return g_enhanced;
    }

    // preprocessing may be different
    gpu::GpuMat& GaussBlur(int size = 7, float sigma = 30.)
    {
        MakeSafe();

        gpu::GaussianBlur(g_buf, g_enhanced, Size(size, size), sigma);
        return g_enhanced;
    }

    Mat& MedianBlur(int size = 7)
    {
        Mat buf;
        g_enhanced.download(buf);
        medianBlur(buf, _enhanced, size);

        g_enhanced.upload(_enhanced);

        return _enhanced;
    }

    // TODO: this is actually bad since it may throw
    TransformImage(Mat image) : _image(image), g_oneChannel(3)
    {
        g_image.upload(image);
        g_enhanced.upload(image);
    }

    TransformImage() : g_oneChannel(3)
    {}

    Mat& GetCannyEdges(int thresh, int thresh1, Mat& edges)
    {
        gpu::GpuMat g_edges;
        gpu::Canny(g_enhanced, g_edges, thresh, thresh1);

        g_edges.download(edges);
        return edges;
    }

    vector<vector<Point>>& FindBlobContours(Mat& edges)
    {
        findContours(edges, _contours, _hierarchy, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
        return _contours;
    }

    Mat& GetHist(Mat& dest, Mat& mask = Mat())
    {
        if (mask.size() == Size(0, 0))
        {
            // for once use g_buf to avoid memory allocations
            gpu::GpuMat gDest;
            calcHist(g_enhanced, gDest, g_buf);
            gDest.download(dest);
            return dest;
        }

        Mat enhanced[] = { getEnhanced() };
        int histSize[] = { 256 };
        float hranges[] = { 0, 255 };
        const float * ranges[] = { hranges };
        int channels[] = { 0 };

        calcHist(enhanced, 1, channels, mask, dest, 1, histSize, ranges);
        return dest;
    }

    gpu::GpuMat& ApplyClahe()
    {
        Ptr<gpu::CLAHE> clahe = gpu::createCLAHE();

        clahe->setClipLimit(4.);
        clahe->setTilesGridSize(Size(16, 16));
        clahe->apply(g_oneChannel[(int)_channel], g_buf);

        g_buf.copyTo(g_oneChannel[(int)_channel]);

        gpu::merge(g_oneChannel, g_enhanced);
        return g_enhanced;
    }

    // display enhanced image. Do we need to merge all 3 channels to do it?
    // if not, only the relevant channel will be isolated
    void DisplayEnhanced(bool merge3 = false)
    {
        Mat enhanced;
        gpu::GpuMat g_enhanced_show;

        if (_channel != Channels::GRAY)
        {
            int channel = (int)_channel;
            vector<gpu::GpuMat> g_zeros(3);

            for (int i = 0; i < 3; i++)
            {
                if (i == channel)
                {
                    g_enhanced.copyTo(g_zeros[i]);
                }
                else
                {
                    if (merge3)
                    {
                        g_oneChannel[i].copyTo(g_zeros[i]);
                    }
                    else
                    {
                        g_zeros[i].upload(Mat::zeros(_image.rows, _image.cols, CV_8UC1));
                    }
                }

            }
            gpu::merge(g_zeros, g_enhanced_show);
        }
        else
        {
            g_enhanced_show = g_enhanced;
        }

        g_enhanced_show.download(enhanced);
        namedWindow("Enhanced", WINDOW_NORMAL);
        imshow("Enhanced", enhanced);
    }

    gpu::GpuMat& AdaptiveThreshold(int blockSize, double param)
    {
        Mat image, out;
        g_enhanced.download(image);
        adaptiveThreshold(image, out, 127, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, blockSize, param);
        g_enhanced.upload(out);

        return g_enhanced;

    }

    gpu::GpuMat& OtsuThreshold()
    {
        //gpu::threshold(g_enhanced, g_enhanced, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
        Mat image, out;
        g_enhanced.download(image);
        cv::threshold(image, out, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
        g_enhanced.upload(out);

        return g_enhanced;
    }

    // slap contours onto an image
    static void DrawContours(vector<vector<Point>>& contours, vector<Vec4i>& hierarchy, Mat& img, int thickness = CV_FILLED, Scalar& color = Scalar(255, 255, 255))
    {
        int idx = 0;
        if (hierarchy.size() == 0)
        {
            for (idx = 0; idx < contours.size(); idx++)
            {
                drawContours(img, contours, idx, color, thickness, 8, noArray());
            }

        }
        else
        {
            for (; idx >= 0; idx = hierarchy[idx][0])
            {
                drawContours(img, contours, idx, color, thickness, 8, hierarchy);
            }
        }
    }

    gpu::GpuMat& AddSaltAndPepper(float fraction = 0.01)
    {
        getEnhanced();
        Mat noise = Mat::zeros(g_enhanced.rows, g_enhanced.cols, CV_8UC1);
        randu(noise, 0, 100);

        int totalNoise = (int)std::round(fraction * 100 / 2);
        Mat black = noise < totalNoise;
        Mat white = noise > 100 - totalNoise;

        Mat sp = _enhanced.clone();
        sp.setTo(255, white);
        sp.setTo(0, black);

        g_enhanced.upload(sp);
        return g_enhanced;
    }

    // Accessors
    void setImage(Mat& image) { image.copyTo(_image); g_image.upload(image); g_image.copyTo(g_enhanced); }
    Mat& getImage() { return _image; }
    void setChannel(Channels channel) { _channel = channel; }
    Mat& getEnhanced() { g_enhanced.download(_enhanced); return _enhanced; }
    void getChannelImage(Channels channel, Mat& dst) { g_oneChannel[(int)channel].download(dst); }
    gpu::GpuMat& getChannelImage(Channels channel) { return g_oneChannel[(int)channel]; }
    void setChannelImage(Channels channel, Mat& src) { g_oneChannel[(int)channel].upload(src); }

    vector<Vec4i>& getHierarchy() { return _hierarchy; }
    vector<vector<Point>>& getContours() { return _contours; }

    void setContours(vector<vector<Point>>& contours)
    {
        _contours.clear();
        _hierarchy.clear();
        _contours.resize(contours.size());
        copy(contours.begin(), contours.end(), _contours.begin());
    }

};


text:
Higher-order functions for easier error handling.

`if (err) return cb(err);` be gone!

## Install
```bash
npm install iferr
```

## Use

### JavaScript/ES6 example
```js
var iferr = require('iferr');

function get_friends_count(id, cb) {
  User.load_user(id, iferr(cb, user =>
    user.load_friends(iferr(cb, friends =>
      cb(null, friends.length)
    ))
  ))
}
```

### JavaScript/ES5 example
```js
var iferr = require('iferr');

function get_friends_count(id, cb) {
  User.load_user(id, iferr(cb, function(user) {
    user.load_friends(iferr(cb, function(friends) {
      cb(null, friends.length)
    }))
  }))
}
```

### CoffeeScript example
```coffee
iferr = require 'iferr'

get_friends_count = (id, cb) ->
  User.load_user id, iferr cb, (user) ->
    user.load_friends iferr cb, (friends) ->
      cb null, friends.length
```

(TODO: document tiferr, throwerr and printerr)

## License
MIT


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Helichrysum picardii Boiss. & Reut.

### Remarks
null


text:
package net.floodlightcontroller.ofSwitchAP;

import org.openflow.protocol.Instantiable;
import org.openflow.protocol.vendor.OFVendorData;

public class OFWlanAPRSSI extends OFWlanRSSI {

	protected static Instantiable<OFVendorData> instantiable =
            new Instantiable<OFVendorData>() {
                public OFVendorData instantiate() {
                    return new OFWlanAPRSSI();
                }
            };

    /**
     * @return a subclass of Instantiable<OFVendorData> that instantiates
     *         an instance of OFWlanAPRSSI.
     */
    public static Instantiable<OFVendorData> getInstantiable() {
        return instantiable;
    }

    public static final int WLAN_AP_REC_POW = 16;

    /**
     * Construct a Probe data with an unspecified role value.
     */
    public OFWlanAPRSSI() {
        super(WLAN_AP_REC_POW);
    }

	public OFWlanAPRSSI(byte[] staMacAddress, byte[] apMacAddress, byte rssi) {
		super(WLAN_AP_REC_POW, staMacAddress, apMacAddress, rssi);
	}

}