text:
title: BGP Configuration
canonical_url: 'https://docs.projectcalico.org/v3.2/usage/configuration/bgp'
---

This document describes the commands available in calicoctl for managing BGP.
It covers configuration of:

-  Global default node AS Number
-  The full node-to-node mesh
-  Global BGP Peers
-  Node-specific BGP Peers

The global default node AS Number is the AS Number used by the BGP agent on a
Calico node when it has not been explicitly specified.  Setting this value
simplifies configuration when your network topology allows all of your Calico
nodes to use the same AS Number.

The full node-to-node mesh option provides a mechanism to automatically
configure peering between all Calico nodes.  When enabled, each Calico node
automatically sets up a BGP peering with every other Calico node in the
network.  By default this is enabled.  However, the full node-to-node mesh is
only useful for small scale deployments and where all Calico nodes are on the
same L2 network.  We generally expect the full node-to-node mesh to be disabled
and explicit BGP peering configured.

Explicit BGP peers may be configured globally or for a particular node.

A global BGP peer is a BGP agent that peers with every Calico node in the
network.  A typical use case for a global peer might be a mid-scale
deployment where all of the Calico nodes are on the same L2 network and are
each peering with the same Route Reflector (or set of Route Reflectors).

At scale, different network topologies come in to play.  For example, in the
[AS per Rack model]({{site.baseurl}}/{{page.version}}/reference/private-cloud/l3-interconnect-fabric#the-as-per-rack-model)
discussed in the reference material, each Calico node peers with
a Route Reflector in the Top of Rack (ToR) switch.  In this case the BGP
peerings are configured on a per-node basis (i.e. these are node-specific
peers).  In the AS Per Rack model, each Calico node in a rack will be
configured with a node-specific peering to the ToR Route Reflector.

### Configuring the default node AS number

When creating a Calico node, you can optionally specify an AS number to use for
the node.  If no AS number if specified, the node will use the global default
value.

Use the `calicoctl bgp default-node-as` command to set the global default AS
number.  If no value is configured, the default AS number is 64511.

If all of your Calico nodes are within the same AS, but you require a
different AS number to be used (e.g because you are peering with a border
router), changing the default AS number to the value you require eliminates
the need to explicitly set it on a per Calico node basis.  For more
complicated topologies where you are explicitly setting the AS number on each
node, the default value will not be used and therefore using this command is
not necessary.

#### Example

To set the default AS number to 64512, run the following calicoctl command on
any node:

	$ calicoctl bgp default-node-as 64512

To view the current default value, run the command without specifying an AS
number, the command will output the current value.

	$ calicoctl bgp default-node-as
	64512

### Disabling the full node-to-node BGP mesh

If you are explicitly configuring the BGP topology for your Calico network,
you may wish to disable the full node-to-node mesh.  Use the
`calicoctl bgp node-mesh` command to disable or re-enable the mesh.

If you are building your network from scratch and do not need the full
node-to-node mesh we recommend turning off the mesh before configuring your
nodes.  If you are updating your network from a full-mesh topology to a
different topology (e.g. to start using a cluster of route reflectors to
increase scaling), configure the appropriate peers before disabling the mesh
to ensure continuity of service.

#### Example

To turn off the full BGP node-to-node mesh run the following command on any
node:

	$ calicoctl bgp node-mesh off

If you need to turn the full BGP node-to-node mesh back on run the following
command on any node:

	$ calicoctl bgp node-mesh on

To view whether the BGP node-to-node mesh is on or off, enter the command
without specifying the parameter, the command will output the current state.

	$ calicoctl bgp node-mesh
	on

### Configuring a global BGP peer

If your network topology includes BGP speakers that will be peered with *every*
Calico node in your deployment, you can use the `calicoctl bgp peer` commands
to set up the peering on your Calico nodes.  We refer to these as global peers
because they peer with every Calico node.

Two situations where global BGP peer configuration is useful are when adding
a border router that is peering into a full node-to-node mesh, or configuring
a Calico network that uses one or two route reflectors to provide moderate
scale-out capabilities.  In the latter case, each Calico node would peer to
each of the Route Reflectors and the full node-to-node mesh would be
disabled.

#### Example

To add a global BGP peer at IP address 192.20.30.40 with AS number 64567 run
the following command on any node:

	$ calicoctl bgp peer add 192.20.30.40 as 64567

To remove a global BGP peer that was configured with IP address 192.20.30.40
(the AS number is not required when deleting) run the following command on any
node:

	$ calicoctl bgp peer remove 192.20.30.40

To view the current list of global peers run the following command on any node:

	$ calicoctl bgp peer show
	+----------------------+--------+
	| Global IPv4 BGP Peer | AS Num |
	+----------------------+--------+
	| 192.20.30.40         | 64567  |
	+----------------------+--------+
	+----------------------+--------+
	| Global IPv6 BGP Peer | AS Num |
	+----------------------+--------+
	| aa:bb::ff            | 64514  |
	+----------------------+--------+

### Configuring a node specific BGP peer

If your network topology requires specific peerings for each Calico node, you
can use the `calicoctl node bgp peer` commands to set up the peers specific to
a Calico nodes.  We refer to these as node specific peers.

Configuring node specific peers is necessary when the BGP topology is more
complicated and requires different peerings on different nodes.  For example,
the
[AS per Rack model]({{site.baseurl}}/{{page.version}}/reference/private-cloud/l3-interconnect-fabric#the-as-per-rack-model)
or
[AS per Compute Server model]({{site.baseurl}}/{{page.version}}/reference/private-cloud/l3-interconnect-fabric#the-as-per-compute-server-model)
described in the reference material.

#### Example

To add a BGP peer at IP address aa:bb::ff with AS number 64514,
peering with Calico node "Node1", run the following command from the "Node1"
command line:

	Node1$ calicoctl node bgp peer add aa:bb::ff as 64514

To remove a BGP peer that was configured with IP address aa:bb::ff (the AS
number is not required), peering with Calico node "Node1", run the following
command from the "Node1" command line:

	Node1$ calicoctl bgp peer remove aa:bb::ff

To view the current list of node specific peers that are configured to peer
with Calico node "Node1", run the following command from the "Node1" command
line:

	Node1$ calicoctl node bgp peer show
	No IPv4 BGP Peers defined for this node.

	+-----------------------------+--------+
	| Node specific IPv6 BGP Peer | AS Num |
	+-----------------------------+--------+
	| aa:bb::ff                   | 64514  |
	+-----------------------------+--------+

### Checking the status of the BGP peers

To display the status of all BGP peerings for a specific node, use the
`calicoctl status` command.  This displays the status of all BGP peers for
that node - this includes the peers that are automatically configured as part
of the full node-to-node mesh and the explicitly configured global peers and
node specific peers.

Understanding the status of the BGP peerings is a useful first step in
diagnosing why routes may not be advertised across your network resulting in
incorrect connectivity between your workloads.

#### Example

To check the status of the peerings on Calico node "Node1", run
the following command from the "Node1" command line:

	Node1$ calicoctl status
	calico-node container is running. Status: Up 13 minutes

	IPv4 BGP status
	+--------------+-------------------+-------+----------+-------------+
	| Peer address |     Peer type     | State |  Since   |     Info    |
	+--------------+-------------------+-------+----------+-------------+
	| 172.17.42.21 | node-to-node mesh |   up  | 16:17:25 | Established |
	| 10.20.30.40  |       global      | start | 16:28:38 |   Connect   |
	|  192.10.0.0  |   node specific   | start | 16:28:57 |   Connect   |
	+--------------+-------------------+-------+----------+-------------+

	IPv6 BGP status
	+--------------+-------------------+-------+----------+-------------+
	| Peer address |     Peer type     | State |  Since   |     Info    |
	+--------------+-------------------+-------+----------+-------------+
	|   aa:bb::ff  | node-to-node mesh |   up  | 16:17:26 | Established |
	+--------------+-------------------+-------+----------+-------------+


text:
license: Licensed to the Apache Software Foundation (ASF) under one
         or more contributor license agreements.  See the NOTICE file
         distributed with this work for additional information
         regarding copyright ownership.  The ASF licenses this file
         to you under the Apache License, Version 2.0 (the
         "License"); you may not use this file except in compliance
         with the License.  You may obtain a copy of the License at

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

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

Capture
=======

> Provides access to the audio, image, and video capture capabilities of the device.

Objects
-------

- Capture
- CaptureAudioOptions
- CaptureImageOptions
- CaptureVideoOptions
- CaptureCB
- CaptureErrorCB
- ConfigurationData
- MediaFile
- MediaFileData

Methods
-------

- capture.captureAudio
- capture.captureImage
- capture.captureVideo
- MediaFile.getFormatData

Scope
-----

The __capture__ object is assigned to the __navigator.device__ object, and therefore has global scope.

    // The global capture object
    var capture = navigator.device.capture;

Properties
----------

- __supportedAudioModes:__ The audio recording formats supported by the device. (ConfigurationData[])
- __supportedImageModes:__ The recording image sizes and formats supported by the device. (ConfigurationData[])
- __supportedVideoModes:__ The recording video resolutions and formats supported by the device. (ConfigurationData[])

Methods
-------

- capture.captureAudio: Launch the device audio recording application for recording audio clip(s).
- capture.captureImage: Launch the device camera application for taking image(s).
- capture.captureVideo: Launch the device video recorder application for recording video(s).

Supported Platforms
-------------------

- Android
- BlackBerry WebWorks (OS 5.0 and higher)
- iOS
- Windows Phone 7 ( Mango )

Permissions
-----------

### Android

#### app/res/xml/plugins.xml

    <plugin name="Capture" value="org.apache.cordova.Capture"/>

#### app/AndroidManifest.xml

    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

### Bada

    @TODO

### BlackBerry WebWorks

#### www/plugins.xml

    @TODO

#### www/config.xml

    @TODO

### iOS

#### App/Supporting Files/Cordova.plist

    <key>Plugins</key>
    <dict>
        <key>Capture</key>
        <string>CDVCapture</string>
    </dict>

### webOS

    @TODO

### Windows Phone

    @TODO

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Code Generation | Microsoft Orleans Documentation </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Code Generation | Microsoft Orleans Documentation ">
    <meta name="generator" content="docfx 2">

    <link rel="shortcut icon" href="../../favicon.ico">
    <link rel="stylesheet" href="../../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../../styles/docfx.css">
    <link rel="stylesheet" href="../../styles/main.css">
    <meta property="docfx:navrel" content="../../toc.html">
    <meta property="docfx:tocrel" content="../toc.html">

    <meta property="docfx:rel" content="../../">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                Toggle navigation

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

Search Results for

          Show / Hide Table of Contents

Code Generation

The Orleans runtime makes use of generated code in order to ensure proper serialization of types that are used across the cluster as well as for generating boilerplate, which abstracts away the implementation details of method shipping, exception propagation, and other internal runtime concepts.

Enabling Code Generation

Code generation can be performed either when your projects are being built or when your application initializes.

During Build

The preferred method for performing code generation is at build time. Build time code generation could be enabled by using one of the following packages:

Microsoft.Orleans.OrleansCodeGenerator.Build. A package that uses Roslyn for code generation and uses .NET Reflection for analysis.

Microsoft.Orleans.CodeGenerator.MSBuild. A new code generation package that leverages Roslyn both for code generation and code analysis. It does not load application binaries, and as a result avoids issues caused by clashing dependency versions and differing target frameworks. The new code generator also improves support for incremental builds, which should result in shorter build times.

One of these packages should be installed into all projects which contain grains, grain interfaces, custom serializers, or types which are sent between grains. Installing a package injects a target into the project which will generate code at build time.

Both packages (Microsoft.Orleans.CodeGenerator.MSBuild and Microsoft.Orleans.OrleansCodeGenerator.Build) only support C# projects. Other languages are supported either using the Microsoft.Orleans.OrleansCodeGenerator package described below, or by creating a C# project which can act as the target for code generated from assemblies written in other languages.

Additional diagnostics can be emitted at build time by specifying a value for OrleansCodeGenLogLevel in the target project's csproj file. For example, <OrleansCodeGenLogLevel>Trace</OrleansCodeGenLogLevel>.

During Initialization

Code generation can be performed during initialization on the client and silo by installing the Microsoft.Orleans.OrleansCodeGenerator package and using the IApplicationPartManager.WithCodeGeneration extension method:

builder.ConfigureApplicationParts(
    parts => parts
        .AddApplicationPart(typeof(IRuntimeCodeGenGrain).Assembly)
        .WithCodeGeneration());

In the foregoing example, builder may be an instance of either ISiloHostBuilder or IClientBuilder.
An optional ILoggerFactory instance can be passed to WithCodeGeneration to enable logging during code generation, for example:

ILoggerFactory codeGenLoggerFactory = new LoggerFactory();
codeGenLoggerFactory.AddProvider(new ConsoleLoggerProvider());
builder.ConfigureApplicationParts(
    parts => parts
        .AddApplicationPart(typeof(IRuntimeCodeGenGrain).Assembly)
        .WithCodeGeneration(codeGenLoggerFactory));

Influencing Code Generation

Generate code for a specific type

Code is automatically generated for grain interfaces, grain classes, grain state, and types passed as arguments in grain methods. If a type does not fit this criteria, the following methods can be used to further guide code generation.

Adding [Serializable] to a type instructs the code generator to generate a serializer for that type.

Adding [assembly: GenerateSerializer(Type)] to a project instructs the code generator to treat that type as serializable, and will cause an error if a serializer could not be generated for that type, for example because the type is not accessible. This error will halt a build if code generation is enabled. This attribute also allows generating code for specific types from another assembly.

[assembly: KnownType(Type)] also instructs the code generator to include a specific type (which may be from a referenced assembly), but does not cause an exception if the type is inaccessible.

Generate serializers for all subtypes

Adding [KnownBaseType] to an interface or class instructs the code generator to generate serialization code for all types which inherit/implement that type.

Generate code for all types in another assembly

There are cases where generated code cannot be included in a particular assembly at build time. For example, this can include shared libraries which do not reference Orleans, assemblies written in languages other than C#, and assemblies which the developer does not have the source code for. In these cases, generated code for those assemblies can be placed into a separate assembly which is referenced during initialization.

In order to enable this for an assembly:

Create a C# project.

Install the Microsoft.Orleans.CodeGenerator.MSBuild or the Microsoft.Orleans.OrleansCodeGenerator.Build package.

Add a reference to the target assembly.

Add [assembly: KnownAssembly("OtherAssembly")] at the top level of a C# file.

The KnownAssembly attribute instructs the code generator to inspect the specified assembly and generate code for the types within it. The attribute can be used multiple times within a project.

The generated assembly must then be added to the client/silo during initialization:

builder.ConfigureApplicationParts(
    parts => parts.AddApplicationPart("CodeGenAssembly"));

In the foregoing example, builder may be an instance of either ISiloHostBuilder or IClientBuilder.

KnownAssemblyAttribute has an optional property, TreatTypesAsSerializable, which can be set to true to instruct the code generator to act as though all types within that assembly are marked as serializable.

                    Improve this Doc

In This Article

              Back to top

            Generated by DocFX


text:
from .base_corpus import BaseCorpus

class NLTKCorpus(BaseCorpus):

    def tokenize(self):
        new_docs = []
        counter = 0
        for doc in self.data:
            counter += 1
            self.update('Tokenizing', counter)
            new_docs.append(doc.tokenize())
        self.update(None, None)
        return new_docs

    def lemmatize(self):
        new_docs = []
        counter = 0
        for doc in self.data:
            counter += 1
            self.update('Lemmatizing', counter)
            new_docs.append(doc.lemmatize())
        self.update(None, None)
        return self.__class__(docs=new_docs)

    def ngrams(self, gram_size=3):
        new_docs = []
        counter = 0
        for doc in self.data:
            counter += 1
            self.update('Compiling ngrams', counter)
            new_docs.append(doc.ngrams())
        self.update(None, None)
        return new_docs

    def skipgrams(self, gram_size=3, skip_size=1):
        new_docs = []
        counter = 0
        for doc in self.data:
            counter += 1
            self.update('Compiling skipgrams', counter)
            new_docs.append(doc.skipgrams())
        self.update(None, None)
        return new_docs


text:
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx.h"
#include "stdio.h"

#if defined (USE_STM324x7I_EVAL)
  #include "stm324x7i_eval.h"

#elif defined (USE_STM324x9I_EVAL)
  #include "stm324x9i_eval.h"

#else
 #error "Please select first the Evaluation board used in your application (in Project Options)"
#endif

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Message length should be multiple of 512-bit (64 bytes).
   Note that message padding isn't handled in this example */
#define SIZE_MSG_TO_HASH_IN_BYTES     ((uint32_t)256)
#define SIZE_MSG_TO_HASH_IN_WORDS     ((uint32_t)SIZE_MSG_TO_HASH_IN_BYTES / 4)
#define HASH_DIN_REG_ADDR             ((uint32_t)0x50060404)  /* HASH DIN register address */

/* Exported functions ------------------------------------------------------- */

#endif /* __MAIN_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


text:
package com.github.mauricio.async.db.column

object BigDecimalEncoderDecoder extends ColumnEncoderDecoder {

  override def decode(value: String): Any = BigDecimal(value)

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<title>
Importar URLs
</title>

Importar URLs

Este complemento añade la opción de importar un archivo de URLs a través del menú de "Herramientas". El archivo debe ser un texto plano con una URL por línea.
Este complemento también expone un punto de conexión a la API de ZAP a <tt>/importurls/importurls (filePath*)</tt> para facilitar el uso de la funcionalidad por la vía programática.


text:
/**
 * Rutilus
 *
 * @homepage https://gmrutilus.github.io
 * @license Apache-2.0
 */

/** @module */

/**
 * @typedef {{
 *   code: Number,
 *   title: String,
 *   message: String,
 * }} ErrorDictionaryError
 */
const errorDictionary = {

    UNKNOWN: {
        code: 2,
        title: 'UNKNOWN',
        message: 'Unknown exception'
    },

    DB: {
        code: 100001,
        title: 'DB',
        message: 'Database error'
    },

    Q: { // 100,000

        BAD_PRESET: {
            code: 100001,
            title: 'Q-BAD_PRESET',
            message: 'Bad preset'
        },
    },

    UAT: {
        BAD_PARAM: {
            code: 200001,
            title: 'UAT-BAD_PARAM',
            message: 'Illegal parameters: a Session ID must be passed'
        },
        BAD_SESSION: {
            code: 200002,
            title: 'UAT-BAD_SESSION',
            message: 'Session not found'
        },
        BAD_USER: {
            code: 200003,
            title: 'UAT-BAD_USER',
            message: 'User not found'
        },
    },

    SYS: {
        CONFLICTING_EXTRA_INFORMATION: {
            code: 300001,
            title: 'CONFLICTING_EXTRA_INFORMATION',
            message: 'Illegal extra information field name',
        },
    }

};

/**
 * Constructs an error object with the code, message, and extra information
 * @param {{}} errorObj Error object from the error dictionary
 * @param {*} (extra) Extra information
 * @param {Boolean} (printTrace) if true, will display the stack trace and the 'extra' information
 * @return {{error: Object}}
 */
const _buildErrorDescription = function (errorObj, extra, printTrace) {
    const that = JSON.parse(JSON.stringify(errorObj));

    if (printTrace) {
        if (extra) {
            let parsedExtra = extra;
            try {
                parsedExtra = JSON.stringify(parsedExtra, null, 4);
            }
            catch (e) {}
            that.extra = parsedExtra;
        }

        if (extra && extra.stack) {
            that.stack = extra.stack;
        }
    }

    // If we are not supposed to print the stack trace, delete any 'extra' or 'stack' from the error
    else {
        delete that.extra;
        delete that.stack;
    }

    return { error: that };
};

/**
 * @namespace
 * @property {ErrorDictionaryError} UNKNOWN
 * @property {ErrorDictionaryError} DB
 * @property {Object} Q
 * @property {Object} UAT
 * @property {Object} SYS
 * @property {ErrorDictionaryError} Q.BAD_PRESET
 * @property {ErrorDictionaryError} UAT.BAD_PARAM
 * @property {ErrorDictionaryError} UAT.BAD_SESSION
 * @property {ErrorDictionaryError} UAT.BAD_USER
 * @property {ErrorDictionaryError} SYS.CONFLICTING_EXTRA_INFORMATION
 */
class ErrorHandler {

    /**
     * Builds an "Error Handler" - this error handler has access to the Response of an HTTP Request,
     * so it can send errors from the API. The Error Handler has 2 methods: dbErrorCatcher and
     * throwError
     * @param {MessageLogger} logger
     */
    constructor(logger) {
        this._logger = logger;
    }

    /**
     * A dbErrorCatcher receives the 'error' from a database query: if the error is present,
     * it logs the error, sends an API response and returns true (this boolean should be
     * used to check and return from the main route, if an error exists). If there is no
     * error, it returns false.
     *
     * @param {Error} err Error returned by the database
     * @return {{}|Boolean}
     */
    dbErrorCatcher(err) {
        if (!err) { return false; }

        this._logger.error(_buildErrorDescription(errorDictionary.DB, err, true));

        return _buildErrorDescription(errorDictionary.DB, err, false);
    }

    /**
     * The throwError function receives two parameters: err and extra (optional), err should
     * be one of the ApiErrors described in this file. When this function is called, it will
     * log the error and send an API response.
     *
     * Important: After this function is called, you should return from the main route.
     *
     * @param {{ code, title, message }} err
     * @param {*} (extra) Extra information for the error
     */
    throwError(err, extra) {
        // Is the error from the dictionary or is it unknown?
        let error = err;

        function isEmpty(e) { return e === null || e === undefined; }

        if (isEmpty(err.title) || isEmpty(err.code) || isEmpty(err.message)) {
            extra = err;
            error = errorDictionary.UNKNOWN;
        }

        this._logger.error(_buildErrorDescription(error, extra, true));

        return _buildErrorDescription(error, extra, false);
    }

}

/**
 * @type {ErrorHandler|ErrorDictionary}
 */
module.exports = ErrorHandler;


text:
@interface CDEConfigurationSummaryRequest ()

#pragma mark Properties
@property (nonatomic, readwrite, copy) NSURL *applicationBundleURL;
@property (nonatomic, readwrite, copy) NSURL *storeURL;

@end

@implementation CDEConfigurationSummaryRequest

#pragma mark Properties
@synthesize applicationBundleURL, storeURL;

#pragma mark Creating
- (id)initWithApplicationBundleURL:(NSURL *)initApplicationBundleURL storeURL:(NSURL *)initStoreURL {
   if(initStoreURL == nil || initApplicationBundleURL == nil) {
      self = nil;
      return nil;
   }
   self = [super init];
   if(self) {
      self.applicationBundleURL = initApplicationBundleURL;
      self.storeURL = initStoreURL;
   }
   return self;
}

- (id)init {
   return [self initWithApplicationBundleURL:nil storeURL:nil];
}

@end


text:
package org.lwjgl.vulkan;

import java.nio.*;

import org.lwjgl.*;
import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;

/**
 * Structure specifying sparse image opaque memory bind info.
 *
 *
Valid Usage

 *
 *

 *
For any given element of {@code pBinds}, if the {@code flags} member of that element contains {@link VK10#VK_SPARSE_MEMORY_BIND_METADATA_BIT SPARSE_MEMORY_BIND_METADATA_BIT}, the binding range defined must be within the mip tail region of the metadata aspect of {@code image}

 *

 *
 *
Valid Usage (Implicit)

 *
 *

 *
{@code image} must be a valid {@code VkImage} handle

 *
{@code pBinds} must be a pointer to an array of {@code bindCount} valid {@link VkSparseMemoryBind} structures

 *
{@code bindCount} must be greater than 0

 *

 *
 *
See Also

 *
 *
{@link VkBindSparseInfo}, {@link VkSparseMemoryBind}

 *
 *
Member documentation

 *
 *

 *
{@code image} – the {@code VkImage} object to be bound.

 *
{@code bindCount} – the number of {@link VkSparseMemoryBind} structures in the {@code pBinds} array.

 *
{@code pBinds} – a pointer to array of {@link VkSparseMemoryBind} structures.

 *

 *
 *
Layout

 *
 *
struct VkSparseImageOpaqueMemoryBindInfo {
    VkImage image;
    uint32_t bindCount;
    const VkSparseMemoryBind * pBinds;
}

 */
public class VkSparseImageOpaqueMemoryBindInfo extends Struct implements NativeResource {

	/** The struct size in bytes. */
	public static final int SIZEOF;

	public static final int ALIGNOF;

	/** The struct member offsets. */
	public static final int
		IMAGE,
		BINDCOUNT,
		PBINDS;

	static {
		Layout layout = __struct(
			__member(8),
			__member(4),
			__member(POINTER_SIZE)
		);

		SIZEOF = layout.getSize();
		ALIGNOF = layout.getAlignment();

		IMAGE = layout.offsetof(0);
		BINDCOUNT = layout.offsetof(1);
		PBINDS = layout.offsetof(2);
	}

	VkSparseImageOpaqueMemoryBindInfo(long address, ByteBuffer container) {
		super(address, container);
	}

	/**
	 * Creates a {@link VkSparseImageOpaqueMemoryBindInfo} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
	 * visible to the struct instance and vice versa.
	 *
	 *
The created instance holds a strong reference to the container object.

	 */
	public VkSparseImageOpaqueMemoryBindInfo(ByteBuffer container) {
		this(memAddress(container), checkContainer(container, SIZEOF));
	}

	@Override
	public int sizeof() { return SIZEOF; }

	/** Returns the value of the {@code image} field. */
	public long image() { return nimage(address()); }
	/** Returns the value of the {@code bindCount} field. */
	public int bindCount() { return nbindCount(address()); }
	/** Returns a {@link VkSparseMemoryBind.Buffer} view of the struct array pointed to by the {@code pBinds} field. */
	public VkSparseMemoryBind.Buffer pBinds() { return npBinds(address()); }

	/** Sets the specified value to the {@code image} field. */
	public VkSparseImageOpaqueMemoryBindInfo image(long value) { nimage(address(), value); return this; }
	/** Sets the address of the specified {@link VkSparseMemoryBind.Buffer} to the {@code pBinds} field. */
	public VkSparseImageOpaqueMemoryBindInfo pBinds(VkSparseMemoryBind.Buffer value) { npBinds(address(), value); return this; }

	/** Initializes this struct with the specified values. */
	public VkSparseImageOpaqueMemoryBindInfo set(
		long image,
		VkSparseMemoryBind.Buffer pBinds
	) {
		image(image);
		pBinds(pBinds);

		return this;
	}

	/** Unsafe version of {@link #set(VkSparseImageOpaqueMemoryBindInfo) set}. */
	public VkSparseImageOpaqueMemoryBindInfo nset(long struct) {
		memCopy(struct, address(), SIZEOF);
		return this;
	}

	/**
	 * Copies the specified struct data to this struct.
	 *
	 * @param src the source struct
	 *
	 * @return this struct
	 */
	public VkSparseImageOpaqueMemoryBindInfo set(VkSparseImageOpaqueMemoryBindInfo src) {
		return nset(src.address());
	}

	// -----------------------------------

	/** Returns a new {@link VkSparseImageOpaqueMemoryBindInfo} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
	public static VkSparseImageOpaqueMemoryBindInfo malloc() {
		return create(nmemAlloc(SIZEOF));
	}

	/** Returns a new {@link VkSparseImageOpaqueMemoryBindInfo} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
	public static VkSparseImageOpaqueMemoryBindInfo calloc() {
		return create(nmemCalloc(1, SIZEOF));
	}

	/** Returns a new {@link VkSparseImageOpaqueMemoryBindInfo} instance allocated with {@link BufferUtils}. */
	public static VkSparseImageOpaqueMemoryBindInfo create() {
		return new VkSparseImageOpaqueMemoryBindInfo(BufferUtils.createByteBuffer(SIZEOF));
	}

	/** Returns a new {@link VkSparseImageOpaqueMemoryBindInfo} instance for the specified memory address or {@code null} if the address is {@code NULL}. */
	public static VkSparseImageOpaqueMemoryBindInfo create(long address) {
		return address == NULL ? null : new VkSparseImageOpaqueMemoryBindInfo(address, null);
	}

	/**
	 * Returns a new {@link VkSparseImageOpaqueMemoryBindInfo.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
	 *
	 * @param capacity the buffer capacity
	 */
	public static Buffer malloc(int capacity) {
		return create(nmemAlloc(capacity * SIZEOF), capacity);
	}

	/**
	 * Returns a new {@link VkSparseImageOpaqueMemoryBindInfo.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
	 *
	 * @param capacity the buffer capacity
	 */
	public static Buffer calloc(int capacity) {
		return create(nmemCalloc(capacity, SIZEOF), capacity);
	}

	/**
	 * Returns a new {@link VkSparseImageOpaqueMemoryBindInfo.Buffer} instance allocated with {@link BufferUtils}.
	 *
	 * @param capacity the buffer capacity
	 */
	public static Buffer create(int capacity) {
		return new Buffer(BufferUtils.createByteBuffer(capacity * SIZEOF));
	}

	/**
	 * Create a {@link VkSparseImageOpaqueMemoryBindInfo.Buffer} instance at the specified memory.
	 *
	 * @param address  the memory address
	 * @param capacity the buffer capacity
	 */
	public static Buffer create(long address, int capacity) {
		return address == NULL ? null : new Buffer(address, null, -1, 0, capacity, capacity);
	}

	// -----------------------------------

	/** Returns a new {@link VkSparseImageOpaqueMemoryBindInfo} instance allocated on the thread-local {@link MemoryStack}. */
	public static VkSparseImageOpaqueMemoryBindInfo mallocStack() {
		return mallocStack(stackGet());
	}

	/** Returns a new {@link VkSparseImageOpaqueMemoryBindInfo} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */
	public static VkSparseImageOpaqueMemoryBindInfo callocStack() {
		return callocStack(stackGet());
	}

	/**
	 * Returns a new {@link VkSparseImageOpaqueMemoryBindInfo} instance allocated on the specified {@link MemoryStack}.
	 *
	 * @param stack the stack from which to allocate
	 */
	public static VkSparseImageOpaqueMemoryBindInfo mallocStack(MemoryStack stack) {
		return create(stack.nmalloc(ALIGNOF, SIZEOF));
	}

	/**
	 * Returns a new {@link VkSparseImageOpaqueMemoryBindInfo} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
	 *
	 * @param stack the stack from which to allocate
	 */
	public static VkSparseImageOpaqueMemoryBindInfo callocStack(MemoryStack stack) {
		return create(stack.ncalloc(ALIGNOF, 1, SIZEOF));
	}

	/**
	 * Returns a new {@link VkSparseImageOpaqueMemoryBindInfo.Buffer} instance allocated on the thread-local {@link MemoryStack}.
	 *
	 * @param capacity the buffer capacity
	 */
	public static Buffer mallocStack(int capacity) {
		return mallocStack(capacity, stackGet());
	}

	/**
	 * Returns a new {@link VkSparseImageOpaqueMemoryBindInfo.Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero.
	 *
	 * @param capacity the buffer capacity
	 */
	public static Buffer callocStack(int capacity) {
		return callocStack(capacity, stackGet());
	}

	/**
	 * Returns a new {@link VkSparseImageOpaqueMemoryBindInfo.Buffer} instance allocated on the specified {@link MemoryStack}.
	 *
	 * @param stack the stack from which to allocate
	 * @param capacity the buffer capacity
	 */
	public static Buffer mallocStack(int capacity, MemoryStack stack) {
		return create(stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
	}

	/**
	 * Returns a new {@link VkSparseImageOpaqueMemoryBindInfo.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
	 *
	 * @param stack the stack from which to allocate
	 * @param capacity the buffer capacity
	 */
	public static Buffer callocStack(int capacity, MemoryStack stack) {
		return create(stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
	}

	// -----------------------------------

	/** Unsafe version of {@link #image}. */
	public static long nimage(long struct) { return memGetLong(struct + VkSparseImageOpaqueMemoryBindInfo.IMAGE); }
	/** Unsafe version of {@link #bindCount}. */
	public static int nbindCount(long struct) { return memGetInt(struct + VkSparseImageOpaqueMemoryBindInfo.BINDCOUNT); }
	/** Unsafe version of {@link #pBinds}. */
	public static VkSparseMemoryBind.Buffer npBinds(long struct) { return VkSparseMemoryBind.create(memGetAddress(struct + VkSparseImageOpaqueMemoryBindInfo.PBINDS), nbindCount(struct)); }

	/** Unsafe version of {@link #image(long) image}. */
	public static void nimage(long struct, long value) { memPutLong(struct + VkSparseImageOpaqueMemoryBindInfo.IMAGE, value); }
	/** Sets the specified value to the {@code bindCount} field of the specified {@code struct}. */
	public static void nbindCount(long struct, int value) { memPutInt(struct + VkSparseImageOpaqueMemoryBindInfo.BINDCOUNT, value); }
	/** Unsafe version of {@link #pBinds(VkSparseMemoryBind.Buffer) pBinds}. */
	public static void npBinds(long struct, VkSparseMemoryBind.Buffer value) { memPutAddress(struct + VkSparseImageOpaqueMemoryBindInfo.PBINDS, value.address()); nbindCount(struct, value.remaining()); }

	/**
	 * Validates pointer members that should not be {@code NULL}.
	 *
	 * @param struct the struct to validate
	 */
	public static void validate(long struct) {
		checkPointer(memGetAddress(struct + VkSparseImageOpaqueMemoryBindInfo.PBINDS));
	}

	/**
	 * Calls {@link #validate(long)} for each struct contained in the specified struct array.
	 *
	 * @param array the struct array to validate
	 * @param count the number of structs in {@code array}
	 */
	public static void validate(long array, int count) {
		for ( int i = 0; i < count; i++ )
			validate(array + i * SIZEOF);
	}

	// -----------------------------------

	/** An array of {@link VkSparseImageOpaqueMemoryBindInfo} structs. */
	public static class Buffer extends StructBuffer<VkSparseImageOpaqueMemoryBindInfo, Buffer> implements NativeResource {

		/**
		 * Creates a new {@link VkSparseImageOpaqueMemoryBindInfo.Buffer} instance backed by the specified container.
		 *
		 * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
		 * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
		 * by {@link VkSparseImageOpaqueMemoryBindInfo#SIZEOF}, and its mark will be undefined.
		 *
		 *
The created buffer instance holds a strong reference to the container object.

		 */
		public Buffer(ByteBuffer container) {
			super(container, container.remaining() / SIZEOF);
		}

		Buffer(long address, ByteBuffer container, int mark, int pos, int lim, int cap) {
			super(address, container, mark, pos, lim, cap);
		}

		@Override
		protected Buffer self() {
			return this;
		}

		@Override
		protected Buffer newBufferInstance(long address, ByteBuffer container, int mark, int pos, int lim, int cap) {
			return new Buffer(address, container, mark, pos, lim, cap);
		}

		@Override
		protected VkSparseImageOpaqueMemoryBindInfo newInstance(long address) {
			return new VkSparseImageOpaqueMemoryBindInfo(address, container);
		}

		@Override
		protected int sizeof() {
			return SIZEOF;
		}

		/** Returns the value of the {@code image} field. */
		public long image() { return VkSparseImageOpaqueMemoryBindInfo.nimage(address()); }
		/** Returns the value of the {@code bindCount} field. */
		public int bindCount() { return VkSparseImageOpaqueMemoryBindInfo.nbindCount(address()); }
		/** Returns a {@link VkSparseMemoryBind.Buffer} view of the struct array pointed to by the {@code pBinds} field. */
		public VkSparseMemoryBind.Buffer pBinds() { return VkSparseImageOpaqueMemoryBindInfo.npBinds(address()); }

		/** Sets the specified value to the {@code image} field. */
		public VkSparseImageOpaqueMemoryBindInfo.Buffer image(long value) { VkSparseImageOpaqueMemoryBindInfo.nimage(address(), value); return this; }
		/** Sets the address of the specified {@link VkSparseMemoryBind.Buffer} to the {@code pBinds} field. */
		public VkSparseImageOpaqueMemoryBindInfo.Buffer pBinds(VkSparseMemoryBind.Buffer value) { VkSparseImageOpaqueMemoryBindInfo.npBinds(address(), value); return this; }

	}

}


text:
name             'charon'
maintainer       'Wanelo, Inc'
maintainer_email 'dev@wanelo.com'
license          'All rights reserved'
description      'Installs/Configures charon'
long_description 'Installs/Configures charon'
version          '0.1.3'

depends 'paths'
depends 'smf'


text:
@interface MOBProjectionEPSG3188 : MOBProjection

@end


text:
package software.amazon.awssdk.enhanced.dynamodb.mapper.testbeans;

import java.util.List;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbIgnoreNulls;
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbPartitionKey;

@DynamoDbBean
public class NestedBeanIgnoreNulls {
    private String id;
    private AbstractBean innerBean1;
    private AbstractBean innerBean2;
    private List<AbstractBean> innerBeanList1;
    private List<AbstractBean> innerBeanList2;

    @DynamoDbPartitionKey
    public String getId() {
        return this.id;
    }
    public void setId(String id) {
        this.id = id;
    }

    @DynamoDbIgnoreNulls
    public AbstractBean getInnerBean1() {
        return innerBean1;
    }
    public void setInnerBean1(AbstractBean innerBean) {
        this.innerBean1 = innerBean;
    }

    public AbstractBean getInnerBean2() {
        return innerBean2;
    }
    public void setInnerBean2(AbstractBean innerBean) {
        this.innerBean2 = innerBean;
    }

    @DynamoDbIgnoreNulls
    public List<AbstractBean> getInnerBeanList1() {
        return innerBeanList1;
    }
    public void setInnerBeanList1(List<AbstractBean> innerBeanList1) {
        this.innerBeanList1 = innerBeanList1;
    }

    public List<AbstractBean> getInnerBeanList2() {
        return innerBeanList2;
    }
    public void setInnerBeanList2(List<AbstractBean> innerBeanList2) {
        this.innerBeanList2 = innerBeanList2;
    }
}


text:
NSString * RKStringFromCommentSortingMethod(RKCommentSortingMethod sortingMethod)
{
    switch (sortingMethod)
    {
        case RKCommentSortingMethodTop:
            return @"top";
        case RKCommentSortingMethodBest:
            return @"best";
        case RKCommentSortingMethodNew:
            return @"new";
        case RKCommentSortingMethodHot:
            return @"hot";
        case RKCommentSortingMethodControversial:
            return @"controversial";
        case RKCommentSortingMethodOld:
            return @"old";
        default:
            return nil;
    }
}

NSString * RKStringFromTimeSortingMethod(RKTimeSortingMethod sortingMethod)
{
    switch (sortingMethod)
    {
        case RKTimeSortingMethodThisHour:
            return @"hour";
        case RKTimeSortingMethodToday:
            return @"day";
        case RKTimeSortingMethodThisWeek:
            return @"week";
        case RKTimeSortingMethodThisMonth:
            return @"month";
        case RKTimeSortingMethodThisYear:
            return @"year";
        case RKTimeSortingMethodAllTime:
            return @"all";
        default:
            return nil;
	}
}

NSString * RKStringFromUserContentSortingMethod(RKUserContentSortingMethod sortingMethod)
{
    switch (sortingMethod)
    {
        case RKUserContentSortingMethodNew:
            return @"new";
        case RKUserContentSortingMethodHot:
            return @"hot";
        case RKUserContentSortingMethodTop:
            return @"top";
        case RKUserContentSortingMethodControversial:
            return @"controversial";
        default:
            return nil;
    }
}

NSString * RKStringFromSearchSortingMethod(RKSearchSortingMethod sortingMethod)
{
    switch (sortingMethod)
    {
        case RKSearchSortingMethodRelevance:
            return @"relevance";
        case RKSearchSortingMethodHot:
            return @"hot";
        case RKSearchSortingMethodTop:
            return @"top";
        case RKSearchSortingMethodNew:
            return @"new";
        case RKSearchSortingMethodComments:
            return @"comments";
        default:
            return nil;
    }
}

@implementation RKPagination

+ (RKPagination *)paginationFromListingResponse:(NSDictionary *)listingResponse
{
    RKPagination *pagination = [[RKPagination alloc] init];

    id before = [listingResponse valueForKeyPath:@"data.before"];
    id after = [listingResponse valueForKeyPath:@"data.after"];

    if (before == [NSNull null] && after == [NSNull null])
    {
        return nil;
    }

    if (before != [NSNull null])
    {
        pagination.before = before;
    }

    if (after != [NSNull null])
    {
        pagination.after = after;
    }

    return pagination;
}

+ (RKPagination *)paginationWithLimit:(NSUInteger)limit
{
    RKPagination *pagination = [[RKPagination alloc] init];

    pagination.limit = limit;

    return pagination;
}

- (instancetype)init
{
    if (self = [super init])
    {
        _limit = 25;
    }

    return self;
}

- (void)setLimit:(NSUInteger)limit
{
    _limit = MIN(100, limit);
}

- (NSString *)description
{
    NSString *className = NSStringFromClass([self class]);
    return [NSString stringWithFormat:@"<%@: %p, before: %@, after: %@>", className, self, self.before, self.after];
}

- (NSDictionary *)dictionaryValue
{
    NSMutableDictionary *parameters = [[NSMutableDictionary alloc] initWithCapacity:4];

    if (self.limit)
    {
        [parameters setObject:[NSString stringWithFormat:@"%lu", (unsigned long)self.limit] forKey:@"limit"];
    }

    if (self.before)
    {
        [parameters setObject:self.before forKey:@"before"];
    }

    if (self.after)
    {
        [parameters setObject:self.after forKey:@"after"];
    }

    if (self.timeMethod)
    {
        [parameters setObject:RKStringFromTimeSortingMethod(self.timeMethod) forKey:@"t"];
    }

    if (self.userContentSortingMethod)
    {
        [parameters setObject:RKStringFromUserContentSortingMethod(self.userContentSortingMethod) forKey:@"sort"];
    }

    if(self.searchSortingMethod)
    {
        [parameters setObject:RKStringFromSearchSortingMethod(self.searchSortingMethod) forKey:@"sort"];
    }

    if ([parameters count] == 0)
    {
        return nil;
    }

    return [parameters copy];
}

#pragma mark - NSSecureCoding

+ (BOOL)supportsSecureCoding
{
    return YES;
}

- (id)initWithCoder:(NSCoder *)decoder
{
    if (self = [super init]) {
        _limit = [[decoder decodeObjectOfClass:[NSNumber class] forKey:@"limit"] unsignedIntegerValue];
        _before = [decoder decodeObjectOfClass:[NSString class] forKey:@"before"];
        _after = [decoder decodeObjectOfClass:[NSString class] forKey:@"after"];
        _commentSortingMethod = [[decoder decodeObjectOfClass:[NSNumber class] forKey:@"commentSortingMethod"] unsignedIntegerValue];
        _userContentSortingMethod = [[decoder decodeObjectOfClass:[NSNumber class] forKey:@"userContentSortingMethod"] unsignedIntegerValue];
        _timeMethod = [[decoder decodeObjectOfClass:[NSNumber class] forKey:@"timeMethod"] unsignedIntegerValue];
    }

    return self;
}

- (void)encodeWithCoder:(NSCoder *)coder
{
    [coder encodeObject:@(self.limit) forKey:@"limit"];
    [coder encodeObject:self.before forKey:@"before"];
    [coder encodeObject:self.after forKey:@"after"];
    [coder encodeObject:@(self.commentSortingMethod) forKey:@"commentSortingMethod"];
    [coder encodeObject:@(self.userContentSortingMethod) forKey:@"userContentSortingMethod"];
    [coder encodeObject:@(self.timeMethod) forKey:@"timeMethod"];
}

@end


text:
const Model = require( "./model" );

const Comment = class Comment extends Model {
  static typifyInstanceResponse( response ) {
    return super.typifyInstanceResponse( response, Comment );
  }
};

module.exports = Comment;


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#fbf7ed"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/linear_create_contact"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingBottom="3dip">

        <Button
            android:id="@+id/cancel_btn"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@color/green"
            android:text="Cancel"
            android:textColor="#FFFFFF" />

        <Button
            android:id="@+id/save_contact_btn"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@color/green"
            android:text="Save"
            android:textColor="#FFFFFF" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingBottom="3dip"
        android:paddingLeft="7dip"
        android:paddingRight="7dip"
        android:paddingTop="6dip">

        <ImageView
            android:id="@+id/take_picture_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="7dip"
            android:layout_weight="0"
            android:background="@drawable/rounded_button_green_selector"
            android:src="@drawable/ic_camera_green"
            android:elevation="2dip"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical"
            android:paddingBottom="3dip"
            android:paddingLeft="7dip"
            android:paddingRight="7dip"
            android:paddingTop="6dip">

            <EditText
                android:id="@+id/contact_name_prefix"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_gravity="center_vertical"
                android:layout_marginBottom="3dip"
                android:layout_weight="1"
                android:background="@drawable/shape_section"
                android:elevation="2dp"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:hint="name prefix"
                android:inputType="textCapWords"
                android:paddingBottom="7dip"
                android:paddingLeft="7dip"
                android:paddingRight="7dip"
                android:paddingTop="7dip"
                android:singleLine="true"
                android:textColor="#72af9c"
                android:textColorHint="#BDBDBD"
                android:textSize="20sp"
                android:textStyle="normal"
                android:visibility="gone" />

            <EditText
                android:id="@+id/contact_name"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_gravity="center_vertical"
                android:layout_marginBottom="3dip"
                android:layout_weight="1"
                android:background="@drawable/shape_section"
                android:elevation="2dp"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:hint="name"
                android:inputType="textCapWords"
                android:paddingBottom="7dip"
                android:paddingLeft="7dip"
                android:paddingRight="7dip"
                android:paddingTop="7dip"
                android:singleLine="true"
                android:textColor="#72af9c"
                android:textColorHint="#BDBDBD"
                android:textSize="20sp"
                android:textStyle="normal"
                android:visibility="visible" />

            <EditText
                android:id="@+id/contact_middle_name"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_gravity="center_vertical"
                android:layout_marginBottom="3dip"
                android:layout_weight="1"
                android:background="@drawable/shape_section"
                android:elevation="2dp"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:hint="middle name"
                android:inputType="textCapWords"
                android:paddingBottom="7dip"
                android:paddingLeft="7dip"
                android:paddingRight="7dip"
                android:paddingTop="7dip"
                android:singleLine="true"
                android:textColor="#72af9c"
                android:textColorHint="#BDBDBD"
                android:textSize="20sp"
                android:textStyle="normal"
                android:visibility="gone" />

            <EditText
                android:id="@+id/contact_last_name"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_gravity="center_vertical"
                android:layout_marginBottom="3dip"
                android:layout_weight="1"
                android:background="@drawable/shape_section"
                android:elevation="2dp"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:hint="last name"
                android:inputType="textCapWords"
                android:paddingBottom="7dip"
                android:paddingLeft="7dip"
                android:paddingRight="7dip"
                android:paddingTop="7dip"
                android:singleLine="true"
                android:textColor="#72af9c"
                android:textColorHint="#BDBDBD"
                android:textSize="20sp"
                android:textStyle="normal"
                android:visibility="gone" />

            <EditText
                android:id="@+id/contact_name_sufix"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_gravity="center_vertical"
                android:layout_marginBottom="3dip"
                android:layout_weight="1"
                android:background="@drawable/shape_section"
                android:elevation="2dp"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:hint="name sufix"
                android:inputType="textCapWords"
                android:paddingBottom="7dip"
                android:paddingLeft="7dip"
                android:paddingRight="7dip"
                android:paddingTop="7dip"
                android:singleLine="true"
                android:textColor="#72af9c"
                android:textColorHint="#BDBDBD"
                android:textSize="20sp"
                android:textStyle="normal"
                android:visibility="gone" />

            <EditText
                android:id="@+id/contact_alias"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_gravity="center_vertical"
                android:layout_marginBottom="3dip"
                android:layout_weight="1"
                android:background="@drawable/shape_section"
                android:elevation="2dp"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:hint="alias"
                android:inputType="textCapWords"
                android:paddingBottom="7dip"
                android:paddingLeft="7dip"
                android:paddingRight="7dip"
                android:paddingTop="7dip"
                android:singleLine="true"
                android:textColor="#72af9c"
                android:textColorHint="#BDBDBD"
                android:textSize="20sp"
                android:textStyle="normal"
                android:visibility="gone" />
        </LinearLayout>

        <ImageButton
            android:id="@+id/details_btn"
            android:layout_width="40dip"
            android:layout_height="40dip"
            android:layout_gravity="top"
            android:layout_margin="5dip"
            android:layout_weight="0"
            android:background="@android:color/transparent"
            android:src="@drawable/ic_arrow_down_grey" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linear_address_tittle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingBottom="3dip"
        android:paddingLeft="7dip"
        android:paddingRight="7dip"
        android:paddingTop="3dip">

        <TextView
            android:id="@+id/address_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|left"
            android:layout_marginLeft="7dip"
            android:layout_weight="1"
            android:text="ADDRESS"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/color_black_light"
            android:textStyle="bold" />

        <ImageButton
            android:id="@+id/ic_plus"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|right"
            android:background="@android:color/transparent"
            android:src="@drawable/ic_plus_green" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/linear_address"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:orientation="horizontal"
        android:paddingBottom="3dip"
        android:paddingLeft="7dip"
        android:paddingRight="7dip"
        android:paddingTop="3dip">

        <EditText
            android:id="@+id/contact_address"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_gravity="end"
            android:layout_marginRight="5dip"
            android:layout_weight="1"
            android:background="@drawable/shape_section"
            android:elevation="2dp"
            android:ellipsize="end"
            android:gravity="center_vertical"
            android:hint="address"
            android:paddingBottom="7dip"
            android:paddingLeft="7dip"
            android:paddingRight="7dip"
            android:paddingTop="7dip"
            android:textColor="#72af9c"
            android:textColorHint="#BDBDBD"
            android:textSize="20sp"
            android:textStyle="normal" />

        <EditText
            android:id="@+id/contact_address_type"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_gravity="end"
            android:layout_marginLeft="5dip"
            android:layout_weight="1"
            android:background="@drawable/shape_section"
            android:elevation="2dp"
            android:ellipsize="end"
            android:gravity="center_vertical"
            android:hint="fermatPacketType"
            android:paddingBottom="7dip"
            android:paddingLeft="7dip"
            android:paddingRight="7dip"
            android:paddingTop="7dip"
            android:textColor="#72af9c"
            android:textColorHint="#BDBDBD"
            android:textSize="20sp"
            android:textStyle="normal" />

        <ImageView
            android:id="@+id/paste_from_clipboard_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="3dp"
            android:src="@drawable/ic_action_send_now_grey" />

        <ImageView
            android:id="@+id/scan_qr"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="3dp"
            android:src="@drawable/ic_action_camera_grey" />
    </LinearLayout>

</LinearLayout>


text:
\chapter{Benchmark Results} \label{chap:benchmarks}

Give an idea of compile time performance.


text:
import {layoutRectFromDomRect, layoutRectLtwh} from '#core/dom/layout/rect';
import {resetStyles, setImportantStyles} from '#core/dom/style';

import {
  centerFrameUnderVsyncMutate,
  collapseFrameUnderVsyncMutate,
  expandFrameUnderVsyncMutate,
} from './full-overlay-frame-helper';
import {restrictedVsync, timer} from './util';

const CENTER_TRANSITION_TIME_MS = 150;
const CENTER_TRANSITION_END_WAIT_TIME_MS = 50;

/**
 * Places the child frame in full overlay mode.
 * @param {!Window} win Host window.
 * @param {!HTMLIFrameElement} iframe
 * @param {function(!LayoutRectDef, !LayoutRectDef)} onFinish
 * @private
 */
const expandFrameImpl = function (win, iframe, onFinish) {
  restrictedVsync(
    win,
    {
      measure(state) {
        state.viewportSize = {
          width: win./*OK*/ innerWidth,
          height: win./*OK*/ innerHeight,
        };
        state.rect = layoutRectFromDomRect(
          iframe./*OK*/ getBoundingClientRect()
        );
      },
      mutate(state) {
        const {height, width} = state.viewportSize;
        const expandedRect = layoutRectLtwh(0, 0, width, height);

        centerFrameUnderVsyncMutate(
          iframe,
          state.rect,
          state.viewportSize,
          CENTER_TRANSITION_TIME_MS
        );

        // To prevent double click during transition;
        setImportantStyles(iframe, {'pointer-events': 'none'});

        timer(() => {
          restrictedVsync(win, {
            mutate() {
              resetStyles(iframe, ['pointer-events']);
              expandFrameUnderVsyncMutate(iframe);
              onFinish(state.rect, expandedRect);
            },
          });
        }, CENTER_TRANSITION_TIME_MS + CENTER_TRANSITION_END_WAIT_TIME_MS);
      },
    },
    {}
  );
};

/**
 * Resets the frame from full overlay mode.
 * @param {!Window} win Host window.
 * @param {!HTMLIFrameElement} iframe
 * @param {function()} onFinish
 * @param {function(!LayoutRectDef)} onMeasure
 * @private
 */
const collapseFrameImpl = function (win, iframe, onFinish, onMeasure) {
  restrictedVsync(win, {
    mutate() {
      collapseFrameUnderVsyncMutate(iframe);

      onFinish();

      // remeasure so client knows about updated dimensions
      restrictedVsync(win, {
        measure() {
          onMeasure(
            layoutRectFromDomRect(iframe./*OK*/ getBoundingClientRect())
          );
        },
      });
    },
  });
};

/**
 * Places the child frame in full overlay mode.
 * @param {!Window} win Host window.
 * @param {!HTMLIFrameElement} iframe
 * @param {function(!LayoutRectDef, !LayoutRectDef)} onFinish
 */
export let expandFrame = expandFrameImpl;

/**
 * @param {!Function} implFn
 * @visibleForTesting
 */
export function stubExpandFrameForTesting(implFn) {
  expandFrame = implFn;
}

/**
 * @visibleForTesting
 */
export function resetExpandFrameForTesting() {
  expandFrame = expandFrameImpl;
}

/**
 * Places the child frame in full overlay mode.
 * @param {!Window} win Host window.
 * @param {!HTMLIFrameElement} iframe
 * @param {function()} onFinish
 * @param {function(!LayoutRectDef)} onMeasure
 */
export let collapseFrame = collapseFrameImpl;

/**
 * @param {!Function} implFn
 * @visibleForTesting
 */
export function stubCollapseFrameForTesting(implFn) {
  collapseFrame = implFn;
}

/**
 * @visibleForTesting
 */
export function resetCollapseFrameForTesting() {
  collapseFrame = collapseFrameImpl;
}


text:
var SelectReplace = new Class({

	Implements: [Events, Options],

	options: {
		activeClass: 'active',
		activeLiClass: 'activeLi',
		containerClass: 'selectContainer',
		displayClass: 'display',
		expandedClass: 'expanded',
		liClass: 'selectLi',
		listClass: 'selectList',
		optgroupClass: 'selectOptgroup',
		triggerActiveHtml: '▲',
		triggerClass: 'trigger',
		triggerInactiveHtml: '▼'
	},

	/**
	 * @param string - selector - The selector of the selects to be replaced
	 * @param object - options - The options object
	 */
	initialize: function(selector, options){
		this.setOptions(options);
		this.selects = $$(selector);
		this.triggers = [];
		this.lists = [];
		this.listOptions = [];
		Array.each(this.selects, function(select, index){
			this.setListOptions(select, index);
			this.createTrigger(select, index);
			this.createList(select, index);
			this.addNavigation(index);
			select.setStyle('display', 'none');
		}.bind(this));
	},

	setListOptions: function(select, index){
		var self = this;
		this.listOptions[index] = [];
		Array.each(select.getChildren(), function(child, key){
			this.listOptions[index][key] = {'text':child.get('text'), 'value':child.get('value')};
			if (child.get('tag') == 'optgroup'){
				this.listOptions[index][key]['text'] = child.get('label');
				this.listOptions[index][key]['value'] = []
				Array.each(child.getChildren(), function(option, subkey){
					self.listOptions[index][key]['value'][subkey] = {'text':option.get('text'), 'value':option.get('value')};
				});
			}
		}.bind(this));
	},

	createTrigger: function(select, index){
		var self = this;
		var replaceId = (select.get('id')) ? select.get('id')+'Replace' : select.get('name')+'Replace';
		var display = new Element('span', {'class':this.options.displayClass, 'html':select.getSelected()[0].get('text')});
		var trigger = new Element('span', {'class':this.options.triggerClass, 'html':self.options.triggerInactiveHtml});
		this.triggers[index] = new Element('a', {
			'id': replaceId,
			'class': self.options.containerClass,
			'name': select.get('name'),
			'tabindex': select.get('tabindex'),
			events: {
				'click': function(){
					(self.lists[index].getStyle('display') == 'block') ? self.collapseList(index) :	self.expandList(index);
				},
				'focus': function(){
					this.addClass(self.options.activeClass);
					select.fireEvent('focus');
				},
				'blur': function(){
					this.removeClass(self.options.activeClass);
					select.fireEvent('blur');
				}
			}
		}).adopt(display, trigger);
		if ((!select.getNext())||(select.getNext().getNext().get('name') != select.get('name'))){ //Prevents duplication
			this.triggers[index].inject(select, 'after');
		}
	},

	/**
	 * @param array - listOptions - An array of options to append to the current options in the dropdown list
	 */
	append: function(listOptions){
		this.listOptions.append(listOptions);
		this.deleteList();
		this.createList();
	},

	/**
	 * @param array - listOptions - An array of options to remove from the current options in the dropdown list
	 */
	remove: function(listOptions){
		var self = this;
		Array.each(listOptions, function(item){
			self.listOptions.erase(item);
		});
		this.deleteList();
		this.createList();
	},

	/**
	 * @param array - listOptions - An array of options to replace the current options in the dropdown list
	 */
	replace: function(listOptions){
		this.listOptions = listOptions;
		this.deleteList();
		this.createList();
	},

	createList: function(select, index){
		var self = this;
		var name = (select.get('id')) ? select.get('id')+'ReplaceList' : select.get('name')+'ReplaceList';

		this.lists[index] = new Element('ul', {
			"data-name": name,
			'class': self.options.listClass,
			styles: {
				'max-height': 300,
				'overflow': 'auto',
				'position': 'absolute',
				'z-index': 1000
			}
		});
		if (select.getNext().getData('name') !== this.lists[index].getData('name')){ //Prevents duplication
			this.lists[index].inject(select, 'after');
		}

		this.createListOptions(index);
		this.triggers[index].getElement('.'+this.options.displayClass).setStyle('min-width', this.lists[index].getSize().x);
		this.lists[index].setStyle('display', 'none');

		$(document).addEvent('click', function(e){
			if ((!e.target.hasClass(self.options.triggerClass))&&(!e.target.hasClass(self.options.displayClass))){
				self.collapseList(index);
			}
		});
	},

	createListOptions: function(index){
		Array.each(this.listOptions[index], function(item){
			if (typeOf(item['value']) == 'array'){
				var optgroup = this.createOptgroup(index, item['text'], item['value']);
				this.lists[index].adopt(optgroup);
			} else {
				var option = this.createListItem(index, item['text'], item['value']);
				this.lists[index].adopt(option);
			}
		}, this);
	},

	createOptgroup: function(index, text, values){
		var label = new Element('span', {'text':text});
		var optgroupList = new Element('ul');

		Array.each(values, function(item){
			var option = this.createListItem(index, item['text'], item['value'])
			optgroupList.adopt(option);
		}, this);

		return new Element('li', {'class':this.options.optgroupClass}).adopt(label, optgroupList);
	},

	createListItem: function(index, text, value){
		var self = this;
		var selectedText = this.selects[index].getSelected().get('text');
		var liClass = (text == selectedText) ? self.options.activeLiClass+' '+self.options.liClass : self.options.liClass;
		var liItem = new Element('li', {
			'class':liClass+' '+text.substring(0,1).toLowerCase(),
			'text':text,
			'data-value':value,
			events: {
				'click': function(){
					var text = this.get('text');
					self.lists[index].getElements('li').removeClass(self.options.activeLiClass);
					this.addClass(self.options.activeLiClass);
					self.triggers[index].getElement('.'+self.options.displayClass).set('html', text);
					self.collapseList(index);
					self.updateSelect(index, text);
				}
			}
		});
		return liItem;
	},

	updateSelect: function(index, selectedText){
		Array.each(this.selects[index].getElements('option'), function(el){
			if (el.get('text') == selectedText){
				el.set('selected', true);
			} else {
				el.set('selected', false);
			}
			this.selects[index].fireEvent('change');
		}, this);
	},

	deleteList: function(){
		this.list.dispose();
	},

	expandList: function(index){
		var dimensions = this.triggers[index].getCoordinates();
		this.lists[index].setStyles({'display':'block', 'left':dimensions.left, 'min-width':(dimensions.width)});
		var listBottom = dimensions.bottom + this.lists[index].getSize().y;
		var listTop = dimensions.top - this.lists[index].getSize().y;
		if ((listBottom > (window.innerHeight + window.getScroll().y))&&(listTop > window.getScroll().y)){
			this.lists[index].setStyle('top', dimensions.top - this.lists[index].getSize().y +2).removeClass('down').addClass('up');
			var direction = 'up';
		} else {
			this.lists[index].setStyle('top', dimensions.bottom -2).removeClass('up').addClass('down');
			var direction = 'down';
		}
		this.triggers[index].getElement('.'+this.options.triggerClass).set('html', this.options.triggerActiveHtml);
		this.triggers[index].addClass(this.options.expandedClass).removeClass('up').removeClass('down').addClass(direction);
	},

	collapseList: function(index){
		this.lists[index].setStyle('display', 'none');
		this.triggers[index].getElement('.'+this.options.triggerClass).set('html', this.options.triggerInactiveHtml);
		this.triggers[index].removeClass(this.options.expandedClass);
	},

	addNavigation: function(index){
		var self = this;
		this.triggers[index].addEvent('keydown', function(e){
			if (e.key != 'tab'){
				e.stop();
			}
			self.addSelectionEvents(e, index);
			if ((self.lists[index].getStyle('display') == 'none')&&((e.key == 'space')||((['down', 'up'].contains(e.key))&&(e.alt)))){
				self.expandList(index);
			} else if ((['tab', 'esc', 'space'].contains(e.key))||((['down', 'up'].contains(e.key))&&(e.alt))){
				self.collapseList(index);
			}
		});
	},

	/**
	 * @param object - e - The event object
	 */
	addSelectionEvents: function(e, index){
		var selector = ((!e.alt)&& (['up', 'down', 'left', 'right'].contains(e.key))) ? '.'+this.options.liClass : '.'+e.key.toLowerCase();
		var sort = ((!e.alt)&& (['up', 'down', 'left', 'right'].contains(e.key))) ? false : true;
		var listItems = this.lists[index].getElements(selector);

		if (listItems.length > 0){
			var currentLi = this.lists[index].getElements('.'+this.options.activeLiClass)[0];
			var currentVal = currentLi.get('text');
			var numLis = listItems.length - 1;
			var currentLiIndex = 0;
			var firstItem = [];
			Array.each(this.lists[index].getElements('.'+this.options.optgroupClass+' ul'), function(optGroup){
				if (optGroup.getFirst(selector)){
					firstItem.push(optGroup.getFirst(selector).get('text'));
				}
			});
			Array.each(listItems, function(item, order){
				if (currentVal == item.get('text')){
					currentLiIndex = order;
				}
			});

			if ((((e.key == 'down')||(e.key == 'right'))&&(currentLiIndex < numLis))||((sort)&&(currentLiIndex < numLis)&&(currentLi.hasClass(e.key)))){
				currentVal = listItems[(currentLiIndex + 1)].addClass(this.options.activeLiClass).get('text');
				currentLi.removeClass(this.options.activeLiClass);
				this.setScrollPosition(currentLi, index, e, firstItem);
			} else if (((currentLiIndex == numLis)&&(sort))||((sort)&&(!currentLi.hasClass(e.key)))){
				currentLi.removeClass(this.options.activeLiClass);
				currentVal = listItems[0].addClass(this.options.activeLiClass).get('text');
				this.setScrollPosition(listItems[0], index, e, firstItem);
			} else if ((((e.key == 'up')||(e.key == 'left'))&&(currentLi)&&(currentLiIndex > 0))||((sort)&&(currentLiIndex > 0))){
				currentVal = listItems[(currentLiIndex - 1)].addClass(this.options.activeLiClass).get('text');
				currentLi.removeClass(this.options.activeLiClass);
				this.setScrollPosition(currentLi, index, e, firstItem);
			}
			this.triggers[index].getElement('.'+this.options.displayClass).set('text', currentVal);
			this.updateSelect(index, currentVal);
		}
	},

	setScrollPosition: function(listItem, index, e, firstItem){
		Array.each(this.lists[index].getElements('li'), function(item, order){
			var height = item.getSize().y;
			//The extra checks in the first statement are to switch between optgroups using the alpha sort
			if ((firstItem.contains(item.get('text')))&&(this.lists[index].getElements('.'+this.options.activeLiClass)[0].get('text') == item.get('text'))){
				this.lists[index].scrollTo(0, (height * order));
			} else if (listItem.get('text') == item.get('text')){
				if (['up', 'left'].contains(e.key)){
					this.lists[index].scrollTo(0, (height * (order)) - height);
				} else {
					this.lists[index].scrollTo(0, (height * (order)) + height);
				}
			}
		}, this);
	}
});


text:
package com.chaocodes.plannit.test;

import java.util.ArrayList;
import java.util.List;

import com.chaocodes.plannit.model.Event;
import com.chaocodes.plannit.model.Model;
import com.chaocodes.plannit.repository.EventRepository;
import com.chaocodes.plannit.util.CalendarUtil;

public class EventTestRepository extends EventRepository
{

	@Override
	public void create(Model model) {
		System.out.println("Model Created: " + model);
	}

	@Override
	public Model read(int id) {
		int month = (int)(Math.random() * 11);
		int day = (int)(Math.random() * 28);
		return new Event(id, "Event id:" + id, 2014, month, day, "2:00");
	}

	@Override
	public List<Event> readByMonthYear(int month, int year) {
		List<Event> events = new ArrayList<Event>();
		for (int i = 1; i <= CalendarUtil.checkMaxDays(year, month); i++) {
			int random = (int)(Math.random() * 10);
			if (random > 6) {
				Event event = new Event("Event #" + i, year, month, i, "4:45");
				events.add(event);
			}
		}
		return events;
	}

	@Override
	public void update(int id, Model model) {
		System.out.println("Model id: " + id + " Updated: " + model);
	}

	@Override
	public void delete(int id) {
		System.out.println("Model id:" + id + " deleted");
	}
}


text:
$(document).ready(function() {
  var image_show;
  image_show = function() {
    // var images = ['brunner.jpg', 'casablanca.jpg', 'shawshank.jpg'];
    var images = ['brunner.jpg'];
  console.log(images);
   $("body").css('background-image', "url(/images/" + images[Math.floor(Math.random() * images.length)] + ")");
  }

  $(document).on('page:load', image_show);
  image_show();

  $("#new-review").on("submit", function(event) {
    event.preventDefault();
    var $that = $(this)
    var url = $(this).attr("action")

    $.ajax({
      url: url,
      method: "GET"
      }).done(function(responseData){
        $that.append(responseData);
      });
  });
})


text:
<?php

/**
 * @author Sylvestre Ho <sho@centreon.com>
 */
class CentreonMeta
{
    /**
     *
     * @var \CentreonDB
     */
    protected $db;

    /**
     * Constructor
     * @param type $db
     */
    public function __construct($db)
    {
        $this->db = $db;
    }

    /**
     * Return host id
     *
     * @return int
     */
    public function getRealHostId()
    {
        static $hostId = null;

        if (is_null($hostId)) {
            $queryHost = 'SELECT host_id '
                . 'FROM host '
                . 'WHERE host_name = "_Module_Meta" '
                . 'AND host_register = "2" '
                . 'LIMIT 1 ';
            $res = $this->db->query($queryHost);
            if ($res->rowCount()) {
                $row = $res->fetchRow();
                $hostId = $row['host_id'];
            } else {
                $query = 'INSERT INTO host (host_name, host_register) '
                    . 'VALUES ("_Module_Meta", "2") ';
                $this->db->query($query);
                $res = $this->db->query($queryHost);
                if ($res->rowCount()) {
                    $row = $res->fetchRow();
                    $hostId = $row['host_id'];
                } else {
                    $hostId = 0;
                }
            }
        }

        return $hostId;
    }

    /**
     * Return service id
     *
     * @param int $metaId
     * @return int
     */
    public function getRealServiceId($metaId)
    {
        static $services = null;
        if (isset($services[$metaId])) {
            return $services[$metaId];
        }

        $sql = 'SELECT s.service_id '
            . 'FROM service s '
            . 'WHERE s.service_description = "meta_' . $metaId . '" ';

        $res = $this->db->query($sql);
        if ($res->rowCount()) {
            while ($row = $res->fetchRow()) {
                $services[$metaId] = $row['service_id'];
            }
        }

        if (isset($services[$metaId])) {
            return $services[$metaId];
        }
        return 0;
    }

    /**
     * Return metaservice id
     *
     * @param string $serviceDisplayName
     * @return int
     */
    public function getMetaIdFromServiceDisplayName($serviceDisplayName)
    {
        $metaId = null;
        $query = 'SELECT service_description '
            . 'FROM service '
            . 'WHERE display_name = "' . $serviceDisplayName . '" ';
        $res = $this->db->query($query);
        if ($res->rowCount()) {
            $row = $res->fetchRow();
            if (preg_match('/meta_(\d+)/', $row['service_description'], $matches)) {
                $metaId = $matches[1];
            }
        }

        return $metaId;
    }

    /**
     *
     * @param integer $field
     * @return array
     */
    public static function getDefaultValuesParameters($field)
    {
        $parameters = array();
        $parameters['currentObject']['table'] = 'meta_service';
        $parameters['currentObject']['id'] = 'meta_id';
        $parameters['currentObject']['name'] = 'meta_name';
        $parameters['currentObject']['comparator'] = 'meta_id';

        switch ($field) {
            case 'check_period':
            case 'notification_period':
                $parameters['type'] = 'simple';
                $parameters['externalObject']['table'] = 'timeperiod';
                $parameters['externalObject']['id'] = 'tp_id';
                $parameters['externalObject']['name'] = 'tp_name';
                $parameters['externalObject']['comparator'] = 'tp_id';
                break;
            case 'ms_cs':
                $parameters['type'] = 'relation';
                $parameters['externalObject']['table'] = 'contact';
                $parameters['externalObject']['id'] = 'contact_id';
                $parameters['externalObject']['name'] = 'contact_name';
                $parameters['externalObject']['comparator'] = 'contact_id';
                $parameters['relationObject']['table'] = 'meta_contact';
                $parameters['relationObject']['field'] = 'contact_id';
                $parameters['relationObject']['comparator'] = 'meta_id';
                break;
            case 'ms_cgs':
                $parameters['type'] = 'relation';
                $parameters['externalObject']['table'] = 'contactgroup';
                $parameters['externalObject']['id'] = 'cg_id';
                $parameters['externalObject']['name'] = 'cg_name';
                $parameters['externalObject']['comparator'] = 'cg_id';
                $parameters['relationObject']['table'] = 'meta_contactgroup_relation';
                $parameters['relationObject']['field'] = 'cg_cg_id';
                $parameters['relationObject']['comparator'] = 'meta_id';
                break;
        }

        return $parameters;
    }

    /**
     * @param array $values
     * @param array $options
     * @return array
     */
    public function getObjectForSelect2($values = array(), $options = array())
    {
        $items = array();
        $listValues = '';
        $queryValues = array();
        if (!empty($values)) {
            foreach ($values as $k => $v) {
                $listValues .= ':meta' . $v . ',';
                $queryValues['meta' . $v] = (int)$v;
            }
            $listValues = rtrim($listValues, ',');
        } else {
            $listValues .= '""';
        }

        # get list of selected meta
        $query = 'SELECT meta_id, meta_name FROM meta_service ' .
            'WHERE meta_id IN (' . $listValues . ') ORDER BY meta_name ';
        $stmt = $this->db->prepare($query);
        if (!empty($queryValues)) {
            foreach ($queryValues as $key => $id) {
                $stmt->bindValue(':' . $key, $id, PDO::PARAM_INT);
            }
        }
        $stmt->execute();

        while ($row = $stmt->fetch()) {
            $items[] = array(
                'id' => $row['meta_id'],
                'text' => $row['meta_name']
            );
        }
        return $items;
    }

    /**
     * Get the list of all meta-service
     *
     * @return array
     */
    public function getList()
    {
        $queryList = "SELECT `meta_id`, `meta_name`
 	    	FROM `meta_service`
 	    	ORDER BY `meta_name`";

        try {
            $res = $this->db->query($queryList);
        } catch (\PDOException $e) {
            return array();
        }
        $listMeta = array();
        while ($row = $res->fetchRow()) {
            $listMeta[$row['meta_id']] = $row['meta_name'];
        }
        return $listMeta;
    }

    /**
     * Returns service details
     *
     * @param int $id
     * @return array
     */
    public function getParameters($id, $parameters = array())
    {
        $sElement = "*";
        $values = array();
        if (empty($id) || empty($parameters)) {
            return array();
        }

        if (count($parameters) > 0) {
            $sElement = implode(",", $parameters);
        }

        $query = "SELECT " . $sElement . " "
            . "FROM meta_service "
            . "WHERE meta_id = " . $this->db->escape($id) . " ";

        $res = $this->db->query($query);

        if ($res->rowCount()) {
            $values = $res->fetchRow();
        }

        return $values;
    }

    /**
     * Returns service id
     *
     * @param int $metaId
     * @param string $metaName
     * @return int
     */
    public function insertVirtualService($metaId, $metaName)
    {
        $hostId = $this->getRealHostId();
        $serviceId = null;

        $composedName = 'meta_' . $metaId;

        $queryService = 'SELECT service_id, display_name FROM service ' .
            'WHERE service_register = "2" AND service_description = "' . $composedName . '" ';
        $res = $this->db->query($queryService);
        if ($res->rowCount()) {
            $row = $res->fetchRow();
            $serviceId = $row['service_id'];
            if ($row['display_name'] !== $metaName) {
                $query = 'UPDATE service SET display_name = :display_name WHERE service_id = :service_id';
                $statement = $this->db->prepare($query);
                $statement->bindValue(':display_name', $metaName, \PDO::PARAM_STR);
                $statement->bindValue(':service_id', (int) $serviceId, \PDO::PARAM_INT);
                $statement->execute();
            }
        } else {
            $query = 'INSERT INTO service (service_description, display_name, service_register) '
                . 'VALUES '
                . '("' . $composedName . '", "' . $metaName . '", "2")';
            $this->db->query($query);
            $query = 'INSERT INTO host_service_relation(host_host_id, service_service_id) '
                . 'VALUES (:host_id,'
                . '(SELECT service_id
                    FROM service
                    WHERE service_description = :service_description AND service_register = "2" LIMIT 1)'
                . ')';
            $statement = $this->db->prepare($query);
            $statement->bindValue(':host_id', (int) $hostId, \PDO::PARAM_INT);
            $statement->bindValue(':service_description', $composedName, \PDO::PARAM_STR);
            $statement->execute();
            $res = $this->db->query($queryService);
            if ($res->rowCount()) {
                $row = $res->fetchRow();
                $serviceId = $row['service_id'];
            }
        }

        return $serviceId;
    }
}


text:
<?php

namespace Zitec\ApiZitecExtension\Services\Response\Content;

abstract class AbstractContent
{
    /**
     * The actual result the API returns
     *
     * @var string
     */
    protected $rawContent;

    /**
     * The result returned by API decoded.
     *
     * @var array
     */
    protected $parsedContent;

    /**
     * Parse received data
     *
     * @throws \Exception
     */
    abstract protected function parseData();

    /**
     * AbstractContent constructor.
     *
     * @param string $responseData
     */
    public function __construct($responseData)
    {
        $this->rawContent = $responseData;
        $this->parseData();
    }

    /**
     * @return string
     */
    public function getRawContent()
    {
        return $this->rawContent;
    }

    /**
     * @return array
     */
    public function getParsedContent()
    {
        return $this->parsedContent;
    }

    /**
     * Walk through the response to retrieve the specific key given as $path.
     *
     * @param string $path
     * @return mixed
     * @throws \Exception
     */
    public function getItem($path)
    {
        $sqBracket = strpos($path, '[');
        $response = $this->parsedContent;
        if ($sqBracket !== false) {
            $indexes = $this->getIndexOutOfString($path);
            foreach ($indexes as $index) {
                if (isset($response[$index])) {
                    $response = $response[$index];
                    continue;
                }
                throw new \Exception(sprintf('Key %s not found in response.', $path));
            }

            return $response;

        } else {
            if (!isset($response[$path])) {
                throw new \Exception(sprintf('Key %s not found in response.', $path));
            }

            return $response[$path];
        }
    }

     /**
     * @param string $string
     * @return array
     */
    protected function getIndexOutOfString($string)
    {
        $indexes = array_map(
            function ($item) {
                return trim($item, ']');
            },
            explode('[', $string)
        );

        return $indexes;
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>org.opencv.objdetect</title>
<meta name="date" content="2015-03-04">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

org.opencv.objdetect

Classes

CascadeClassifier

HOGDescriptor

Objdetect


text: """Package marker file."""


text:
<?php

namespace ItvisionSy\Laravel\Modules\Tests;

/**
 * Description of ExtendedModules
 *
 * @author muhannad
 */
class ExtendedModules extends \ItvisionSy\Laravel\Modules\Modules {

    public static function resetStoreHandler() {
        static::$storeHandler = null;
    }

}


text:
package ro.tla.feedback;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Parameter;
import org.jgroups.JChannel;

public abstract class AbstractFeedbackMojo extends AbstractMojo {
    @Parameter(defaultValue = "feedback-default-cluster")
    private String clusterName;

    public void execute() throws MojoExecutionException {
	JChannel channel = null;
	try {
	    channel = new JChannel();
	    channel.connect(clusterName);
	} catch (Exception ex) {
	    throw new MojoExecutionException("", ex);
	} finally {
	    channel.close();
	}
	getLog().info("foobar");
    }
}


text:
package org.keycloak.authentication;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.ws.rs.core.Response;

import org.keycloak.events.Details;
import org.keycloak.events.Errors;
import org.keycloak.models.AuthenticationExecutionModel;
import org.keycloak.models.AuthenticationFlowModel;
import org.keycloak.models.ClientModel;
import org.keycloak.models.utils.KeycloakModelUtils;
import org.keycloak.services.ServicesLogger;

/**
 * @author Marek Posolda
 */
public class ClientAuthenticationFlow implements AuthenticationFlow {

    protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;

    Response alternativeChallenge = null;
    AuthenticationProcessor processor;
    AuthenticationFlowModel flow;

    public ClientAuthenticationFlow(AuthenticationProcessor processor, AuthenticationFlowModel flow) {
        this.processor = processor;
        this.flow = flow;
    }

    @Override
    public Response processAction(String actionExecution) {
        throw new IllegalStateException("Not supposed to be invoked");
    }

    @Override
    public Response processFlow() {
        List<AuthenticationExecutionModel> executions = findExecutionsToRun();

        for (AuthenticationExecutionModel model : executions) {
            ClientAuthenticatorFactory factory = (ClientAuthenticatorFactory) processor.getSession().getKeycloakSessionFactory().getProviderFactory(ClientAuthenticator.class, model.getAuthenticator());
            if (factory == null) {
                throw new AuthenticationFlowException("Could not find ClientAuthenticatorFactory for: " + model.getAuthenticator(), AuthenticationFlowError.INTERNAL_ERROR);
            }
            ClientAuthenticator authenticator = factory.create();
            logger.debugv("client authenticator: {0}", factory.getId());

            AuthenticationProcessor.Result context = processor.createClientAuthenticatorContext(model, authenticator, executions);
            authenticator.authenticateClient(context);

            ClientModel client = processor.getClient();
            if (client != null) {
                String expectedClientAuthType = client.getClientAuthenticatorType();

                // Fallback to secret just in case (for backwards compatibility)
                if (expectedClientAuthType == null) {
                    expectedClientAuthType = KeycloakModelUtils.getDefaultClientAuthenticatorType();
                    logger.authMethodFallback(client.getClientId(), expectedClientAuthType);
                }

                // Check if client authentication matches
                if (factory.getId().equals(expectedClientAuthType)) {
                    Response response = processResult(context);
                    if (response != null) return response;

                    if (!context.getStatus().equals(FlowStatus.SUCCESS)) {
                        throw new AuthenticationFlowException("Expected success, but for an unknown reason the status was " + context.getStatus(), AuthenticationFlowError.INTERNAL_ERROR);
                    }

                    logger.debugv("Client {0} authenticated by {1}", client.getClientId(), factory.getId());
                    processor.getEvent().detail(Details.CLIENT_AUTH_METHOD, factory.getId());
                    return null;
                }
            }
        }

        // Check if any alternative challenge was identified
        if (alternativeChallenge != null) {
            processor.getEvent().error(Errors.INVALID_CLIENT);
            return alternativeChallenge;
        }
        throw new AuthenticationFlowException("Client was not identified by any client authenticator", AuthenticationFlowError.UNKNOWN_CLIENT);
    }

    protected List<AuthenticationExecutionModel> findExecutionsToRun() {
        List<AuthenticationExecutionModel> executions = processor.getRealm().getAuthenticationExecutions(flow.getId());
        List<AuthenticationExecutionModel> executionsToRun = new ArrayList<>();

        for (AuthenticationExecutionModel execution : executions) {
            if (execution.isRequired()) {
                executionsToRun = Arrays.asList(execution);
                break;
            }

            if (execution.isAlternative()) {
                executionsToRun.add(execution);
            }
        }

        if (logger.isTraceEnabled()) {
            List<String> exIds = new ArrayList<>();
            for (AuthenticationExecutionModel execution : executionsToRun) {
                exIds.add(execution.getId());
            }
            logger.tracef("Using executions for client authentication: %s", exIds.toString());
        }

        return executionsToRun;
    }

    protected Response processResult(AuthenticationProcessor.Result result) {
        AuthenticationExecutionModel execution = result.getExecution();
        FlowStatus status = result.getStatus();

        logger.debugv("client authenticator {0}: {1}", status.toString(), execution.getAuthenticator());

        if (status == FlowStatus.SUCCESS) {
            return null;
        }

        if (status == FlowStatus.FAILED) {
            if (result.getChallenge() != null) {
                return sendChallenge(result, execution);
            } else {
                throw new AuthenticationFlowException(result.getError());
            }
        } else if (status == FlowStatus.FORCE_CHALLENGE) {
            return sendChallenge(result, execution);
        } else if (status == FlowStatus.CHALLENGE) {

            // Make sure the first priority alternative challenge is used
            if (alternativeChallenge == null) {
                alternativeChallenge = result.getChallenge();
            }
            return sendChallenge(result, execution);
        } else if (status == FlowStatus.FAILURE_CHALLENGE) {
            return sendChallenge(result, execution);
        } else {
            logger.unknownResultStatus();
            throw new AuthenticationFlowException(AuthenticationFlowError.INTERNAL_ERROR);
        }
    }

    public Response sendChallenge(AuthenticationProcessor.Result result, AuthenticationExecutionModel execution) {
        logger.debugv("client authenticator: sending challenge for authentication execution {0}", execution.getAuthenticator());

        if (result.getError() != null) {
            String errorAsString = result.getError().toString().toLowerCase();
            result.getEvent().error(errorAsString);
        } else {
            if (result.getClient() == null) {
                result.getEvent().error(Errors.INVALID_CLIENT);
            } else {
                result.getEvent().error(Errors.INVALID_CLIENT_CREDENTIALS);
            }
        }

        return result.getChallenge();
    }
}