text:
module.exports = function(grunt) {
    // Project configuration.
    grunt.initConfig({
        jsonlint: {
            src: ['*.json','nested/*.json'],
            options: {
                formatter: 'prose'
            }
        },
        tv4: {
            validateUiJson :{
                options: {
                    fresh:true,
                    root: 'https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json'
                },
                src: ['createUiDefinition.json']
            },
            validateMainTemplate: {
                options: {
                    fresh:true,
                    root: 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#'
                },
                src: ['mainTemplate.json','nested/*.json']
            }
        }
    });

    // Load the plugins
    grunt.loadNpmTasks('grunt-jsonlint');
    grunt.loadNpmTasks('grunt-tv4');

    // Default task(s).

    grunt.registerTask('validateJson',['tv4:validateUiJson','tv4:validateMainTemplate']);
    grunt.registerTask('default', ['jsonlint','validateJson']);

};

redpajama_set_name: RedPajamaGithub


text:
layout: page
title: Anderson 55th Anniversary
date: 2016-05-24
author: Paul Bright
tags: weekly links, java
status: published
summary: Integer fringilla ante at arcu.
banner: images/banner/leisure-02.jpg
booking:
  startDate: 04/02/2017
  endDate: 04/04/2017
  ctyhocn: ETSALHX
  groupCode: A5A
published: true
---
Vestibulum ut pellentesque enim, vitae rutrum nulla. Duis tristique, est a lobortis finibus, dui nisi maximus magna, eu tincidunt est velit eu mauris. Pellentesque id ipsum luctus, accumsan nibh id, consectetur felis. Nullam eu nunc vestibulum, aliquam nibh eu, efficitur lectus. Ut quis facilisis velit, eget feugiat metus. Sed maximus faucibus libero a auctor. Suspendisse tempus velit aliquam dui interdum tincidunt. Phasellus dolor dui, tristique et lorem iaculis, viverra malesuada urna. Vestibulum nunc felis, fermentum id malesuada a, pharetra at ligula. Maecenas sed consectetur ipsum, sed pharetra magna. Nullam elementum vitae tellus vitae scelerisque.

* Cras sagittis ipsum ut ipsum pretium, dapibus elementum leo tincidunt
* Aliquam accumsan dolor at neque condimentum, quis dapibus ex pellentesque
* Etiam vel odio vel massa commodo venenatis
* Donec in diam a ipsum porta semper
* Nulla posuere purus et sapien sagittis, ut mattis ligula fermentum.

Praesent condimentum turpis et purus interdum, at luctus nibh scelerisque. Proin non ultricies leo. Nulla blandit, lorem quis pellentesque semper, erat urna euismod odio, id fermentum nulla sem et ligula. Interdum et malesuada fames ac ante ipsum primis in faucibus. Cras eget sem dapibus, blandit metus ut, imperdiet lorem. Praesent eu enim vel tellus faucibus pretium. Proin vulputate ante ac lectus luctus euismod. Donec pellentesque tellus ac mi varius rutrum sit amet dictum orci. Sed condimentum varius eleifend.


text:
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

module WhosGotDirt::Requests::Entity
  RSpec.describe Poderopedia do
    describe '#to_s' do
      it 'should return the URL to request' do
        expect(Poderopedia.new(name: 'ACME Inc.').to_s).to eq('http://api.poderopedia.org/visualizacion/search?alias=ACME+Inc.')
      end
    end

    describe '#convert' do
      context 'when given a name' do
        include_examples 'match', 'alias', 'name', ['ACME Inc.', 'Inc. ACME']
      end

      context 'when given an API key' do
        include_examples 'equal', 'user_key', 'poderopedia_api_key', 123
      end
    end
  end
end


text: export type SourceMapRegistry = Record<string, string>;


text:
"""Keras initializers for TF 2.
"""
# pylint: disable=g-classes-have-attributes
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.keras import backend
from tensorflow.python.ops import init_ops_v2
from tensorflow.python.util.tf_export import keras_export

@keras_export('keras.initializers.Initializer')
class Initializer(object):
  """Initializer base class: all Keras initializers inherit from this class.

  Initializers should implement a `__call__` method with the following
  signature:

  ```python
  def __call__(self, shape, dtype=None)`:
    # returns a tensor of shape `shape` and dtype `dtype`
    # containing values drawn from a distribution of your choice.
  ```

  Optionally, you an also implement the method `get_config` and the class
  method `from_config` in order to support serialization -- just like with
  any Keras object.

  Here's a simple example: a random normal initializer.

  ```python
  import tensorflow as tf

  class ExampleRandomNormal(tf.keras.initializers.Initializer):

    def __init__(self, mean, stddev):
      self.mean = mean
      self.stddev = stddev

    def __call__(self, shape, dtype=None)`:
      return tf.random.normal(
          shape, mean=self.mean, stddev=self.stddev, dtype=dtype)

    def get_config(self):  # To support serialization
      return {"mean": self.mean, "stddev": self.stddev}
  ```

  Note that we don't have to implement `from_config` in the example above since
  the constructor arguments of the class the keys in the config returned by
  `get_config` are the same. In this case, the default `from_config`
  works fine.
  """

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized as specified by the initializer.

    Args:
      shape: Shape of the tensor.
      dtype: Optional dtype of the tensor.
    """
    raise NotImplementedError

  def get_config(self):
    """Returns the configuration of the initializer as a JSON-serializable dict.

    Returns:
      A JSON-serializable Python dict.
    """
    return {}

  @classmethod
  def from_config(cls, config):
    """Instantiates an initializer from a configuration dictionary.

    Example:

    ```python
    initializer = RandomUniform(-1, 1)
    config = initializer.get_config()
    initializer = RandomUniform.from_config(config)
    ```

    Args:
      config: A Python dictionary, the output of `get_config`.

    Returns:
      A `tf.keras.initializers.Initializer` instance.
    """
    config.pop('dtype', None)
    return cls(**config)

@keras_export('keras.initializers.Zeros', 'keras.initializers.zeros', v1=[])
class Zeros(init_ops_v2.Zeros, Initializer):
  """Initializer that generates tensors initialized to 0.

  Also available via the shortcut function `tf.keras.initializers.zeros`.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.Zeros()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.Zeros()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)
  """

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized as specified by the initializer.

    Args:
      shape: Shape of the tensor.
      dtype: Optional dtype of the tensor. Only numeric or boolean dtypes are
       supported. If not specified, `tf.keras.backend.floatx()` is used,
       which default to `float32` unless you configured it otherwise
       (via `tf.keras.backend.set_floatx(float_dtype)`).
    """
    return super(Zeros, self).__call__(shape, dtype=_get_dtype(dtype))

@keras_export('keras.initializers.Ones', 'keras.initializers.ones', v1=[])
class Ones(init_ops_v2.Ones, Initializer):
  """Initializer that generates tensors initialized to 1.

  Also available via the shortcut function `tf.keras.initializers.ones`.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.Ones()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.Ones()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)
  """

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized as specified by the initializer.

    Args:
      shape: Shape of the tensor.
      dtype: Optional dtype of the tensor. Only numeric or boolean dtypes are
       supported. If not specified, `tf.keras.backend.floatx()` is used,
       which default to `float32` unless you configured it otherwise
       (via `tf.keras.backend.set_floatx(float_dtype)`).
    """
    return super(Ones, self).__call__(shape, dtype=_get_dtype(dtype))

@keras_export('keras.initializers.Constant',
              'keras.initializers.constant',
              v1=[])
class Constant(Initializer):
  """Initializer that generates tensors with constant values.

  Also available via the shortcut function `tf.keras.initializers.constant`.

  Only scalar values are allowed.
  The constant value provided must be convertible to the dtype requested
  when calling the initializer.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.Constant(3.)
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.Constant(3.)
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Args:
    value: A Python scalar.
  """

  def __init__(self, value=0):
    self.value = value

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized to `self.value`.

    Args:
      shape: Shape of the tensor.
      dtype: Optional dtype of the tensor. If not specified,
       `tf.keras.backend.floatx()` is used,
       which default to `float32` unless you configured it otherwise
       (via `tf.keras.backend.set_floatx(float_dtype)`).
    """
    return constant_op.constant(
        self.value, dtype=_get_dtype(dtype), shape=shape)

  def get_config(self):
    return {'value': self.value}

@keras_export('keras.initializers.RandomUniform',
              'keras.initializers.random_uniform',
              v1=[])
class RandomUniform(init_ops_v2.RandomUniform, Initializer):
  """Initializer that generates tensors with a uniform distribution.

  Also available via the shortcut function
  `tf.keras.initializers.random_uniform`.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.RandomUniform(minval=0., maxval=1.)
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.RandomUniform(minval=0., maxval=1.)
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Args:
    minval: A python scalar or a scalar tensor. Lower bound of the range of
      random values to generate (inclusive).
    maxval: A python scalar or a scalar tensor. Upper bound of the range of
      random values to generate (exclusive).
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.
  """

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized as specified by the initializer.

    Args:
      shape: Shape of the tensor.
      dtype: Optional dtype of the tensor. Only floating point and integer
      types are supported. If not specified,
        `tf.keras.backend.floatx()` is used,
       which default to `float32` unless you configured it otherwise
       (via `tf.keras.backend.set_floatx(float_dtype)`).
    """
    return super(RandomUniform, self).__call__(shape, dtype=_get_dtype(dtype))

@keras_export('keras.initializers.RandomNormal',
              'keras.initializers.random_normal',
              v1=[])
class RandomNormal(init_ops_v2.RandomNormal, Initializer):
  """Initializer that generates tensors with a normal distribution.

  Also available via the shortcut function
  `tf.keras.initializers.random_normal`.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.RandomNormal(mean=0., stddev=1.)
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.RandomNormal(mean=0., stddev=1.)
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Args:
    mean: a python scalar or a scalar tensor. Mean of the random values to
      generate.
    stddev: a python scalar or a scalar tensor. Standard deviation of the random
      values to generate.
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.
  """

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized to random normal values.

    Args:
      shape: Shape of the tensor.
      dtype: Optional dtype of the tensor. Only floating point types are
       supported. If not specified, `tf.keras.backend.floatx()` is used,
       which default to `float32` unless you configured it otherwise
       (via `tf.keras.backend.set_floatx(float_dtype)`)
    """
    return super(RandomNormal, self).__call__(shape, dtype=_get_dtype(dtype))

@keras_export('keras.initializers.TruncatedNormal',
              'keras.initializers.truncated_normal',
              v1=[])
class TruncatedNormal(init_ops_v2.TruncatedNormal, Initializer):
  """Initializer that generates a truncated normal distribution.

  Also available via the shortcut function
  `tf.keras.initializers.truncated_normal`.

  The values generated are similar to values from a
  `tf.keras.initializers.RandomNormal` initializer except that values more
  than two standard deviations from the mean are
  discarded and re-drawn.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.TruncatedNormal(mean=0., stddev=1.)
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.TruncatedNormal(mean=0., stddev=1.)
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Args:
    mean: a python scalar or a scalar tensor. Mean of the random values
      to generate.
    stddev: a python scalar or a scalar tensor. Standard deviation of the
      random values to generate.
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.
  """

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized to random normal values (truncated).

    Args:
      shape: Shape of the tensor.
      dtype: Optional dtype of the tensor. Only floating point types are
       supported. If not specified, `tf.keras.backend.floatx()` is used,
       which default to `float32` unless you configured it otherwise
       (via `tf.keras.backend.set_floatx(float_dtype)`)
    """
    return super(TruncatedNormal, self).__call__(shape, dtype=_get_dtype(dtype))

@keras_export('keras.initializers.VarianceScaling',
              'keras.initializers.variance_scaling',
              v1=[])
class VarianceScaling(init_ops_v2.VarianceScaling, Initializer):
  """Initializer capable of adapting its scale to the shape of weights tensors.

  Also available via the shortcut function
  `tf.keras.initializers.variance_scaling`.

  With `distribution="truncated_normal" or "untruncated_normal"`, samples are
  drawn from a truncated/untruncated normal distribution with a mean of zero and
  a standard deviation (after truncation, if used) `stddev = sqrt(scale / n)`,
  where `n` is:

  - number of input units in the weight tensor, if `mode="fan_in"`
  - number of output units, if `mode="fan_out"`
  - average of the numbers of input and output units, if `mode="fan_avg"`

  With `distribution="uniform"`, samples are drawn from a uniform distribution
  within `[-limit, limit]`, where `limit = sqrt(3 * scale / n)`.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.VarianceScaling(
  ... scale=0.1, mode='fan_in', distribution='uniform')
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.VarianceScaling(
  ... scale=0.1, mode='fan_in', distribution='uniform')
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Args:
    scale: Scaling factor (positive float).
    mode: One of "fan_in", "fan_out", "fan_avg".
    distribution: Random distribution to use. One of "truncated_normal",
      "untruncated_normal" and  "uniform".
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.
  """

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized as specified by the initializer.

    Args:
      shape: Shape of the tensor.
      dtype: Optional dtype of the tensor. Only floating point types are
       supported. If not specified, `tf.keras.backend.floatx()` is used,
       which default to `float32` unless you configured it otherwise
       (via `tf.keras.backend.set_floatx(float_dtype)`)
    """
    return super(VarianceScaling, self).__call__(shape, dtype=_get_dtype(dtype))

@keras_export('keras.initializers.Orthogonal',
              'keras.initializers.orthogonal',
              v1=[])
class Orthogonal(init_ops_v2.Orthogonal, Initializer):
  """Initializer that generates an orthogonal matrix.

  Also available via the shortcut function `tf.keras.initializers.orthogonal`.

  If the shape of the tensor to initialize is two-dimensional, it is initialized
  with an orthogonal matrix obtained from the QR decomposition of a matrix of
  random numbers drawn from a normal distribution.
  If the matrix has fewer rows than columns then the output will have orthogonal
  rows. Otherwise, the output will have orthogonal columns.

  If the shape of the tensor to initialize is more than two-dimensional,
  a matrix of shape `(shape[0] * ... * shape[n - 2], shape[n - 1])`
  is initialized, where `n` is the length of the shape vector.
  The matrix is subsequently reshaped to give a tensor of the desired shape.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.Orthogonal()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.Orthogonal()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Args:
    gain: multiplicative factor to apply to the orthogonal matrix
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.

  References:
      [Saxe et al., 2014](https://openreview.net/forum?id=_wzZwKpTDF_9C)
      ([pdf](https://arxiv.org/pdf/1312.6120.pdf))
  """

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized to an orthogonal matrix.

    Args:
      shape: Shape of the tensor.
      dtype: Optional dtype of the tensor. Only floating point types are
        supported. If not specified, `tf.keras.backend.floatx()` is used,
       which default to `float32` unless you configured it otherwise
       (via `tf.keras.backend.set_floatx(float_dtype)`)
    """
    return super(Orthogonal, self).__call__(shape, dtype=_get_dtype(dtype))

@keras_export('keras.initializers.Identity',
              'keras.initializers.identity',
              v1=[])
class Identity(init_ops_v2.Identity, Initializer):
  """Initializer that generates the identity matrix.

  Also available via the shortcut function `tf.keras.initializers.identity`.

  Only usable for generating 2D matrices.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.Identity()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.Identity()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Args:
    gain: Multiplicative factor to apply to the identity matrix.
  """

  def __call__(self, shape, dtype=None):
    """Returns a tensor object initialized to a 2D identity matrix.

    Args:
      shape: Shape of the tensor. It should have exactly rank 2.
      dtype: Optional dtype of the tensor. Only floating point types are
       supported. If not specified, `tf.keras.backend.floatx()` is used,
       which default to `float32` unless you configured it otherwise
       (via `tf.keras.backend.set_floatx(float_dtype)`)
    """
    return super(Identity, self).__call__(shape, dtype=_get_dtype(dtype))

@keras_export('keras.initializers.GlorotUniform',
              'keras.initializers.glorot_uniform',
              v1=[])
class GlorotUniform(VarianceScaling):
  """The Glorot uniform initializer, also called Xavier uniform initializer.

  Also available via the shortcut function
  `tf.keras.initializers.glorot_uniform`.

  Draws samples from a uniform distribution within `[-limit, limit]`, where
  `limit = sqrt(6 / (fan_in + fan_out))` (`fan_in` is the number of input units
  in the weight tensor and `fan_out` is the number of output units).

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.GlorotUniform()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.GlorotUniform()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Args:
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.

  References:
      [Glorot et al., 2010](http://proceedings.mlr.press/v9/glorot10a.html)
      ([pdf](http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf))
  """

  def __init__(self, seed=None):
    super(GlorotUniform, self).__init__(
        scale=1.0,
        mode='fan_avg',
        distribution='uniform',
        seed=seed)

  def get_config(self):
    return {'seed': self.seed}

@keras_export('keras.initializers.GlorotNormal',
              'keras.initializers.glorot_normal',
              v1=[])
class GlorotNormal(VarianceScaling):
  """The Glorot normal initializer, also called Xavier normal initializer.

  Also available via the shortcut function
  `tf.keras.initializers.glorot_normal`.

  Draws samples from a truncated normal distribution centered on 0 with `stddev
  = sqrt(2 / (fan_in + fan_out))` where `fan_in` is the number of input units in
  the weight tensor and `fan_out` is the number of output units in the weight
  tensor.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.GlorotNormal()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.GlorotNormal()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Args:
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.

  References:
      [Glorot et al., 2010](http://proceedings.mlr.press/v9/glorot10a.html)
      ([pdf](http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf))
  """

  def __init__(self, seed=None):
    super(GlorotNormal, self).__init__(
        scale=1.0,
        mode='fan_avg',
        distribution='truncated_normal',
        seed=seed)

  def get_config(self):
    return {'seed': self.seed}

@keras_export('keras.initializers.LecunNormal',
              'keras.initializers.lecun_normal',
              v1=[])
class LecunNormal(VarianceScaling):
  """Lecun normal initializer.

   Also available via the shortcut function
  `tf.keras.initializers.lecun_normal`.

  Initializers allow you to pre-specify an initialization strategy, encoded in
  the Initializer object, without knowing the shape and dtype of the variable
  being initialized.

  Draws samples from a truncated normal distribution centered on 0 with `stddev
  = sqrt(1 / fan_in)` where `fan_in` is the number of input units in the weight
  tensor.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.LecunNormal()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.LecunNormal()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Arguments:
    seed: A Python integer. Used to seed the random generator.

  References:
      - Self-Normalizing Neural Networks,
      [Klambauer et al., 2017]
      (https://papers.nips.cc/paper/6698-self-normalizing-neural-networks)
      ([pdf]
      (https://papers.nips.cc/paper/6698-self-normalizing-neural-networks.pdf))
      - Efficient Backprop,
      [Lecun et al., 1998](http://yann.lecun.com/exdb/publis/pdf/lecun-98b.pdf)
  """

  def __init__(self, seed=None):
    super(LecunNormal, self).__init__(
        scale=1., mode='fan_in', distribution='truncated_normal', seed=seed)

  def get_config(self):
    return {'seed': self.seed}

@keras_export('keras.initializers.LecunUniform',
              'keras.initializers.lecun_uniform',
              v1=[])
class LecunUniform(VarianceScaling):
  """Lecun uniform initializer.

   Also available via the shortcut function
  `tf.keras.initializers.lecun_uniform`.

  Draws samples from a uniform distribution within `[-limit, limit]`,
  where `limit = sqrt(3 / fan_in)` (`fan_in` is the number of input units in the
  weight tensor).

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.LecunUniform()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.LecunUniform()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Arguments:
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.

  References:
      - Self-Normalizing Neural Networks,
      [Klambauer et al., 2017](https://papers.nips.cc/paper/6698-self-normalizing-neural-networks) # pylint: disable=line-too-long
      ([pdf](https://papers.nips.cc/paper/6698-self-normalizing-neural-networks.pdf))
      - Efficient Backprop,
      [Lecun et al., 1998](http://yann.lecun.com/exdb/publis/pdf/lecun-98b.pdf)
  """

  def __init__(self, seed=None):
    super(LecunUniform, self).__init__(
        scale=1., mode='fan_in', distribution='uniform', seed=seed)

  def get_config(self):
    return {'seed': self.seed}

@keras_export('keras.initializers.HeNormal',
              'keras.initializers.he_normal',
              v1=[])
class HeNormal(VarianceScaling):
  """He normal initializer.

   Also available via the shortcut function
  `tf.keras.initializers.he_normal`.

  It draws samples from a truncated normal distribution centered on 0 with
  `stddev = sqrt(2 / fan_in)` where `fan_in` is the number of input units in the
  weight tensor.

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.HeNormal()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.HeNormal()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Arguments:
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.

  References:
      [He et al., 2015](https://www.cv-foundation.org/openaccess/content_iccv_2015/html/He_Delving_Deep_into_ICCV_2015_paper.html) # pylint: disable=line-too-long
      ([pdf](https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/He_Delving_Deep_into_ICCV_2015_paper.pdf))
  """

  def __init__(self, seed=None):
    super(HeNormal, self).__init__(
        scale=2., mode='fan_in', distribution='truncated_normal', seed=seed)

  def get_config(self):
    return {'seed': self.seed}

@keras_export('keras.initializers.HeUniform',
              'keras.initializers.he_uniform',
              v1=[])
class HeUniform(VarianceScaling):
  """He uniform variance scaling initializer.

   Also available via the shortcut function
  `tf.keras.initializers.he_uniform`.

  Draws samples from a uniform distribution within `[-limit, limit]`, where
  `limit = sqrt(6 / fan_in)` (`fan_in` is the number of input units in the
  weight tensor).

  Examples:

  >>> # Standalone usage:
  >>> initializer = tf.keras.initializers.HeUniform()
  >>> values = initializer(shape=(2, 2))

  >>> # Usage in a Keras layer:
  >>> initializer = tf.keras.initializers.HeUniform()
  >>> layer = tf.keras.layers.Dense(3, kernel_initializer=initializer)

  Arguments:
    seed: A Python integer. An initializer created with a given seed will
      always produce the same random tensor for a given shape and dtype.

  References:
      [He et al., 2015](https://www.cv-foundation.org/openaccess/content_iccv_2015/html/He_Delving_Deep_into_ICCV_2015_paper.html) # pylint: disable=line-too-long
      ([pdf](https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/He_Delving_Deep_into_ICCV_2015_paper.pdf))
  """

  def __init__(self, seed=None):
    super(HeUniform, self).__init__(
        scale=2., mode='fan_in', distribution='uniform', seed=seed)

  def get_config(self):
    return {'seed': self.seed}

def _get_dtype(dtype):
  if dtype is None:
    dtype = backend.floatx()
  return dtypes.as_dtype(dtype)


text:
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed 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.

package google.registry.testing;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;

import google.registry.config.SystemPropertySetter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

/**
 * JUnit extension for overriding the values Java system properties during tests.
 *
 *
In most scenarios this class should be the last extension/extension to apply. In JUnit 5,
 * apply {@code @Order(value = Integer.MAX_VALUE)} to the extension.
 */
public final class SystemPropertyExtension
    implements SystemPropertySetter, BeforeEachCallback, AfterEachCallback {

  /** Class representing a system property key value pair. */
  private static class Property {
    final String key;
    final Optional<String> value;

    Property(String key, Optional<String> value) {
      this.key = checkNotNull(key, "key");
      this.value = checkNotNull(value, "value");
    }

    void set() {
      if (value.isPresent()) {
        System.setProperty(key, value.get());
      } else {
        System.clearProperty(key);
      }
    }
  }

  private boolean isRunning = false;
  private final List<Property> pendings = new ArrayList<>();
  private final Map<String, Property> originals = new HashMap<>();

  /**
   * Change the value of a system property which is restored to its original value after the test.
   *
   *
It's safe to call this method multiple times with the same {@code key} within a single test.
   * Only the truly original property value will be restored at the end.
   *
   *
This method can be called fluently when declaring the Extension field, or within a Test
   * method.
   *
   * @see java.lang.System#setProperty(String, String)
   */
  @Override
  public SystemPropertyExtension setProperty(String key, @Nullable String value) {
    originals.computeIfAbsent(
        key, k -> new Property(k, Optional.ofNullable(System.getProperty(k))));
    Property property = new Property(key, Optional.ofNullable(value));
    if (isRunning) {
      property.set();
    } else {
      pendings.add(property);
    }
    return this;
  }

  @Override
  public void beforeEach(ExtensionContext context) {
    checkState(!isRunning);
    for (Property pending : pendings) {
      pending.set();
    }
    isRunning = true;
  }

  @Override
  public void afterEach(ExtensionContext context) {
    for (Property original : originals.values()) {
      original.set();
    }
  }
}


text:
package unit.com.bitdubai.fermat_osa_addon.layer.android.database_system.developer.bitdubai.version_1.structure.AndroidRecord;

import com.bitdubai.fermat_api.layer.osa_android.database_system.DatabaseFilterOrder;
import com.bitdubai.fermat_osa_addon.layer.android.database_system.developer.bitdubai.version_1.structure.AndroidRecord;

import org.junit.Before;
import org.junit.Test;

import static org.fest.assertions.api.Assertions.assertThat;

/**
 * Created by angel on 22/7/15.
 */
public class AndroidRecordTest {

    private String name1 = "name1";
    private String name2 = "name2";

    private String value1 = "value1";
    private String value2 = "value2";

    AndroidRecord record1;
    AndroidRecord record2;

    @Before
    public void setUpAndroidRecord1(){
        record1 = constructAndroidRecord(
            name1,
            value1,
            true,
            true
        );
    }

    @Test
    public void Variables_AreEquals(){
        record2 = constructAndroidRecord(
            name1,
            value1,
            true,
            true
        );

        assertThat(record1.getChange()).isEqualTo(record2.getChange());
        assertThat(record1.getValue()).isEqualTo(record2.getValue());
        assertThat(record1.getUseValueofVariable()).isEqualTo(record2.getUseValueofVariable());
        assertThat(record1.getName()).isEqualTo(record2.getName());

        assertThat(record1.toString()).isEqualTo(record2.toString());
    }

    @Test
    public void Variables_NotEquals(){
        record2 = constructAndroidRecord(
                name2,
                value2,
                false,
                false
        );

        assertThat(record1.getChange()).isNotEqualTo(record2.getChange());
        assertThat(record1.getValue()).isNotEqualTo(record2.getValue());
        assertThat(record1.getUseValueofVariable()).isNotEqualTo(record2.getUseValueofVariable());
        assertThat(record1.getName()).isNotEqualTo(record2.getName());

        assertThat(record1.toString()).isNotEqualTo(record2.toString());
    }

    private AndroidRecord constructAndroidRecord(
            String name,
            String value,
            boolean change,
            boolean ValueofVariable
    ){
        AndroidRecord record = new AndroidRecord();
        record.setName(name);
        record.setChange(change);
        record.setUseValueofVariable(ValueofVariable);
        record.setValue(value);

        return record;
    }
}


text:
//
//  BRSnappetSecurityService.h
//  BluetoothRobotControlLibrary
//
//  Created by Forrest Chan on 19/11/14.
//  Copyright (c) 2014 WOWWEE GROUP LIMITED. All rights reserved.
//

@import Foundation;
#import "BRBaseService.h"
#import "SnappetRobotConstants.h"

/** KVO **/
// Context
#ifndef snappetSecurityKVOContext
#define snappetSecurityKVOContext "snappetSecurity"
#endif
// KeyPath
FOUNDATION_EXPORT NSString *const pinCodeEnabledKeyPathKVO;
FOUNDATION_EXPORT NSString *const authenticateResponseKeyPathKVO;

@interface BRSnappetSecurityService : BRBaseService

@property (nonatomic, assign) bool isNotifying;

@property (nonatomic, strong) NSNumber *pinCodeEnabled;
@property (nonatomic, strong) NSData *authenticateResponse;

#pragma mark - NOTIFY
- (void)turnOff;
- (void)turnOn;

#pragma mark - READ
- (void)readASCIIPinCodeEnabled;

#pragma mark - WRITE
- (void)setASCIIPinCodeEnabled:(BOOL)pinEnabled withCallback:(void (^)(NSError *))callback;
- (void)setASCIIPinCode:(short)digit1 digit2:(short)digit2 digit3:(short)digit3 digit4:(short)digit4 withCallback:(void (^)(NSError *))callback;
- (void)authenticateWithASCIIPinCode:(short)digit1 digit2:(short)digit2 digit3:(short)digit3 digit4:(short)digit4 withCallback:(void (^)(NSError *))callback;
- (void)resetASCIIPinCodeAndEraseFlash;

@end


text:
package main

// All known licenses.
var licenses []license


text:
import random

from core.exception import *
from core.grid import *

class NoAvailablePlaceError(CoreError):

    message = "No available place."

class NoAvailableTargetError(CoreError):

    message = "No available target."

class TurnState(object):
    NONE = 0x00
    MARKED = 0x01
    MISS = 0x02
    HIT = 0x03
    SUNK = 0x04

class Turn(Position):

    owner = None
    state = None

    def __init__(self, owner, v=None, h=None):
        self.owner = owner
        self.state = TurnState.NONE

        super().__init__(v, h)

    def is_none(self):
        return TurnState.NONE == self.state

    def is_marked(self):
        return TurnState.MARKED == self.state

    def is_miss(self):
        return TurnState.MISS == self.state

    def is_hit(self):
        return TurnState.HIT == self.state

    def is_sunk(self):
        return TurnState.SUNK == self.state

    def marked(self):
        self.state = TurnState.MARKED

    def miss(self):
        self.state = TurnState.MISS

    def hit(self):
        self.state = TurnState.HIT

    def sunk(self):
        self.state = TurnState.SUNK

class Player(object):

    grid = None
    fleet = None

    def __init__(self, grid, fleet):
        self.grid = grid
        self.fleet = fleet

        self.fleet.create(self.grid)

    def name(self):
        raise NotImplementedError()

    def prepare(self):
        raise NotImplementedError()

    def answer(self, turn):
        cell = self.grid.cell(turn.position)

        if not cell.is_marked():
            cell.mark()

            if cell.unit:
                if cell.unit.is_sunked():
                    turn.sunk()
                else:
                    turn.hit()
            else:
                turn.miss()
        else:
            turn.marked()

        return turn

    def is_defeated(self):
        return self.fleet.is_defeated()

    def is_ready(self):
        return self.fleet.is_ready()

    def turn(self):
        raise NotImplementedError()

    def say(self):
        return self.turn()

class BaseHumanPlayer(Player):

    def name(self):
        return 'Human'

    def current_unit(self):
        return self.fleet.current()

    def prepare(self):
        self.current_unit().move_to()

    def unit_rotate(self):
        self.current_unit().rotate()

    def unit_move_left(self):
        self.current_unit().move_left()

    def unit_move_right(self):
        self.current_unit().move_right()

    def unit_move_up(self):
        self.current_unit().move_up()

    def unit_move_down(self):
        self.current_unit().move_down()

    def unit_place(self):
        if self.current_unit().place():
            if not self.is_ready():
                self.current_unit().move_to()

    def turn(self):
        return Turn(self)

class BaseComputerPlayer(Player):

    def name(self):
        return 'Computer'

class HumanPlayer(BaseHumanPlayer):
    pass

class ComputerPlayer(BaseComputerPlayer):

    enemy = None
    turns = []

    def __init__(self, grid, fleet):
        super().__init__(grid, fleet)

        self.enemy = []
        self.turns = []

    def turn(self):
        target = None

        if self.turns:
            last = self.turns[-1]

            if last.is_sunk():
                self.enemy.clear()
            elif last.is_hit():
                self.enemy.append(last.position)

        if self.enemy:
            target = self.get_available_target(self.turns, self.enemy)
        else:
            target = self.get_available_target(self.turns)

        if not target:
            raise NoAvailableTargetError()

        target = random.choice(target)

        turn = Turn(self, target[0], target[1])

        self.turns.append(turn)

        return turn

    def get_available_target(self, turns, enemy=None):
        marked = []

        for t in turns:
            marked.append(t.position)

        position = []

        if enemy:
            position = self.grid.near(enemy)
        else:
            for v in range(self.grid.config.size):
                for h in range(self.grid.config.size):
                    position.append([v, h])

        target = []

        for p in filter((lambda p: p not in marked), position):
            target.append(p)

        return target

    def prepare(self):
        for u in self.fleet.units:

            available = self.get_available_position(u.size)
            available = random.choice(available)

            (u.move_to(available) and u.place())

        if not self.is_ready():
            raise NoAvailablePlaceError()

    def get_available_position(self, size):
        available = []
        position = []

        for d in [1, 2]:
            for v in range(self.grid.config.size):
                position.clear()
                position.append([])

                for h in range(self.grid.config.size):
                    if d % 2:
                        p = [v, h]
                    else:
                        p = [h, v]

                    cell = self.grid.cell([p[0], p[1]])

                    if cell.is_locked():
                        position.append([])
                    else:
                        position[-1].append(p)

                for p in filter((lambda p: len(p) >= size), position):
                    for i in range((len(p) - size + 1)):
                        available.append(p[i:(i + size):1])

        return available


text:
package ole

// safeArrayAccessData returns raw array pointer.
func safeArrayAccessData(safearray *SafeArray) (uintptr, error) {
	return uintptr(0), NewError(E_NOTIMPL)
}

func safeArrayUnaccessData(safearray *SafeArray) error {
	return NewError(E_NOTIMPL)
}

func safeArrayAllocData(safearray *SafeArray) error {
	return NewError(E_NOTIMPL)
}

func safeArrayAllocDescriptor(dimensions uint32) (*SafeArray, error) {
	return nil, NewError(E_NOTIMPL)
}

func safeArrayAllocDescriptorEx(variantType VT, dimensions uint32) (*SafeArray, error) {
	return nil, NewError(E_NOTIMPL)
}

func safeArrayCopy(original *SafeArray) (*SafeArray, error) {
	return nil, NewError(E_NOTIMPL)
}

func safeArrayCopyData(original *SafeArray, duplicate *SafeArray) error {
	return NewError(E_NOTIMPL)
}

func safeArrayCreate(variantType VT, dimensions uint32, bounds *SafeArrayBound) (*SafeArray, error) {
	return nil, NewError(E_NOTIMPL)
}

func safeArrayCreateEx(variantType VT, dimensions uint32, bounds *SafeArrayBound, extra uintptr) (*SafeArray, error) {
	return nil, NewError(E_NOTIMPL)
}

func safeArrayCreateVector(variantType VT, lowerBound int32, length uint32) (*SafeArray, error) {
	return nil, NewError(E_NOTIMPL)
}

func safeArrayCreateVectorEx(variantType VT, lowerBound int32, length uint32, extra uintptr) (*SafeArray, error) {
	return nil, NewError(E_NOTIMPL)
}

func safeArrayDestroy(safearray *SafeArray) error {
	return NewError(E_NOTIMPL)
}

func safeArrayDestroyData(safearray *SafeArray) error {
	return NewError(E_NOTIMPL)
}

func safeArrayDestroyDescriptor(safearray *SafeArray) error {
	return NewError(E_NOTIMPL)
}

func safeArrayGetDim(safearray *SafeArray) (*uint32, error) {
	u := uint32(0)
	return &u, NewError(E_NOTIMPL)
}

func safeArrayGetElementSize(safearray *SafeArray) (*uint32, error) {
	u := uint32(0)
	return &u, NewError(E_NOTIMPL)
}

func safeArrayGetElement(safearray *SafeArray, index int64) (uintptr, error) {
	return uintptr(0), NewError(E_NOTIMPL)
}

func safeArrayGetElementString(safearray *SafeArray, index int64) (string, error) {
	return "", NewError(E_NOTIMPL)
}

func safeArrayGetIID(safearray *SafeArray) (*GUID, error) {
	return nil, NewError(E_NOTIMPL)
}

func safeArrayGetLBound(safearray *SafeArray, dimension uint32) (int64, error) {
	return int64(0), NewError(E_NOTIMPL)
}

func safeArrayGetUBound(safearray *SafeArray, dimension uint32) (int64, error) {
	return int64(0), NewError(E_NOTIMPL)
}

func safeArrayGetVartype(safearray *SafeArray) (uint16, error) {
	return uint16(0), NewError(E_NOTIMPL)
}

func safeArrayLock(safearray *SafeArray) error {
	return NewError(E_NOTIMPL)
}

func safeArrayUnlock(safearray *SafeArray) error {
	return NewError(E_NOTIMPL)
}

func safeArrayPutElement(safearray *SafeArray, index int64, element uintptr) error {
	return NewError(E_NOTIMPL)
}

func safeArrayGetRecordInfo(safearray *SafeArray) (interface{}, error) {
	return nil, NewError(E_NOTIMPL)
}

func safeArraySetRecordInfo(safearray *SafeArray, recordInfo interface{}) error {
	return NewError(E_NOTIMPL)
}


text:
<?php

namespace Carta\CartaBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Carta\CartaBundle\Entity\Cliente;
use Carta\CartaBundle\Form\ClienteType;

/**
 * Cliente controller.
 *
 * @Route("/cliente")
 */
class ClienteController extends Controller
{
    /**
     * Lists all Cliente entities.
     *
     * @Route("/", name="cliente")
     * @Method("GET")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('CartaCartaBundle:Cliente')->findAll();

        return array(
            'entities' => $entities,
        );
    }

    /**
     * Creates a new Cliente entity.
     *
     * @Route("/", name="cliente_create")
     * @Method("POST")
     * @Template("CartaCartaBundle:Cliente:new.html.twig")
     */
    public function createAction(Request $request)
    {
        $entity  = new Cliente();
        $form = $this->createForm(new ClienteType(), $entity);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('cliente_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Displays a form to create a new Cliente entity.
     *
     * @Route("/new", name="cliente_new")
     * @Method("GET")
     * @Template()
     */
    public function newAction()
    {
        $entity = new Cliente();
        $form   = $this->createForm(new ClienteType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Finds and displays a Cliente entity.
     *
     * @Route("/{id}", name="cliente_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('CartaCartaBundle:Cliente')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Cliente entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Displays a form to edit an existing Cliente entity.
     *
     * @Route("/{id}/edit", name="cliente_edit")
     * @Method("GET")
     * @Template()
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('CartaCartaBundle:Cliente')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Cliente entity.');
        }

        $editForm = $this->createForm(new ClienteType(), $entity);
        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Edits an existing Cliente entity.
     *
     * @Route("/{id}", name="cliente_update")
     * @Method("PUT")
     * @Template("CartaCartaBundle:Cliente:edit.html.twig")
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('CartaCartaBundle:Cliente')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Cliente entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createForm(new ClienteType(), $entity);
        $editForm->bind($request);

        if ($editForm->isValid()) {
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('cliente_edit', array('id' => $id)));
        }

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Deletes a Cliente entity.
     *
     * @Route("/{id}", name="cliente_delete")
     * @Method("DELETE")
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('CartaCartaBundle:Cliente')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Cliente entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('cliente'));
    }

    /**
     * Creates a form to delete a Cliente entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder(array('id' => $id))
            ->add('id', 'hidden')
            ->getForm()
        ;
    }
}


text:
package org.teachingkidsprogramming.recipes.completed.section03ifs.KataQuestions;

import java.awt.Toolkit;

import org.teachingextensions.logo.utils.EventUtils.MessageBox;

//------------Kata Question---------------//
//  How would you make sure the guess is NOT zero
//      and end the game if the guess is zero?
//  How would you make sure the guess is NOT a negative number
//      but go to the next turn if the guess is negative?
//  Write out the steps in English
//  Then translate the steps into code
//  Make sure to run after each line
//
public class HiLoNoZeroNoNegativeAndPlayOn_02
{
  public static void main(String[] args)
  {
    // int answer = NumberUtils.getRandomInt(1, 100);
    int answer = 12;
    for (int i = 0; i < 8; i++)
    {
      int guess = MessageBox.askForNumericalInput("Can you guess the random number between 1 and 100?");
      if (guess == 0)
      {
        MessageBox.showMessage("No Zero allowed, you lose!");
        System.exit(0);
      }
      if (guess == answer)
      {
        Toolkit.getDefaultToolkit().beep();
        MessageBox.showMessage("You won!");
        System.exit(0);
      }
      else if (guess > answer)
      {
        MessageBox.showMessage("Try a lower number.");
      }
      else if (guess < answer)
      {
        MessageBox.showMessage("Try a higher number.");
      }
    }
    MessageBox.showMessage("You lost!");
  }
}


text:
'use strict';

privateScriptController.installClass('PluginPlaceholderElement', function(PluginPlaceholderElementPrototype) {
    // FIXME: Load this from a .css file.
    var styleSource =
        '#plugin-placeholder {' +
        '    all: initial;' +
        '    width: 100%;' +
        '    height: 100%;' +
        '    overflow: hidden;' +
        '    display: flex;' +
        '    align-items: center;' +
        '    background: gray;' +
        '    font: 12px -webkit-control;' +
        '}' +
        '#plugin-placeholder-content {' +
        '    text-align: center;' +
        '    margin: auto;' +
        '}';

    PluginPlaceholderElementPrototype.createdCallback = function() {
        this.id = 'plugin-placeholder';

        var styleElement = document.createElement('style');
        styleElement.textContent = styleSource;

        var contentElement = document.createElement('div');
        contentElement.id = 'plugin-placeholder-content';

        var messageElement = document.createElement('div');
        messageElement.id = 'plugin-placeholder-message';

        // FIXME: UI polish, l10n, etc. for the close button.
        var closeButton = document.createElement('button');
        closeButton.id = 'plugin-placeholder-close-button';
        closeButton.textContent = 'Close';
        closeButton.style.display = 'none';
        closeButton.addEventListener('click', function() {
            // FIXME: Record UMA Plugin_Hide_Click.
            this.hide();
        }.bind(this));

        contentElement.appendChild(messageElement);
        contentElement.appendChild(closeButton);
        this.appendChild(styleElement);
        this.appendChild(contentElement);

        this.messageElement = messageElement;
        this.closeButton = closeButton;
    };

    PluginPlaceholderElementPrototype.hide = function() {
        var host = (this.parentNode instanceof ShadowRoot) ? this.parentNode.host : this;
        host.style.display = 'none';

        // If we have a width and height, search for a parent (often <div>) with the
        // same dimensions. If we find such a parent, hide that as well.
        // This makes much more uncovered page content usable (including clickable)
        // as opposed to merely visible.
        // TODO(cevans) -- it's a foul heuristic but we're going to tolerate it for
        // now for these reasons:
        // 1) Makes the user experience better.
        // 2) Foulness is encapsulated within this single function.
        // 3) Confidence in no false positives.
        // 4) Seems to have a good / low false negative rate at this time.
        //
        // This heuristic was copied from plugins::PluginPlaceholder::HidePlugin
        // (src/components/plugins/renderer/plugin_placeholder.cc) and should be
        // kept in sync with it until it goes away.
        if (host.hasAttribute('width') && host.hasAttribute('height')) {
            var presentationAttributeInPixels = function(attr) {
                var match = host.getAttribute(attr).match(/^\s*(\d+)\s*(px)?\s*$/);
                if (match)
                    return match[1] + 'px';
            };
            var width = presentationAttributeInPixels('width');
            var height = presentationAttributeInPixels('height');
            if (!width || !height)
                return;

            var element = host;
            while (element instanceof Element) {
                if (element.style.width == width && element.style.height == height)
                    element.style.display = 'none';
                element = element.parentNode;
            }
        }
    };

    Object.defineProperty(PluginPlaceholderElementPrototype, 'message', {
        get: function() { return this.messageElement.textContent; },
        set: function(message) { this.messageElement.textContent = message; },
    });

    Object.defineProperty(PluginPlaceholderElementPrototype, 'closeable', {
        get: function() { return this.closeButton.style.display != 'none'; },
        set: function(closeable) { this.closeButton.style.display = closeable ? '' : 'none'; },
    });
});


text:
//Module dependencies.
//var passport = require( 'passport' );
var orm = require( "orm" );
var address = process.env.DB_PORT_3306_TCP_ADDR || 'localhost';
var dbname = 'test';
var db = orm.connect( "mysql://root:mysqluser@" + address + "/" + dbname );
var moduleEnabled = false;

db.on( "connect", function ( err ) {
  if ( err ) {
    console.log( "Something is wrong with the connection", err );
    return;
  }
  // connected!
  console.log( 'mysql connected' );
} );

module.exports.getModuleStatus = function ( req, res ) {
  res.json( moduleEnabled );
};

module.exports.setModuleStatus = function ( req, res ) {
  moduleEnabled = stringToBoolean( req.body.enabled.toString() || '' );
  res.json( 'Switch auth module to:' + moduleEnabled );
};

module.exports.register = function ( req, res ) {
  if ( !moduleEnabled )
    return res.json( 'Module is not enabled' );
  if ( !req.body.username || !req.body.password ) {
    return res.json( 'missing parameters!' );
  }
  db.load( "../mysql/model/account", function ( err ) {
    // loaded!
    var Account = db.models.account;
    Account.create( [
      {
        username : req.body.username,
        password  : req.body.password
      }
    ], function ( err, items ) {
      if ( err )
        res.json( err );
      else
        res.json( 'ok' );
    } );
  } );
};

module.exports.login = function ( req, res ) {
  if ( !moduleEnabled )
    return res.json( 'Module is not enabled' );
  if ( !req.body.username || !req.body.password ) {
    return res.json( 'missing parameters!' );
  }
  db.load( "../mysql/model/account", function ( err ) {
    // loaded!
    var Account = db.models.account;
    Account.find( { username : req.body.username, password : req.body.password }, 1, function ( err, account ) {
      if ( err )
        res.json( err );
      else if( account.length <= 0 )
        res.json( 'user or password is wrong' );
      else {
        res.json( 'successfully login!' );
      }
    } );
  } );
};

module.exports.modifyPassword = function ( req, res ) {
  if ( !moduleEnabled )
    return res.json( 'Module is not enabled' );
  if ( !req.body.username || !req.body.password || !req.body.newpassword ) {
    return res.json( 'missing parameters!' );
  }
  db.load( "../mysql/model/account", function ( err ) {
    // loaded!
    var Account = db.models.account;
    Account.find( { username : req.body.username, password : req.body.password }, 1, function ( err, account ) {
      if ( err )
        res.json( err );
      else if( account.length <= 0 )
        res.json( 'user not find!' );
      else {
        account[0].password = req.body.newpassword;
        account[0].save( function ( err ) {
          if ( err )
            res.json( err );
          else
            res.json( 'ok' );
        } );
      }
    } );
  } );
};

module.exports.logout = function ( req, res ) {
  if ( !moduleEnabled )
    return res.json( 'Module is not enabled' );
  db.load( "../mysql/model/account", function ( err ) {
    // loaded!
    var Account = db.models.account;
  } );
};

function stringToBoolean ( string ) {
  switch (string.toLowerCase()) {
    case "true":
    case "yes":
    case "1":
      return true;
    case "false":
    case "no":
    case "0":
    case null:
      return false;
    default:
      return Boolean( string );
  }
}


text:
package worker

import (
	"errors"
	"github.com/MG-RAST/AWE/lib/core"
	"github.com/MG-RAST/AWE/lib/logger"
)

var (
	fromStealer   chan *mediumwork // workStealer -> dataMover
	fromMover     chan *mediumwork // dataMover -> processor
	fromProcessor chan *mediumwork // processor -> deliverer
	chanPermit    chan bool
	chankill      chan bool      //heartbeater -> worker
	workmap       map[string]int //workunit map [work_id]stage_id}
)

type mediumwork struct {
	workunit *core.Workunit
	perfstat *core.WorkPerf
}

const (
	ID_HEARTBEATER   = 0
	ID_WORKSTEALER   = 1
	ID_DATAMOVER     = 2
	ID_WORKER        = 3
	ID_DELIVERER     = 4
	ID_REDISTRIBUTOR = 5
	ID_DISCARDED     = 6
)

func InitWorkers(client *core.Client) (err error) {
	if client == nil {
		return errors.New("InitClientWorkers(): empty client")
	}
	fromStealer = make(chan *mediumwork)   // workStealer -> dataMover
	fromMover = make(chan *mediumwork)     // dataMover -> processor
	fromProcessor = make(chan *mediumwork) // processor -> deliverer
	chankill = make(chan bool)             //heartbeater -> processor
	chanPermit = make(chan bool)
	workmap = map[string]int{} //workunit map [work_id]stage_idgit
	return
}

func StartClientWorkers() {
	control := make(chan int)
	go heartBeater(control)
	go workStealer(control)
	go dataMover(control)
	go processor(control)
	go deliverer(control)
	for {
		who := <-control //block till someone dies and then restart it
		switch who {
		case ID_HEARTBEATER:
			go heartBeater(control)
			logger.Error("heartBeater died and restarted")
		case ID_WORKSTEALER:
			go workStealer(control)
			logger.Error("workStealer died and restarted")
		case ID_DATAMOVER:
			go dataMover(control)
			logger.Error("dataMover died and restarted")
		case ID_WORKER:
			go processor(control)
			logger.Error("worker died and restarted")
		case ID_DELIVERER:
			go deliverer(control)
			logger.Error("deliverer died and restarted")
		}
	}
}

func StartProxyWorkers() {
	control := make(chan int)
	go heartBeater(control)
	go workStealer(control)
	go redistributor(control)
	for {
		who := <-control //block till someone dies and then restart it
		switch who {
		case ID_HEARTBEATER:
			go heartBeater(control)
			logger.Error("heartBeater died and restarted")
		case ID_WORKSTEALER:
			go workStealer(control)
			logger.Error("workStealer died and restarted")
		case ID_REDISTRIBUTOR:
			go redistributor(control)
			logger.Error("deliverer died and restarted")
		}
	}
}


text:
/**
 * @file inc/stdint.h
 * @brief Standard definitions for integers
 *
 * Inspired by CMU's 2016 OS course
 *
 * @author Alex O'Neill <me@aoneill.me>
 *
 * @bugs No known bugs.
 */

#ifndef __INC_STDINT_H__
#define __INC_STDINT_H__

#ifndef ASSEMBLER

typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef unsigned long long uint64_t;

typedef signed char int8_t;
typedef signed short int16_t;
typedef signed long int32_t;
typedef signed long long int64_t;

typedef int intptr_t;
typedef unsigned int uintptr_t;

typedef int64_t intmax_t;
typedef uint64_t uintmax_t;

typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;

typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;

typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;

typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;

#endif /* !ASSEMBLER */

#define UINT8_C(x) (x)
#define UINT16_C(x) (x)
#define UINT32_C(x) (x ## U)
#define UINT64_C(x) (x ## ULL)

#define INT8_C(x) (x)
#define INT16_C(x) (x)
#define INT32_C(x) (x)
#define INT64_C(x) (x ## LL)

#define INTMAX_C(x) (x ## LL)
#define UINTMAX_C(x) (x ## ULL)

#define INT8_MIN       (-128)
#define INT8_MAX       (127)
#define INT16_MIN      (-32768)
#define INT16_MAX      (32767)
#define INT32_MIN      (0x80000000)
#define INT32_MAX      (0x7FFFFFFF)
#define INT64_MIN      (0x8000000000000000LL)
#define INT64_MAX      (0x7FFFFFFFFFFFFFFFLL)

#define UINT8_MAX       (255)
#define UINT16_MAX      (65535)
#define UINT32_MAX      (0xFFFFFFFF)
#define UINT64_MAX      (0xFFFFFFFFFFFFFFFFULL)

#define INT_LEAST8_MIN     INT8_MIN
#define INT_LEAST8_MAX     INT8_MAX
#define INT_LEAST16_MIN    INT16_MIN
#define INT_LEAST16_MAX    INT16_MAX
#define INT_LEAST32_MIN    INT32_MIN
#define INT_LEAST32_MAX    INT32_MAX
#define INT_LEAST64_MIN    INT64_MIN
#define INT_LEAST64_MAX    INT64_MAX

#define UINT_LEAST8_MAX    UINT8_MAX
#define UINT_LEAST16_MAX   UINT16_MAX
#define UINT_LEAST32_MAX   UINT32_MAX
#define UINT_LEAST64_MAX   UINT64_MAX

#define INT_FAST8_MIN      INT8_MIN
#define INT_FAST8_MAX      INT8_MAX
#define INT_FAST16_MIN     INT16_MIN
#define INT_FAST16_MAX     INT16_MAX
#define INT_FAST32_MIN     INT32_MIN
#define INT_FAST32_MAX     INT32_MAX
#define INT_FAST64_MIN     INT64_MIN
#define INT_FAST64_MAX     INT64_MAX

#define UINT_FAST8_MAX     UINT8_MAX
#define UINT_FAST16_MAX    UINT16_MAX
#define UINT_FAST32_MAX    UINT32_MAX
#define UINT_FAST64_MAX    UINT64_MAX

#endif /* __INC_STDINT_H__ */


text:
#ifndef ARM_COMPUTE_CPPUPSAMPLEKERNEL_H
#define ARM_COMPUTE_CPPUPSAMPLEKERNEL_H

#include "arm_compute/core/CPP/ICPPKernel.h"

namespace arm_compute
{
class ITensor;

/** CPP kernel to perform tensor upsample.
 *
 */
class CPPUpsampleKernel : public ICPPKernel
{
public:
    const char *name() const override
    {
        return "CPPUpsampleKernel";
    }
    /** Default constructor */
    CPPUpsampleKernel();
    /** Prevent instances of this class from being copied (As this class contains pointers) */
    CPPUpsampleKernel(const CPPUpsampleKernel &) = delete;
    /** Prevent instances of this class from being copied (As this class contains pointers) */
    CPPUpsampleKernel &operator=(const CPPUpsampleKernel &) = delete;
    /** Allow instances of this class to be moved */
    CPPUpsampleKernel(CPPUpsampleKernel &&) = default;
    /** Allow instances of this class to be moved */
    CPPUpsampleKernel &operator=(CPPUpsampleKernel &&) = default;
    /** Default destructor */
    ~CPPUpsampleKernel() = default;

    /** Set the input and output of the kernel.
     *
     * @param[in]  input  The input tensor to upsample. Data types supported: All.
     * @param[out] output The output tensor. Data types supported: same as @p input.
     * @param[in]  info   Padding info.
     */
    void configure(const ITensor *input, ITensor *output, const PadStrideInfo &info);

    // Inherited methods overridden:
    void run(const Window &window, const ThreadInfo &info) override;
    bool is_parallelisable() const override;

private:
    const ITensor *_input;
    ITensor       *_output;
    PadStrideInfo  _info;
};
} // namespace arm_compute
#endif /*ARM_COMPUTE_CPPUPSAMPLEKERNEL_H */


text: require 'range/bisect'


text:
@interface FLErrorAlert : FLAlert {
}

+ (FLErrorAlert*) errorAlertViewController;

@end


text:
This is the minimal requirement release. You need to have
sphinxsearch properly installed.

This library will use sphinxsearch API approach. It delegates
method calls to the sphinxsearch client following the ci convention.
Ex if sphinx client have method named SetServer you can call it via
$this->sphinxsearch->set_server($params_here)

You can configure some settings like server etc by omitting the set
and use snakes instead of camels.
Ex since we have SetMaxQueryTime method we can set $config['max_query_time']  = 1000

At this moment indexing is not supported but will be added in the future.

Usage:
$this->load->spark('sphinx/0.0.1'); $result = $this->sphinxsearch->query("test");


text:
package org.apache.rave.portal.web.model;

import org.springframework.web.bind.annotation.ModelAttribute;

/**
 * Created by equipo12 on 02-10-2014.
 */
public class AudioForm {

    private String id;
    private String name;
    private String audioUrl;
    private String category;
    private String newCategory;
    private String user;
    private String album;

    @ModelAttribute("id")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @ModelAttribute("audioUrl")
    public String getAudioUrl() {
        return audioUrl;
    }

    public void setAudioUrl(String audioUrl) {
        this.audioUrl = audioUrl;
    }

    @ModelAttribute("category")
    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    @ModelAttribute("newCategory")
    public String getNewCategory() {
        return newCategory;
    }

    public void setNewCategory(String newCategory) {
        this.newCategory = newCategory;
    }

    @ModelAttribute("name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    @ModelAttribute("album")
    public String getAlbum() {
        return album;
    }

    public void setAlbum(String album) {
        this.album = album;
    }
}


text:
package com.zimbra.qa.selenium.projects.ajax.tests.preferences.general.login;

import java.util.HashMap;

import org.testng.annotations.Test;

import com.zimbra.qa.selenium.framework.ui.*;
import com.zimbra.qa.selenium.framework.util.*;
import com.zimbra.qa.selenium.projects.ajax.core.AjaxCommonTest;
import com.zimbra.qa.selenium.projects.ajax.ui.preferences.TreePreferences.TreeItem;

public class ZimbraPrefClientTypeAdvanced extends AjaxCommonTest {

	public ZimbraPrefClientTypeAdvanced() {
		logger.info("New "+ ZimbraPrefClientTypeAdvanced.class.getCanonicalName());

		// All tests start at the login page
		super.startingPage = app.zPagePreferences;

		super.startingAccountPreferences = new HashMap<String, String>() {
			private static final long serialVersionUID = -1303088148746653112L;
			{

				put("zimbraPrefClientType", "advanced");

			}
		};

	}

	@Test(
			description = "Verify the 'Sign in using' option can be toggled",
			groups = { "functional" }
			)
	public void ZimbraPrefClientTypeAdvanced_01() throws HarnessException {

		// Go to "General"
		app.zTreePreferences.zTreeItem(Action.A_LEFTCLICK, TreeItem.General);

		String locator = "css=input[id$='_input'][value='standard']";

		ZAssert.assertTrue(
				app.zPagePreferences.sIsElementPresent(locator),
				"Verify the 'Sign in using: advanced' radio is present");

		app.zPagePreferences.sClick(locator);
		app.zPagePreferences.zWaitForBusyOverlay();

		app.zPagePreferences.zToolbarPressButton(Button.B_SAVE);

		app.zGetActiveAccount().soapSend(
						"<GetPrefsRequest xmlns='urn:zimbraAccount'>"
				+			"<pref name='zimbraPrefClientType'/>"
				+		"</GetPrefsRequest>");

		String value = app.zGetActiveAccount().soapSelectValue("//acct:pref[@name='zimbraPrefClientType']", null);
		ZAssert.assertEquals(value, "standard", "Verify the zimbraPrefClientType preference was changed to 'standard'");

	}
}


text:
package uk.ac.ncl.la.soar.glance.web.client.component

import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.html_<^._
import org.scalajs.jquery.{JQuery, JQueryEventObject, JQueryStatic}

import scala.scalajs.js
import scalacss.ScalaCssReact._
import scalacss.DevDefaults._
import uk.ac.ncl.la.soar.glance.web.client.style.GlobalStyle

import scala.scalajs.js.annotation.JSImport
import scalacss.StyleA

/**
  * Wraps all Bootstrap/jQuery extensions in Scalajs-react components for easy integration
  *
  * Much of the ScalaCSS code in this project has been cribbed wholesale from ochrons' great
  * [[https://github.com/ochrons/scalajs-spa-tutorial scala-spa-tutorial]]
  */
object Bootstrap {

  @inline private def bss = GlobalStyle.bootstrapStyle

  @js.native
  @JSImport("jquery", JSImport.Namespace)
  object jquery extends JQueryStatic

  @js.native
  trait BootstrapJQuery extends JQuery {
    def modal(action: String): BootstrapJQuery = js.native
    def modal(options: js.Any): BootstrapJQuery = js.native
  }

  implicit final def jq2bootstrap(jq: JQuery): BootstrapJQuery = jq.asInstanceOf[BootstrapJQuery]
  //The below is not necessary in spa-tutorial. TODO: Check implicit conversion interaction with Seq
  implicit final def seqStylesToTagMod(styles: Seq[StyleA]): TagMod = styles.map(s => ^.className := s.htmlClass).toTagMod

  /** Common Bootstrap contextual styles */
  // Why an Enumeration rather than a sealed ADT of objects?
  object CommonStyle extends Enumeration {
    val default, primary, success, info, warning, danger = Value
  }

  /** Bootstrap button component */
  object Button {

    case class Props(onClick: Callback, style: CommonStyle.Value = CommonStyle.default, addStyles: Seq[StyleA] = Seq())

    val component = ScalaComponent.builder[Props]("Button")
      .renderPC((_, p, c) =>
        <.button(bss.buttonOpt(p.style), p.addStyles, ^.tpe := "button", ^.onClick --> p.onClick, c)
      ).build

    def apply(props: Props, children: VdomNode*) = component(props)(children: _*)
    def apply() = component
  }

  /** Bootstrap panel component */
  object Panel {

    case class Props(heading: String, style: CommonStyle.Value = CommonStyle.default)

    val component = ScalaComponent.builder[Props]("Panel")
      .renderPC((_, p, c) =>
        <.div(bss.panelOpt(p.style),
          <.div(bss.panelHeading, p.heading),
          <.div(bss.panelBody, c)
        )
      ).build

    def apply(props: Props, children: VdomNode*) = component(props)(children: _*)
    def apply() = component
  }

  /** Bootstrap Modal component */
  object Modal {

    // header and footer are functions, so that they can get access to the the hide() function for their buttons
    case class Props(header: Callback => VdomNode, footer: Callback => VdomNode, closed: Callback,
                     backdrop: Boolean = true, keyboard: Boolean = true)

    class Backend(t: BackendScope[Props, Unit]) {
      def hide = t.getDOMNode.map {n =>
        jquery(n).modal("hide")
        ()
      }

      // jQuery event handler to be fired when the modal has been hidden
      def hidden(e: JQueryEventObject): js.Any = {
        // inform the owner of the component that the modal was closed/hidden
        t.props.flatMap(_.closed).runNow()
      }

      def render(p: Props, c: PropsChildren) = {
        val modalStyle = bss.modal
        <.div(modalStyle.modal, modalStyle.fade, ^.role := "dialog", ^.aria.hidden := true,
          <.div(modalStyle.dialog,
            <.div(modalStyle.content,
              <.div(modalStyle.header, p.header(hide)),
              <.div(modalStyle.body, c),
              <.div(modalStyle.footer, p.footer(hide))
            )
          )
        )
      }
    }

    val component = ScalaComponent.builder[Props]("Modal")
      .renderBackendWithChildren[Backend]
      .componentDidMount(scope => Callback {
        val p = scope.props
        // instruct Bootstrap to show the modal
        jquery(scope.getDOMNode).modal(js.Dynamic.literal("backdrop" -> p.backdrop, "keyboard" -> p.keyboard, "show" -> true))
        // register event listener to be notified when the modal is closed
        jquery(scope.getDOMNode).on("hidden.bs.modal", null, null, scope.backend.hidden _)
      })
      .build

    def apply(props: Props, children: VdomElement*) = component(props)(children: _*)
    def apply() = component
  }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>gem5: dev/arm/amba_fake.hh File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Modules

Namespaces

Classes

Files

Related Pages

      <form action="search.php" method="get">

             Search for
            <input type="text" name="query" value="" size="20" accesskey="s"/>

      </form>

File List

File Members

dev/arm/amba_fake.hh File Reference
This device sits in memory and reponds appropriately so the linux kernel ignores the device it is trying to talk to. More...

#include "dev/arm/amba_device.hh"

#include "params/AmbaFake.hh"

Go to the source code of this file.

Classes

class  	AmbaFake

Detailed Description

This device sits in memory and reponds appropriately so the linux kernel ignores the device it is trying to talk to.

It is used so the kernel doesn't need to be modified and devices that we are not interested in will simply be skipped.

Definition in file amba_fake.hh.
<address style="align: right;">
Generated on Fri Apr 17 12:39:11 2015 for gem5 by  doxygen 1.4.7</address>


text:
package org.apache.cassandra.index.internal;

import java.nio.ByteBuffer;
import java.util.NavigableSet;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.cassandra.schema.TableMetadata;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.filter.*;
import org.apache.cassandra.db.partitions.UnfilteredPartitionIterator;
import org.apache.cassandra.db.rows.RowIterator;
import org.apache.cassandra.db.rows.UnfilteredRowIterator;
import org.apache.cassandra.db.rows.UnfilteredRowIterators;
import org.apache.cassandra.dht.AbstractBounds;
import org.apache.cassandra.index.Index;
import org.apache.cassandra.utils.btree.BTreeSet;

public abstract class CassandraIndexSearcher implements Index.Searcher
{
    private static final Logger logger = LoggerFactory.getLogger(CassandraIndexSearcher.class);

    private final RowFilter.Expression expression;
    protected final CassandraIndex index;
    protected final ReadCommand command;

    public CassandraIndexSearcher(ReadCommand command,
                                  RowFilter.Expression expression,
                                  CassandraIndex index)
    {
        this.command = command;
        this.expression = expression;
        this.index = index;
    }

    @SuppressWarnings("resource") // Both the OpOrder and 'indexIter' are closed on exception, or through the closing of the result
    // of this method.
    public UnfilteredPartitionIterator search(ReadExecutionController executionController)
    {
        // the value of the index expression is the partition key in the index table
        DecoratedKey indexKey = index.getBackingTable().get().decorateKey(expression.getIndexValue());
        UnfilteredRowIterator indexIter = queryIndex(indexKey, command, executionController);
        try
        {
            return queryDataFromIndex(indexKey, UnfilteredRowIterators.filter(indexIter, command.nowInSec()), command, executionController);
        }
        catch (RuntimeException | Error e)
        {
            indexIter.close();
            throw e;
        }
    }

    private UnfilteredRowIterator queryIndex(DecoratedKey indexKey, ReadCommand command, ReadExecutionController executionController)
    {
        ClusteringIndexFilter filter = makeIndexFilter(command);
        ColumnFamilyStore indexCfs = index.getBackingTable().get();
        TableMetadata indexMetadata = indexCfs.metadata();
        return SinglePartitionReadCommand.create(indexMetadata, command.nowInSec(), indexKey, ColumnFilter.all(indexMetadata), filter)
                                         .queryMemtableAndDisk(indexCfs, executionController.indexReadController());
    }

    private ClusteringIndexFilter makeIndexFilter(ReadCommand command)
    {
        if (command instanceof SinglePartitionReadCommand)
        {
            // Note: as yet there's no route to get here - a 2i query *always* uses a
            // PartitionRangeReadCommand. This is here in preparation for coming changes
            // in SelectStatement.
            SinglePartitionReadCommand sprc = (SinglePartitionReadCommand)command;
            ByteBuffer pk = sprc.partitionKey().getKey();
            ClusteringIndexFilter filter = sprc.clusteringIndexFilter();

            if (filter instanceof ClusteringIndexNamesFilter)
            {
                NavigableSet<Clustering> requested = ((ClusteringIndexNamesFilter)filter).requestedRows();
                BTreeSet.Builder<Clustering> clusterings = BTreeSet.builder(index.getIndexComparator());
                for (Clustering c : requested)
                    clusterings.add(makeIndexClustering(pk, c));
                return new ClusteringIndexNamesFilter(clusterings.build(), filter.isReversed());
            }
            else
            {
                Slices requested = ((ClusteringIndexSliceFilter)filter).requestedSlices();
                Slices.Builder builder = new Slices.Builder(index.getIndexComparator());
                for (Slice slice : requested)
                    builder.add(makeIndexBound(pk, slice.start()), makeIndexBound(pk, slice.end()));
                return new ClusteringIndexSliceFilter(builder.build(), filter.isReversed());
            }
        }
        else
        {

            DataRange dataRange = ((PartitionRangeReadCommand)command).dataRange();
            AbstractBounds<PartitionPosition> range = dataRange.keyRange();

            Slice slice = Slice.ALL;

            /*
             * XXX: If the range requested is a token range, we'll have to start at the beginning (and stop at the end) of
             * the indexed row unfortunately (which will be inefficient), because we have no way to intuit the smallest possible
             * key having a given token. A potential fix would be to actually store the token along the key in the indexed row.
             */
            if (range.left instanceof DecoratedKey)
            {
                // the right hand side of the range may not be a DecoratedKey (for instance if we're paging),
                // but if it is, we can optimise slightly by restricting the slice
                if (range.right instanceof DecoratedKey)
                {

                    DecoratedKey startKey = (DecoratedKey) range.left;
                    DecoratedKey endKey = (DecoratedKey) range.right;

                    ClusteringBound start = ClusteringBound.BOTTOM;
                    ClusteringBound end = ClusteringBound.TOP;

                    /*
                     * For index queries over a range, we can't do a whole lot better than querying everything for the
                     * key range, though for slice queries where we can slightly restrict the beginning and end. We can
                     * not do this optimisation for static column indexes.
                     */
                    if (!dataRange.isNamesQuery() && !index.indexedColumn.isStatic())
                    {
                        ClusteringIndexSliceFilter startSliceFilter = ((ClusteringIndexSliceFilter) dataRange.clusteringIndexFilter(
                                                                                startKey));
                        ClusteringIndexSliceFilter endSliceFilter = ((ClusteringIndexSliceFilter) dataRange.clusteringIndexFilter(
                                                                                endKey));

                        // We can't effectively support reversed queries when we have a range, so we don't support it
                        // (or through post-query reordering) and shouldn't get there.
                        assert !startSliceFilter.isReversed() && !endSliceFilter.isReversed();

                        Slices startSlices = startSliceFilter.requestedSlices();
                        Slices endSlices = endSliceFilter.requestedSlices();

                        if (startSlices.size() > 0)
                            start = startSlices.get(0).start();

                        if (endSlices.size() > 0)
                            end = endSlices.get(endSlices.size() - 1).end();
                    }

                    slice = Slice.make(makeIndexBound(startKey.getKey(), start),
                                       makeIndexBound(endKey.getKey(), end));
                }
                else
                {
                    // otherwise, just start the index slice from the key we do have
                    slice = Slice.make(makeIndexBound(((DecoratedKey)range.left).getKey(), ClusteringBound.BOTTOM),
                                       ClusteringBound.TOP);
                }
            }
            return new ClusteringIndexSliceFilter(Slices.with(index.getIndexComparator(), slice), false);
        }
    }

    private ClusteringBound makeIndexBound(ByteBuffer rowKey, ClusteringBound bound)
    {
        return index.buildIndexClusteringPrefix(rowKey, bound, null)
                                 .buildBound(bound.isStart(), bound.isInclusive());
    }

    protected Clustering makeIndexClustering(ByteBuffer rowKey, Clustering clustering)
    {
        return index.buildIndexClusteringPrefix(rowKey, clustering, null).build();
    }

    protected abstract UnfilteredPartitionIterator queryDataFromIndex(DecoratedKey indexKey,
                                                                      RowIterator indexHits,
                                                                      ReadCommand command,
                                                                      ReadExecutionController executionController);
}


text:
package com.vaadin.client.widget.grid.events;

import com.google.gwt.event.shared.EventHandler;

/**
 * Common handler interface for editor events
 */
public interface EditorEventHandler extends EventHandler {

    /**
     * Action to perform when the editor has been opened
     *
     * @param e
     *            an editor open event object
     */
    public void onEditorOpen(EditorOpenEvent e);

    /**
     * Action to perform when the editor is re-opened on another row
     *
     * @param e
     *            an editor move event object
     */
    public void onEditorMove(EditorMoveEvent e);

    /**
     * Action to perform when the editor is closed
     *
     * @param e
     *            an editor close event object
     */
    public void onEditorClose(EditorCloseEvent e);

}


text:
/*	$NetBSD: terminal.c,v 1.6 1998/02/27 10:44:14 christos Exp $	*/

/*
 * Copyright (c) 1988, 1990, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)terminal.c	8.2 (Berkeley) 2/16/95";
#else
__RCSID("$NetBSD: terminal.c,v 1.6 1998/02/27 10:44:14 christos Exp $");
#endif
#endif /* not lint */

#include <arpa/telnet.h>
#include <sys/types.h>

#include "ring.h"

#include "externs.h"
#include "types.h"

Ring		ttyoring, ttyiring;
unsigned char	ttyobuf[2*BUFSIZ], ttyibuf[BUFSIZ];

int termdata;			/* Debugging flag */

#ifdef	USE_TERMIO
# ifndef VDISCARD
cc_t termFlushChar;
# endif
# ifndef VLNEXT
cc_t termLiteralNextChar;
# endif
# ifndef VSUSP
cc_t termSuspChar;
# endif
# ifndef VWERASE
cc_t termWerasChar;
# endif
# ifndef VREPRINT
cc_t termRprntChar;
# endif
# ifndef VSTART
cc_t termStartChar;
# endif
# ifndef VSTOP
cc_t termStopChar;
# endif
# ifndef VEOL
cc_t termForw1Char;
# endif
# ifndef VEOL2
cc_t termForw2Char;
# endif
# ifndef VSTATUS
cc_t termAytChar;
# endif
#else
cc_t termForw2Char;
cc_t termAytChar;
#endif

/*
 * initialize the terminal data structures.
 */

    void
init_terminal()
{
    if (ring_init(&ttyoring, ttyobuf, sizeof ttyobuf) != 1) {
	exit(1);
    }
    if (ring_init(&ttyiring, ttyibuf, sizeof ttyibuf) != 1) {
	exit(1);
    }
    autoflush = TerminalAutoFlush();
}

/*
 *		Send as much data as possible to the terminal.
 *
 *		Return value:
 *			-1: No useful work done, data waiting to go out.
 *			 0: No data was waiting, so nothing was done.
 *			 1: All waiting data was written out.
 *			 n: All data - n was written out.
 */

    int
ttyflush(drop)
    int drop;
{
    register int n, n0, n1;

    n0 = ring_full_count(&ttyoring);
    if ((n1 = n = ring_full_consecutive(&ttyoring)) > 0) {
	if (drop) {
	    TerminalFlushOutput();
	    /* we leave 'n' alone! */
	} else {
	    n = TerminalWrite(ttyoring.consume, n);
	}
    }
    if (n > 0) {
	if (termdata && n) {
	    Dump('>', ttyoring.consume, n);
	}
	/*
	 * If we wrote everything, and the full count is
	 * larger than what we wrote, then write the
	 * rest of the buffer.
	 */
	if (n1 == n && n0 > n) {
		n1 = n0 - n;
		if (!drop)
			n1 = TerminalWrite(ttyoring.bottom, n1);
		if (n1 > 0)
			n += n1;
	}
	ring_consumed(&ttyoring, n);
    }
    if (n < 0)
	return -1;
    if (n == n0) {
	if (n0)
	    return -1;
	return 0;
    }
    return n0 - n + 1;
}

/*
 * These routines decides on what the mode should be (based on the values
 * of various global variables).
 */

    int
getconnmode()
{
    extern int linemode;
    int mode = 0;
#ifdef	KLUDGELINEMODE
    extern int kludgelinemode;
#endif

    if (In3270)
	return(MODE_FLOW);

    if (my_want_state_is_dont(TELOPT_ECHO))
	mode |= MODE_ECHO;

    if (localflow)
	mode |= MODE_FLOW;

    if (my_want_state_is_will(TELOPT_BINARY))
	mode |= MODE_INBIN;

    if (his_want_state_is_will(TELOPT_BINARY))
	mode |= MODE_OUTBIN;

#ifdef	KLUDGELINEMODE
    if (kludgelinemode) {
	if (my_want_state_is_dont(TELOPT_SGA)) {
	    mode |= (MODE_TRAPSIG|MODE_EDIT);
	    if (dontlecho && (clocks.echotoggle > clocks.modenegotiated)) {
		mode &= ~MODE_ECHO;
	    }
	}
	return(mode);
    }
#endif
    if (my_want_state_is_will(TELOPT_LINEMODE))
	mode |= linemode;
    return(mode);
}

    void
setconnmode(force)
    int force;
{
    register int newmode;

    newmode = getconnmode()|(force?MODE_FORCE:0);

    TerminalNewMode(newmode);

}

    void
setcommandmode()
{
    TerminalNewMode(-1);
}


text:
<?php

namespace Picto\AppBundle\DataFixtures\ORM;

use Picto\AppBundle\Entity\Image;
use Picto\AppBundle\Library\Constants;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

use \DateTime;

class FixtureLoader extends AbstractFixture
    implements FixtureInterface, ContainerAwareInterface
{

    /** @var Symfony\Component\DependencyInjection\ContainerInterface */
    private $container;

    public function setContainer(ContainerInterface $container=null)
    {
        $this->container = $container;
    }

    public function load(ObjectManager $entityManager)
    {
        $parameters = $this->container->parameters;

        $image = new Image;
        $image->setHash($parameters['picto_test_image_hash'])
            ->setRawHash($parameters['picto_test_image_raw_hash'])
            ->setFilePath($parameters['picto_test_image_path'])
            ->setFileName(basename($parameters['picto_test_image_path']))
            ->setFileSize(filesize($parameters['picto_test_image_path']))
            ->setFileExtension($parameters['picto_test_image_extension'])
            ->setContentType($parameters['picto_test_image_mime_type']);

        $entityManager->persist($image);
        $entityManager->flush();

        $this->addReference('image', $image);

        return true;
    }

}


text:
package io.netty.handler.codec.string;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundMessageHandlerAdapter;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.LineBasedFrameDecoder;

import java.nio.charset.Charset;

/**
 * Encodes the requested {@link String} into a {@link ByteBuf}.
 * A typical setup for a text-based line protocol in a TCP/IP socket would be:
 *

 * {@link ChannelPipeline} pipeline = ...;
 *
 * // Decoders
 * pipeline.addLast("frameDecoder", new {@link LineBasedFrameDecoder}(80));
 * pipeline.addLast("stringDecoder", new {@link StringDecoder}(CharsetUtil.UTF_8));
 *
 * // Encoder
 * pipeline.addLast("stringEncoder", new {@link StringEncoder}(CharsetUtil.UTF_8));
 *

 * and then you can use a {@link String} instead of a {@link ByteBuf}
 * as a message:
 *

 * void messageReceived({@link ChannelHandlerContext} ctx, {@link String} msg) {
 *     ch.write("Did you say '" + msg + "'?\n");
 * }
 *

 */
@Sharable
public class StringEncoder extends ChannelOutboundMessageHandlerAdapter<CharSequence> {

    // TODO Use CharsetEncoder instead.
    private final Charset charset;

    /**
     * Creates a new instance with the current system character set.
     */
    public StringEncoder() {
        this(Charset.defaultCharset());
    }

    /**
     * Creates a new instance with the specified character set.
     */
    public StringEncoder(Charset charset) {
        if (charset == null) {
            throw new NullPointerException("charset");
        }
        this.charset = charset;
    }

    @Override
    public void flush(ChannelHandlerContext ctx, CharSequence msg) throws Exception {
        if (msg.length() == 0) {
            return;
        }
        ByteBuf encoded = Unpooled.copiedBuffer(msg, charset);
        switch (ctx.nextOutboundBufferType()) {
            case BYTE:
                ctx.nextOutboundByteBuffer().writeBytes(encoded);
                break;
            case MESSAGE:
                ctx.nextOutboundMessageBuffer().add(Unpooled.wrappedBuffer(encoded));
                break;
            default:
                throw new Error();
        }
    }
}