text:
/* ProgressBar
 *
 * Styling of the ProgressBar consists of the following:
 *
 * 1. the base progress bar
 *		.dijitProgressBar -	sets margins for the progress bar
 *
 * 2. the empty bar
 *		.dijitProgressBarEmpty  - sets background img and color for bar or parts of bar that are not finished yet
 *		Also sets border color for whole bar
 *
 * 3. tile mode
 * 		.dijitProgressBarTile
 *		inner container for finished portion when in 'tile' (image) mode
 *
 * 4. full bar mode
 * 		.dijitProgressBarFull
 *		adds border to right side of the filled portion of bar
 *
 * 5. text for label of  bar
 *		.dijitProgressBarLabel - sets text color, which must contrast with both the "Empty" and "Full" parts.
 *
 * 6. indeterminate mode
 *		.dijitProgressBarIndeterminate .dijitProgressBarTile
 * 		sets animated gif for the progress bar in 'indeterminate' mode
 */
.claro .dijitProgressBar {
  margin: 2px 0 2px 0;
}
.claro .dijitProgressBarEmpty {
  /* outer container and background of the bar that's not finished yet*/

  background: #ffffff url("images/progressBarEmpty.png") repeat-none left;
  border-color: #769dc0;
}
.claro .dijitProgressBarTile {
  /* inner container for finished portion when in 'tile' (image) mode */

  background: #abd6ff url("images/progressBarFull.png") repeat-x top;
}
.dj_ie6 .claro .dijitProgressBarTile {
  background-image: none;
}
.claro .dijitProgressBarFull {
  border-right: 1px solid #769dc0;
}
.claro .dijitProgressBarLabel {
  /* Set to a color that contrasts with both the "Empty" and "Full" parts. */

  color: #000000;
}
.claro .dijitProgressBarIndeterminate .dijitProgressBarTile {
  /* use an animated gif for the progress bar in 'indeterminate' mode;
		background-color won't appear unless user has turned off background images */

  background: #efefef url("images/progressBarAnim.gif") repeat-x top;
}


text:
'use babel';

const exec = require('child_process').exec;

// A copy of package-install that uninstalls a package
export default class PackageUninstaller {

	constructor() {
		this.isInteractive = true;
		this.prefix = 'Uninstall package: ';
		this.async = true;
	}

	run(pkg) {
		let _this = this, returnString;
		_this.output = null;

		// Uninstalls the package
		function uninstallPackage(callback) {
			if (pkg == '') {
				returnString = "";
				return
			};
			exec(`apm uninstall ${pkg}`, callback)
		}

		uninstallPackage(function(error, stdout, stderr) {
			if (error && error.toString().includes("Does not exist")) {
				returnString = "The specified package is not installed! [Enter to continue]";
			} else if (stderr) {
				returnString = "There was an error uninstalling the package! [Enter to continue]"
			} else if (stdout) {
				returnString = `Uninstalled ${pkg}... [Enter to continue]`;
				atom.packages.deactivatePackage(pkg);
			} else {
				returnString = "Error!"
			};
			_this.output = returnString;
		});
	}
}

redpajama_set_name: RedPajamaGithub


text:
#pragma once
#include <aws/kms/KMS_EXPORTS.h>
#include <aws/kms/KMSRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/kms/model/KeyUsageType.h>
#include <aws/kms/model/OriginType.h>

namespace Aws
{
namespace KMS
{
namespace Model
{

  /**
   */
  class AWS_KMS_API CreateKeyRequest : public KMSRequest
  {
  public:
    CreateKeyRequest();
    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
The key policy to attach to the CMK.

If you specify a policy and do
     * not set BypassPolicyLockoutSafetyCheck to true, the policy must
     * meet the following criteria:

It must allow the principal making
     * the CreateKey request to make a subsequent PutKeyPolicy
     * request on the CMK. This reduces the likelihood that the CMK becomes
     * unmanageable. For more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.

The principal(s) specified in the key policy must
     * exist and be visible to AWS KMS. When you create a new AWS principal (for
     * example, an IAM user or role), you might need to enforce a delay before
     * specifying the new principal in a key policy because the new principal might not
     * immediately be visible to AWS KMS. For more information, see Changes
     * that I make are not always immediately visible in the IAM User
     * Guide.

If you do not specify a policy, AWS KMS attaches a
     * default key policy to the CMK. For more information, see Default
     * Key Policy in the AWS Key Management Service Developer Guide.

     *
The policy size limit is 32 KiB (32768 bytes).

     */
    inline const Aws::String& GetPolicy() const{ return m_policy; }

    /**
     *
The key policy to attach to the CMK.

If you specify a policy and do
     * not set BypassPolicyLockoutSafetyCheck to true, the policy must
     * meet the following criteria:

It must allow the principal making
     * the CreateKey request to make a subsequent PutKeyPolicy
     * request on the CMK. This reduces the likelihood that the CMK becomes
     * unmanageable. For more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.

The principal(s) specified in the key policy must
     * exist and be visible to AWS KMS. When you create a new AWS principal (for
     * example, an IAM user or role), you might need to enforce a delay before
     * specifying the new principal in a key policy because the new principal might not
     * immediately be visible to AWS KMS. For more information, see Changes
     * that I make are not always immediately visible in the IAM User
     * Guide.

If you do not specify a policy, AWS KMS attaches a
     * default key policy to the CMK. For more information, see Default
     * Key Policy in the AWS Key Management Service Developer Guide.

     *
The policy size limit is 32 KiB (32768 bytes).

     */
    inline void SetPolicy(const Aws::String& value) { m_policyHasBeenSet = true; m_policy = value; }

    /**
     *
The key policy to attach to the CMK.

If you specify a policy and do
     * not set BypassPolicyLockoutSafetyCheck to true, the policy must
     * meet the following criteria:

It must allow the principal making
     * the CreateKey request to make a subsequent PutKeyPolicy
     * request on the CMK. This reduces the likelihood that the CMK becomes
     * unmanageable. For more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.

The principal(s) specified in the key policy must
     * exist and be visible to AWS KMS. When you create a new AWS principal (for
     * example, an IAM user or role), you might need to enforce a delay before
     * specifying the new principal in a key policy because the new principal might not
     * immediately be visible to AWS KMS. For more information, see Changes
     * that I make are not always immediately visible in the IAM User
     * Guide.

If you do not specify a policy, AWS KMS attaches a
     * default key policy to the CMK. For more information, see Default
     * Key Policy in the AWS Key Management Service Developer Guide.

     *
The policy size limit is 32 KiB (32768 bytes).

     */
    inline void SetPolicy(Aws::String&& value) { m_policyHasBeenSet = true; m_policy = value; }

    /**
     *
The key policy to attach to the CMK.

If you specify a policy and do
     * not set BypassPolicyLockoutSafetyCheck to true, the policy must
     * meet the following criteria:

It must allow the principal making
     * the CreateKey request to make a subsequent PutKeyPolicy
     * request on the CMK. This reduces the likelihood that the CMK becomes
     * unmanageable. For more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.

The principal(s) specified in the key policy must
     * exist and be visible to AWS KMS. When you create a new AWS principal (for
     * example, an IAM user or role), you might need to enforce a delay before
     * specifying the new principal in a key policy because the new principal might not
     * immediately be visible to AWS KMS. For more information, see Changes
     * that I make are not always immediately visible in the IAM User
     * Guide.

If you do not specify a policy, AWS KMS attaches a
     * default key policy to the CMK. For more information, see Default
     * Key Policy in the AWS Key Management Service Developer Guide.

     *
The policy size limit is 32 KiB (32768 bytes).

     */
    inline void SetPolicy(const char* value) { m_policyHasBeenSet = true; m_policy.assign(value); }

    /**
     *
The key policy to attach to the CMK.

If you specify a policy and do
     * not set BypassPolicyLockoutSafetyCheck to true, the policy must
     * meet the following criteria:

It must allow the principal making
     * the CreateKey request to make a subsequent PutKeyPolicy
     * request on the CMK. This reduces the likelihood that the CMK becomes
     * unmanageable. For more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.

The principal(s) specified in the key policy must
     * exist and be visible to AWS KMS. When you create a new AWS principal (for
     * example, an IAM user or role), you might need to enforce a delay before
     * specifying the new principal in a key policy because the new principal might not
     * immediately be visible to AWS KMS. For more information, see Changes
     * that I make are not always immediately visible in the IAM User
     * Guide.

If you do not specify a policy, AWS KMS attaches a
     * default key policy to the CMK. For more information, see Default
     * Key Policy in the AWS Key Management Service Developer Guide.

     *
The policy size limit is 32 KiB (32768 bytes).

     */
    inline CreateKeyRequest& WithPolicy(const Aws::String& value) { SetPolicy(value); return *this;}

    /**
     *
The key policy to attach to the CMK.

If you specify a policy and do
     * not set BypassPolicyLockoutSafetyCheck to true, the policy must
     * meet the following criteria:

It must allow the principal making
     * the CreateKey request to make a subsequent PutKeyPolicy
     * request on the CMK. This reduces the likelihood that the CMK becomes
     * unmanageable. For more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.

The principal(s) specified in the key policy must
     * exist and be visible to AWS KMS. When you create a new AWS principal (for
     * example, an IAM user or role), you might need to enforce a delay before
     * specifying the new principal in a key policy because the new principal might not
     * immediately be visible to AWS KMS. For more information, see Changes
     * that I make are not always immediately visible in the IAM User
     * Guide.

If you do not specify a policy, AWS KMS attaches a
     * default key policy to the CMK. For more information, see Default
     * Key Policy in the AWS Key Management Service Developer Guide.

     *
The policy size limit is 32 KiB (32768 bytes).

     */
    inline CreateKeyRequest& WithPolicy(Aws::String&& value) { SetPolicy(value); return *this;}

    /**
     *
The key policy to attach to the CMK.

If you specify a policy and do
     * not set BypassPolicyLockoutSafetyCheck to true, the policy must
     * meet the following criteria:

It must allow the principal making
     * the CreateKey request to make a subsequent PutKeyPolicy
     * request on the CMK. This reduces the likelihood that the CMK becomes
     * unmanageable. For more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.

The principal(s) specified in the key policy must
     * exist and be visible to AWS KMS. When you create a new AWS principal (for
     * example, an IAM user or role), you might need to enforce a delay before
     * specifying the new principal in a key policy because the new principal might not
     * immediately be visible to AWS KMS. For more information, see Changes
     * that I make are not always immediately visible in the IAM User
     * Guide.

If you do not specify a policy, AWS KMS attaches a
     * default key policy to the CMK. For more information, see Default
     * Key Policy in the AWS Key Management Service Developer Guide.

     *
The policy size limit is 32 KiB (32768 bytes).

     */
    inline CreateKeyRequest& WithPolicy(const char* value) { SetPolicy(value); return *this;}

    /**
     *
A description of the CMK.

Use a description that helps you decide
     * whether the CMK is appropriate for a task.

     */
    inline const Aws::String& GetDescription() const{ return m_description; }

    /**
     *
A description of the CMK.

Use a description that helps you decide
     * whether the CMK is appropriate for a task.

     */
    inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; }

    /**
     *
A description of the CMK.

Use a description that helps you decide
     * whether the CMK is appropriate for a task.

     */
    inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = value; }

    /**
     *
A description of the CMK.

Use a description that helps you decide
     * whether the CMK is appropriate for a task.

     */
    inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); }

    /**
     *
A description of the CMK.

Use a description that helps you decide
     * whether the CMK is appropriate for a task.

     */
    inline CreateKeyRequest& WithDescription(const Aws::String& value) { SetDescription(value); return *this;}

    /**
     *
A description of the CMK.

Use a description that helps you decide
     * whether the CMK is appropriate for a task.

     */
    inline CreateKeyRequest& WithDescription(Aws::String&& value) { SetDescription(value); return *this;}

    /**
     *
A description of the CMK.

Use a description that helps you decide
     * whether the CMK is appropriate for a task.

     */
    inline CreateKeyRequest& WithDescription(const char* value) { SetDescription(value); return *this;}

    /**
     *
The intended use of the CMK.

You can use CMKs only for symmetric
     * encryption and decryption.

     */
    inline const KeyUsageType& GetKeyUsage() const{ return m_keyUsage; }

    /**
     *
The intended use of the CMK.

You can use CMKs only for symmetric
     * encryption and decryption.

     */
    inline void SetKeyUsage(const KeyUsageType& value) { m_keyUsageHasBeenSet = true; m_keyUsage = value; }

    /**
     *
The intended use of the CMK.

You can use CMKs only for symmetric
     * encryption and decryption.

     */
    inline void SetKeyUsage(KeyUsageType&& value) { m_keyUsageHasBeenSet = true; m_keyUsage = value; }

    /**
     *
The intended use of the CMK.

You can use CMKs only for symmetric
     * encryption and decryption.

     */
    inline CreateKeyRequest& WithKeyUsage(const KeyUsageType& value) { SetKeyUsage(value); return *this;}

    /**
     *
The intended use of the CMK.

You can use CMKs only for symmetric
     * encryption and decryption.

     */
    inline CreateKeyRequest& WithKeyUsage(KeyUsageType&& value) { SetKeyUsage(value); return *this;}

    /**
     *
The source of the CMK's key material.

The default is
     * AWS_KMS, which means AWS KMS creates the key material. When this
     * parameter is set to EXTERNAL, the request creates a CMK without key
     * material so that you can import key material from your existing key management
     * infrastructure. For more information about importing key material into AWS KMS,
     * see Importing
     * Key Material in the AWS Key Management Service Developer Guide.

     *
The CMK's Origin is immutable and is set when the CMK is
     * created.

     */
    inline const OriginType& GetOrigin() const{ return m_origin; }

    /**
     *
The source of the CMK's key material.

The default is
     * AWS_KMS, which means AWS KMS creates the key material. When this
     * parameter is set to EXTERNAL, the request creates a CMK without key
     * material so that you can import key material from your existing key management
     * infrastructure. For more information about importing key material into AWS KMS,
     * see Importing
     * Key Material in the AWS Key Management Service Developer Guide.

     *
The CMK's Origin is immutable and is set when the CMK is
     * created.

     */
    inline void SetOrigin(const OriginType& value) { m_originHasBeenSet = true; m_origin = value; }

    /**
     *
The source of the CMK's key material.

The default is
     * AWS_KMS, which means AWS KMS creates the key material. When this
     * parameter is set to EXTERNAL, the request creates a CMK without key
     * material so that you can import key material from your existing key management
     * infrastructure. For more information about importing key material into AWS KMS,
     * see Importing
     * Key Material in the AWS Key Management Service Developer Guide.

     *
The CMK's Origin is immutable and is set when the CMK is
     * created.

     */
    inline void SetOrigin(OriginType&& value) { m_originHasBeenSet = true; m_origin = value; }

    /**
     *
The source of the CMK's key material.

The default is
     * AWS_KMS, which means AWS KMS creates the key material. When this
     * parameter is set to EXTERNAL, the request creates a CMK without key
     * material so that you can import key material from your existing key management
     * infrastructure. For more information about importing key material into AWS KMS,
     * see Importing
     * Key Material in the AWS Key Management Service Developer Guide.

     *
The CMK's Origin is immutable and is set when the CMK is
     * created.

     */
    inline CreateKeyRequest& WithOrigin(const OriginType& value) { SetOrigin(value); return *this;}

    /**
     *
The source of the CMK's key material.

The default is
     * AWS_KMS, which means AWS KMS creates the key material. When this
     * parameter is set to EXTERNAL, the request creates a CMK without key
     * material so that you can import key material from your existing key management
     * infrastructure. For more information about importing key material into AWS KMS,
     * see Importing
     * Key Material in the AWS Key Management Service Developer Guide.

     *
The CMK's Origin is immutable and is set when the CMK is
     * created.

     */
    inline CreateKeyRequest& WithOrigin(OriginType&& value) { SetOrigin(value); return *this;}

    /**
     *
A flag to indicate whether to bypass the key policy lockout safety check.

     * <important>
Setting this value to true increases the likelihood that the CMK
     * becomes unmanageable. Do not set this value to true indiscriminately.

For
     * more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.
 </important>
Use this parameter only when you include a policy
     * in the request and you intend to prevent the principal making the request from
     * making a subsequent PutKeyPolicy request on the CMK.

The default
     * value is false.

     */
    inline bool GetBypassPolicyLockoutSafetyCheck() const{ return m_bypassPolicyLockoutSafetyCheck; }

    /**
     *
A flag to indicate whether to bypass the key policy lockout safety check.

     * <important>
Setting this value to true increases the likelihood that the CMK
     * becomes unmanageable. Do not set this value to true indiscriminately.

For
     * more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.
 </important>
Use this parameter only when you include a policy
     * in the request and you intend to prevent the principal making the request from
     * making a subsequent PutKeyPolicy request on the CMK.

The default
     * value is false.

     */
    inline void SetBypassPolicyLockoutSafetyCheck(bool value) { m_bypassPolicyLockoutSafetyCheckHasBeenSet = true; m_bypassPolicyLockoutSafetyCheck = value; }

    /**
     *
A flag to indicate whether to bypass the key policy lockout safety check.

     * <important>
Setting this value to true increases the likelihood that the CMK
     * becomes unmanageable. Do not set this value to true indiscriminately.

For
     * more information, refer to the scenario in the Default
     * Key Policy section in the AWS Key Management Service Developer
     * Guide.
 </important>
Use this parameter only when you include a policy
     * in the request and you intend to prevent the principal making the request from
     * making a subsequent PutKeyPolicy request on the CMK.

The default
     * value is false.

     */
    inline CreateKeyRequest& WithBypassPolicyLockoutSafetyCheck(bool value) { SetBypassPolicyLockoutSafetyCheck(value); return *this;}

  private:
    Aws::String m_policy;
    bool m_policyHasBeenSet;
    Aws::String m_description;
    bool m_descriptionHasBeenSet;
    KeyUsageType m_keyUsage;
    bool m_keyUsageHasBeenSet;
    OriginType m_origin;
    bool m_originHasBeenSet;
    bool m_bypassPolicyLockoutSafetyCheck;
    bool m_bypassPolicyLockoutSafetyCheckHasBeenSet;
  };

} // namespace Model
} // namespace KMS
} // namespace Aws


text:
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.

/* This file is obsolete!
 *
 * You should be including pxtask/CUDA/GPUProfile.h instead
 *
 */

#ifndef __PSPA_GPU_EVENT_SRC___
#define __PSPA_GPU_EVENT_SRC___

/*!! Changing any parameter in this file requires a full rebuild of all CUDA code !!*/

///< Enables per-warp logging to external memory
#define ENABLE_CTA_PROFILING					0

///< Defines the size of the profiling buffers allocated on both the GPU
///< and host pinned memory.  A single buffer is used to collect all
///< of the profile data for an entire push-buffer.  A warning will be
///< emitted by the GpuDispatcher if this limit is reached.
#define NUM_CTAS_PER_PROFILE_BUFFER             (4*1024*1024)

///< Total number of profile buffers that will be allocated by the Gpu
///< Dispatcher.  A good guess is the maximum number of addCompletionPrereq
///< calls you make in a single frame.  Having too few buffers is not harmful,
///< you will simply have unprofiled push-buffers (you will only see the
///< GpuTaskBatch bar).
#define NUM_CTA_PROFILE_BUFFERS					2

#include "Ps.h"
#include "cuda.h"

namespace physx
{
namespace shdfnd
{

#if defined(__CUDACC__)
	#define CUDA_ALIGN_16 __align__(16)
#else
	#define CUDA_ALIGN_16
#endif

typedef struct CUDA_ALIGN_16 kernelEvent_sd
{
	PxU16 block;
	PxU8  warp;
	PxU8  mpId;
	PxU8  hwWarpId;
	PxU8  userDataCfg;
	PxU16 eventId;
	PxU32 startTime;
	PxU32 endTime;
} kernelEvent_st;

#if ENABLE_CTA_PROFILING && __CUDA_ARCH__ > 100  // atomicAdd needs SM11

// extMem is the void* returned by GpuDispatcher::getCurrentProfileBuffer()
// kernelEnum is the value returned by GpuDispatcher::registerKernelNames() plus your local index

__device__
void fillKernelEvent( kernelEvent_sd& ev, PxU16 id, int threadID )
{
	int smidVal;
	int hwWarpId;
	int smclock;
	asm("mov.u32" " %0, %clock;" : "=r" (smclock));
	asm("mov.u32" " %0, %smid;" : "=r" (smidVal));
	asm("mov.u32" " %0, %warpid;" : "=r" (hwWarpId));
	ev.block		= (blockIdx.x + gridDim.x*blockIdx.y);
	ev.warp			= (threadID >> 5);
	ev.mpId			= smidVal;
	ev.eventId		= id;
	ev.hwWarpId		= hwWarpId;
	ev.startTime	= smclock;
	ev.endTime		= smclock;
	ev.userDataCfg	= 0;
}

#define KERNEL_START_EVENT(extMem, kernelEnum)															\
__shared__ volatile int _prof_offset_;																	\
if( extMem ) {																							\
	int threadID = threadIdx.x + blockDim.x*(threadIdx.y + blockDim.y*threadIdx.z);						\
	physx::shdfnd::kernelEvent_st ev;																	\
	physx::shdfnd::fillKernelEvent( ev, kernelEnum, threadID );											\
	if (threadID == 0)																					\
		_prof_offset_ = 1 + atomicAdd( extMem, ((blockDim.x * blockDim.y * blockDim.z) + 0x1f) >> 5 );	\
	__syncthreads();																					\
	if ((threadID & 0x1f) == 0) {																		\
		int index = _prof_offset_ + (threadID >> 5);													\
		if (index < NUM_CTAS_PER_PROFILE_BUFFER)														\
			((int4 *) extMem)[ index ] = *(int4*)&ev;													\
	}																									\
}

#define KERNEL_STOP_EVENT(extMem, kernelEnum)															\
if( extMem ) {																							\
	int threadID = threadIdx.x + blockDim.x*(threadIdx.y + blockDim.y*threadIdx.z);						\
	if ((threadID & 0x1f) == 0) {																		\
		int index = _prof_offset_ + (threadID >> 5);													\
		int regVal;																						\
		asm("mov.u32" " %0, %clock;" : "=r" (regVal));													\
		if (index < NUM_CTAS_PER_PROFILE_BUFFER)														\
			((int4 *)extMem)[ index ].w = regVal;														\
	}																									\
}

#else // !ENABLE_CTA_PROFILING

#define KERNEL_STOP_EVENT(extMem, kernelEnum)
#define KERNEL_START_EVENT(extMem, kernelEnum)

#endif

} // end namespace shdfnd
} // end namespace physx

#endif /** __PSPA_GPU_EVENT_SRC___ */


text:
title: "Testing Scala projects"
---

We scan Scala projects by examining your `build.sbt` to compare the specific versions of every [direct and deep dependency](https://snyk.io/docs/faqs/#about-known-vulnerabilities) in your project against our [Maven vulnerability database](/vuln?type=maven).


text:
package org.zentaur.http;

import static org.zentaur.http.Response.Status.METHOD_NOT_ALLOWED;

import java.io.IOException;

/**
 * Provides an abstract class to be subclassed to create
 * an HTTP handler.
 *
 * This class is inspired from HttpServlet.
 *
 * A subclass should override at least one method, usually one of:
 *
 *

 *
options, for HTTP OPTIONS requests

 *
get, for HTTP GET requests

 *
head, for HTTP HEAD requests

 *
post, for HTTP POST requests

 *
put, for HTTP PUT requests

 *
delete, for HTTP DELETE requests

 *
trace, for HTTP TRACE requests

 *
connect, for HTTP CONNECT requests

 *

 */
public abstract class BaseRequestHandler
    implements RequestHandler
{

    /**
     * {@inheritDoc}
     */
    public final void handle( Request request, Response response )
        throws IOException
    {
        switch ( request.getMethod() )
        {
            case OPTIONS:
                options( request, response );
                break;

            case GET:
                get( request, response );
                break;

            case HEAD:
                head( request, response );
                break;

            case POST:
                post( request, response );
                break;

            case PUT:
                put( request, response );
                break;

            case DELETE:
                delete( request, response );
                break;

            case TRACE:
                trace( request, response );
                break;

            case CONNECT:
                connect( request, response );
                break;
        }
    }

    /**
     * HTTP OPTIONS request.
     *
     * @param request the HTTP request
     * @param response the HTTP response
     * @throws IOException if any error occurs while HTTP negotiation
     */
    protected void options( Request request, Response response )
        throws IOException
    {
        notAllowed( response );
    }

    /**
     * HTTP GET request.
     *
     * @param request the HTTP request
     * @param response the HTTP response
     * @throws IOException if any error occurs while HTTP negotiation
     */
    protected void get( Request request, Response response )
        throws IOException
    {
        notAllowed( response );
    }

    /**
     * HTTP HEAD request.
     *
     * @param request the HTTP request
     * @param response the HTTP response
     * @throws IOException if any error occurs while HTTP negotiation
     */
    protected void head( Request request, Response response )
        throws IOException
    {
        notAllowed( response );
    }

    /**
     * HTTP POST request.
     *
     * @param request the HTTP request
     * @param response the HTTP response
     * @throws IOException if any error occurs while HTTP negotiation
     */
    protected void post( Request request, Response response )
        throws IOException
    {
        notAllowed( response );
    }

    /**
     * HTTP PUT request.
     *
     * @param request the HTTP request
     * @param response the HTTP response
     * @throws IOException if any error occurs while HTTP negotiation
     */
    protected void put( Request request, Response response )
        throws IOException
    {
        notAllowed( response );
    }

    /**
     * HTTP DELETE request.
     *
     * @param request the HTTP request
     * @param response the HTTP response
     * @throws IOException if any error occurs while HTTP negotiation
     */
    protected void delete( Request request, Response response )
        throws IOException
    {
        notAllowed( response );
    }

    /**
     * HTTP TRACE request.
     *
     * @param request the HTTP request
     * @param response the HTTP response
     * @throws IOException if any error occurs while HTTP negotiation
     */
    protected void trace( Request request, Response response )
        throws IOException
    {
        notAllowed( response );
    }

    /**
     * HTTP CONNECT request.
     *
     * @param request the HTTP request
     * @param response the HTTP response
     * @throws IOException if any error occurs while HTTP negotiation
     */
    protected void connect( Request request, Response response )
        throws IOException
    {
        notAllowed( response );
    }

    /**
     * Initializes the status of the response as METHOD_NOT_ALLOWED
     *
     * @param response the HTTP response
     */
    private void notAllowed( Response response )
    {
        response.setStatus( METHOD_NOT_ALLOWED );
    }

}


text:
using System;

namespace NuPattern.Runtime.Serialization
{
    /// <summary>
    /// A custom converter for creating Json objects.
    /// </summary>
    public abstract class CustomCreationConverter<T> : JsonConverter
    {
        /// <summary>
        /// Creates a new instance of the <see cref="CustomCreationConverter{T}"/> class.
        /// </summary>
        protected CustomCreationConverter()
            : base(new CustomCreationConverterInternal<T>())
        {
            ((CustomCreationConverterInternal<T>)this.InnerConverter).CreateCallBack = Create;
        }

        /// <summary>
        /// Creates an object which will then be populated by the serializer.
        /// </summary>
        public abstract T Create(System.Type objectType);
    }

    /// <summary>
    /// A wrapper class for a custom creationc converter.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    internal class CustomCreationConverterInternal<T> : Newtonsoft.Json.Converters.CustomCreationConverter<T>
    {
        public Func<Type, T> CreateCallBack;

        /// <summary>
        /// Creates something
        /// </summary>
        /// <param name="objectType"></param>
        /// <returns></returns>
        public override T Create(Type objectType)
        {
            return CreateCallBack(objectType);
        }
    }
}


text:
package com.metapatrol.gitlab.ci.runner.entrypoint;

import com.metapatrol.gitlab.ci.runner.commands.StartCommand;
import com.metapatrol.gitlab.ci.runner.engine.Engine;
import org.apache.log4j.Logger;

/**
 * @author Denis Neuling (denisneuling@gmail.com)
 */
public class StartEntryPoint extends EntryPoint<StartCommand> {
    private Logger log = Logger.getLogger(getClass());

    @Override
    public boolean enter(StartCommand command) {
        log.info("Starting Gitlab CI Runner.");

        new Engine().start();

        return true;
    }
}


text:
<?php $html_head = array(
'pageID' => 'pageHome',
'title'=>'',
'description'=>'',
'keywords'=>'',
'canonical'=>'',
'css'=> array('home')
);
$this->load->view('includes/header', $html_head);?>

Welcome

Good news, everyone! I've taught the toaster to feel love! You guys go on without me! I'm going to go… look for more stuff to steal! Oh right.

Good news, everyone! I've taught the toaster to feel love! You guys go on without me! I'm going to go… look for more stuff to steal! Oh right.

Good news, everyone! I've taught the toaster to feel love! You guys go on without me! I'm going to go… look for more stuff to steal! Oh right.

Home

About

Services

Contact Us

Referance

<?php $this->load->view('includes/footer');?>


text:
package org.dominokit.domino.apt.client.processors.module.client.presenters.model;

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

public class DependsOnModel {

  private List<EventsGroup> eventsGroups = new ArrayList<>();

  public DependsOnModel() {}

  public void addEventGroup(EventsGroup eventsGroup) {
    this.eventsGroups.add(eventsGroup);
  }

  public List<EventsGroup> getEventsGroups() {
    return eventsGroups;
  }
}


text:
> The process of setting up and starting a WSO2 Carbon server is explained below. For the full list of capabilities available in this kernel version, see the **features** section in the [root README.md file](../README.md#key-features-and-tools).

See the following sub topics on how to get started with WSO2 Carbon.

* **[Installation Prerequisites](#installation-prerequisites)**
* **[Setting `JAVA_HOME`](#setting-java_home)**
* **[Downloading the Kernel](#downloading-the-kernel)**
* **[Launching the Kernel](#launching-the-kernel)**

## Installation Prerequisites
Prior to installing any WSO2 Carbon-based product, it is necessary to have the appropriate prerequisite software installed on your system. Verify that the computer has the supported operating system and development platform before starting the installation.

 * ### System requirements
   * **Memory:** ~ 256 MB minimum
   * **Disk:** ~ 50 MB, excluding space allocated for log files.

 * ### Environment compatibility

   **Operating Systems/Databases:** WSO2 Carbon Kernel can be run on Windows / Linux and MacOS platforms that are Oracle/Open JDK 1.8.* compliant.

 * ### Supporting applications

   The following applications are required for running the product and its samples or for using the source code to build a product. Mandatory installs are marked with an asterisk (*).

   * [*Oracle Java SE Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) version 1.8 is required for the following:
     * To launch the product, as a Carbon product is a Java application.
     * To build the product from the source distribution (both JDK and Apache Maven are required).

   * [Apache Maven](http://maven.apache.org/) version 3.3.x is required for the following:
     * To build the product from the source distribution (both JDK and Apache Maven are required). If you are installing the product by  downloading and extracting the binary distribution instead of building from the source code, you do not need to install Maven.
     * To build samples.

## Setting `JAVA_HOME`

 * ### On Linux: Setting `JAVA_HOME`

  You must set your `JAVA_HOME` environment variable to point to the directory where the Java Development Kit (JDK) is installed on the computer. The way you set the `JAVA_HOME` depends on the operating system and the shell you are using.

  > Environment variables are global system variables accessible to all the processes running under the operating system.

    1. In your home directory, open the `.bashrc` file in your favorite Linux text editor.
    2. Add the following two lines at the bottom of the file, replacing `/opt/java/jdk1.8.*` with the actual directory where the JDK is installed.

           export JAVA_HOME=<jdk-install-dir>
           export PATH=$JAVA_HOME/bin:$PATH

    3. To get the changes reflected, run the following command:

           source ~/.bashrc

    4. To verify that the JAVA_HOME variable is set correctly, execute the following command:

           echo $JAVA_HOME

       The above command should return the JDK installation path.

 * ### On Windows: Setting `JAVA_HOME`

    You must set your `JAVA_HOME` environment variable to point to the directory where the Java Development Kit (JDK) is installed on the computer. Typically, the JDK is installed in a directory under `C:\Program Files\Java`, such as `C:\Program Files\Java\jdk1.8.*`.

    > Environment variables are global system variables accessible to all the processes running under the operating system. You can define an environment variable as a system variable, which applies to all users, or as a user variable, which applies only to the user who is currently logged in.

    You can set `JAVA_HOME` using the system properties, as described below. Alternatively, if you just want to set `JAVA_HOME` temporarily in the current command prompt window, set it at the command prompt.

   * Setting `JAVA_HOME` using system properties

     1. Right-click the **My Computer** icon on the desktop and click **Properties**.
     2. In the **System Properties** window, go to the **Advanced** tab, and then click **Environment Variables**.
     3. Click **New** under "System variables" (for all users) or under "User variables" (just for the user who is currently logged in).
     4. Enter the following information:
        * In the **Variable name** field, enter: `JAVA_HOME`
        * In the **Variable value** field, enter the installation path of the Java Development Kit, such as: `c:\Program Files\Java jdk1.8.*`
     5. Click **OK**.

     The `JAVA_HOME` variable is now set and will apply to any subsequent command prompt windows that you open. If you have any command prompt windows currently running, you must close and reopen them for the `JAVA_HOME` variable to take effect, or manually set the `JAVA_HOME` variable in those command prompt windows as described in the next section. To verify that the `JAVA_HOME` variable is set correctly, open a command window (from the Start menu, click Run, and then type **CMD** and click **Enter**) and execute the following command:

          set JAVA_HOME

      The system returns the JDK installation path.

    * Setting `JAVA_HOME` temporarily using the Windows command prompt (CMD)

      You can temporarily set the `JAVA_HOME` environment variable within a Windows command prompt window (CMD). This is useful when you have an existing command prompt window running and you do not want to restart it.

      1. In the command prompt window, enter the following command where `<JDK_INSTALLATION_PATH>` is the JDK installation directory and press Enter: `set JAVA_HOME=<JDK_INSTALLATION_PATH>`.
      For example: `set JAVA_HOME=c:\Program Files\java\jdk1.8.*`.
       The `JAVA_HOME` variable is now set only for the current CMD session.

      2. To verify that the `JAVA_HOME` variable is set correctly, execute the following command:
 set `JAVA_HOME`.
       The system returns the JDK installation path.

## Downloading the Kernel
You can download the product distribution from here.
Extract the archive file to a dedicated directory for the product, which will hereafter be referred to as `<PRODUCT_HOME>`.

## Launching the Kernel

  * ### Starting the server
    To start the server, you need to run the `carbon.bat` (on Windows) script or the `carbon.sh` (on Linux) script from the `<PRODUCT_HOME>/bin` folder:

    > To start and stop the server in the daemon mode in Linux, run `carbon.sh start` and `carbon.sh stop` commands.

    1. Open a command prompt.
    (On **Windows**, choose `Start -> Run`, type `cmd` at the prompt, and press **Enter**).
    2. Execute one of the following commands, where `<PRODUCT_HOME>` is the directory where you installed the product distribution:
      * **On Windows:**	`<PRODUCT_HOME>\bin\carbon.bat`
      * **On Linux/Solaris:** `sh <PRODUCT_HOME>/bin/carbon.sh`

    Now, the server startup logs will get printed. When the server startup is completed, the log will display the following message: "WSO2 Carbon started in 'n' seconds."

  * ### Stopping the server
    To stop the server, press **Ctrl+C** in the command window. If you have started the server in `daemon` mode in Linux, `run carbon.sh stop` command.


text:
using namespace Glay;
using namespace Tesca::Provision;
using namespace Tesca::Storage;
using namespace std;

namespace Tesca
{
	namespace Arithmetic
	{
		UnaryExtractor::UnaryExtractor (Extractor const* operand, const string& prefix, Callback callback) :
			callback (callback),
			operand (operand),
			prefix (prefix)
		{
		}

		string UnaryExtractor::createName (Int32u slot) const
		{
			return this->prefix + "_" + this->operand->createName (slot);
		}

		Variant UnaryExtractor::collect (Aggregator const* const* aggregators) const
		{
			return this->callback (this->operand->collect (aggregators));
		}

		Variant UnaryExtractor::extract (Row const& row) const
		{
			return this->callback (this->operand->extract (row));
		}

		void UnaryExtractor::recurse (RecurseCallback callback) const
		{
			callback (this->operand);
		}
	}
}


text:
require "rails_helper"

RSpec.describe NewsItem, type: :model do
  it_behaves_like "an author"

  describe ".published" do
    # Published
    let(:recent_item) { create(:news_item, :published) }
    let(:older_item) { create(:news_item, :published, published_at: 1.year.ago) }
    # Unpublished
    let(:archived_item) { create(:news_item, :archived) }
    let(:draft_item) { create(:news_item, :draft) }

    it "returns a sorted array of most recently published items first" do
      expect(NewsItem.published).to eq [recent_item, older_item]
    end

    it "does not return archived items" do
      expect(NewsItem.published).not_to include archived_item
    end

    it "does not return draft items" do
      expect(NewsItem.published).not_to include draft_item
    end
  end

  describe "validation" do
    subject { FactoryGirl.create(:news_item) }
    it { is_expected.to validate_presence_of(:state) }

    context "when published" do
      subject { FactoryGirl.create(:news_item, :published) }

      it { is_expected.to validate_presence_of(:published_at) }
      it { is_expected.to validate_presence_of(:title) }
      it do
        is_expected.to validate_length_of(:title).
          is_at_most(ActiveRecordExtensions::MAX_STRING_COLUMN_LENGTH)
      end
      it { is_expected.to validate_presence_of(:body) }
      it do
        is_expected.to validate_length_of(:body).
          is_at_most(ActiveRecordExtensions::MAX_TEXT_COLUMN_LENGTH)
      end
    end

    context "when draft" do
      subject { FactoryGirl.create(:news_item, :draft) }

      it { is_expected.to_not validate_presence_of(:published_at) }
      it { is_expected.to_not validate_presence_of(:title) }
      it { is_expected.to_not validate_presence_of(:body) }
    end

    context "for state" do
      NewsItem::STATES.each do |state|
        it "passes for value #{state}" do
          news_item = build(:news_item, state: state)
          expect(news_item).to be_valid
        end
      end
      it "fails for invalid value" do
        news_item = build(:news_item, state: "someinvalidvalue")
        expect(news_item).to_not be_valid
        expect(news_item.errors.messages[:state]).to be_present
      end
      it "fails for empty value" do
        news_item = build(:news_item, state: "")
        expect(news_item).to_not be_valid
        expect(news_item.errors.messages[:state]).to be_present
      end
      it "fails for not being present (nil value)" do
        news_item = build(:news_item, state: nil)
        expect(news_item).to_not be_valid
        expect(news_item.errors.messages[:state]).to be_present
      end
    end

    context "for published_at" do
      it "passes when published_at is present and the news item state is
          published" do
        news_item = build :news_item,
                          state: :published,
                          published_at: Date.yesterday
        expect(news_item).to be_valid
        expect(news_item.errors.messages[:published_at]).to_not be_present
      end
      it "fails when published_at is not present and the news item state is
          published" do
        news_item = build(:news_item, state: "published", published_at: nil)
        expect(news_item).to_not be_valid
        expect(news_item.errors.messages[:published_at]).to be_present
      end
      it "passes when published_at is not present and the news item state is
          other than published" do
        news_item = build(:news_item, state: "draft", published_at: nil)
        expect(news_item).to be_valid
        expect(news_item.errors.messages[:published_at]).to_not be_present
      end
      it "passes when published_at is not present and the news item state is
          nil" do
        news_item = build(:news_item, state: nil, published_at: nil)
        expect(news_item).to_not be_valid # state is nil
        expect(news_item.errors.messages[:published_at]).to_not be_present
      end
    end
  end
end


text:
//
//  GMSPolyline.h
//  Google Maps SDK for iOS
//
//  Copyright 2012 Google Inc.
//
//  Usage of this SDK is subject to the Google Maps/Google Earth APIs Terms of
//  Service: https://developers.google.com/maps/terms
//

#import <UIKit/UIKIt.h>

#import <GoogleMaps/GMSOverlay.h>

@class GMSPath;

NS_ASSUME_NONNULL_BEGIN

/** Describes the drawing style for one-dimensional entities such as polylines. */
@interface GMSStrokeStyle : NSObject

/** Creates a solid color stroke style. */
+ (instancetype)solidColor:(UIColor *)color;

/** Creates a gradient stroke style interpolating from |fromColor| to |toColor|. */
+ (instancetype)gradientFromColor:(UIColor *)fromColor toColor:(UIColor *)toColor;

@end

/** Describes the style for some region of a polyline. */
@interface GMSStyleSpan : NSObject

/**
 * Factory returning a solid color span of length one segment. Equivalent to
 * [GMSStyleSpan spanWithStyle:[GMSStrokeStyle solidColor:|color|] segments:1].
 */
+ (instancetype)spanWithColor:(UIColor *)color;

/**
 * Factory returning a solid color span with a given number of segments. Equivalent to
 * [GMSStyleSpan spanWithStyle:[GMSStrokeStyle solidColor:|color|] segments:|segments|].
 */
+ (instancetype)spanWithColor:(UIColor *)color segments:(double)segments;

/**
 * Factory returning a span with the given |style| of length one segment. Equivalent to
 * [GMSStyleSpan spanWithStyle:|style| segments:1].
 */
+ (instancetype)spanWithStyle:(GMSStrokeStyle *)style;

/**
 * Factory returning a span with the given |style| and length in number of segments.
 * |segments| must be greater than 0 (i.e. can't be 0).
 */
+ (instancetype)spanWithStyle:(GMSStrokeStyle *)style segments:(double)segments;

/** The style of this span. */
@property(nonatomic, readonly) GMSStrokeStyle *style;

/** The length of this span in number of segments. */
@property(nonatomic, readonly) double segments;

@end

/**
 * GMSPolyline specifies the available options for a polyline that exists on the Earth's surface.
 * It is drawn as a physical line between the points specified in |path|.
 */
@interface GMSPolyline : GMSOverlay

/**
 * The path that describes this polyline.
 */
@property(nonatomic, copy, nullable) GMSPath *path;

/**
 * The width of the line in screen points. Defaults to 1.
 */
@property(nonatomic, assign) CGFloat strokeWidth;

/**
 * The UIColor used to render the polyline. Defaults to [UIColor blueColor].
 */
@property(nonatomic, strong) UIColor *strokeColor;

/** Whether this line should be rendered with geodesic correction. */
@property(nonatomic, assign) BOOL geodesic;

/**
 * Convenience constructor for GMSPolyline for a particular path. Other properties will have
 * default values.
 */
+ (instancetype)polylineWithPath:(nullable GMSPath *)path;

/**
 * An array containing GMSStyleSpan, the spans used to render this polyline.
 *
 * If this array contains fewer segments than the polyline itself, the final segment will be applied
 * over the remaining length. If this array is unset or empty, then |strokeColor| is used for the
 * entire line instead.
 */
@property(nonatomic, copy, nullable) NSArray<GMSStyleSpan *> *spans;

@end

NS_ASSUME_NONNULL_END


text:
layout: post
title: Ruby Constant Resolution Operator (::)
---

I came across `::ENV` and `ENV` when I was reading the Figaro gem.  I was not able to articulate the difference between the two, so I set out to find more about the constant resolution operator (::).  Hopefully this will be useful for others as well.

Let's play around with it in irb (or alternatively, pry), to get a feel of what we are dealing with:

```
[1] pry(main)> ENV
=> {"CLUTTER_IM_MODULE"=>"xim",
 "COLUMNS"=>"119",
 "DBUS_SESSION_BUS_ADDRESS"=>"unix:abstract=/tmp/dbus-o7ga8nDMeL",
 "DEFAULTS_PATH"=>"/usr/share/gconf/Lubuntu.default.path",
 ...
 "XMODIFIERS"=>"@im=ibus",
 "ZSH"=>"/home/eric/.oh-my-zsh",
 "_LXSESSION_PID"=>"1689"}
[2] pry(main)>
```

It looks like `ENV` has all of my environment variables already.  So I suspect this is built into Ruby already.  Indeed, this is the [ENV class documentation](http://www.ruby-doc.org/core-2.1.2/ENV.html).  Then I tried:

```
[2] pry(main)> ::ENV
=> {"CLUTTER_IM_MODULE"=>"xim",
 "COLUMNS"=>"119",
 "DBUS_SESSION_BUS_ADDRESS"=>"unix:abstract=/tmp/dbus-o7ga8nDMeL",
 "DEFAULTS_PATH"=>"/usr/share/gconf/Lubuntu.default.path",
...
 "XMODIFIERS"=>"@im=ibus",
 "ZSH"=>"/home/eric/.oh-my-zsh",
 "_LXSESSION_PID"=>"1689"}
[3] pry(main)>
```

It seems like we are getting the same output for both `ENV` and `::ENV`.  What does the `::` do?  The clearest explanation I can find is an excerpt from Dave Thomas and Andy Hunt's [Programming Ruby - The Pragmatic Programmer's Guide](http://ruby-doc.com/docs/ProgrammingRuby/) -> The Ruby Language (section) -> Scope of Constants and Variables (sub-section):

**"Constants defined outside any class or module may be accessed unadorned or by using the scope operator `::` with no prefix."**

But wait, we just confirmed that `ENV` is a Ruby core class.  Is it also a constant? Yes, in Ruby, [class names and module names are constants](http://rubylearning.com/satishtalim/ruby_names.html).   Let's confirm that:

```
[3] pry(main)> Object.constants
=> [:Object,
 :Module,
 :Class,
 ...
 :ENV,
 ...
 :RUBYGEMS_ACTIVATION_MONITOR]
[4] pry(main)>
```

`ENV` is indeed one of `Object`'s constants.

So far, we still have not figured out why the Figaro gem uses [`::ENV`](https://github.com/laserlemon/figaro/blob/master/lib/figaro/env.rb#L33) instead of `ENV` to access the Ruby built-in `ENV` class:

```
module Figaro
  module ENV
    extend self
    # ...
    def has_key?(key)
      ::ENV.any? { |k, _| k.downcase == key }
    end
    # ...
  end
end
```

Could it be because Figaro also defines it's own module named `ENV`?  To test this out, let's use a custom made example:

```
[1] pry(main)> module MyModule
[1] pry(main)*   module ENV
[1] pry(main)*     extend self
[1] pry(main)*     def envvar(name)
[1] pry(main)*       ::ENV.fetch(name)
[1] pry(main)*     end
[1] pry(main)*   end
[1] pry(main)* end
=> :envvar
[2] pry(main)> MyModule::ENV.envvar("HOME")
=> "/home/eric"
[3] pry(main)>
```

`::ENV` from the above example is using Ruby's built-in class, which knows about the [fetch](http://www.ruby-doc.org/core-2.1.2/ENV.html) method.  Now let's try:

```
[3] pry(main)> module MyModule
[3] pry(main)*   module ENV
[3] pry(main)*     extend self
[3] pry(main)*     def envvar(name)
[3] pry(main)*       ENV.fetch(name)
[3] pry(main)*     end
[3] pry(main)*   end
[3] pry(main)* end
=> :envvar
[4] pry(main)> MyModule::ENV.envvar("HOME")
NoMethodError: undefined method `fetch' for MyModule::ENV:Module
from (pry):14:in `envvar'
[5] pry(main)>
```

Here, `ENV` resolves to `MyModule::ENV`, which does not know about the `fetch` method.  How come `ENV` does not resolve to the built-in Ruby `ENV` class?  Based on [Stackoverflow Q&A](http://stackoverflow.com/questions/5032844/ruby-what-does-prefix-do),
the prefix `::` refers to the global scope, so `::ENV` resolves to the build-in Ruby `ENV` class.  Without the prefix, `ENV` resolves to `MyModule::ENV` because when Ruby tries to resolve a constant, it begins searching within the current module or class, and continues searching the enclosing scope.  (For more details, check out [@valve's article](http://valve.github.io/blog/2013/10/26/constant-resolution-in-ruby/))


text:
package com.rampatra.bits;

/**
 * Created by rampatra on 30/05/2016.
 */
public class BinaryGap {

    /**
     * A binary gap of a positive integer N is any maximal
     * sequence of consecutive zeros that is surrounded by ones
     * at both ends in the binary representation of N.
     *
     * @param n
     * @return
     */
    public static int findBinaryGap(long n) {
        int gap = 0;
        int maxGap = 0;
        while (n > 0) {
            if ((n & 1) == 1) {
                while (n >>> 1 > 0 && (n >>> 1 & 1) == 0) {
                    gap++;
                    n = n >>> 1;
                }
                if (gap > maxGap) {
                    maxGap = gap;
                }
                gap = 0;
            }
            n = n >>> 1;
        }

        return maxGap;
    }

    public static int findMaxNoOf0sBetweenTwo1s(long n) {
        return findBinaryGap(n);
    }

    public static void main(String[] args) {
        System.out.println(findBinaryGap(2));
        System.out.println(findBinaryGap(8));
        System.out.println(findBinaryGap(9));
        System.out.println(findBinaryGap(16));
        System.out.println(findBinaryGap(17));
        System.out.println(findMaxNoOf0sBetweenTwo1s(121));
        System.out.println(findMaxNoOf0sBetweenTwo1s(1041));
        System.out.println(findMaxNoOf0sBetweenTwo1s(2_147_483_64889L));
    }
}


text:
author: slowe
comments: true
date: 2007-10-08 16:37:44+00:00
layout: post
slug: vm-file-level-recovery-with-netapp-snapshots
title: VM File-Level Recovery with NetApp Snapshots
wordpress_id: 557
categories: Tutorial
tags:
- ESX
- NetApp
- NFS
- Snapshot
- Snapshots
- Storage
- Virtualization
- VMware
---

Last year, I wrote an article about [using NetApp Snapshots and LUN clones][1] to enable the recovery on individual files within a VM. This time around, I'd like to have a quick at that same process, but this time using NFS instead of block-level storage.

As I mentioned [a couple of weeks ago][2], NFS is getting more and more attention as a key storage enabler for Virtual Infrastructure implementations. I do still plan to conduct some tests of my own between iSCSI and NFS. (Since they are both IP-based storage protocols, I figure that makes the playing field as level as possible.) In any case, with regards to file-level recovery within VMs, NFS does possess at least one advantage.

Using any sort of clones (LUN clones or FlexClones) within VI3 currently requires resignaturing enabled, or else the ESX Servers don't even **see** the clones. While enabling resignaturing is not difficult (can be done via the command line or via VirtualCenter), it is not the default configuration and VMware appears not to recommend it (per the _SAN Configuration Guide_, pages 112 through 115). With NFS, it's only necessary to create a FlexClone and set up a new NFS mount; no other configuration is required.

By the same token, using NFS for file-level recovery within VMs also has one key disadvantage: LUN clones are free, whereas the use of FlexClone requires a license.

With these advantages and disadvantages in mind, let's have a look at the what the process would look like to recover files inside VMs using NFS for VM storage with NetApp Snapshots.

First, we'd review the list of available Snapshots using the `snap list <volname>` command. For example, for a volume named "nfs\_volume1", the command would be `snap list nfs_volume1`. The output of that command would look something like this:

{% highlight text %}
  %/used       %/total  date          name
----------  ----------  ------------  --------
  0% ( 0%)    0% ( 0%)  Oct 08 12:00  hourly.0
  0% ( 0%)    0% ( 0%)  Oct 08 08:00  hourly.1
  0% ( 0%)    0% ( 0%)  Oct 08 00:00  nightly.0
  0% ( 0%)    0% ( 0%)  Oct 07 20:00  hourly.2
  0% ( 0%)    0% ( 0%)  Oct 07 16:00  hourly.3
  0% ( 0%)    0% ( 0%)  Oct 07 12:00  hourly.4
  0% ( 0%)    0% ( 0%)  Oct 07 08:00  hourly.5
  0% ( 0%)    0% ( 0%)  Oct 07 00:00  nightly.1`
{% endhighlight %}

Once we identify the Snapshot that contains the data we need to recover (based on the date/time of the Snapshot), we create a FlexClone using that Snapshot as its backing:

	vol clone create nfs_volume1_clone -s file -b nfs_volume1 nightly.0

This creates a FlexClone named nfs\_volume1\_clone based on the nightly.0 Snapshot of the volume nfs\_volume1. If you immediately run the `exportfs` command, you'll see that the new clone is already shared via NFS, too.

From here, the process is pretty straightforward:

1. Create a new NFS datastore within VirtualCenter, using the new NFS mount as the destination. This makes the data inside the FlexClone visible to the existing VMs.

2. Add one of the VMDKs on the cloned NFS datastore to an existing VM as an additional hard drive. You should be able to do this on the fly without shutting down the VM.

3. Extract the files you need and place them back where you want them.

When you're done recovering files, the clean-up process looks like this:

1. Remove the VMDK(s) from the VM to which it/they was/were added.

2. Remove the NFS datastore from VirtualCenter.

3. Destroy the FlexClone using the `vol offline` and `vol destroy` commands.

Overall, this process is rather similar to the technique described using LUN clones, although a bit simpler because resignaturing is not required.

[1]: {% post_url 2006-12-30-recovering-data-inside-vms-using-netapp-snapshots %}
[2]: {% post_url 2007-09-21-nfs-for-vmware-storage %}


text:
/**
 * <EntryList />
 */

import React from 'react';
import classNames from 'classnames';
import { connect } from 'react-redux';

const EntryList = ({ entries }) => (

    { entries.map((entry, i) => {
      const iconClass = classNames(
        'thumbs outline icon',
        { 'up green': parseInt(entry.amount, 10) >= 0 },
        { 'down red': parseInt(entry.amount, 10) < 0 },
      );

      return (

            { entry.content } : { entry.amount }

      );
    })}

);

export default connect(state => ({ entries: state.app.entries }))(EntryList);


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>Stack parameters (display gap between numerator and denominator)</title>
<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
<link rel="match" href="frac-parameters-gap-006-ref.html"/>
<meta name="assert" content="Element mfrac with zero linethickness correctly uses the StackGapMin parameter from the MATH table when denominator contains text.">

    This test passes if the blue squares are aligned:

    <math style="font-family: gapmin8000">

      <mspace height="10em" depth="10em"/>

      <mfrac linethickness="0px">
        <mspace width="3em" depth="1em"/>
        <mspace id="reference" width="3em" height=".5em" depth=".5em"/>
      </mfrac>
      <mfrac linethickness="0px">
        <mspace width="3em" depth="1em"/>
        <mtext>A</mtext>
      </mfrac>
      <mfrac linethickness="0px">
        <mspace width="3em" depth="1.5em"/>
        <mtext>B</mtext>
      </mfrac>
      <mfrac linethickness="0px">
        <mspace width="3em" depth=".5em"/>
        <mtext>C</mtext>
      </mfrac>
    </math>


text:
/**
 * @author mikael emtinger / http://gomo.se/
 */

// do not crash if somebody includes the file in oldie browser

if ( !window.Float32Array ) {

	window.Float32Array = Array;

}

THREE.SkinnedMesh = function( geometry, materials ) {

	THREE.Mesh.call( this, geometry, materials );

	// init bones

	this.identityMatrix = new THREE.Matrix4();

	this.bones = [];
	this.boneMatrices = [];

	var b, bone, gbone, p, q, s;

	if ( this.geometry.bones !== undefined ) {

		for ( b = 0; b < this.geometry.bones.length; b++ ) {

			gbone = this.geometry.bones[ b ];

			p = gbone.pos;
			q = gbone.rotq;
			s = gbone.scl;

			bone = this.addBone();

			bone.name = gbone.name;
			bone.position.set( p[0], p[1], p[2] );
			bone.quaternion.set( q[0], q[1], q[2], q[3] );

			if ( s !== undefined ) {

				bone.scale.set( s[0], s[1], s[2] );

			} else {

				bone.scale.set( 1, 1, 1 );

			}

		}

		for ( b = 0; b < this.bones.length; b++ ) {

			gbone = this.geometry.bones[ b ];
			bone = this.bones[ b ];

			if ( gbone.parent === -1 ) {

				this.addChild( bone );

			} else {

				this.bones[ gbone.parent ].addChild( bone );

			}

		}

		this.boneMatrices = new Float32Array( 16 * this.bones.length );

		this.pose();

	}

};

THREE.SkinnedMesh.prototype = new THREE.Mesh();
THREE.SkinnedMesh.prototype.constructor = THREE.SkinnedMesh;

/*
 * Update
 */

THREE.SkinnedMesh.prototype.update = function ( parentMatrixWorld, forceUpdate, camera ) {

	// visible?

	if ( this.visible ) {

		// update local

		if ( this.matrixAutoUpdate ) {

			forceUpdate |= this.updateMatrix();

		}

		// update global

		if ( forceUpdate || this.matrixNeedsUpdate ) {

			if ( parentMatrixWorld ) {

				this.matrixWorld.multiply( parentMatrixWorld, this.matrix );

			} else {

				this.matrixWorld.copy( this.matrix );

			}

			this.matrixNeedsUpdate = false;
			forceUpdate = true;

		}

		// update children

		var child, i, l = this.children.length;

		for ( i = 0; i < l; i++ ) {

			child = this.children[ i ];

			if ( child instanceof THREE.Bone ) {

				child.update( this.identityMatrix, false, camera );

			} else {

				child.update( this.matrixWorld, forceUpdate, camera );

			}

		}

	}

};

/*
 * Add
 */

THREE.SkinnedMesh.prototype.addBone = function( bone ) {

	if ( bone === undefined ) {

		bone = new THREE.Bone( this );

	}

	this.bones.push( bone );

	return bone;

};

/*
 * Pose
 */

THREE.SkinnedMesh.prototype.pose = function() {

	this.update( undefined, true );

	var bim, bone, boneInverses = [];

	for ( var b = 0; b < this.bones.length; b++ ) {

		bone = this.bones[ b ];

		boneInverses.push( THREE.Matrix4.makeInvert( bone.skinMatrix ) );

		bone.skinMatrix.flattenToArrayOffset( this.boneMatrices, b * 16 );

	}

	// project vertices to local

	if ( this.geometry.skinVerticesA === undefined ) {

		this.geometry.skinVerticesA = [];
		this.geometry.skinVerticesB = [];

		var orgVertex, vertex;

		for ( var i = 0; i < this.geometry.skinIndices.length; i++ ) {

			orgVertex = this.geometry.vertices[ i ].position;

			var indexA = this.geometry.skinIndices[ i ].x;
			var indexB = this.geometry.skinIndices[ i ].y;

			vertex = new THREE.Vector3( orgVertex.x, orgVertex.y, orgVertex.z );
			this.geometry.skinVerticesA.push( boneInverses[ indexA ].multiplyVector3( vertex ) );

			vertex = new THREE.Vector3( orgVertex.x, orgVertex.y, orgVertex.z );
			this.geometry.skinVerticesB.push( boneInverses[ indexB ].multiplyVector3( vertex ) );

			// todo: add more influences

			// normalize weights

			if ( this.geometry.skinWeights[ i ].x + this.geometry.skinWeights[ i ].y !== 1 ) {

				var len = ( 1.0 - ( this.geometry.skinWeights[ i ].x + this.geometry.skinWeights[ i ].y )) * 0.5;
				this.geometry.skinWeights[ i ].x += len;
				this.geometry.skinWeights[ i ].y += len;

			}

		}

	}

};


text:
/**
 * S3 Storage
 */

@interface EC2S3Storage:NSObject

{
    NSString *bucket;
    NSString *prefix;
    NSString *aWSAccessKeyId;
    NSString *uploadPolicy;
    NSString *uploadPolicySignature;
}

/**
 * Default constructor for a new  object.  Callers should use the
 * property methods to initialize this object after creating it.
 */
-(id)init;

/**
 * The bucket in which to store the AMI. You can specify a bucket that
 * you already own or a new bucket that Amazon EC2 creates on your
 * behalf. <p> If you specify a bucket that belongs to someone else,
 * Amazon EC2 returns an error.
 */
@property (nonatomic, retain) NSString *bucket;

/**
 * The prefix to use when storing the AMI in S3.
 */
@property (nonatomic, retain) NSString *prefix;

/**
 * The Access Key ID of the owner of the Amazon S3 bucket.
 */
@property (nonatomic, retain) NSString *aWSAccessKeyId;

/**
 * A Base64-encoded Amazon S3 upload policy that gives Amazon EC2
 * permission to upload items into Amazon S3 on the user's behalf.
 */
@property (nonatomic, retain) NSString *uploadPolicy;

/**
 * The signature of the Base64 encoded JSON document.
 */
@property (nonatomic, retain) NSString *uploadPolicySignature;

/**
 * Returns a string representation of this object; useful for testing and
 * debugging.
 *
 * @return A string representation of this object.
 */
-(NSString *)description;

@end


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/spanner/v1/spanner.proto

package com.google.spanner.v1;

/**
 *

 * The request for [CreateSession][google.spanner.v1.Spanner.CreateSession].
 *

 *
 * Protobuf type {@code google.spanner.v1.CreateSessionRequest}
 */
public  final class CreateSessionRequest extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.spanner.v1.CreateSessionRequest)
    CreateSessionRequestOrBuilder {
private static final long serialVersionUID = 0L;
  // Use CreateSessionRequest.newBuilder() to construct.
  private CreateSessionRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private CreateSessionRequest() {
    database_ = "";
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private CreateSessionRequest(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          default: {
            if (!parseUnknownFieldProto3(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
          case 10: {
            java.lang.String s = input.readStringRequireUtf8();

            database_ = s;
            break;
          }
          case 18: {
            com.google.spanner.v1.Session.Builder subBuilder = null;
            if (session_ != null) {
              subBuilder = session_.toBuilder();
            }
            session_ = input.readMessage(com.google.spanner.v1.Session.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(session_);
              session_ = subBuilder.buildPartial();
            }

            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.spanner.v1.SpannerProto.internal_static_google_spanner_v1_CreateSessionRequest_descriptor;
  }

  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.spanner.v1.SpannerProto.internal_static_google_spanner_v1_CreateSessionRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.spanner.v1.CreateSessionRequest.class, com.google.spanner.v1.CreateSessionRequest.Builder.class);
  }

  public static final int DATABASE_FIELD_NUMBER = 1;
  private volatile java.lang.Object database_;
  /**
   *

   * Required. The database in which the new session is created.
   *

   *
   * string database = 1;
   */
  public java.lang.String getDatabase() {
    java.lang.Object ref = database_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs =
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      database_ = s;
      return s;
    }
  }
  /**
   *

   * Required. The database in which the new session is created.
   *

   *
   * string database = 1;
   */
  public com.google.protobuf.ByteString
      getDatabaseBytes() {
    java.lang.Object ref = database_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      database_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int SESSION_FIELD_NUMBER = 2;
  private com.google.spanner.v1.Session session_;
  /**
   *

   * The session to create.
   *

   *
   * .google.spanner.v1.Session session = 2;
   */
  public boolean hasSession() {
    return session_ != null;
  }
  /**
   *

   * The session to create.
   *

   *
   * .google.spanner.v1.Session session = 2;
   */
  public com.google.spanner.v1.Session getSession() {
    return session_ == null ? com.google.spanner.v1.Session.getDefaultInstance() : session_;
  }
  /**
   *

   * The session to create.
   *

   *
   * .google.spanner.v1.Session session = 2;
   */
  public com.google.spanner.v1.SessionOrBuilder getSessionOrBuilder() {
    return getSession();
  }

  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (!getDatabaseBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, database_);
    }
    if (session_ != null) {
      output.writeMessage(2, getSession());
    }
    unknownFields.writeTo(output);
  }

  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!getDatabaseBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, database_);
    }
    if (session_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(2, getSession());
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof com.google.spanner.v1.CreateSessionRequest)) {
      return super.equals(obj);
    }
    com.google.spanner.v1.CreateSessionRequest other = (com.google.spanner.v1.CreateSessionRequest) obj;

    boolean result = true;
    result = result && getDatabase()
        .equals(other.getDatabase());
    result = result && (hasSession() == other.hasSession());
    if (hasSession()) {
      result = result && getSession()
          .equals(other.getSession());
    }
    result = result && unknownFields.equals(other.unknownFields);
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + DATABASE_FIELD_NUMBER;
    hash = (53 * hash) + getDatabase().hashCode();
    if (hasSession()) {
      hash = (37 * hash) + SESSION_FIELD_NUMBER;
      hash = (53 * hash) + getSession().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.spanner.v1.CreateSessionRequest parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.spanner.v1.CreateSessionRequest parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.spanner.v1.CreateSessionRequest prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *

   * The request for [CreateSession][google.spanner.v1.Spanner.CreateSession].
   *

   *
   * Protobuf type {@code google.spanner.v1.CreateSessionRequest}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.spanner.v1.CreateSessionRequest)
      com.google.spanner.v1.CreateSessionRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.spanner.v1.SpannerProto.internal_static_google_spanner_v1_CreateSessionRequest_descriptor;
    }

    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.spanner.v1.SpannerProto.internal_static_google_spanner_v1_CreateSessionRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.spanner.v1.CreateSessionRequest.class, com.google.spanner.v1.CreateSessionRequest.Builder.class);
    }

    // Construct using com.google.spanner.v1.CreateSessionRequest.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    public Builder clear() {
      super.clear();
      database_ = "";

      if (sessionBuilder_ == null) {
        session_ = null;
      } else {
        session_ = null;
        sessionBuilder_ = null;
      }
      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.spanner.v1.SpannerProto.internal_static_google_spanner_v1_CreateSessionRequest_descriptor;
    }

    public com.google.spanner.v1.CreateSessionRequest getDefaultInstanceForType() {
      return com.google.spanner.v1.CreateSessionRequest.getDefaultInstance();
    }

    public com.google.spanner.v1.CreateSessionRequest build() {
      com.google.spanner.v1.CreateSessionRequest result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.google.spanner.v1.CreateSessionRequest buildPartial() {
      com.google.spanner.v1.CreateSessionRequest result = new com.google.spanner.v1.CreateSessionRequest(this);
      result.database_ = database_;
      if (sessionBuilder_ == null) {
        result.session_ = session_;
      } else {
        result.session_ = sessionBuilder_.build();
      }
      onBuilt();
      return result;
    }

    public Builder clone() {
      return (Builder) super.clone();
    }
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.setField(field, value);
    }
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.spanner.v1.CreateSessionRequest) {
        return mergeFrom((com.google.spanner.v1.CreateSessionRequest)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.spanner.v1.CreateSessionRequest other) {
      if (other == com.google.spanner.v1.CreateSessionRequest.getDefaultInstance()) return this;
      if (!other.getDatabase().isEmpty()) {
        database_ = other.database_;
        onChanged();
      }
      if (other.hasSession()) {
        mergeSession(other.getSession());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.spanner.v1.CreateSessionRequest parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.spanner.v1.CreateSessionRequest) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private java.lang.Object database_ = "";
    /**
     *

     * Required. The database in which the new session is created.
     *

     *
     * string database = 1;
     */
    public java.lang.String getDatabase() {
      java.lang.Object ref = database_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        database_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *

     * Required. The database in which the new session is created.
     *

     *
     * string database = 1;
     */
    public com.google.protobuf.ByteString
        getDatabaseBytes() {
      java.lang.Object ref = database_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        database_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *

     * Required. The database in which the new session is created.
     *

     *
     * string database = 1;
     */
    public Builder setDatabase(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }

      database_ = value;
      onChanged();
      return this;
    }
    /**
     *

     * Required. The database in which the new session is created.
     *

     *
     * string database = 1;
     */
    public Builder clearDatabase() {

      database_ = getDefaultInstance().getDatabase();
      onChanged();
      return this;
    }
    /**
     *

     * Required. The database in which the new session is created.
     *

     *
     * string database = 1;
     */
    public Builder setDatabaseBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);

      database_ = value;
      onChanged();
      return this;
    }

    private com.google.spanner.v1.Session session_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.spanner.v1.Session, com.google.spanner.v1.Session.Builder, com.google.spanner.v1.SessionOrBuilder> sessionBuilder_;
    /**
     *

     * The session to create.
     *

     *
     * .google.spanner.v1.Session session = 2;
     */
    public boolean hasSession() {
      return sessionBuilder_ != null || session_ != null;
    }
    /**
     *

     * The session to create.
     *

     *
     * .google.spanner.v1.Session session = 2;
     */
    public com.google.spanner.v1.Session getSession() {
      if (sessionBuilder_ == null) {
        return session_ == null ? com.google.spanner.v1.Session.getDefaultInstance() : session_;
      } else {
        return sessionBuilder_.getMessage();
      }
    }
    /**
     *

     * The session to create.
     *

     *
     * .google.spanner.v1.Session session = 2;
     */
    public Builder setSession(com.google.spanner.v1.Session value) {
      if (sessionBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        session_ = value;
        onChanged();
      } else {
        sessionBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *

     * The session to create.
     *

     *
     * .google.spanner.v1.Session session = 2;
     */
    public Builder setSession(
        com.google.spanner.v1.Session.Builder builderForValue) {
      if (sessionBuilder_ == null) {
        session_ = builderForValue.build();
        onChanged();
      } else {
        sessionBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *

     * The session to create.
     *

     *
     * .google.spanner.v1.Session session = 2;
     */
    public Builder mergeSession(com.google.spanner.v1.Session value) {
      if (sessionBuilder_ == null) {
        if (session_ != null) {
          session_ =
            com.google.spanner.v1.Session.newBuilder(session_).mergeFrom(value).buildPartial();
        } else {
          session_ = value;
        }
        onChanged();
      } else {
        sessionBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *

     * The session to create.
     *

     *
     * .google.spanner.v1.Session session = 2;
     */
    public Builder clearSession() {
      if (sessionBuilder_ == null) {
        session_ = null;
        onChanged();
      } else {
        session_ = null;
        sessionBuilder_ = null;
      }

      return this;
    }
    /**
     *

     * The session to create.
     *

     *
     * .google.spanner.v1.Session session = 2;
     */
    public com.google.spanner.v1.Session.Builder getSessionBuilder() {

      onChanged();
      return getSessionFieldBuilder().getBuilder();
    }
    /**
     *

     * The session to create.
     *

     *
     * .google.spanner.v1.Session session = 2;
     */
    public com.google.spanner.v1.SessionOrBuilder getSessionOrBuilder() {
      if (sessionBuilder_ != null) {
        return sessionBuilder_.getMessageOrBuilder();
      } else {
        return session_ == null ?
            com.google.spanner.v1.Session.getDefaultInstance() : session_;
      }
    }
    /**
     *

     * The session to create.
     *

     *
     * .google.spanner.v1.Session session = 2;
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.spanner.v1.Session, com.google.spanner.v1.Session.Builder, com.google.spanner.v1.SessionOrBuilder>
        getSessionFieldBuilder() {
      if (sessionBuilder_ == null) {
        sessionBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.spanner.v1.Session, com.google.spanner.v1.Session.Builder, com.google.spanner.v1.SessionOrBuilder>(
                getSession(),
                getParentForChildren(),
                isClean());
        session_ = null;
      }
      return sessionBuilder_;
    }
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(unknownFields);
    }

    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.spanner.v1.CreateSessionRequest)
  }

  // @@protoc_insertion_point(class_scope:google.spanner.v1.CreateSessionRequest)
  private static final com.google.spanner.v1.CreateSessionRequest DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.spanner.v1.CreateSessionRequest();
  }

  public static com.google.spanner.v1.CreateSessionRequest getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<CreateSessionRequest>
      PARSER = new com.google.protobuf.AbstractParser<CreateSessionRequest>() {
    public CreateSessionRequest parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new CreateSessionRequest(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<CreateSessionRequest> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<CreateSessionRequest> getParserForType() {
    return PARSER;
  }

  public com.google.spanner.v1.CreateSessionRequest getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}


text:
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit934f702bd880bc59bfb09c0e22463642::getLoader();


text:
<?php
/**
 * Source Already Added Exception
 *
 * @author Wenzel Pünter <wenzel@phelix.me>
 * @version 0.0.1-dev
 * @package Lingua
*/
namespace Lingua\Exception;

use Lingua\Exception;

/**
 * Thrown instances of this class express, that a source has been added twice to the
 * {@see \Lingua\Setup} object. One can resolve this issue by updating the code or catching this
 * error without further processing.
 *
 * @since 1.0.0
*/
class SourceAlreadyAdded extends Exception
{
    /**
     * Constructor
     *
     * This method initializes a new {@see \Lingua\Exception\SourceAlreadyAdded} exception and
     * provides an appropriate error message.
    */
    public function __construct()
    {
        parent::__construct(
            'The source is already registered in this setup object.'
        );
    }
}


text:
<?php

namespace App;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract,
    AuthorizableContract,
    CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['name', 'email', 'password'];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = ['password', 'remember_token'];

    public static function boot()
    {
        parent::boot();

        static::creating(function ($user) {
            $user->email_token = str_random(30);
        });
    }

    public function setPasswordAttribute($password)
    {
        $this->attributes['password'] = bcrypt($password);
    }

    public function confirmEmail()
    {
        $this->verified = true;
        $this->email_token = null;
        $this->save();
    }

    public function sites()
    {
        return $this->hasMany('App\Site');
    }
}


text:
using Newtonsoft.Json;

namespace Auth0.AuthenticationApi.Models
{
    /// <summary>
    /// Represents the response from a Device Authorization request.
    /// </summary>
    public class DeviceCodeResponse
    {
        /// <summary>
        /// The unique code for the device. When the user goes to the <see cref="VerificationUri"/> in their browser-based device, this code will be bound to their session.
        /// </summary>
        [JsonProperty("device_code")]
        public string DeviceCode { get; set; }

        /// <summary>
        /// The code that should be input at the <see cref="VerificationUri"/> to authorize the device.
        /// </summary>
        [JsonProperty("user_code")]
        public string UserCode { get; set; }

        /// <summary>
        /// The URL the user should visit to authorize the device.
        /// </summary>
        [JsonProperty("verification_uri")]
        public string VerificationUri { get; set; }

        /// <summary>
        /// The lifetime (in seconds) of the <see cref="DeviceCode"/> and <see cref="UserCode"/>.
        /// </summary>
        [JsonProperty("expires_in")]
        public int ExpiresIn { get; set; }

        /// <summary>
        /// The interval (in seconds) at which the app should poll the token URL to request a token.
        /// </summary>
        [JsonProperty("interval")]
        public int Interval { get; set; }

        /// <summary>
        ///  The complete URL the user should visit to authorize the device. This allows embedding the <see cref="UserCode"/> in the URL.
        /// </summary>
        [JsonProperty("verification_uri_complete")]
        public string VerificationUriComplete { get; set; }
    }
}


text:
package com.netflix.spinnaker.orca.pipeline;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder;
import com.netflix.spinnaker.orca.api.pipeline.graph.TaskNode;
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution;
import com.netflix.spinnaker.orca.pipeline.tasks.WaitTask;
import java.time.Duration;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.springframework.stereotype.Component;

@Component
public class WaitStage implements StageDefinitionBuilder {

  public static String STAGE_TYPE = "wait";

  @Override
  public void taskGraph(@Nonnull StageExecution stage, @Nonnull TaskNode.Builder builder) {
    builder.withTask("wait", WaitTask.class);
  }

  public static final class WaitStageContext {
    private final Long waitTime;
    private final boolean skipRemainingWait;

    @JsonCreator
    public WaitStageContext(
        @JsonProperty("waitTime") @Nullable Long waitTime,
        @JsonProperty("skipRemainingWait") @Nullable Boolean skipRemainingWait) {
      this.waitTime = waitTime;
      this.skipRemainingWait = skipRemainingWait == null ? false : skipRemainingWait;
    }

    public WaitStageContext(@Nonnull Long waitTime) {
      this(waitTime, false);
    }

    @JsonIgnore
    public Duration getWaitDuration() {
      return waitTime == null ? Duration.ZERO : Duration.ofSeconds(waitTime);
    }

    public boolean isSkipRemainingWait() {
      return skipRemainingWait;
    }
  }
}


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

<title>org.canova.spark.functions.pairdata</title>
<meta name="date" content="2016-06-19">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package org.canova.spark.functions.pairdata

Interface Summary

Interface
Description

PathToKeyConverter

PathToKeyConverter: Used to match up files based on their file names, for PairSequenceRecordReaderBytesFunction
 For example, suppose we have files "/features_0.csv" and "/labels_0.csv", map both to same key: "0"

Class Summary

Class
Description

BytesPairWritable

A Hadoop writable class for a pair of byte arrays, plus the original URIs (as Strings) of the files they came from

MapToBytesPairWritableFunction

A function to read files (assuming exactly 2 per input) from a PortableDataStream and combine the contents into a BytesPairWritable

PairSequenceRecordReaderBytesFunction

SequenceRecordReaderBytesFunction: Converts two sets of binary data (in the form of a BytesPairWritable) to Canova format data
 (Tuple2<Collection<Collection<<Writable>>,Collection<Collection<Writable>>) using two SequenceRecordReaders.

PathToKeyConverterFilename

Convert the path to a key by taking the full file name (excluding the file extension and directories)

PathToKeyConverterNumber

A PathToKeyConverter that generates a key based on the file name.

PathToKeyFunction

Given a Tuple2<String,PortableDataStream>, where the first value is the full path, map this
 to a Tuple3<String,Integer,PortableDataStream> where the first value is a key (using a PathToKeyConverter),
 second is an index, and third is the original data stream

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes