text:
from django.db import models
from django.db.models.fields.related import (
    RECURSIVE_RELATIONSHIP_CONSTANT, ManyRelatedObjectsDescriptor,
    ManyToManyField, ManyToManyRel, RelatedField,
    create_many_to_many_intermediary_model,
)
from django.utils.functional import curry

class CustomManyToManyField(RelatedField):
    """
    Ticket #24104 - Need to have a custom ManyToManyField,
    which is not an inheritor of ManyToManyField.
    """
    many_to_many = True

    def __init__(self, to, db_constraint=True, swappable=True, **kwargs):
        try:
            to._meta
        except AttributeError:
            to = str(to)
        kwargs['rel'] = ManyToManyRel(
            self, to,
            related_name=kwargs.pop('related_name', None),
            related_query_name=kwargs.pop('related_query_name', None),
            limit_choices_to=kwargs.pop('limit_choices_to', None),
            symmetrical=kwargs.pop('symmetrical', to == RECURSIVE_RELATIONSHIP_CONSTANT),
            through=kwargs.pop('through', None),
            through_fields=kwargs.pop('through_fields', None),
            db_constraint=db_constraint,
        )
        self.swappable = swappable
        self.db_table = kwargs.pop('db_table', None)
        if kwargs['rel'].through is not None:
            assert self.db_table is None, "Cannot specify a db_table if an intermediary model is used."
        super(CustomManyToManyField, self).__init__(**kwargs)

    def contribute_to_class(self, cls, name, **kwargs):
        if self.remote_field.symmetrical and (
                self.remote_field.model == "self" or self.remote_field.model == cls._meta.object_name):
            self.remote_field.related_name = "%s_rel_+" % name
        super(CustomManyToManyField, self).contribute_to_class(cls, name, **kwargs)
        if not self.remote_field.through and not cls._meta.abstract and not cls._meta.swapped:
            self.remote_field.through = create_many_to_many_intermediary_model(self, cls)
        setattr(cls, self.name, ManyRelatedObjectsDescriptor(self.remote_field))
        self.m2m_db_table = curry(self._get_m2m_db_table, cls._meta)

    def get_internal_type(self):
        return 'ManyToManyField'

    # Copy those methods from ManyToManyField because they don't call super() internally
    contribute_to_related_class = ManyToManyField.__dict__['contribute_to_related_class']
    _get_m2m_attr = ManyToManyField.__dict__['_get_m2m_attr']
    _get_m2m_reverse_attr = ManyToManyField.__dict__['_get_m2m_reverse_attr']
    _get_m2m_db_table = ManyToManyField.__dict__['_get_m2m_db_table']

class InheritedManyToManyField(ManyToManyField):
    pass

class MediumBlobField(models.BinaryField):
    """
    A MySQL BinaryField that uses a different blob size.
    """
    def db_type(self, connection):
        return 'MEDIUMBLOB'


text:
local lfs = require 'lfs'

local M = { }

-- http://stackoverflow.com/questions/6380820/get-containing-path-of-lua-file
function script_path()
   local str = debug.getinfo(2, "S").source:sub(2)
   return str:match("(.*/)")
end

function M.parse(arg)
   local cmd = torch.CmdLine()
   cmd:text()
   cmd:text('OpenFace')
   cmd:text()
   cmd:text('Options:')

   ------------ General options --------------------
   cmd:option('-outDir', './reps/', 'Subdirectory to output the representations')
   cmd:option('-data',
              paths.concat(script_path(), '..', 'data', 'lfw', 'dlib-affine-sz:96'),
              'Home of dataset')
   cmd:option('-model',
              paths.concat(script_path(), '..', 'models', 'openface', 'nn4.v1.t7'),
              'Path to model to use.')
   cmd:option('-imgDim', 96, 'Image dimension. nn1=224, nn4=96')
   cmd:option('-batchSize',       50,   'mini-batch size')
   cmd:option('-cuda',       false,   'Use cuda')
   cmd:text()

   local opt = cmd:parse(arg or {})
   os.execute('mkdir -p ' .. opt.outDir)

   return opt
end

return M

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Predis\Protocol;

require_once __DIR__.'/../CommunicationExceptionTest.php';

use Predis\CommunicationExceptionTest;
use Predis\Connection\NodeConnectionInterface;

/**
 *
 */
class ProtocolExceptionTest extends CommunicationExceptionTest
{
    /**
     * {@inheritdoc}
     */
    protected function getException(NodeConnectionInterface $connection, $message, $code = 0, \Exception $inner = null)
    {
        return new ProtocolException($connection, $message, $code, $inner);
    }
}


text:
@extends('layouts.club')
@section('style')
{{HTML::style('css/helpers/croppic.css')}}
@stop
@section('content')

Update Player

						Important: This page is intended for parents or legal guardian only.

						Instructions:

						Step 1 - Add new player information.

						Step 2 - Save.

Privacy questions?

Click here for the Privacy Policy

Update Player

					{{Form::open(array('action' => array('PlayerController@update', $player->id), 'class'=>'form-horizontal', 'method' => 'Put')) }}
					@if($errors->has())

									<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>

										@foreach ($errors->all() as $error)

{{$error}}

										@endforeach

					@endif
					@if(Session::has('notice'))

									<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>

{{Session::get('notice')}}

					@endif

Player Information

All fields required

								First name

									{{ Form::text('firstname',$player->firstname, array('class' => 'form-control', 'placeholder'=>'First name')) }}

								Last name

									{{ Form::text('lastname',$player->lastname, array('class' => 'form-control', 'placeholder'=>'Last name')) }}

								Email

									{{ Form::text('email',$player->email, array('class' => 'form-control', 'placeholder'=>'Email')) }}

								Mobile

									{{ Form::text('mobile',$player->mobile, array('class' => 'form-control mobile', 'placeholder'=>'Mobile')) }}

								Player's position

									{{ Form::select('position', ['attack' => 'Attack','midfield' => 'Midfield','defense' => 'Defense','LSM' => 'LSM','goalie' => 'Goalie'],$player->position,array('class' => 'form-control', 'placeholder'=>'Position')) }}

								Relationship

									{{ Form::text('relation',$player->relation, array('class' => 'form-control', 'placeholder'=>'Ex. father, mother, legal guardian, etc.')) }}

								DOB

									{{ Form::text('dob',$player->dob, array('class' => 'form-control datepicker', 'placeholder'=>'MM/DD/YYYY')) }}

								Gender

									{{Form::select('gender', array('M' => 'Male', 'F' => 'Female'),$player->gender, array('class'=>'form-control'));}}

								School

									{{ Form::text('school',$player->school, array('class' => 'form-control', 'placeholder'=>'School Name')) }}

								Graduation class

									{{ Form::selectRange('year', 2015, 2035, $player->year, array('class'=>'form-control'));}}

								US Lacrosse #

									{{ Form::text('laxid',$player->laxid, array('class' => 'form-control', 'placeholder'=>'US Lax ID')) }}

								USL # exp. date

									{{ Form::text('laxid_exp',$player->laxid_exp, array('class' => 'form-control datepicker', 'placeholder'=>'MM/DD/YYYY')) }}

								Prefer Uniform #

									{{ Form::text('uniform',$player->uniform, array('class' => 'form-control', 'placeholder'=>'Uniform #')) }}
									# is not guaranteed

								Roster picture

										avatar}}">

									<input type="hidden" id="croppic" name="avatar" value="{{$player->avatar}}">

Address

All fields required

								Street Address

									{{Form::text('address', $player->address, array('id'=>'address','class'=>'form-control','placeholder'=>'eg. 80 Dolphin St','tabindex'=>'2')) }}

								City

									{{Form::text('city',$player->city,array('id'=>'city','class'=>'form-control','placeholder'=>'eg. New York','tabindex'=>'2')) }}

								State

									{{ Form::select('state', State::all()->lists('name','short'), $player->state, array('class'=>"form-control")) }}

								Zip

									{{Form::text('zip', $player->zip, array('id'=>'zip','class'=>'form-control','placeholder'=>'eg. 83401','tabindex'=>'5')) }}

Player Preferences

All fields required

									<button type="submit" class="btn btn-primary btn-outline">Save</button>
									Cancel

					{{Form::close()}}

Contacts Information

											Name
											Relationship
											Mobile

										@foreach($player->contacts as $contact)

id}}" data-player="{{$player->id}}" >
											{{$contact->firstname}} {{$contact->lastname}}
											{{$contact->relation}}
											{{$contact->mobile}}

										@endforeach

									id)}}" class="btn btn-success btn-outline">Add New

@stop
@section('script')
{{ HTML::script('js/helpers/croppic.min.js')}}

@stop


text:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".activity.AlertDetailActivity" />
</layout>


text:
from ._version import __version_info__, __version__
from .tasks import task, ctask, Task
from .runner import run
from .collection import Collection
from .context import Context


text:
<!DOCTYPE html>
<html>
<head>
<link href="../generic.css" rel="stylesheet"/>
<script type="text/javascript" src="OutlineTest.js"></script>
<script>
function performTest()
{
    Outline_init();
    PostponedActions_perform();

    // Create a series of tables
    createTestTables(4);

    // Add a list of tables
    Selection_set(document.body,0,document.body,0);
    Outline_insertListOfTables();
    PostponedActions_perform();

    // Delete all tables
    var current = document.getElementsByTagName("table")[0];
    var next;
    for (; current != null; current = next) {
        next = current.nextSibling;
        DOM_deleteNode(current);
    }
    PostponedActions_perform();
}
</script>
</head>
<body>
</body>
</html>


text:
[![Build status](https://ci.appveyor.com/api/projects/status/k0n0853v26f1thl4/branch/master?svg=true)](https://ci.appveyor.com/project/SpeckleWorks/specklecore/branch/master) [![DOI](https://zenodo.org/badge/100398062.svg)](https://zenodo.org/badge/latestdoi/100398062)

## ⚠ IMPORTANT ⚠

Speckle v1 has reached EOL and is no longer mainatined. Check out our brand new 👉 [Speckle v2](https://github.com/specklesystems)!
Read more about the announcemnt [here](https://speckle.systems/blog/speckle2-vision-and-faq) and check out or new [website](https://speckle.systems).

## Overview

This is the core .NET client lib of Speckle. It provides:
- async methods for calling the speckle [api](https://speckleworks.github.io/SpeckleOpenApi/)
- methods for interacting with the speckle's websocket api
- the core conversion methods (`Serialise` and `Deserialise`) & other helper methods
- a base SpeckleObject from which you can inherit to create your own speckle kits

Pretty much all of speckle's connectors are using this library, including:
- Rhino
- Grasshopper
- Revit
- Dynamo
- Unity (with flavours)

## Example usage

Please check [out the docs and sample starter project on the speckle website](https://speckle.systems/docs/developers/dotnet-sdk)!

## License
MIT


text:
/*
 * Changes for GemFireXD distributed data platform (some marked by "GemStone changes")
 *
 * Portions Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */

package com.pivotal.gemfirexd.internal.impl.sql.execute;

import com.gemstone.gemfire.internal.cache.TXState;
import com.pivotal.gemfirexd.internal.engine.GfxdConstants;
import com.pivotal.gemfirexd.internal.engine.access.GemFireTransaction;
import com.pivotal.gemfirexd.internal.engine.distributed.utils.GemFireXDUtils;
import com.pivotal.gemfirexd.internal.engine.sql.execute.AbstractGemFireResultSet;
import com.pivotal.gemfirexd.internal.iapi.error.StandardException;
import com.pivotal.gemfirexd.internal.iapi.reference.SQLState;
import com.pivotal.gemfirexd.internal.iapi.services.sanity.SanityManager;
import com.pivotal.gemfirexd.internal.iapi.sql.Activation;
import com.pivotal.gemfirexd.internal.iapi.sql.execute.CursorResultSet;
import com.pivotal.gemfirexd.internal.iapi.sql.execute.ExecRow;
import com.pivotal.gemfirexd.internal.iapi.sql.execute.NoPutResultSet;
import com.pivotal.gemfirexd.internal.iapi.store.access.BackingStoreHashtable;
import com.pivotal.gemfirexd.internal.iapi.types.DataValueDescriptor;
import com.pivotal.gemfirexd.internal.iapi.types.RowLocation;
import com.pivotal.gemfirexd.internal.iapi.types.SQLBoolean;
import com.pivotal.gemfirexd.internal.iapi.types.SQLInteger;
import com.pivotal.gemfirexd.internal.impl.sql.execute.xplain.XPLAINUtil;

/**
 *
 * Provide insensitive scrolling functionality for the underlying
 * result set.  We build a disk backed hash table of rows as the
 * user scrolls forward, with the position as the key.
 *
 * For read-only result sets the hash table will containg the
 * following columns:
 *

 *  +-------------------------------+
 *  | KEY                           |
 *  +-------------------------------+
 *  | Row                           |
 *  +-------------------------------+
 *

 * where key is the position of the row in the result set and row is the data.
 *
 * And for updatable result sets it will contain:
 *

 *  +-------------------------------+
 *  | KEY                           | [0]
 *  +-------------------------------+
 *  | RowLocation                   | [POS_ROWLOCATION]
 *  +-------------------------------+
 *  | Deleted                       | [POS_ROWDELETED]
 *  +-------------------------------+
 *  | Updated                       | [POS_ROWUPDATED]
 *  +-------------------------------+
 *  | Row                           | [extraColumns ... n]
 *  +-------------------------------+
 *

 * where key is the position of the row in the result set, rowLocation is
 * the row location of that row in the Heap, Deleted indicates whether the
 * row has been deleted, Updated indicates whether the row has been updated,
 * and row is the data.
 *
 */

public class ScrollInsensitiveResultSet extends NoPutResultSetImpl
	implements CursorResultSet
{
	/*
    ** Set in constructor and not altered during life of object.
	*/

    public NoPutResultSet	source;

	private int							sourceRowWidth;

	private	  BackingStoreHashtable		ht;
	private	  ExecRow					resultRow;

	// Scroll tracking
	private int positionInSource;
	private int currentPosition;
	private int lastPosition;
	private	boolean seenFirst;
	private	boolean seenLast;
	private	boolean beforeFirst = true;
	private	boolean afterLast;

	public int numFromHashTable;
	public int numToHashTable;

	private int maxRows;

    private boolean keepAfterCommit;

	/* The hash table will contain a different number of extra columns depending
	 * on whether the result set is updatable or not.
	 * extraColumns will contain the number of extra columns on the hash table,
	 * 1 for read-only result sets and LAST_EXTRA_COLUMN + 1 for updatable
	 * result sets.
	 */
	private int extraColumns;

	/* positionInHashTable is used for getting a row from the hash table. Prior
	 * to getting the row, positionInHashTable will be set to the desired KEY.
	 */
	private SQLInteger positionInHashTable;

	/* Reference to the target result set. Target is used for updatable result
	 * sets in order to keep the target result set on the same row as the
	 * ScrollInsensitiveResultSet.
	 */
	private CursorResultSet target;

	/* If the last row was fetched from the HashTable, updatable result sets
	 * need to be positioned in the last fetched row before resuming the
	 * fetch from core.
	 */
	private boolean needsRepositioning;

	/* Position of the different fields in the hash table row for updatable
	 * result sets
	 */
	private static final int POS_ROWLOCATION = 1;
	private static final int POS_ROWDELETED = 2;
	private static final int POS_ROWUPDATED = 3;
	private static final int LAST_EXTRA_COLUMN = 3;

	/**
	 * Constructor for a ScrollInsensitiveResultSet
	 *
	 * @param source					The NoPutResultSet from which to get rows
	 *									to scroll through
	 * @param activation				The activation for this execution
	 * @param resultSetNumber			The resultSetNumber
	 * @param sourceRowWidth			# of columns in the source row
	 *
	 * @exception StandardException	on error
	 */

	public ScrollInsensitiveResultSet(NoPutResultSet source,
							  Activation activation, int resultSetNumber,
							  int sourceRowWidth,
							  double optimizerEstimatedRowCount,
							  double optimizerEstimatedCost) throws StandardException
	{
		super(activation, resultSetNumber,
			  optimizerEstimatedRowCount, optimizerEstimatedCost);
		this.source = source;
		this.sourceRowWidth = sourceRowWidth;
        keepAfterCommit = activation.getResultSetHoldability();
		maxRows = activation.getMaxRows();
		if (SanityManager.DEBUG)
		{
			SanityManager.ASSERT(maxRows != -1,
				"maxRows not expected to be -1");
		}

		positionInHashTable = new SQLInteger();
		needsRepositioning = false;
		if (isForUpdate()) {
			target = ((CursorActivation)activation).getTargetResultSet();
			extraColumns = LAST_EXTRA_COLUMN + 1;
		} else {
			target = null;
			extraColumns = 1;
		}

// GemStone changes BEGIN
		// ensure one initLocalTXState() call before getNextRowCore()
		initLocalTXState();
// GemStone changes END
		recordConstructorTime();

                // GemStone changes BEGIN
		printResultSetHierarchy();
                // GemStone changes END
	}

	//
	// ResultSet interface (leftover from NoPutResultSet)
	//

	/**
     * open a scan on the source. scan parameters are evaluated
     * at each open, so there is probably some way of altering
     * their values...
	 *
 	 * @exception StandardException thrown on failure
     */
	public void	openCore() throws StandardException
	{
		beginTime = statisticsTimingOn ? XPLAINUtil.nanoTime() : 0;
		if (SanityManager.DEBUG)
	    	SanityManager.ASSERT( ! isOpen, "ScrollInsensitiveResultSet already open");

		isOpen = true;
        source.openCore();
	    //isOpen = true;
		numOpens++;

		/* Create the hash table.  We pass
		 * null in as the row source as we will
		 * build the hash table on demand as
		 * the user scrolls.
		 * The 1st column, the position in the
		 * scan, will be the key column.
		 */
		final int[] keyCols = new int[] { 0 };

		/* We don't use the optimizer row count for this because it could be
		 * wildly pessimistic.  We only use Hash tables when the optimizer row count
		 * is within certain bounds.  We have no alternative for scrolling insensitive
		 * cursors so we'll just trust that it will fit.
		 * We need BackingStoreHashtable to actually go to disk when it doesn't fit.
		 * This is a known limitation.
		 */
		ht = new BackingStoreHashtable(getTransactionController(),
									   null,
									   keyCols,
									   false,
										-1, // don't trust optimizer row count
									   HashScanResultSet.DEFAULT_MAX_CAPACITY,
									   HashScanResultSet.DEFAULT_INITIAL_CAPACITY,
									   HashScanResultSet.DEFAULT_MAX_CAPACITY,
									   false,
                                       keepAfterCommit);

		// When re-using language result sets (DERBY-827) we need to
		// reset some member variables to the value they would have
		// had in a newly constructed object.
		lastPosition = 0;
		needsRepositioning = false;
		numFromHashTable = 0;
		numToHashTable = 0;
		positionInSource = 0;
		seenFirst = false;
		seenLast = false;
		maxRows = activation.getMaxRows();

		if (statisticsTimingOn) openTime += getElapsedNanos(beginTime);
		setBeforeFirstRow();
	}

	/**
     * reopen a scan on the table. scan parameters are evaluated
     * at each open, so there is probably some way of altering
     * their values...
	 *
	 * @exception StandardException thrown if cursor finished.
     */
	public void	reopenCore() throws StandardException
	{
		boolean constantEval = true;

		beginTime = statisticsTimingOn ? XPLAINUtil.nanoTime() : 0;

		if (SanityManager.DEBUG)
		{
		    SanityManager.ASSERT(isOpen, "ScrollInsensitiveResultSet already open");
			SanityManager.THROWASSERT(
				"reopenCore() not expected to be called");
		}
		setBeforeFirstRow();
	}

	/**
	 * Returns the row at the absolute position from the query,
	 * and returns NULL when there is no such position.
	 * (Negative position means from the end of the result set.)
	 * Moving the cursor to an invalid position leaves the cursor
	 * positioned either before the first row (negative position)
	 * or after the last row (positive position).
	 * NOTE: An exception will be thrown on 0.
	 *
	 * @param row	The position.
	 * @return	The row at the absolute position, or NULL if no such position.
	 *
	 * @exception StandardException		Thrown on failure
	 * @see com.pivotal.gemfirexd.internal.iapi.sql.Row
	 */
	public ExecRow	getAbsoluteRow(int row) throws StandardException
	{
	    if ( ! isOpen )
		{
			throw StandardException.newException(SQLState.LANG_RESULT_SET_NOT_OPEN, "absolute");
		}

		attachStatementContext();

		if (SanityManager.DEBUG)
		{
			if (!isTopResultSet)
			{
				SanityManager.THROWASSERT(
					this + "expected to be the top ResultSet");
			}
		}

                // Absolute 0 is defined to be before first!
		if (row == 0)
		{
                    setBeforeFirstRow();
                    return null;
		}

		if (seenLast && row > lastPosition) {
		   return setAfterLastRow();
		}

		if (row > 0)
		{
			// position is from the start of the result set
			if (row <= positionInSource)
			{
				// We've already seen the row before
				return getRowFromHashTable(row);
			}

			/* We haven't seen the row yet, scan until we find
			 * it or we get to the end.
			 */
			int diff = row - positionInSource;
			ExecRow result = null;
			while (diff > 0)
			{
				if ((result = getNextRowFromSource()) != null)
				{
					diff--;
				}
				else
				{
					break;
				}
			}
			if (result != null) {
				result = getRowFromHashTable(row);
			}
			currentRow = result;
			return result;
		}
		else if (row < 0)
		{
			// position is from the end of the result set

			// Get the last row, if we haven't already
			if (!seenLast)
			{
				getLastRow();
			}

			// Note, for negative values position is from beyond the end
			// of the result set, e.g. absolute(-1) points to the last row
			int beyondResult = lastPosition + 1;
			if (beyondResult + row > 0)
			{
				// valid row
				return getRowFromHashTable(beyondResult + row);
			}
			else
			{
				// position before the beginning of the result set
				return setBeforeFirstRow();
			}
		}

		currentRow = null;
		return null;
	}

	/**
	 * Returns the row at the relative position from the current
	 * cursor position, and returns NULL when there is no such position.
	 * (Negative position means toward the beginning of the result set.)
	 * Moving the cursor to an invalid position leaves the cursor
	 * positioned either before the first row (negative position)
	 * or after the last row (positive position).
	 * NOTE: 0 is valid.
	 * NOTE: An exception is thrown if the cursor is not currently
	 * positioned on a row.
	 *
	 * @param row	The position.
	 * @return	The row at the relative position, or NULL if no such position.
	 *
	 * @exception StandardException		Thrown on failure
	 * @see com.pivotal.gemfirexd.internal.iapi.sql.Row
	 */
	public ExecRow	getRelativeRow(int row) throws StandardException
	{
	    if ( ! isOpen )
		{
			throw StandardException.newException(SQLState.LANG_RESULT_SET_NOT_OPEN, "relative");
		}

		attachStatementContext();

		if (SanityManager.DEBUG)
		{
			if (!isTopResultSet)
			{
				SanityManager.THROWASSERT(
					this + "expected to be the top ResultSet");
			}
		}

		// Return the current row for 0
		if (row == 0)
		{
                    if (beforeFirst || afterLast || currentPosition==0) {
                        return null;
                    } else {
			return getRowFromHashTable(currentPosition);
                    }
		}
		else if (row > 0)
		{
			return getAbsoluteRow(currentPosition + row);
		}
		else
		{
			// row < 0
			if (currentPosition + row < 0)
			{
				return setBeforeFirstRow();
			}
			return getAbsoluteRow(currentPosition + row);
		}
	}

	/**
	 * Sets the current position to before the first row and returns NULL
	 * because there is no current row.
	 *
	 * @return	NULL.
	 *
	 * @see com.pivotal.gemfirexd.internal.iapi.sql.Row
	 */
	public ExecRow	setBeforeFirstRow()
	{
		currentPosition = 0;
		beforeFirst = true;
		afterLast = false;
		currentRow = null;
		return null;
	}

	/**
	 * Returns the first row from the query, and returns NULL when there
	 * are no rows.
	 *
	 * @return	The first row, or NULL if no rows.
	 *
	 * @exception StandardException		Thrown on failure
	 * @see com.pivotal.gemfirexd.internal.iapi.sql.Row
	 */
	public ExecRow	getFirstRow()
		throws StandardException
	{
	    if ( ! isOpen )
		{
			throw StandardException.newException(SQLState.LANG_RESULT_SET_NOT_OPEN, "first");
		}

		/* Get the row from the hash table if
		 * we have already seen it before.
		 */
		if (seenFirst)
		{
			return getRowFromHashTable(1);
		}

		attachStatementContext();

		if (SanityManager.DEBUG)
		{
			if (!isTopResultSet)
			{
				SanityManager.THROWASSERT(
					this + "expected to be the top ResultSet");
			}
		}

		return getNextRowCore();
	}

	/**
	 *
 	 * @exception StandardException thrown on failure
	 */
	public ExecRow	getNextRowCore() throws StandardException
	{
		ExecRow result = null;

		beginTime = statisticsTimingOn ? XPLAINUtil.nanoTime() : 0;
		if (!isOpen)
			throw StandardException.newException(SQLState.LANG_RESULT_SET_NOT_OPEN, "next");

		if (seenLast && currentPosition == lastPosition) {
		   return setAfterLastRow();
		}

		/* Should we get the next row from the source or the hash table? */
		if (currentPosition == positionInSource)
		{
			/* Current position is same as position in source.
			 * Get row from the source.
			 */
			result = getNextRowFromSource();
			if (result !=null) {
				result = getRowFromHashTable(currentPosition);
			}
		}
		else if (currentPosition < positionInSource)
		{
			/* Current position is before position in source.
			 * Get row from the hash table.
			 */
			result = getRowFromHashTable(currentPosition + 1);
		}
		else
		{
			result = null;
		}

		if (result != null)
		{
			rowsSeen++;
			afterLast = false;
		}

		setCurrentRow(result);
		beforeFirst = false;
// GemStone changes BEGIN
		if (this.localTXState != null && this.isTopResultSet &&
		    result != null && isForUpdate()) {
		  updateRowLocationPostRead();
		}
// GemStone changes END

		if (statisticsTimingOn) nextTime += getElapsedNanos(beginTime);

		return result;
	}

	/**
	 * Returns the previous row from the query, and returns NULL when there
	 * are no more previous rows.
	 *
	 * @return	The previous row, or NULL if no more previous rows.
	 *
	 * @exception StandardException		Thrown on failure
	 * @see com.pivotal.gemfirexd.internal.iapi.sql.Row
	 */
	public ExecRow	getPreviousRow()
		throws StandardException
	{
	    if ( ! isOpen )
		{
			throw StandardException.newException(SQLState.LANG_RESULT_SET_NOT_OPEN, "next");
		}

		if (SanityManager.DEBUG)
		{
			if (!isTopResultSet)
			{
				SanityManager.THROWASSERT(
					this + "expected to be the top ResultSet");
			}
		}

		/* No row if we are positioned before the first row
		 * or the result set is empty.
		 */
		if (beforeFirst || currentPosition == 0)
		{
			currentRow = null;
			return null;
		}

		// Get the last row, if we are after it
		if (afterLast)
		{
			// Special case for empty tables
			if (lastPosition == 0)
			{
				afterLast = false;
				beforeFirst = false;
				currentRow = null;
				return null;
			}
			else
			{
				return getRowFromHashTable(lastPosition);
			}
		}

		// Move back 1
		currentPosition--;
		if (currentPosition == 0)
		{
			setBeforeFirstRow();
			return null;
		}
		return getRowFromHashTable(currentPosition);
	}

	/**
	 * Returns the last row from the query, and returns NULL when there
	 * are no rows.
	 *
	 * @return	The last row, or NULL if no rows.
	 *
	 * @exception StandardException		Thrown on failure
	 * @see com.pivotal.gemfirexd.internal.iapi.sql.Row
	 */
	public ExecRow	getLastRow()
		throws StandardException
	{
	    if ( ! isOpen )
		{
			throw StandardException.newException(SQLState.LANG_RESULT_SET_NOT_OPEN, "next");
		}

		if (!seenLast)
		{
			attachStatementContext();

			if (SanityManager.DEBUG)
			{
				if (!isTopResultSet)
				{
					SanityManager.THROWASSERT(
											  this + "expected to be the top ResultSet");
				}
			}

			/* Scroll to the end, filling the hash table as
			 * we scroll, and return the last row that we find.
			 */
			ExecRow result = null;
			while ((result = getNextRowFromSource()) != null);
		}

		if (SanityManager.DEBUG && !seenLast)
		{
			SanityManager.THROWASSERT(this + "expected to have seen last");
		}

		beforeFirst = false;
		afterLast = false;

		// Special case if table is empty
		if (lastPosition == 0)
		{
			currentRow = null;
			return null;
		}
		else
		{
			return getRowFromHashTable(lastPosition);
		}
	}

	/**
	 * Sets the current position to after the last row and returns NULL
	 * because there is no current row.
	 *
	 * @return	NULL.
	 *
	 * @exception StandardException		Thrown on failure
	 * @see com.pivotal.gemfirexd.internal.iapi.sql.Row
	 */
	public ExecRow	setAfterLastRow()
		throws StandardException
	{
		if (! seenLast)
		{
			getLastRow();
		}
		if (lastPosition == 0) {
		   // empty rs special case
		   currentPosition = 0;
		   afterLast = false;
		} else {
		   currentPosition = lastPosition + 1;
		   afterLast = true;
		}

		beforeFirst = false;
		currentRow = null;
		return null;
	}

    /**
     * Determine if the cursor is before the first row in the result
     * set.
     *
     * @return true if before the first row, false otherwise. Returns
     * false when the result set contains no rows.
	 * @exception StandardException Thrown on error.
     */
   public boolean checkRowPosition(int isType) throws StandardException
	{
		switch (isType) {
		case ISBEFOREFIRST:

			if (! beforeFirst)
			{
				return false;
			}

			//  Spec says to return false if result set is empty
			if (seenFirst)
			{
				return true;
			}
			else
			{
				ExecRow firstRow = getFirstRow();
				if (firstRow == null)
				{
					// ResultSet is empty
					return false;
				}
				else
				{
					// ResultSet is not empty - reset position
					getPreviousRow();
					return true;
				}
			}
		case ISFIRST:
			return (currentPosition == 1);
		case ISLAST:
			if (beforeFirst || afterLast || currentPosition==0 ||
				currentPosition<positionInSource)
			{
				return false;
			}

			/* If we have seen the last row, we can tell if we are
			 * on it by comparing currentPosition with lastPosition.
			 * Otherwise, we check if there is a next row.
			 */
			if (seenLast)
			{
				return (currentPosition == lastPosition);
			}
			else
			{
				final int savePosition = currentPosition;
				final boolean retval = (getNextRowFromSource() == null);
				getRowFromHashTable(savePosition);
				return retval;
			}
		case ISAFTERLAST:
			return afterLast;
		default:
			return false;
		}
	}

	/**
	 * Returns the row number of the current row.  Row
	 * numbers start from 1 and go to 'n'.  Corresponds
	 * to row numbering used to position current row
	 * in the result set (as per JDBC).
	 *
	 * @return	the row number, or 0 if not on a row
	 *
	 */
	public int getRowNumber()
	{
		return currentRow == null ? 0 : currentPosition;
	}

	/* Get the next row from the source ResultSet tree and insert into the hash table */
	private ExecRow getNextRowFromSource() throws StandardException
	{
		ExecRow		sourceRow = null;
		ExecRow		result = null;

		/* Don't give back more rows than requested */
		if (maxRows > 0 && maxRows == positionInSource)
		{
			seenLast = true;
			lastPosition = positionInSource;
			afterLast = true;
			return null;
		}

		if (needsRepositioning) {
			positionInLastFetchedRow();
			needsRepositioning = false;
		}
		sourceRow = source.getNextRowCore();

    if (sourceRow != null) {

      seenFirst = true;
      beforeFirst = false;

      // long beginTCTime = statisticsTimingOn ? XPLAINUtil.nanoTime() : 0;
      /*
       * If this is the first row from the source then we create a new row for
       * use when fetching from the hash table.
       */
      if (resultRow == null) {
        resultRow = activation.getExecutionFactory()
            .getValueRow(sourceRowWidth);
      }

      positionInSource++;
      currentPosition = positionInSource;

      RowLocation rowLoc = null;
      if (source.isForUpdate()) {
        rowLoc = ((CursorResultSet) source).getRowLocation();
      }

      addRowToHashTable(sourceRow, currentPosition, rowLoc, false);
      //TODO:Asif check if a Group by may be on top of scroll insensitive resultset
      this.source.releasePreviousByteSource();
    }
		// Remember whether or not we're past the end of the table
		else
		{
			if (! seenLast)
			{
				lastPosition = positionInSource;
			}
			seenLast = true;
			// Special case for empty table (afterLast is never true)
			if (positionInSource == 0)
			{
				afterLast = false;
			}
			else
			{
				afterLast = true;
				currentPosition = positionInSource + 1;
			}
		}

		return sourceRow;
	}

	/**
	 * If the result set has been opened,
	 * close the open scan.
	 *
	 * @exception StandardException thrown on error
	 */
	public void	close(boolean cleanupOnError) throws StandardException
	{
		beginTime = statisticsTimingOn ? XPLAINUtil.nanoTime() : 0;
	    if ( isOpen )
	    {
			currentRow = null;
	        source.close(cleanupOnError);

			if (ht != null)
			{
				ht.close();
				ht = null;
			}

			super.close(cleanupOnError);
	    }
		else
			if (SanityManager.DEBUG)
				SanityManager.DEBUG("CloseRepeatInfo","Close of ScrollInsensitiveResultSet repeated");
		setBeforeFirstRow();

		if (statisticsTimingOn) closeTime += getElapsedNanos(beginTime);
	}

	public void	finish() throws StandardException
	{
		source.finish();
		finishAndRTS();
	}

	/**
	 * Return the total amount of time spent in this ResultSet
	 *
	 * @param type	CURRENT_RESULTSET_ONLY - time spent only in this ResultSet
	 *				ENTIRE_RESULTSET_TREE  - time spent in this ResultSet and below.
	 *
	 * @return long		The total amount of time spent (in milliseconds).
	 */
	public final long getTimeSpent(int type, int timeType)
	{
	        final long time = PlanUtils.getTimeSpent(constructorTime, openTime, nextTime, closeTime, timeType);

		if (type == NoPutResultSet.CURRENT_RESULTSET_ONLY)
		{
			return	time - source.getTimeSpent(ENTIRE_RESULTSET_TREE, timeType);
		}
		else
		{
                        // GemStone changes BEGIN
                        return timeType == ALL ? (time - constructorTime) : time;
                        /*(original code) return totTime; */
                        // GemStone changes END
		}
	}

	//
	// CursorResultSet interface
	//

	/**
	 * Gets information from its source. We might want
	 * to have this take a CursorResultSet in its constructor some day,
	 * instead of doing a cast here?
	 *
	 * @see CursorResultSet
	 *
	 * @return the row location of the current cursor row.
	 *
 	 * @exception StandardException thrown on failure
	 */
	public RowLocation getRowLocation() throws StandardException
	{
		if (SanityManager.DEBUG)
			SanityManager.ASSERT(source instanceof CursorResultSet, "source not CursorResultSet");
		return ( (CursorResultSet)source ).getRowLocation();
	}

	/**
	 * Gets information from last getNextRow call.
	 *
	 * @see CursorResultSet
	 *
	 * @return the last row returned.
	 */
	/* RESOLVE - this should return activation.getCurrentRow(resultSetNumber),
	 * once there is such a method.  (currentRow is redundant)
	 */
	public ExecRow getCurrentRow() throws StandardException
	{
		if (isForUpdate() && isDeleted()) {
			return null;
		} else {
			return currentRow;
		}
	}

	//
	// class implementation
	//

	/**
	 * Add a row to the backing hash table, keyed on position.
	 * When a row gets updated when using scrollable insensitive updatable
	 * result sets, the old entry for the row will be deleted from the hash
	 * table and this method will be called to add the new values for the row
	 * to the hash table, with the parameter rowUpdated = true so as to mark
	 * the row as updated. The latter is done in order to implement
	 * detectability of own changes for result sets of this type.
	 *
	 * @param sourceRow	The row to add.
	 * @param position The key
	 * @param rowLoc The rowLocation of the row to add.
	 * @param rowUpdated Indicates whether the row has been updated.
	 *
	 */
	private void addRowToHashTable(ExecRow sourceRow, int position,
			RowLocation rowLoc, boolean rowUpdated)
		throws StandardException
	{
		DataValueDescriptor[] hashRowArray = new
				DataValueDescriptor[sourceRowWidth + extraColumns];
		// 1st element is the key
		hashRowArray[0] = new SQLInteger(position);
		if (isForUpdate()) {
			hashRowArray[POS_ROWLOCATION] = rowLoc.getClone();
			hashRowArray[POS_ROWDELETED] = new SQLBoolean(false);
			hashRowArray[POS_ROWUPDATED] = new SQLBoolean(rowUpdated);
		}

		/* Copy rest of elements from sourceRow.
		 * NOTE: We need to clone the source row
		 * and we do our own cloning since the 1st column
		 * is not a wrapper.
		 */
		DataValueDescriptor[] sourceRowArray = sourceRow.getRowArray();

	//	System.out.println("XXX the source row width "+this.sourceRowWidth+" ExtraColumns="+extraColumns+" the source row length="+sourceRowArray.length);
                // GemStone changes BEGIN
		/*(original code) System.arraycopy(sourceRowArray, 0, hashRowArray, extraColumns,
		    sourceRowArray.length);*/
                System.arraycopy(sourceRowArray, 0, hashRowArray, extraColumns,
                    sourceRowWidth);

		ht.putRow(true, hashRowArray, null);
		// GemStone changes END

		numToHashTable++;
	}

	/**
	 * Get the row at the specified position
	 * from the hash table.
	 *
	 * @param position	The specified position.
	 *
	 * @return	The row at that position.
	 *
 	 * @exception StandardException thrown on failure
	 */
	private ExecRow getRowFromHashTable(int position)
		throws StandardException
	{

		// Get the row from the hash table
		positionInHashTable.setValue(position);
		DataValueDescriptor[] hashRowArray = (DataValueDescriptor[])
				ht.get(positionInHashTable);

		if (SanityManager.DEBUG)
		{
			SanityManager.ASSERT(hashRowArray != null,
				"hashRowArray expected to be non-null");
		}
		// Copy out the Object[] without the position.
		DataValueDescriptor[] resultRowArray = new
				DataValueDescriptor[hashRowArray.length - extraColumns];
		System.arraycopy(hashRowArray, extraColumns, resultRowArray, 0,
				resultRowArray.length);

		resultRow.setRowArray(resultRowArray);

		// Reset the current position to the user position
		currentPosition = position;

		numFromHashTable++;

		if (resultRow != null)
		{
			beforeFirst = false;
			afterLast = false;
		}

		if (isForUpdate()) {
			RowLocation rowLoc = (RowLocation) hashRowArray[POS_ROWLOCATION];
			// Keep source and target with the same currentRow
			((NoPutResultSet)target).setCurrentRow(resultRow);
			((NoPutResultSet)target).positionScanAtRowLocation(rowLoc);
			needsRepositioning = true;
		}

		setCurrentRow(resultRow);

		return resultRow;
	}

	/**
	 * Get the row data at the specified position
	 * from the hash table.
	 *
	 * @param position	The specified position.
	 *
	 * @return	The row data at that position.
	 *
 	 * @exception StandardException thrown on failure
	 */
	private DataValueDescriptor[] getRowArrayFromHashTable(int position)
		throws StandardException
	{
		positionInHashTable.setValue(position);
		final DataValueDescriptor[] hashRowArray = (DataValueDescriptor[])
			ht.get(positionInHashTable);

		// Copy out the Object[] without the position.
		final DataValueDescriptor[] resultRowArray = new
			DataValueDescriptor[hashRowArray.length - extraColumns];
		System.arraycopy(hashRowArray, extraColumns, resultRowArray, 0,
						 resultRowArray.length);
		return resultRowArray;
	}

	/**
	 * Positions the cursor in the last fetched row. This is done before
	 * navigating to a row that has not previously been fetched, so that
	 * getNextRowCore() will re-start from where it stopped.
	 */
	private void positionInLastFetchedRow() throws StandardException {
		if (positionInSource > 0) {
			positionInHashTable.setValue(positionInSource);
			DataValueDescriptor[] hashRowArray = (DataValueDescriptor[])
					ht.get(positionInHashTable);
			RowLocation rowLoc = (RowLocation) hashRowArray[POS_ROWLOCATION];
			((NoPutResultSet)target).positionScanAtRowLocation(rowLoc);
			currentPosition = positionInSource;
		}
	}

	/**
	 * @see NoPutResultSet#updateRow
	 *
	 * Sets the updated column of the hash table to true and updates the row
	 * in the hash table with the new values for the row.
	 */
	public void updateRow(ExecRow row) throws StandardException {
		ExecRow newRow = row;
		boolean undoProjection = false;

		if (source instanceof ProjectRestrictResultSet) {
			newRow = ((ProjectRestrictResultSet)source).
				doBaseRowProjection(row);
			undoProjection = true;
		}
		positionInHashTable.setValue(currentPosition);
		DataValueDescriptor[] hashRowArray = (DataValueDescriptor[])
				ht.get(positionInHashTable);
		RowLocation rowLoc = (RowLocation) hashRowArray[POS_ROWLOCATION];
		ht.remove(new SQLInteger(currentPosition));
		addRowToHashTable(newRow, currentPosition, rowLoc, true);

		// Modify row to refer to data in the BackingStoreHashtable.
		// This allows reading of data which goes over multiple pages
		// when doing the actual update (LOBs). Putting columns of
		// type SQLBinary to disk, has destructive effect on the columns,
		// and they need to be re-read. That is the reason this is needed.
		if (undoProjection) {

			final DataValueDescriptor[] newRowData = newRow.getRowArray();

			// Array of original position in row
			final int[] origPos =((ProjectRestrictResultSet)source).
				getBaseProjectMapping();

			// We want the row to contain data backed in BackingStoreHashtable
			final DataValueDescriptor[] backedData =
				getRowArrayFromHashTable(currentPosition);

			for (int i=0; i<origPos.length; i++) {
				if (origPos[i]>=0) {
					row.setColumn(origPos[i], backedData[i]);
				}
			}
		} else {
			row.setRowArray(getRowArrayFromHashTable(currentPosition));
		}
	}

	/**
	 * @see NoPutResultSet#markRowAsDeleted
	 *
	 * Sets the deleted column of the hash table to true in the current row.
	 */
	public void markRowAsDeleted() throws StandardException  {
		positionInHashTable.setValue(currentPosition);
		DataValueDescriptor[] hashRowArray = (DataValueDescriptor[])
				ht.get(positionInHashTable);
		RowLocation rowLoc = (RowLocation) hashRowArray[POS_ROWLOCATION];
		ht.remove(new SQLInteger(currentPosition));
		((SQLBoolean)hashRowArray[POS_ROWDELETED]).setValue(true);
		// Set all columns to NULL, the row is now a placeholder
		for (int i=extraColumns; i<hashRowArray.length; i++) {
			hashRowArray[i].setToNull();
		}
                // Gemstone changes BEGIN
		ht.putRow(true, hashRowArray, null);
		// Gemstone changes END
	}

	/**
	 * Returns TRUE if the row was been deleted within the transaction,
	 * otherwise returns FALSE
	 *
	 * @return True if the row has been deleted, otherwise false
	 *
	 * @exception StandardException on error
	 */
	public boolean isDeleted() throws StandardException  {
		if (currentPosition <= positionInSource && currentPosition > 0) {
			positionInHashTable.setValue(currentPosition);
			DataValueDescriptor[] hashRowArray = (DataValueDescriptor[])
					ht.get(positionInHashTable);
			return hashRowArray[POS_ROWDELETED].getBoolean();
		}
		return false;
	}

	/**
	 * Returns TRUE if the row was been updated within the transaction,
	 * otherwise returns FALSE
	 *
	 * @return True if the row has been deleted, otherwise false
	 *
	 * @exception StandardException on error
	 */
	public boolean isUpdated() throws StandardException {
		if (currentPosition <= positionInSource && currentPosition > 0) {
			positionInHashTable.setValue(currentPosition);
			DataValueDescriptor[] hashRowArray = (DataValueDescriptor[])
					ht.get(positionInHashTable);
			return hashRowArray[POS_ROWUPDATED].getBoolean();
		}
		return false;
	}

	public boolean isForUpdate() {
		return source.isForUpdate();
	}

// GemStone changes BEGIN
  public void setSourceRowWidth(int width) {
    this.sourceRowWidth = width;
  }

  @Override
  public void updateRowLocationPostRead() throws StandardException {
    this.source.updateRowLocationPostRead();
  }

  @Override
  public void filteredRowLocationPostRead(TXState localTXState) throws StandardException {
    this.source.filteredRowLocationPostRead(localTXState);
  }

  @Override
  public void releasePreviousByteSource() {
    this.source.releasePreviousByteSource();
  }

  @Override
  public void accept(
      ResultSetStatisticsVisitor visitor) {
    if(source != null) {
      visitor.setNumberOfChildren(1);
    }
    else {
      visitor.setNumberOfChildren(0);
    }

    visitor.visit(this);

    if(source != null) {
      source.accept(visitor);
    }

  }

  @Override
  public void resetStatistics() {
    super.resetStatistics();
    source.resetStatistics();
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isDistributedResultSet() {
    return this.source.isDistributedResultSet();
  }

  @Override
  protected AbstractGemFireResultSet getWrappedGemFireRS() {
    return this.source instanceof AbstractGemFireResultSet
        ? (AbstractGemFireResultSet)this.source : null;
  }

  @Override
  protected void attachStatementContext() throws StandardException {
    if (!isDistributedResultSet()) {
      super.attachStatementContext();
    }
  }

  private boolean hasLockReference;

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean addLockReference(GemFireTransaction tran) {
    tran.getLockSpace().addResultSetRef();
    this.hasLockReference = true;
    return true;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean releaseLocks(GemFireTransaction tran) {
    if (this.hasLockReference) {
      tran.releaseAllLocks(false, true);
      this.hasLockReference = false;
      return true;
    }
    else {
      return false;
    }
  }
// GemStone changes END

  @Override
  public StringBuilder buildQueryPlan(StringBuilder builder, PlanUtils.Context context) {
    super.buildQueryPlan(builder, context);

    PlanUtils.xmlTermTag(builder, context, PlanUtils.OP_GROUP);

    if(this.source != null) {
      this.source.buildQueryPlan(builder, context.pushContext());
    }

    PlanUtils.xmlCloseTag(builder, context, this);

    return builder;
  }

  @Override
  public void printResultSetHierarchy() {
    if (SanityManager.DEBUG) {
      if (GemFireXDUtils.TraceNCJ) {
        SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_NON_COLLOCATED_JOIN,
            "ResultSet Created: "
                + this.getClass().getSimpleName()
                + " with resultSetNumber="
                + resultSetNumber
                + " with source = "
                + (this.source != null ? this.source.getClass().getSimpleName()
                    : null) + " and source ResultSetNumber = "
                + (this.source != null ? this.source.resultSetNumber() : -1));
      }
    }
  }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="favicon.ico">

    <title>SMEP Painel</title>

    <link href="components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <link href="static/css/dashboard.css" rel="stylesheet">

    <link href="components/odometer/themes/odometer-theme-car.css" rel="stylesheet" />

            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                Toggle navigation

            </button>
            SMEP

Início (current)

 Relatórios

Metas

Configurações

SMEP Painel

Informações

Anual - {{date | date:'yyyy' }}

                    <canvas id="line" class="chart chart-line" chart-data="consumo_mensal" chart-labels="labels" chart-series="series"></canvas>

Consumo Últimos 5 minutos [kW]

                    <canvas class="chart chart-line" chart-data="data_lastMinutes" chart_labels="labels_lastMinutes" chart-series="series_lastMinutes"></canvas>

Última amostra

Consumo Instantâneo: {{ lastPower }} kW

Consumo kWh: {{ lastkWh }} kWh

Data: {{ lastDate | date:'hh:mm:ss d/m/y' }}

Dispositivos Conectados

{{ tomada.nome }} {{ tomada.mac }}

Consumido no dia: {{ tomada.stats.dia | number : 2}} kWh

Consumido no mês: {{ tomada.stats.mes | number : 2 }} kWh

Consumido no ano:  {{ tomada.stats.ano | number : 2}} kWh

1000,001

                                Pronto

Trigger modal


text:
Package.describe({
  summary: "Check whether a value matches a pattern",
  version: '1.1.0'
});

Package.onUse(function (api) {
  api.use(['underscore', 'ejson'], ['client', 'server']);

  api.export(['check', 'Match']);

  api.addFiles('match.js', ['client', 'server']);
});

Package.onTest(function (api) {
  api.use(['check', 'tinytest', 'underscore', 'ejson'], ['client', 'server']);

  api.addFiles('match_test.js', ['client', 'server']);
});


text:
package org.kie.pmml.pmml_4_2.predictive.models.mining;

import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.kie.api.io.Resource;
import org.kie.api.pmml.PMMLRequestData;
import org.kie.internal.io.ResourceFactory;
import org.kie.pmml.pmml_4_2.PMML4ExecutionHelper;
import org.kie.pmml.pmml_4_2.PMMLRequestDataBuilder;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

@RunWith(Parameterized.class)
public class MiningModelSelectFirstRegressionTest {

    private static final String PMML_SOURCE = "org/kie/pmml/pmml_4_2/test_mining_model_select_first_regression.pmml";
    private static final String MINING_MODEL = "SampleMiningModel";

    private static final String INPUT1_FIELD_NAME = "input1";
    private static final String INPUT2_FIELD_NAME = "input2";
    private static final String INPUT3_FIELD_NAME = "input3";
    private static final String OUTPUT_FIELD_NAME = "Result";

    private static final double COMPARISON_DELTA = 0.001;

    private Optional<Double> input1;
    private Optional<Double> input2;
    private Optional<Double> input3;
    private double result;

    @Parameterized.Parameters
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][] {
                { Optional.of(10.0), Optional.of(10.0), Optional.of(10.0), 670 },
                { Optional.of(-10.0), Optional.of(-25.0), Optional.of(10.0), 455 },
                { Optional.of(200.0), Optional.of(-1.0), Optional.of(2.0), -299 },
                { Optional.of(90.0), Optional.of(2.0), Optional.of(4.0), 17040 },
        });
    }

    public MiningModelSelectFirstRegressionTest(Optional<Double> input1, Optional<Double> input2,
                                                Optional<Double> input3, double result) {
        this.input1 = input1;
        this.input2 = input2;
        this.input3 = input3;
        this.result = result;
    }

    @Test
    public void testMiningModelSelectFirstRegression() {
        final Resource res = ResourceFactory.newClassPathResource(PMML_SOURCE);
        final PMML4ExecutionHelper helper = PMML4ExecutionHelper.PMML4ExecutionHelperFactory
                .getExecutionHelper(MINING_MODEL, res, null, true);
        final PMMLRequestDataBuilder rdb = new PMMLRequestDataBuilder("1234", MINING_MODEL);
        input1.ifPresent(x -> rdb.addParameter(INPUT1_FIELD_NAME, x, Double.class));
        input2.ifPresent(x -> rdb.addParameter(INPUT2_FIELD_NAME, x, Double.class));
        input3.ifPresent(x -> rdb.addParameter(INPUT3_FIELD_NAME, x, Double.class));
        PMMLRequestData request = rdb.build();
        helper.submitRequest(request);
        helper.getResultData().iterator().forEachRemaining(rd -> {
            assertEquals(request.getCorrelationId(), rd.getCorrelationId());
            if (rd.getSegmentationId() == null) {
                assertEquals("OK",rd.getResultCode());
                double value = rd.getResultValue(OUTPUT_FIELD_NAME, "value", Double.class).orElse(null);
                assertNotNull(value);
                assertEquals(result, value, COMPARISON_DELTA);
            }
        });
    }
}


text:
package org.apache.hadoop.hdfs.server.datanode.fsdataset.impl;

import com.google.common.collect.Lists;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystemTestHelper;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.StorageType;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
import org.apache.hadoop.hdfs.server.common.Storage;
import org.apache.hadoop.hdfs.server.common.StorageInfo;
import org.apache.hadoop.hdfs.server.datanode.DNConf;
import org.apache.hadoop.hdfs.server.datanode.DataBlockScanner;
import org.apache.hadoop.hdfs.server.datanode.DataNode;
import org.apache.hadoop.hdfs.server.datanode.DataStorage;
import org.apache.hadoop.hdfs.server.datanode.StorageLocation;
import org.apache.hadoop.hdfs.server.datanode.fsdataset.RoundRobinVolumeChoosingPolicy;
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.DiskChecker;
import org.apache.hadoop.util.StringUtils;
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyListOf;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class TestFsDatasetImpl {
  private static final String BASE_DIR =
      new FileSystemTestHelper().getTestRootDir();
  private static final int NUM_INIT_VOLUMES = 2;
  private static final String[] BLOCK_POOL_IDS = {"bpid-0", "bpid-1"};

  // Use to generate storageUuid
  private static final DataStorage dsForStorageUuid = new DataStorage(
      new StorageInfo(HdfsServerConstants.NodeType.DATA_NODE));

  private Configuration conf;
  private DataNode datanode;
  private DataStorage storage;
  private DataBlockScanner scanner;
  private FsDatasetImpl dataset;

  private static Storage.StorageDirectory createStorageDirectory(File root) {
    Storage.StorageDirectory sd = new Storage.StorageDirectory(root);
    dsForStorageUuid.createStorageID(sd);
    return sd;
  }

  private static void createStorageDirs(DataStorage storage, Configuration conf,
      int numDirs) throws IOException {
    List<Storage.StorageDirectory> dirs =
        new ArrayList<Storage.StorageDirectory>();
    List<String> dirStrings = new ArrayList<String>();
    for (int i = 0; i < numDirs; i++) {
      File loc = new File(BASE_DIR + "/data" + i);
      dirStrings.add(loc.toString());
      loc.mkdirs();
      dirs.add(createStorageDirectory(loc));
      when(storage.getStorageDir(i)).thenReturn(dirs.get(i));
    }

    String dataDir = StringUtils.join(",", dirStrings);
    conf.set(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY, dataDir);
    when(storage.getNumStorageDirs()).thenReturn(numDirs);
  }

  @Before
  public void setUp() throws IOException {
    datanode = mock(DataNode.class);
    storage = mock(DataStorage.class);
    scanner = mock(DataBlockScanner.class);
    this.conf = new Configuration();
    final DNConf dnConf = new DNConf(conf);

    when(datanode.getConf()).thenReturn(conf);
    when(datanode.getDnConf()).thenReturn(dnConf);
    when(datanode.getBlockScanner()).thenReturn(scanner);

    createStorageDirs(storage, conf, NUM_INIT_VOLUMES);
    dataset = new FsDatasetImpl(datanode, storage, conf);
    for (String bpid : BLOCK_POOL_IDS) {
      dataset.addBlockPool(bpid, conf);
    }

    assertEquals(NUM_INIT_VOLUMES, dataset.getVolumes().size());
    assertEquals(0, dataset.getNumFailedVolumes());
  }

  @Test
  public void testAddVolumes() throws IOException {
    final int numNewVolumes = 3;
    final int numExistingVolumes = dataset.getVolumes().size();
    final int totalVolumes = numNewVolumes + numExistingVolumes;
    Set<String> expectedVolumes = new HashSet<String>();
    List<NamespaceInfo> nsInfos = Lists.newArrayList();
    for (String bpid : BLOCK_POOL_IDS) {
      nsInfos.add(new NamespaceInfo(0, "cluster-id", bpid, 1));
    }
    for (int i = 0; i < numNewVolumes; i++) {
      String path = BASE_DIR + "/newData" + i;
      StorageLocation loc = StorageLocation.parse(path);
      Storage.StorageDirectory sd = createStorageDirectory(new File(path));
      DataStorage.VolumeBuilder builder =
          new DataStorage.VolumeBuilder(storage, sd);
      when(storage.prepareVolume(eq(datanode), eq(loc.getFile()),
          anyListOf(NamespaceInfo.class)))
          .thenReturn(builder);

      dataset.addVolume(loc, nsInfos);
    }

    assertEquals(totalVolumes, dataset.getVolumes().size());
    assertEquals(totalVolumes, dataset.storageMap.size());

    Set<String> actualVolumes = new HashSet<String>();
    for (int i = 0; i < numNewVolumes; i++) {
      dataset.getVolumes().get(numExistingVolumes + i).getBasePath();
    }
    assertEquals(actualVolumes, expectedVolumes);
  }

  @Test
  public void testRemoveVolumes() throws IOException {
    // Feed FsDataset with block metadata.
    final int NUM_BLOCKS = 100;
    for (int i = 0; i < NUM_BLOCKS; i++) {
      String bpid = BLOCK_POOL_IDS[NUM_BLOCKS % BLOCK_POOL_IDS.length];
      ExtendedBlock eb = new ExtendedBlock(bpid, i);
      dataset.createRbw(StorageType.DEFAULT, eb, false);
    }
    final String[] dataDirs =
        conf.get(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY).split(",");
    final String volumePathToRemove = dataDirs[0];
    List<StorageLocation> volumesToRemove = new ArrayList<StorageLocation>();
    volumesToRemove.add(StorageLocation.parse(volumePathToRemove));

    dataset.removeVolumes(volumesToRemove);
    int expectedNumVolumes = dataDirs.length - 1;
    assertEquals("The volume has been removed from the volumeList.",
        expectedNumVolumes, dataset.getVolumes().size());
    assertEquals("The volume has been removed from the storageMap.",
        expectedNumVolumes, dataset.storageMap.size());

    try {
      dataset.asyncDiskService.execute(volumesToRemove.get(0).getFile(),
          new Runnable() {
            @Override
            public void run() {}
          });
      fail("Expect RuntimeException: the volume has been removed from the "
           + "AsyncDiskService.");
    } catch (RuntimeException e) {
      GenericTestUtils.assertExceptionContains("Cannot find root", e);
    }

    int totalNumReplicas = 0;
    for (String bpid : dataset.volumeMap.getBlockPoolList()) {
      totalNumReplicas += dataset.volumeMap.size(bpid);
    }
    assertEquals("The replica infos on this volume has been removed from the "
                 + "volumeMap.", NUM_BLOCKS / NUM_INIT_VOLUMES,
                 totalNumReplicas);

    // Verify that every BlockPool deletes the removed blocks from the volume.
    verify(scanner, times(BLOCK_POOL_IDS.length))
        .deleteBlocks(anyString(), any(Block[].class));
  }

  @Test(timeout = 5000)
  public void testChangeVolumeWithRunningCheckDirs() throws IOException {
    RoundRobinVolumeChoosingPolicy<FsVolumeImpl> blockChooser =
        new RoundRobinVolumeChoosingPolicy<>();
    final FsVolumeList volumeList = new FsVolumeList(0, blockChooser);
    final List<FsVolumeImpl> oldVolumes = new ArrayList<>();

    // Initialize FsVolumeList with 5 mock volumes.
    final int NUM_VOLUMES = 5;
    for (int i = 0; i < NUM_VOLUMES; i++) {
      FsVolumeImpl volume = mock(FsVolumeImpl.class);
      oldVolumes.add(volume);
      when(volume.getBasePath()).thenReturn("data" + i);
      volumeList.addVolume(volume);
    }

    // When call checkDirs() on the 2nd volume, anther "thread" removes the 5th
    // volume and add another volume. It does not affect checkDirs() running.
    final FsVolumeImpl newVolume = mock(FsVolumeImpl.class);
    FsVolumeImpl blockedVolume = volumeList.getVolumes().get(1);
    doAnswer(new Answer() {
      @Override
      public Object answer(InvocationOnMock invocationOnMock)
          throws Throwable {
        volumeList.removeVolume("data4");
        volumeList.addVolume(newVolume);
        return null;
      }
    }).when(blockedVolume).checkDirs();

    FsVolumeImpl brokenVolume = volumeList.getVolumes().get(2);
    doThrow(new DiskChecker.DiskErrorException("broken"))
        .when(brokenVolume).checkDirs();

    volumeList.checkDirs();

    // Since FsVolumeImpl#checkDirs() get a snapshot of the list of volumes
    // before running removeVolume(), it is supposed to run checkDirs() on all
    // the old volumes.
    for (FsVolumeImpl volume : oldVolumes) {
      verify(volume).checkDirs();
    }
    // New volume is not visible to checkDirs() process.
    verify(newVolume, never()).checkDirs();
    assertTrue(volumeList.getVolumes().contains(newVolume));
    assertFalse(volumeList.getVolumes().contains(brokenVolume));
    assertEquals(NUM_VOLUMES - 1, volumeList.getVolumes().size());
  }
}


text:
angular.module('app').controller("appSearchCtrl", ["$scope", "$rootScope", "$timeout", "AdvertisementService", function($scope, $rootScope, $timeout, AdvertisementService) {
    $scope.adType = 'sell';
    $scope.period = 'week';
    $scope.city = '';
    $scope.page = 0;

    $scope.getCtrlAdType = function(){
        return $scope.adType;
    };

    $scope.setCtrlAdType = function(adType){
        $scope.adType = adType;
    };

    $scope.getCtrlPeriod = function(){
        return $scope.period;
    };

    $scope.setCtrlPeriod = function(period){
        $scope.period = period;
    };

    $scope.getCtrlCity = function(){
        return $scope.city;
    };

    $scope.setCtrlCity = function(city){
        $scope.city = city;
    };

    $scope.getCtrlPage = function(){
        return $scope.page;
    };

    $scope.setCtrlPage = function(page){
        $scope.page = page;
    };

    $scope.$on('searchFilterTypeChange', function(e, args){
        $scope.setCtrlAdType(args.adType);
        $scope.setCtrlPage(0);
        $scope.search();
    });

    $scope.$on('searchFilterPeriodChange', function(e, args){
        $scope.setCtrlPeriod(args.period);
        $scope.setCtrlPage(0);
        $scope.search();
    });

    $scope.$on('searchFilterCityChange', function(e, args){
        $scope.setCtrlCity(args.cityId);
        $scope.setCtrlPage(0);
        $scope.search();
    });

    $scope.$on('searchPage', function(e, args){
        $scope.setCtrlPage(args.page);
        $scope.search();
    });

    $scope.$on('search', function(e, args){
        $scope.search();
    });

    $scope.search = function(){
        $timeout(function(){
            var params = $('#mainSearch').serializeArray().reduce(function(obj, item) {
                obj[item.name] = item.value;
                return obj;
            }, {});
            AdvertisementService.getAdvertisements(params).then(function(data){
                $rootScope.$broadcast('searchComplete', {'data': data});
                AdvertisementService.getAdvertisementsMap({'ad_type': params.ad_type, 'period': params.period, 'city_id': params.city_id}).then(function(data){
                    $rootScope.$broadcast('searchAdvertisementMap', data);
                });
            });
        }, 50);
    }

}])


text:
package jp.sourceforge.ea2ddl.dao.cbean.cq;

import jp.sourceforge.ea2ddl.dao.cbean.cq.bs.BsTFilesCQ;

import org.seasar.dbflute.cbean.ConditionQuery;
import org.seasar.dbflute.cbean.sqlclause.SqlClause;

/**
 * The condition-query of t_files.
 * <p>
 * You can implement your original methods here.
 * This class is NOT overrided when re-generating.
 * </p>
 * @author DBFlute(AutoGenerator)
 */
@SuppressWarnings("unchecked")
public class TFilesCQ extends BsTFilesCQ {

    // ===================================================================================
    //                                                                         Constructor
    //                                                                         ===========
    /**
     * Constructor.
     * @param childQuery Child query as abstract class. (Nullable: If null, this is base instance.)
     * @param sqlClause SQL clause instance. (NotNull)
     * @param aliasName My alias name. (NotNull)
     * @param nestLevel Nest level.
     */
    public TFilesCQ(ConditionQuery childQuery, SqlClause sqlClause, String aliasName, int nestLevel) {
        super(childQuery, sqlClause, aliasName, nestLevel);
    }

    // ===================================================================================
    //                                                                      Arrange Method
    //                                                                      ==============
	// You can make original arrange query methods here.
	// public void arranegeXxx() {
	//     ...
	// }
}


text:
using ManagerShop.DTOModel;
using ManagerShop.DTOModel.Model.RaKuTen;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;

namespace ManagerShop.Service.Contract
{
    [ServiceContract]
    public interface IStockService
    {
        [OperationContract]
        string GetProductStockByOrderNo(String OrderNo);

        [OperationContract]
        List<DTO_RAKUTEN_ITEMSTOCK> GetProductStockInfoFormDB();

        [OperationContract]
        ServiceResult UpdateStockRoomCount(List<DTO_RAKUTEN_ITEMSTOCK> listStockRoomStock);
    }
}


text:
// +build !ignore_autogenerated

// Code generated by controller-gen. DO NOT EDIT.

package v1alpha1

import (
	"k8s.io/api/apps/v1"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/runtime"
)

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition) {
	*out = *in
	in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCondition.
func (in *ClusterCondition) DeepCopy() *ClusterCondition {
	if in == nil {
		return nil
	}
	out := new(ClusterCondition)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterVersion) DeepCopyInto(out *ClusterVersion) {
	*out = *in
	out.TypeMeta = in.TypeMeta
	in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
	in.Spec.DeepCopyInto(&out.Spec)
	out.Status = in.Status
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterVersion.
func (in *ClusterVersion) DeepCopy() *ClusterVersion {
	if in == nil {
		return nil
	}
	out := new(ClusterVersion)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterVersion) DeepCopyObject() runtime.Object {
	if c := in.DeepCopy(); c != nil {
		return c
	}
	return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterVersionList) DeepCopyInto(out *ClusterVersionList) {
	*out = *in
	out.TypeMeta = in.TypeMeta
	in.ListMeta.DeepCopyInto(&out.ListMeta)
	if in.Items != nil {
		in, out := &in.Items, &out.Items
		*out = make([]ClusterVersion, len(*in))
		for i := range *in {
			(*in)[i].DeepCopyInto(&(*out)[i])
		}
	}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterVersionList.
func (in *ClusterVersionList) DeepCopy() *ClusterVersionList {
	if in == nil {
		return nil
	}
	out := new(ClusterVersionList)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterVersionList) DeepCopyObject() runtime.Object {
	if c := in.DeepCopy(); c != nil {
		return c
	}
	return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterVersionSpec) DeepCopyInto(out *ClusterVersionSpec) {
	*out = *in
	if in.APIServer != nil {
		in, out := &in.APIServer, &out.APIServer
		*out = new(StatefulSetSvcBundle)
		(*in).DeepCopyInto(*out)
	}
	if in.ControllerManager != nil {
		in, out := &in.ControllerManager, &out.ControllerManager
		*out = new(StatefulSetSvcBundle)
		(*in).DeepCopyInto(*out)
	}
	if in.ETCD != nil {
		in, out := &in.ETCD, &out.ETCD
		*out = new(StatefulSetSvcBundle)
		(*in).DeepCopyInto(*out)
	}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterVersionSpec.
func (in *ClusterVersionSpec) DeepCopy() *ClusterVersionSpec {
	if in == nil {
		return nil
	}
	out := new(ClusterVersionSpec)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterVersionStatus) DeepCopyInto(out *ClusterVersionStatus) {
	*out = *in
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterVersionStatus.
func (in *ClusterVersionStatus) DeepCopy() *ClusterVersionStatus {
	if in == nil {
		return nil
	}
	out := new(ClusterVersionStatus)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *StatefulSetSvcBundle) DeepCopyInto(out *StatefulSetSvcBundle) {
	*out = *in
	in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
	if in.StatefulSet != nil {
		in, out := &in.StatefulSet, &out.StatefulSet
		*out = new(v1.StatefulSet)
		(*in).DeepCopyInto(*out)
	}
	if in.Service != nil {
		in, out := &in.Service, &out.Service
		*out = new(corev1.Service)
		(*in).DeepCopyInto(*out)
	}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatefulSetSvcBundle.
func (in *StatefulSetSvcBundle) DeepCopy() *StatefulSetSvcBundle {
	if in == nil {
		return nil
	}
	out := new(StatefulSetSvcBundle)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualCluster) DeepCopyInto(out *VirtualCluster) {
	*out = *in
	out.TypeMeta = in.TypeMeta
	in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
	in.Spec.DeepCopyInto(&out.Spec)
	in.Status.DeepCopyInto(&out.Status)
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualCluster.
func (in *VirtualCluster) DeepCopy() *VirtualCluster {
	if in == nil {
		return nil
	}
	out := new(VirtualCluster)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *VirtualCluster) DeepCopyObject() runtime.Object {
	if c := in.DeepCopy(); c != nil {
		return c
	}
	return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualClusterList) DeepCopyInto(out *VirtualClusterList) {
	*out = *in
	out.TypeMeta = in.TypeMeta
	in.ListMeta.DeepCopyInto(&out.ListMeta)
	if in.Items != nil {
		in, out := &in.Items, &out.Items
		*out = make([]VirtualCluster, len(*in))
		for i := range *in {
			(*in)[i].DeepCopyInto(&(*out)[i])
		}
	}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualClusterList.
func (in *VirtualClusterList) DeepCopy() *VirtualClusterList {
	if in == nil {
		return nil
	}
	out := new(VirtualClusterList)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *VirtualClusterList) DeepCopyObject() runtime.Object {
	if c := in.DeepCopy(); c != nil {
		return c
	}
	return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualClusterSpec) DeepCopyInto(out *VirtualClusterSpec) {
	*out = *in
	if in.TransparentMetaPrefixes != nil {
		in, out := &in.TransparentMetaPrefixes, &out.TransparentMetaPrefixes
		*out = make([]string, len(*in))
		copy(*out, *in)
	}
	if in.OpaqueMetaPrefixes != nil {
		in, out := &in.OpaqueMetaPrefixes, &out.OpaqueMetaPrefixes
		*out = make([]string, len(*in))
		copy(*out, *in)
	}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualClusterSpec.
func (in *VirtualClusterSpec) DeepCopy() *VirtualClusterSpec {
	if in == nil {
		return nil
	}
	out := new(VirtualClusterSpec)
	in.DeepCopyInto(out)
	return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualClusterStatus) DeepCopyInto(out *VirtualClusterStatus) {
	*out = *in
	if in.Conditions != nil {
		in, out := &in.Conditions, &out.Conditions
		*out = make([]ClusterCondition, len(*in))
		for i := range *in {
			(*in)[i].DeepCopyInto(&(*out)[i])
		}
	}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualClusterStatus.
func (in *VirtualClusterStatus) DeepCopy() *VirtualClusterStatus {
	if in == nil {
		return nil
	}
	out := new(VirtualClusterStatus)
	in.DeepCopyInto(out)
	return out
}


text:
package com.android.internal.telephony;

@com.francetelecom.rd.stubs.annotation.ClassDone(0)
public interface IccConstants
{
  // Fields

  public static final int EF_ADN = 28474;

  public static final int EF_FDN = 28475;

  public static final int EF_SDN = 28489;

  public static final int EF_EXT1 = 28490;

  public static final int EF_EXT2 = 28491;

  public static final int EF_EXT3 = 28492;

  public static final int EF_EXT6 = 28616;

  public static final int EF_MWIS = 28618;

  public static final int EF_MBDN = 28615;

  public static final int EF_PNN = 28613;

  public static final int EF_SPN = 28486;

  public static final int EF_SMS = 28476;

  public static final int EF_ICCID = 12258;

  public static final int EF_AD = 28589;

  public static final int EF_MBI = 28617;

  public static final int EF_MSISDN = 28480;

  public static final int EF_SPDI = 28621;

  public static final int EF_SST = 28472;

  public static final int EF_CFIS = 28619;

  public static final int EF_IMG = 20256;

  public static final int EF_PBR = 20272;

  public static final int EF_MAILBOX_CPHS = 28439;

  public static final int EF_VOICE_MAIL_INDICATOR_CPHS = 28433;

  public static final int EF_CFF_CPHS = 28435;

  public static final int EF_SPN_CPHS = 28436;

  public static final int EF_SPN_SHORT_CPHS = 28440;

  public static final int EF_INFO_CPHS = 28438;

  public static final int EF_CSP_CPHS = 28437;

  public static final int EF_CST = 28466;

  public static final int EF_RUIM_SPN = 28481;

  public static final int EF_PL = 12037;

  public static final int EF_CSIM_LI = 28474;

  public static final int EF_CSIM_SPN = 28481;

  public static final int EF_CSIM_MDN = 28484;

  public static final int EF_CSIM_IMSIM = 28450;

  public static final int EF_CSIM_CDMAHOME = 28456;

  public static final int EF_CSIM_EPRL = 28506;

  public static final int EF_IMPU = 28420;

  public static final int EF_IMPI = 28418;

  public static final int EF_DOMAIN = 28419;

  public static final int EF_IST = 28423;

  public static final int EF_PCSCF = 28425;

  public static final int SMS_RECORD_LENGTH = 176;

  public static final java.lang.String MF_SIM = "3F00";

  public static final java.lang.String DF_TELECOM = "7F10";

  public static final java.lang.String DF_PHONEBOOK = "5F3A";

  public static final java.lang.String DF_GRAPHICS = "5F50";

  public static final java.lang.String DF_GSM = "7F20";

  public static final java.lang.String DF_CDMA = "7F25";

  public static final java.lang.String DF_ADFISIM = "7FFF";

}


text:
<?php
return [
    'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=host;dbname=db_name',
            'username' => 'user',
            'password' => 'pass',
            'charset' => 'utf8',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@common/mail',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
    ],
];


text:
package net.nemerosa.ontrack.extension.svn.service;

import net.nemerosa.ontrack.extension.svn.model.SVNSyncInfoStatus;
import net.nemerosa.ontrack.model.structure.ID;

public interface SVNSyncService {

    SVNSyncInfoStatus launchSync(ID branchId);

}


text:
<!DOCTYPE html>

		<link rel="stylesheet" type="text/css" href="stylesheet.css">
		<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans">

			<form>

Goal:

Current:

Needed:

Percentage Complete:

				</form>


text:
<?php

namespace Smartbox\Integration\FrameworkBundle\Exceptions;

class MessageDecodingFailedException extends \InvalidArgumentException
{
}


text:
package com.hmatalonga.greenhub.models;

import android.annotation.TargetApi;
import android.content.Context;
import android.app.Activity;
import android.app.ActivityManager;
import android.os.Debug;

import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.List;
import java.util.Locale;

import static com.hmatalonga.greenhub.util.LogUtils.logI;
import static com.hmatalonga.greenhub.util.LogUtils.makeLogTag;

/**
 * Memory properties model.
 */
public class Memory {

    private static final String TAG = makeLogTag(Memory.class);

    public static final int TOTAL = 0;
    public static final int FREE = 1;
    public static final int ACTIVE = 2;
    public static final int INACTIVE = 3;

    //TODO: Provide implementations for newer API levels due to SDK changes.

    /**
     * Read memory usage using the public Android API methods in ActivityManager,
     * such as MemoryInfo and getProcessMemoryInfo.
     *
     * @param context the Context from the running Activity.
     * @return array of int values with total and used memory, in KB.
     */
    @TargetApi(21)
    public static int[] readMemory(final Context context) {
        int[] pIds;
        int total;
        int used = 0;
        int counter = 0;
        int memoryUsed = 0;

        ActivityManager manager = (ActivityManager)
                context.getSystemService(Activity.ACTIVITY_SERVICE);
        ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();

        manager.getMemoryInfo(memoryInfo);
        total = (int) memoryInfo.availMem;

        List<ActivityManager.RunningAppProcessInfo> processInfoList =
                manager.getRunningAppProcesses();
        List<ActivityManager.RunningServiceInfo> serviceInfoList =
                manager.getRunningServices(Integer.MAX_VALUE);

        if (processInfoList == null || serviceInfoList == null) {
            return new int[] {total, used};
        }

        pIds = new int[processInfoList.size() + serviceInfoList.size()];

        for (ActivityManager.RunningAppProcessInfo processInfo : processInfoList) {
            pIds[counter] = processInfo.pid;
            counter++;
        }

        for (ActivityManager.RunningServiceInfo serviceInfo : serviceInfoList) {
            pIds[counter] = serviceInfo.pid;
            counter++;
        }

        // Two approaches one for Debug and other for Production
        // TODO: Do further testing to check Debug.MemoryInfo vs ActivityManager.MemoryInfo...

        // 1) ActivityManager.MemoryInfo
        manager.getMemoryInfo(memoryInfo);

        String message =
                String.format(Locale.US, "%d availMem, %b lowMemory, %d threshold, %d total",
                        memoryInfo.availMem, memoryInfo.lowMemory,
                        memoryInfo.threshold, memoryInfo.totalMem);

        logI(TAG, message);

        // 2) Debug.MemoryInfo
        Debug.MemoryInfo[] memoryInfosArray = manager.getProcessMemoryInfo(pIds);

        for (Debug.MemoryInfo memory : memoryInfosArray) {
            memoryUsed += memory.getTotalPss();
        }

        return new int[] {total, used};
    }

    /**
     * Reads the current memory usage by accessing the system file /proc/meminfo
     *
     * @return array of int values containing free, total, active and inactive memory in KB.
     */
    public static synchronized int[] readMemoryInfo() {
        // Local variables need to initialized before use, because of static
        int total = 0;
        int free = 0;
        int active = 0;
        int inactive = 0;

        try {
            RandomAccessFile reader = new RandomAccessFile("/proc/meminfo", "r");

            String load = reader.readLine();
            String[] tokens = load.split("\\s+");
            total = Integer.parseInt(tokens[1]);
            load = reader.readLine();
            tokens = load.split("\\s+");
            free = Integer.parseInt(tokens[1]);
            for (int i = 0; i < 4; i++) {
                load = reader.readLine();
            }
            tokens = load.split("\\s+");
            active = Integer.parseInt(tokens[1]);
            load = reader.readLine();
            tokens = load.split("\\s+");
            inactive = Integer.parseInt(tokens[1]);

            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return new int[] {free, total, active, inactive};
    }

    public static long[] getMemoryInfo(Context context) {
        ActivityManager.MemoryInfo info = new ActivityManager.MemoryInfo();
        ActivityManager activityManager = (ActivityManager)
                context.getSystemService(Context.ACTIVITY_SERVICE);
        activityManager.getMemoryInfo(info);

        return new long[] {info.totalMem, info.availMem, (info.totalMem - info.availMem)};
    }

    public static double getAvailableMemoryMB(Context context) {
        long[] memoryInfo = getMemoryInfo(context);
        return Math.round(memoryInfo[1] / 1000000);
    }

}


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* MarcBibliographicalIndex.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using JetBrains.Annotations;

#endregion

namespace ManagedClient.ImportExport
{
    /// <summary>
    /// Библиографический указатель.
    /// </summary>
    [PublicAPI]
    public enum MarcBibliographicalIndex
    {
        /// <summary>
        /// Часть монографии.
        /// </summary>
        PartOfMonograph = (int)'a',

        /// <summary>
        /// Часть сериального издания.
        /// </summary>
        PartOfSerialPrinting = (int)'b',

        /// <summary>
        /// Коллекция.
        /// </summary>
        Collection = (int)'c',

        /// <summary>
        /// Часть коллекции.
        /// </summary>
        PartOfCollection = (int)'d',

        /// <summary>
        /// Монография (книга, рукопись, картина и т.д.).
        /// </summary>
        Monograph = (int)'m',

        /// <summary>
        /// Сериальное издание, периодика.
        /// </summary>
        SerialPrinting = (int)'s'
    }
}


text:
class AddPositionToArticles < ActiveRecord::Migration

  def self.up
    add_column :articles, :author_position, :integer
  end

  def self.down
    remove_column :articles, :author_position
  end

end


text:
package serf

import (
	"time"

	"github.com/hashicorp/serf/serf"
)

// QueryOption func
type QueryOption func(*serf.QueryParam)

// WithFilterNodes returns node filter query option
func WithFilterNodes(nodes ...string) QueryOption {
	return func(p *serf.QueryParam) { p.FilterNodes = nodes }
}

// WithFilterTags returns tags filter query option
func WithFilterTags(tags map[string]string) QueryOption {
	return func(p *serf.QueryParam) { p.FilterTags = tags }
}

// WithRequestAck returns request ack query option
func WithRequestAck(ack bool) QueryOption {
	return func(p *serf.QueryParam) { p.RequestAck = ack }
}

// WithRelayFactor returns relay factor query option
func WithRelayFactor(num uint8) QueryOption {
	return func(p *serf.QueryParam) { p.RelayFactor = num }
}

// WithTimeout returns timeout query option
func WithTimeout(timeout time.Duration) QueryOption {
	return func(p *serf.QueryParam) { p.Timeout = timeout }
}


text:
package com.koenv.universalminecraftapi.spigot;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class SpigotTest {
    @Test
    public void sanityTest() {
        assertEquals(4, 2 + 2);
    }
}


text:
<?php

require_once('Commentaire.class.php');

class CommentaireManager{

	private $_db;

	public function __construct($db){
		$this->setDb($db);
	}

	public function setDb(PDO $db){
		$this->_db = $db;
	}

	/**
	*	Add comment in database
	*	@param : commentaire object
	*	@return : false if the insert failed / else true
	*/

	public function add(Commentaire $commentaire){

		$comment = $commentaire->getCommentaire();
		$dateCommentaire = $commentaire->getDateCommentaire();
		$heureCommentaire = $commentaire->getHeureCommentaire();
		$idCommentaireParent = $commentaire->getIdCommentaireParent();
		$idUtilisateur = $commentaire->getIdUtilisateur();
		$idActivite = $commentaire->getIdActivite();

		$sql = "INSERT INTO commentaire (commentaire, dateCommentaire, heureCommentaire, idCommentaireParent, idUtilisateur, idActivite)
			VALUES (:commentaire, :dateCommentaire, :heureCommentaire, :idCommentaireParent, :idUtilisateur, :idActivite)";
		$req = $this->_db->prepare($sql);
		$req->bindParam(':commentaire', $comment, PDO::PARAM_STR);
		$req->bindParam(':dateCommentaire', $dateCommentaire, PDO::PARAM_STR);
		$req->bindParam(':heureCommentaire', $heureCommentaire, PDO::PARAM_STR);
		$req->bindParam(':idCommentaireParent', $idCommentaireParent, PDO::PARAM_INT);
		$req->bindParam(':idUtilisateur', $idUtilisateur, PDO::PARAM_STR);
		$req->bindParam(':idActivite', $idActivite, PDO::PARAM_STR);
		$req->execute();
		$nbTupleInsere = $req->rowCount();
		$req->closeCursor();

		//check if insert has failed
		if($nbTupleInsere < 1)
			return false;
		return true;
	}

		//Delete  le commentaire donné en paramètre
	public function remove(Commentaire $commentaire){
		$idCommentaire = $commentaire->getIdCommentaire();
		$sql = "DELETE FROM commentaire WHERE idCommentaire = :idCommentaire ";
		$req = $this->_db->prepare($sql);
		$req->bindParam(':idCommentaire', $idCommentaire, PDO::PARAM_INT);
		$req->execute();
		$req->closeCursor();
	}

	/**
	*	Get comment with his ID
	*	@param : id : id of the comment we want to get
	*	@return : false if we have no result / else return an comment object
	*/
	public function getComment($id){
		$commentaire;
		$req = $this->_db->query('SELECT *
								FROM commentaire WHERE idCommentaire = \''.$id.'\' ');
		while ($donnees = $req->fetch(PDO::FETCH_ASSOC)){
			$commentaire = new Commentaire($donnees);
		}
		$nbTupleObt = $req->rowCount();
		$req->closeCursor();

		if($nbTupleObt < 1)
			return false;
		return $commentaire;

	}

	//get comments with commentaireParent's Id.
	public function getSonComment($id){
		$infos = array();
		$infosReturn = array();
		$req = $this->_db->query('SELECT *
								FROM commentaire WHERE idCommentaireParent = \''.$id.'\' ');
		while ($donnees = $req->fetch(PDO::FETCH_ASSOC)){
			$infos['idCommentaire'] = $donnees['idCommentaire'];
			$infos['idCommentaireParent'] = $donnees['idCommentaireParent'];
			$infos['commentaire'] = $donnees['commentaire'];
			$infos['dateCommentaire'] = $donnees['dateCommentaire'];
			$infos['heureCommentaire'] = $donnees['heureCommentaire'];
			$infos['idUtilisateur'] = $donnees['idUtilisateur'];
			$infos['idActivite'] = $donnees['idActivite'];
			$infosReturn[] = new Commentaire($infos);

		}
		$nbTupleObt = $req->rowCount();
		$req->closeCursor();

		if($nbTupleObt < 1)
			return false;
		return $infosReturn;

	}

	public function getParentCommentOfAgenda($idAgenda){
		$infos = array();
		$infosReturn = array();
		$sql = 'SELECT * FROM commentaire WHERE idActivite IN (SELECT idActivite FROM activite WHERE idAgenda='.$idAgenda.') AND idCommentaireParent IS NULL ';
		$req = $this->_db->query($sql);

		//Querry seems like that : SELECT * FROM commentaire WHERE idActivite IN ( (SELECT idActivite FROM activite WHERE idAgenda=60)) AND idCommentaireParent IS NULL
		while ($donnees = $req->fetch(PDO::FETCH_ASSOC)){
			$infos['idCommentaire'] = $donnees['idCommentaire'];
			$infos['idCommentaireParent'] = $donnees['idCommentaireParent'];
			$infos['commentaire'] = $donnees['commentaire'];
			$infos['dateCommentaire'] = $donnees['dateCommentaire'];
			$infos['heureCommentaire'] = $donnees['heureCommentaire'];
			$infos['idUtilisateur'] = $donnees['idUtilisateur'];
			$infos['idActivite'] = $donnees['idActivite'];
			$infosReturn[] = new Commentaire($infos);

		}
		$nbTupleObt = $req->rowCount();
		$req->closeCursor();

		if($nbTupleObt < 1)
			return false;
		return $infosReturn;
	}

	public function getParentCommentOfActivity($idActivite){
				$infos = array();
		$infosReturn = array();
		$sql = 'SELECT * FROM commentaire WHERE idActivite = '.$idActivite.' AND idCommentaireParent IS NULL ';
		$req = $this->_db->query($sql);

		//Querry seems like that : SELECT * FROM commentaire WHERE idActivite IN ( (SELECT idActivite FROM activite WHERE idAgenda=60)) AND idCommentaireParent IS NULL
		while ($donnees = $req->fetch(PDO::FETCH_ASSOC)){
			$infos['idCommentaire'] = $donnees['idCommentaire'];
			$infos['idCommentaireParent'] = $donnees['idCommentaireParent'];
			$infos['commentaire'] = $donnees['commentaire'];
			$infos['dateCommentaire'] = $donnees['dateCommentaire'];
			$infos['heureCommentaire'] = $donnees['heureCommentaire'];
			$infos['idUtilisateur'] = $donnees['idUtilisateur'];
			$infos['idActivite'] = $donnees['idActivite'];
			$infosReturn[] = new Commentaire($infos);

		}
		$nbTupleObt = $req->rowCount();
		$req->closeCursor();

		if($nbTupleObt < 1)
			return false;
		return $infosReturn;
	}

	/**
	*	List all comments
	*	@return : false if the insert failed / else return an array of comment object
	*/
	public function getAllComments(){
		$comment = array();
		$return = array();
		$req = $this->_db->query('SELECT *
									FROM commentaire ');
		while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) {
			$comment['idCommentaire'] = $donnees['idCommentaire'];
			$comment['idCommentaireParent'] = $donnees['idCommentaireParent'];
			$comment['commentaire'] = $donnees['commentaire'];
			$comment['dateCommentaire'] = $donnees['dateCommentaire'];
			$comment['heureCommentaire'] = $donnees['heureCommentaire'];
			$comment['idUtilisateur'] = $donnees['idUtilisateur'];
			$comment['idActivite'] = $donnees['idActivite'];
			$return[] = new Commentaire($comment);
		}

		$nbTupleObt = $req->rowCount();
		$req->closeCursor();

		if($nbTupleObt < 1)
			return false;
		return $return;
	}

	/**
	*	Update comment in database
	*	@param : Activity object
	*	@return : false if the update failed / else true
	*/
	public function modify(Commentaire $commentaire){
		$sql = "UPDATE commentaire
			SET commentaire = :commentaire,
			dateCommentaire = :dateCommentaire,
			heureCommentaire = :heureCommentaire,
			idUtilisateur = :idUtilisateur,
			idActivite = :idActivite
			WHERE idCommentaire = :idCommentaire";

		$comm = $commentaire->getCommentaire();
		$dateCom = $commentaire->getDateCommentaire();
		$heure = $commentaire->getHeureCommentaire();
		$util = $commentaire->getIdUtilisateur();
		$act = $commentaire->getIdActivite();
		$idComm = $commentaire->getIdCommentaire();

		$req = $this->_db->prepare($sql);
		$req->bindParam(':commentaire',$comm , PDO::PARAM_STR);
		$req->bindParam(':dateCommentaire',$dateCom , PDO::PARAM_STR);
		$req->bindParam(':heureCommentaire',$heure , PDO::PARAM_STR);
		$req->bindParam(':idUtilisateur',$util , PDO::PARAM_STR);
		$req->bindParam(':idActivite', $act, PDO::PARAM_STR);
		$req->bindParam(':idCommentaire', $idComm, PDO::PARAM_STR);
		$req->execute();

		$nbTupleObt = $req->rowCount();
		$req->closeCursor();

		if($nbTupleObt < 1)
			return false;
		return true;
	}
}