text:
-- Add indexes for improved performance and reduced locking.
alter table SAM_MEDIA_T modify (MEDIA blob);

create index SAM_AMETADATA_ASSESSMENTID_I on SAM_ASSESSMETADATA_T (ASSESSMENTID);
create index SAM_SECUREDIP_ASSESSMENTID_I on SAM_SECUREDIP_T (ASSESSMENTID);
create index SAM_SECTION_ASSESSMENTID_I on SAM_SECTION_T (ASSESSMENTID);
create index SAM_SECTIONMETA_SECTIONID_I on SAM_SECTIONMETADATA_T (SECTIONID);

create index SAM_ANSWER_ITEMID_I on SAM_ANSWER_T (ITEMID);

create index SAM_PUBA_ASSESSMENT_I on SAM_PUBLISHEDASSESSMENT_T (ASSESSMENTID);
create index SAM_PUBMETDATA_ASSESSMENT_I on SAM_PUBLISHEDMETADATA_T(ASSESSMENTID);

create index SAM_ITEMGRADING_ITEM_I on SAM_ITEMGRADING_T (PUBLISHEDITEMID);
create index SAM_ITEMGRADING_ITEMTEXT_I on SAM_ITEMGRADING_T (PUBLISHEDITEMTEXTID);
create index SAM_ITEMGRADING_PUBANS_I on SAM_ITEMGRADING_T (PUBLISHEDANSWERID);
create index SAM_PUBLISHEDASSESSMENT_I on SAM_ASSESSMENTGRADING_T (PUBLISHEDASSESSMENTID);
create index SAM_PUBLISHEDASSESSMENT2_I on SAM_STUDENTGRADINGSUMMARY_T (PUBLISHEDASSESSMENTID);
create index SAM_ASSGRAD_AID_PUBASSEID_T on SAM_ASSESSMENTGRADING_T (AGENTID,PUBLISHEDASSESSMENTID);

create index SAM_QPOOL_OWNER_I on SAM_QUESTIONPOOL_T (OWNERID);
create index SAM_QPOOLITEM_QPOOL_I on SAM_QUESTIONPOOLITEM_T (QUESTIONPOOLID);


text:
package hcs

import (
	"context"

	"github.com/Microsoft/hcsshim/internal/log"
	"github.com/sirupsen/logrus"
)

func logOperationBegin(ctx context.Context, f logrus.Fields, msg string) {
	log.G(ctx).WithFields(f).Debug(msg)
}

func logOperationEnd(ctx context.Context, f logrus.Fields, msg string, err error) {
	// Copy the log and fields first.
	log := log.G(ctx).WithFields(f)
	if err == nil {
		log.Debug(msg)
	} else {
		// Edit only the copied field data to avoid race conditions on the
		// write.
		log.Data[logrus.ErrorKey] = err
		log.Error(msg)
	}
}

redpajama_set_name: RedPajamaGithub


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class VNE_EditorController : EditorWindow
{
    private static EditorWindow currentWindow;
    private static EditorWindow additionalWindow;
    private bool isInMainMenu = true;

    /***********************************************/
    [MenuItem("Window/VN_Editor/MainWindow")]
    public static void ShowWindow()
    {
        currentWindow = EditorWindow.GetWindow(typeof(VNE_EditorController));
        currentWindow.Focus();
    }

    public void OnGUI()
    {
        if (isInMainMenu)
        {
            #region Start buttons
            GUILayout.BeginArea(new Rect(0, 0, Screen.width, 75));
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Show scenes", GUILayout.MaxWidth(100)))
            {
                isInMainMenu = false;
                GetWindow(typeof(VNE_SceneController), currentWindow);
                currentWindow.Close();
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndArea();

            GUILayout.BeginArea(new Rect(0, 25, Screen.width, 75));
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Settings", GUILayout.MaxWidth(100)))
            {
                isInMainMenu = false;
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndArea();

            GUILayout.BeginArea(new Rect(0, 50, Screen.width, 75));
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Credits", GUILayout.MaxWidth(100)))
            {
                isInMainMenu = false;
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndArea();
            #endregion
        }
    }
}


text:
=head1 LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2017] EMBL-European Bioinformatics Institute

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.

=cut

=head1 CONTACT

 Please email comments or questions to the public Ensembl
 developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.

 Questions may also be sent to the Ensembl help desk at
 <http://www.ensembl.org/Help/Contact>.

=cut
package Bio::EnsEMBL::Variation::Pipeline::ReleaseDataDumps::InitDumpPopulation;

use strict;
use warnings;

use base ('Bio::EnsEMBL::Variation::Pipeline::ReleaseDataDumps::BaseDataDumpsProcess');

use File::Path qw(make_path);
use FileHandle;

sub fetch_input {
  my $self = shift;

  my $populations = {
    'HAPMAP' => {
      'CSHL-HAPMAP:HAPMAP-ASW' => 'ASW',
      'CSHL-HAPMAP:HAPMAP-CHB' => 'CHB',
      'CSHL-HAPMAP:HAPMAP-CHD' => 'CHD',
      'CSHL-HAPMAP:HAPMAP-GIH' => 'GIH',
      'CSHL-HAPMAP:HAPMAP-LWK' => 'LWK',
      'CSHL-HAPMAP:HAPMAP-MEX' => 'MEX',
      'CSHL-HAPMAP:HAPMAP-MKK' => 'MKK',
      'CSHL-HAPMAP:HAPMAP-TSI' => 'TSI',
      'CSHL-HAPMAP:HapMap-CEU' => 'CEU',
      'CSHL-HAPMAP:HapMap-HCB' => 'HCB',
      'CSHL-HAPMAP:HapMap-JPT' => 'JPT',
      'CSHL-HAPMAP:HapMap-YRI' => 'YRI',
    },
    'ESP' => {
      'ESP6500:African_American'  => 'AA',
      'ESP6500:European_American' => 'EA',
    },
  };

  $self->param('populations', $populations);

  my $pipeline_dir = $self->param('pipeline_dir');
  my $file_type = $self->param('file_type');

  if ($file_type eq 'gvf') {

    my $prefetched_frequencies_dir = $self->param('prefetched_frequencies');
    die "$prefetched_frequencies_dir doesn't exist" unless (-d $prefetched_frequencies_dir);

    my $variation_ids_dir = "$pipeline_dir/variation_ids";
    make_path($variation_ids_dir) unless (-d $variation_ids_dir);
    $self->param('variation_ids_dir', $variation_ids_dir);

    my $human_gvf_file_gz = $self->param('pipeline_dir') . '/gvf/Homo_sapiens/Homo_sapiens.gvf.gz';
    die("$human_gvf_file_gz doesn't exist") unless (-f $human_gvf_file_gz);
    my $human_gvf_file = $self->param('pipeline_dir') . '/gvf/Homo_sapiens/Homo_sapiens.gvf';
    system("gunzip $human_gvf_file_gz");

    $self->param('human_gvf_file', $human_gvf_file);
    $self->param('gvf_files_dir', "$pipeline_dir/gvf/Homo_sapiens/");
  }

  if ($file_type eq 'vcf') {
    $self->param('vcf_files_dir', "$pipeline_dir/vcf/Homo_sapiens/");
  }
}

sub run {
  my $self = shift;
  my $file_type = $self->param('file_type');
  if ($file_type eq 'gvf') {
    $self->divide_variation_ids_by_chrom;
    my $input = $self->get_input_dump_gvf;
    $self->param('input_parameters', $input);
  } elsif ($file_type eq 'vcf') {
    my $input = $self->get_input_dump_vcf;
    $self->param('input_parameters', $input);
  } else {
    die "File type must be gvf or vcf. File type ($file_type) is not valid.";
  }
}

sub get_input_dump_vcf {
  my $self = shift;
  my $populations = $self->param('populations');

  my $file_type       = 'vcf';
  my $script_dir      = $self->param('script_dir');
  my $script          = '/misc/release/gvf2vcf.pl';
  my $output_dir      = $self->param('pipeline_dir');
  my $connection_args = '--registry ' . $self->param('registry_file');
  my $species = 'Homo_sapiens';
  my @input = ();

  foreach my $group (keys %$populations) {
    foreach my $population_name (keys %{$populations->{$group}}) {
      my $params = {};
      my $short_name = $populations->{$group}->{$population_name};
      my $file_name = $population_name;
      $file_name =~ s/:/-/;
      my $err = "$output_dir/$file_type/$species/$file_name.err";
      my $out = "$output_dir/$file_type/$species/$file_name.out";
      $params->{'species'}          = $species;
      $params->{'script'}           = "$script_dir/$script";
      $params->{'connection_args'}  = $connection_args;
      $params->{'script_args'}      = "--population $population_name --evidence --ancestral_allele --clinical_significance" ;
      $params->{'err'}              = $err;
      $params->{'out'}              = $out;

      my $gvf_file_name = "$file_name.gvf.gz";
      my $vcf_file_name = "$file_name.vcf";
      my $gvf_file = "$output_dir/gvf/$species/$gvf_file_name";
      die "GVF file $gvf_file not found" unless(-e $gvf_file);
      my $vcf_file = "$output_dir/vcf/$species/$vcf_file_name";
      $params->{'gvf_file'} = "--gvf_file $gvf_file";
      $params->{'vcf_file'} = "--vcf_file $vcf_file";
      push @input, $params;
    }
  }
  return \@input;
}

sub divide_variation_ids_by_chrom {
  my $self = shift;
  my $pipeline_dir = $self->param('pipeline_dir');

  my $variation_ids_dir = $self->param('variation_ids_dir');
  my $human_gvf_file = $self->param('human_gvf_file');

  my $fh_gvf = FileHandle->new($human_gvf_file, 'r');
  my $prev_seq_id = undef;
  my $fh = undef;

  while (<$fh_gvf>) {
    chomp;
    if (/^#/) {
      next;
    } else {
      my $line = $_;
      my $gvf_line = get_gvf_line($line);
      my $seq_id = $gvf_line->{seq_id};
      my $variation_id  = $gvf_line->{attributes}->{variation_id};
      if ("$seq_id" ne "$prev_seq_id" || !$seq_id) {
        $fh->close() if ($fh);
        $fh = FileHandle->new("$variation_ids_dir/$seq_id.txt", 'w');
        $prev_seq_id = $seq_id;
      }
      print $fh $variation_id, "\n";
    }
  }
  $fh_gvf->close();
  $fh->close();
}

sub get_gvf_line {
  my $line = shift;
  my $gvf_line = {};
  my @header_names = qw/seq_id source type start end score strand phase/;
  my @header_values = split(/\t/, $line);
  my $attrib = pop @header_values;

  for my $i (0 .. $#header_names) {
    $gvf_line->{$header_names[$i]} = $header_values[$i];
  }

  my @attributes = split(';', $attrib);
  foreach my $attribute (@attributes) {
    my ($key, $value) = split('=', $attribute);
    if ($value) {
      $gvf_line->{attributes}->{$key} = $value;
    }
  }
  return $gvf_line;
}

sub get_input_dump_gvf {
  my $self = shift;
  my @input = ();

  my $populations = $self->param('populations');
  my $human_gvf_file = $self->param('human_gvf_file');
  my $gvf_files_dir = $self->param('gvf_files_dir');
  my $variation_ids_dir = $self->param('variation_ids_dir');

  my $file_type = $self->param('file_type');
  foreach my $group (keys %$populations) {
    foreach my $population_name (keys %{$populations->{$group}}) {
      $self->warning("$group $population_name");
      my $params = {};
      my $short_name = $populations->{$group}->{$population_name};
      my $file_name = $population_name;
      $file_name =~ s/:/-/;

      $params->{human_gvf_file} = $human_gvf_file;
      $params->{variation_ids_dir} = $variation_ids_dir;
      $params->{population_name} = $population_name;
      $params->{file_name} = $population_name;
      $params->{population_gvf_file} = "$gvf_files_dir/$file_name.gvf";
      $params->{short_name} = $short_name;
      $params->{file_type} = $file_type;
      $params->{group} = $group;
      push @input, $params;
    }
  }
  return \@input;
}

sub write_output {
  my $self = shift;
  my $input_parameters = $self->param('input_parameters');
  $self->dataflow_output_id($input_parameters, 2);
  return;
}

1;


text:
export MASTER=spark://localhost:7077
export SPARK_HOME=/opt/spark
export SPARK_SUBMIT_OPTIONS="--jars /opt/systemml/systemml-0.15.0.jar"
export ZEPPELIN_PORT=8081
export ZEPPELIN_SPARK_USEHIVECONTEXT=false

# export JAVA_HOME=
# export MASTER=                 		# Spark master url. eg. spark://master_addr:7077. Leave empty if you want to use local mode.
# export ZEPPELIN_JAVA_OPTS      		# Additional jvm options. for example, export ZEPPELIN_JAVA_OPTS="-Dspark.executor.memory=8g -Dspark.cores.max=16"
# export ZEPPELIN_MEM            		# Zeppelin jvm mem options Default -Xmx1024m -XX:MaxPermSize=512m
# export ZEPPELIN_INTP_MEM       		# zeppelin interpreter process jvm mem options. Default = ZEPPELIN_MEM
# export ZEPPELIN_INTP_JAVA_OPTS 		# zeppelin interpreter process jvm options. Default = ZEPPELIN_JAVA_OPTS

# export ZEPPELIN_LOG_DIR        		# Where log files are stored.  PWD by default.
# export ZEPPELIN_PID_DIR        		# The pid files are stored. /tmp by default.
# export ZEPPELIN_WAR_TEMPDIR    		# The location of jetty temporary directory.
# export ZEPPELIN_NOTEBOOK_DIR   		# Where notebook saved
# export ZEPPELIN_NOTEBOOK_HOMESCREEN		# Id of notebook to be displayed in homescreen. ex) 2A94M5J1Z
# export ZEPPELIN_NOTEBOOK_HOMESCREEN_HIDE	# hide homescreen notebook from list when this value set to "true". default "false"
# export ZEPPELIN_NOTEBOOK_S3_BUCKET    # Bucket where notebook saved
# export ZEPPELIN_NOTEBOOK_S3_USER      # User in bucket where notebook saved. For example bucket/user/notebook/2A94M5J1Z/note.json
# export ZEPPELIN_IDENT_STRING   		# A string representing this instance of zeppelin. $USER by default.
# export ZEPPELIN_NICENESS       		# The scheduling priority for daemons. Defaults to 0.

#### Spark interpreter configuration ####

## Use provided spark installation ##
## defining SPARK_HOME makes Zeppelin run spark interpreter process using spark-submit
##
# export SPARK_HOME                             # (required) When it is defined, load it instead of Zeppelin embedded Spark libraries
# export SPARK_SUBMIT_OPTIONS                   # (optional) extra options to pass to spark submit. eg) "--driver-memory 512M --executor-memory 1G".

## Use embedded spark binaries ##
## without SPARK_HOME defined, Zeppelin still able to run spark interpreter process using embedded spark binaries.
## however, it is not encouraged when you can define SPARK_HOME
##
# Options read in YARN client mode
# export HADOOP_CONF_DIR         		# yarn-site.xml is located in configuration directory in HADOOP_CONF_DIR.
# Pyspark (supported with Spark 1.2.1 and above)
# To configure pyspark, you need to set spark distribution's path to 'spark.home' property in Interpreter setting screen in Zeppelin GUI
# export PYSPARK_PYTHON          		# path to the python command. must be the same path on the driver(Zeppelin) and all workers.
# export PYTHONPATH

## Spark interpreter options ##
##
# export ZEPPELIN_SPARK_USEHIVECONTEXT  # Use HiveContext instead of SQLContext if set true. true by default.
# export ZEPPELIN_SPARK_CONCURRENTSQL   # Execute multiple SQL concurrently if set true. false by default.
# export ZEPPELIN_SPARK_MAXRESULT       # Max number of SparkSQL result to display. 1000 by default.


text:
from ntsecuritycon import *
import win32api, win32security, winerror

# This is a Python implementation of win32api.GetDomainName()
def GetDomainName():
    try:
        tok = win32security.OpenThreadToken(win32api.GetCurrentThread(),
                                            TOKEN_QUERY, 1)
    except win32api.error, details:
        if details[0] != winerror.ERROR_NO_TOKEN:
            raise
        # attempt to open the process token, since no thread token
        # exists
        tok = win32security.OpenProcessToken(win32api.GetCurrentProcess(),
                                             TOKEN_QUERY)
    sid, attr = win32security.GetTokenInformation(tok, TokenUser)
    win32api.CloseHandle(tok)

    name, dom, typ = win32security.LookupAccountSid(None, sid)
    return dom

if __name__=='__main__':
    print "Domain name is", GetDomainName()


text:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Registry Object PHP object
 *
 * @author Ben Greenwood <ben.greenwood@ands.org.au>
 * @package ands/datasource
 * @subpackage helpers
 */
class _registry_object extends ExtensionBoilerplate {

	public static $extensions = array(); // temporary reference to this class's extension(s)

	// Minimum set of fields here, let our extensions handle most of the fields?
	private $_CI; 	// an internal reference to the CodeIgniter Engine
	public $id;

	function __construct($id = NULL, $core_attributes_only = FALSE)
	{

		// Get our CI instance
		$this->_CI =& get_instance();

		// Prepare the extension list based on files in our extensions directory not starting with an underscore
		if (count(self::$extensions) == 0)
		{
			$this->_CI->load->helper('directory');
			$map = directory_map(REGISTRY_APP_PATH.'registry_object/models/extensions/');
			include_once('extensions/_base.php');
			foreach($map AS $file)
			{
				if (!preg_match("/\.php$/",$file))
				{
					continue;
				}
				if (substr($file, 0, 1) != '_')
				{
					include_once('extensions/'.$file);
					$extension_name = str_replace(".php","",$file);
					self::$extensions[] = $extension_name;
				}
			}
		}

		parent::__construct();

		// Setup our object id
		if (!is_numeric($id) && !is_null($id))
		{
			throw new Exception("Registry Object Wrapper must be initialised with a numeric Identifier");
		}
		$this->id = $id;

		// Load up all our extensions (effectively providing multiple class inheritence)
		foreach(self::$extensions AS $extension)
		{
			$this->_extends($extension);
		}

		// Initialise the object if we haven't done so yet!
		if (!is_null($id))
		{
			$this->init($core_attributes_only);
		}

	}

}

// BEN'S WITCHCRAFT
abstract class ExtensionBoilerplate
{
	public $extended_objects = array();

    public function __construct() {

    }

    public function __destruct() {
    	// Explicitly clean up our extensions...
    	foreach($this->extended_objects AS $class => $instance)
    	{
			unset($this->extended_objects[$class]);
    	}
    }

    protected function _extends($class) { //the $class is put to enforce passing class name (otherwise class name can be ommited and no error would be rased)
        $args = func_get_args();
        $class = array_shift($args);
		if (!class_exists($class."_Extension"))
		{
			include ''.strtolower($class).'.php';
		}
        $reflection_object = new \ReflectionClass($class."_Extension");//reflection has to be used so arguments can be provided to the constructor
        $this->extended_objects[$class] = $reflection_object->newInstanceArgs(array($this));
		//var_dump($this->extended_objects);
    }

    public function __get($property) {

        foreach ($this->extended_objects as $object) {
            if (isset($object->$property)) {
                return $object->$property;
            }
        }
		foreach ($this->extended_objects as $object) {
            if (method_exists($object, "getAttribute"))
            {
                return $object->getAttribute($property);
            }
        }
        //it is good to be strict...
        throw new \Exception(sprintf('Trying to get %s property on object of class %s.',$property,get_class($this)));
    }

    public function __set($property,$value) {
        foreach ($this->extended_objects as $object) {
            if (isset($object->$property)) { //variable variable
                $object->$property = $value;
                return;
            }
        }
		foreach ($this->extended_objects as $object) {
            if (method_exists($object, "setAttribute"))
            {
            	call_user_func_array(array($object, "setAttribute"), array($property, $value));
                return;
            }
        }
        //it is good to be strict...
        throw new \Exception(sprintf('Trying to set %s property on object of class %s.',$property,get_class($this)));
    }

    public function __isset($property) {
        foreach ($this->extended_objects as $object) {
            if (isset($object->$property)) {
                return true;
            }
        }
        return false;
    }

    public function __unset($property) {
        //it is good to be strict...
        throw new \Exception(sprintf('Trying to unset %s property on object of class %s. In strict classes unsetting is nto allowed.',$property,get_class($this)));
    }

    public function __call($method,$args) {
        foreach ($this->extended_objects as $object) {
            if (method_exists($object,$method)) {
              	return call_user_func_array(array($object,$method),$args);
            }
        }
		//echo "NSM: $method() "; var_dump($args);
        throw new \Exception(sprintf('Dynamic call of unexistant method %s on instance of class %s.',$method,get_class($this)));
    }

    public static function __callStatic($method,$args) {
        $class = get_called_class();//late static binding
        if (isset($class::$_extends)) { //then there is static extension
            foreach ($class::$_extends as $extended_class) {
                if (method_exists($extended_class,$method)) {
                    return call_user_func_array(array($extended_class,$method),$args);
                }
            }
        }
        throw new \Exception(sprintf('Static call of unexistant method %s on instance of class %s.',$method,$class));
    }

    public function __invoke() {
        $args = func_get_args();
        foreach ($this->extended_objects as $object) {
            if (method_exists($object,'__invoke')) {
                return call_user_func_array(array($object,'__invoke'),$args);
            }
        }
        throw new \Exception(sprintf('Invoking an instance of %s as function.',get_class($this)));
    }

	public function __toString()
	{
		$return = '';

		$return = sprintf("%s (%s) [%d]", $this->getAttribute("key", TRUE), $this->getAttribute("status", TRUE),$this->id) . BR;

		if (isset($this->attributes) && !is_null($this->attributes))
		{
			foreach ($this->attributes AS $attribute)
			{
				$return .= sprintf("%s", $attribute) . BR;
			}
		}

		return $return;
	}

}


text:
	      menu

Name:

Dr.Amrit Goyal

Abbott Associate Name:

Aman Singh

Camp Location:

Andheri

Camp Date & Time:

31st May

Results

High Risk Patients:

30/50

Positive:

53%

Male Percentage:

40%

Planned Registrations

30

Actual Registrations

35

Images

Back


text:
package dk.tennisprob.tournament

trait TournamentProbCalc {

  /**
   *
   * @param draw First round pairs
   * @param winProb(player1,player2) Probability of winning a tennis match by player 1 against player 2
   *
   * @returns Map[player,winning probabilities]
   */
  def winningProbs(draw: Seq[Tuple2[String, String]], winProb: (String, String) => Double): Map[String, Double]

}


text:
    <form class="signin form-horizontal">
      <fieldset>

Crop your picture then press upload below:

          <md-button class="md-raised btn-file" ngf-select="vm.fileSelected = true; vm.success = null" ng-model="picFile" accept="image/*">Select Picture</md-button>

          <md-button class="md-raised md-primary" ng-click="vm.upload(croppedDataUrl, picFile.name)">Upload</md-button>
          <md-button class="md-raised" ng-click="vm.fileSelected = false">Cancel</md-button>

            {{vm.progress}}% Complete

      </fieldset>
    </form>


text:
<?php

return require __DIR__.'/da.php';


text:
func doAllThatThing() error {
	if err := doSomething(); err != nil {
		return err
	}
	if err = doSomethingElse(); err != nil {
		return err
	}
	if err = doMore(); err != nil {
		return err
	}
	return nil
}


text:
package test.app.controllers;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.log4j.*;
import src.main.othello.web.controller.impl.AbstractControllerImpl;
import test.app.models.ToyToXml;
import test.app.models.XmlToToy;

public class Toy extends AbstractControllerImpl {

    private static Logger logger = Logger.getLogger(Toy.class);

    public void doMain(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        ToyToXml.transform();
        String name = XmlToToy.transform();
        request.setAttribute("toyName", name);
        super.forward("app/views/toy.jsp", request, response);
    }

}


text:
Support links

Feedback

Cookies

Terms and conditions

Privacy policy

Cymraeg

Built by the Driver and Vehicle Licensing Agency


text:
package com.salesforce.dva.argus.service.metric.transform;

import java.util.List;
import java.util.Map;

/**
 * This interface is used to map datapoint values.
 *
 * @author  Ruofan zhang (rzhang@salesforce.com)
 */
public interface ValueMapping {

    //~ Methods **************************************************************************************************************************************

    /**
     * Apply function to every datapoint of a datapoint map and return a new datapoint.
     *
     * @param   originalDatapoints  values The values to map.
     *
     * @return  The value after mapping.
     */
    Map<Long, String> mapping(Map<Long, String> originalDatapoints);

    /**
     * Apply function to every datapoint of a datapoint map and return a new datapoint.
     *
     * @param   originalDatapoints  datapoint values The values to map, constants constant value used by mapping function.
     * @param   constants           input constants
     *
     * @return  The value after mapping.
     */
    Map<Long, String> mapping(Map<Long, String> originalDatapoints, List<String> constants);

    /**
     * Returns the name of the value mapping.
     *
     * @return  The name of the value mapping.
     */
    String name();
}
/* Copyright (c) 2016, Salesforce.com, Inc.  All rights reserved. */


text:
struct uiColorButton {
	uiWindowsControl c;
	HWND hwnd;
	double r;
	double g;
	double b;
	double a;
	void (*onChanged)(uiColorButton *, void *);
	void *onChangedData;
};

static void uiColorButtonDestroy(uiControl *c)
{
	uiColorButton *b = uiColorButton(c);

	uiWindowsUnregisterWM_COMMANDHandler(b->hwnd);
	uiWindowsUnregisterWM_NOTIFYHandler(b->hwnd);
	uiWindowsEnsureDestroyWindow(b->hwnd);
	uiFreeControl(uiControl(b));
}

static BOOL onWM_COMMAND(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult)
{
	uiColorButton *b = uiColorButton(c);
	HWND parent;
	struct colorDialogRGBA rgba;

	if (code != BN_CLICKED)
		return FALSE;

	parent = parentToplevel(b->hwnd);
	rgba.r = b->r;
	rgba.g = b->g;
	rgba.b = b->b;
	rgba.a = b->a;
	if (showColorDialog(parent, &rgba)) {
		b->r = rgba.r;
		b->g = rgba.g;
		b->b = rgba.b;
		b->a = rgba.a;
		invalidateRect(b->hwnd, NULL, TRUE);
		(*(b->onChanged))(b, b->onChangedData);
	}

	*lResult = 0;
	return TRUE;
}

static BOOL onWM_NOTIFY(uiControl *c, HWND hwnd, NMHDR *nmhdr, LRESULT *lResult)
{
	uiColorButton *b = uiColorButton(c);
	NMCUSTOMDRAW *nm = (NMCUSTOMDRAW *) nmhdr;
	RECT client;
	ID2D1DCRenderTarget *rt;
	D2D1_RECT_F r;
	D2D1_COLOR_F color;
	D2D1_BRUSH_PROPERTIES bprop;
	ID2D1SolidColorBrush *brush;
	uiWindowsSizing sizing;
	int x, y;
	HRESULT hr;

	if (nmhdr->code != NM_CUSTOMDRAW)
		return FALSE;
	// and allow the button to draw its background
	if (nm->dwDrawStage != CDDS_PREPAINT)
		return FALSE;

	uiWindowsEnsureGetClientRect(b->hwnd, &client);
	rt = makeHDCRenderTarget(nm->hdc, &client);
	rt->BeginDraw();

	uiWindowsGetSizing(b->hwnd, &sizing);
	x = 3;		// should be enough
	y = 3;
	uiWindowsSizingDlgUnitsToPixels(&sizing, &x, &y);
	r.left = client.left + x;
	r.top = client.top + y;
	r.right = client.right - x;
	r.bottom = client.bottom - y;

	color.r = b->r;
	color.g = b->g;
	color.b = b->b;
	color.a = b->a;
	ZeroMemory(&bprop, sizeof (D2D1_BRUSH_PROPERTIES));
	bprop.opacity = 1.0;
	bprop.transform._11 = 1;
	bprop.transform._22 = 1;
	hr = rt->CreateSolidColorBrush(&color, &bprop, &brush);
	if (hr != S_OK)
		logHRESULT(L"error creating brush for color button", hr);
	rt->FillRectangle(&r, brush);
	brush->Release();

	hr = rt->EndDraw(NULL, NULL);
	if (hr != S_OK)
		logHRESULT(L"error drawing color on color button", hr);
	rt->Release();

	// skip default processing (don't draw text)
	*lResult = CDRF_SKIPDEFAULT;
	return TRUE;
}

uiWindowsControlAllDefaultsExceptDestroy(uiColorButton)

// from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
#define buttonHeight 14

// TODO check widths
static void uiColorButtonMinimumSize(uiWindowsControl *c, int *width, int *height)
{
	uiColorButton *b = uiColorButton(c);
	SIZE size;
	uiWindowsSizing sizing;
	int y;

	// try the comctl32 version 6 way
	size.cx = 0;		// explicitly ask for ideal size
	size.cy = 0;
	if (SendMessageW(b->hwnd, BCM_GETIDEALSIZE, 0, (LPARAM) (&size)) != FALSE) {
		*width = size.cx;
		*height = size.cy;
		return;
	}

	// that didn't work; fall back to using Microsoft's metrics
	// Microsoft says to use a fixed width for all buttons; this isn't good enough
	// use the text width instead, with some edge padding
	*width = uiWindowsWindowTextWidth(b->hwnd) + (2 * GetSystemMetrics(SM_CXEDGE));
	y = buttonHeight;
	uiWindowsGetSizing(b->hwnd, &sizing);
	uiWindowsSizingDlgUnitsToPixels(&sizing, NULL, &y);
	*height = y;
}

static void defaultOnChanged(uiColorButton *b, void *data)
{
	// do nothing
}

void uiColorButtonColor(uiColorButton *b, double *r, double *g, double *bl, double *a)
{
	*r = b->r;
	*g = b->g;
	*bl = b->b;
	*a = b->a;
}

void uiColorButtonSetColor(uiColorButton *b, double r, double g, double bl, double a)
{
	b->r = r;
	b->g = g;
	b->b = bl;
	b->a = a;
	invalidateRect(b->hwnd, NULL, TRUE);
}

void uiColorButtonOnChanged(uiColorButton *b, void (*f)(uiColorButton *, void *), void *data)
{
	b->onChanged = f;
	b->onChangedData = data;
}

uiColorButton *uiNewColorButton(void)
{
	uiColorButton *b;

	uiWindowsNewControl(uiColorButton, b);

	// initial color is black
	b->r = 0.0;
	b->g = 0.0;
	b->b = 0.0;
	b->a = 1.0;

	b->hwnd = uiWindowsEnsureCreateControlHWND(0,
		L"button", L" ",		// TODO; can't use "" TODO
		BS_PUSHBUTTON | WS_TABSTOP,
		hInstance, NULL,
		TRUE);

	uiWindowsRegisterWM_COMMANDHandler(b->hwnd, onWM_COMMAND, uiControl(b));
	uiWindowsRegisterWM_NOTIFYHandler(b->hwnd, onWM_NOTIFY, uiControl(b));
	uiColorButtonOnChanged(b, defaultOnChanged, NULL);

	return b;
}


text:
- Given a linked list, remove the n-th node from the end of list and return its head.
- Given n will always be valid.
- Try to do this in one pass.

> For example,
>
>    Given linked list: 1->2->3->4->5, and n = 2.
>
>    After removing the second node from the end, the linked list becomes 1->2->3->5.

## Solution

- O(n) in both time and space:

```python
class Solution(object):
    def removeNthFromEnd(self, head, n):
        """
        :type head: ListNode
        :type n: int
        :rtype: ListNode
        """
        tmp = []
        cur = head
        while cur:
            tmp.append(cur)
            cur = cur.next
        l = len(tmp)
        if n == l:
            return head.next
        elif n == 1:
            tmp[-2].next = None
            return head
        else:
            tmp[l-n-1].next = tmp[l-n+1]
            return head
```

- O(n) in time, O(1) in space, [reference](https://leetcode.com/articles/remove-nth-node-end-list/):

```python
class Solution(object):
    def removeNthFromEnd(self, head, n):
        """
        :type head: ListNode
        :type n: int
        :rtype: ListNode
        """
        dummy = ListNode(0)
        dummy.next = head
        first, second = dummy, dummy
        for i in xrange(n):
            first = first.next
        while first.next:
            first = first.next
            second = second.next
        second.next = second.next.next
        return dummy.next
```


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;

namespace Microsoft.CodeAnalysis.CSharp
{
    // https://github.com/dotnet/roslyn/issues/30067 Should UnassignedFieldsWalker
    // inherit from DataFlowPassBase<LocalState> directly since it has simpler
    // requirements than DataFlowPass?
    internal sealed class UnassignedFieldsWalker : DataFlowPass
    {
        private readonly DiagnosticBag _diagnostics;

        private UnassignedFieldsWalker(CSharpCompilation compilation, MethodSymbol method, BoundNode node, DiagnosticBag diagnostics)
            : base(compilation, method, node, trackClassFields: true)
        {
            _diagnostics = diagnostics;
        }

        internal static void Analyze(CSharpCompilation compilation, MethodSymbol method, BoundNode node, DiagnosticBag diagnostics)
        {
            Debug.Assert(method.MethodKind == MethodKind.Constructor);

            if (method.NonNullTypes == null)
            {
                return;
            }

            if (HasThisConstructorInitializer(method))
            {
                return;
            }

            var walker = new UnassignedFieldsWalker(compilation, method, node, diagnostics);
            try
            {
                bool badRegion = false;
                walker.Analyze(ref badRegion, diagnostics: null);
            }
            finally
            {
                walker.Free();
            }
        }

        private static bool HasThisConstructorInitializer(MethodSymbol method)
        {
            Debug.Assert(method.DeclaringSyntaxReferences.Length <= 1);
            var syntax = method.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() as ConstructorDeclarationSyntax;
            return syntax?.Initializer?.Kind() == SyntaxKind.ThisConstructorInitializer;
        }

        protected override ImmutableArray<PendingBranch> Scan(ref bool badRegion)
        {
            var result = base.Scan(ref badRegion);
            ReportUninitializedNonNullableReferenceTypeFields();
            return result;
        }

        private void ReportUninitializedNonNullableReferenceTypeFields()
        {
            var thisParameter = MethodThisParameter;
            var location = thisParameter.ContainingSymbol.Locations.FirstOrDefault() ?? Location.None;

            int thisSlot = VariableSlot(thisParameter);
            if (thisSlot == -1)
            {
                return;
            }

            var thisType = thisParameter.Type.TypeSymbol;
            Debug.Assert(thisType.IsDefinition);

            foreach (var member in thisType.GetMembersUnordered())
            {
                if (member.Kind != SymbolKind.Field)
                {
                    // https://github.com/dotnet/roslyn/issues/30067 Handle events.
                    continue;
                }
                var field = (FieldSymbol)member;
                // https://github.com/dotnet/roslyn/issues/30067 Can the HasInitializer
                // call be removed, if the body already contains the initializers?
                if (field.IsStatic || HasInitializer(field))
                {
                    continue;
                }
                var fieldType = field.Type;
                if (fieldType.IsValueType || fieldType.IsErrorType())
                {
                    continue;
                }
                if (fieldType.IsNullable != false && !fieldType.TypeSymbol.IsUnconstrainedTypeParameter())
                {
                    continue;
                }
                int fieldSlot = VariableSlot(field, thisSlot);
                if (fieldSlot == -1 || !this.State.IsAssigned(fieldSlot))
                {
                    var symbol = (Symbol)(field.AssociatedSymbol as PropertySymbol) ?? field;
                    _diagnostics.Add(ErrorCode.WRN_UninitializedNonNullableField, location, symbol.Kind.Localize(), symbol.Name);
                }
            }
        }
    }
}


text:
/* eslint-disable import/no-unresolved, import/extensions */

import { PropTypes } from 'react';

const TestComponent = {};

TestComponent.propTypes = {
  a: PropTypes.array,
  b: PropTypes.bool,
  c: PropTypes.func,
  d: PropTypes.number,
  e: PropTypes.object,
  f: PropTypes.string,
  g: PropTypes.any,
  h: PropTypes.arrayOf,
  i: PropTypes.element,
  j: PropTypes.instanceOf,
  k: PropTypes.node,
  l: PropTypes.objectOf,
  m: PropTypes.oneOf,
  n: PropTypes.oneOfType,
  o: PropTypes.shape,
  p: PropTypes.array,
  q: PropTypes.bool,
  r: PropTypes.func,
  s: PropTypes.number,
  t: PropTypes.object,
  u: PropTypes.string,
  v: PropTypes.any,
  w: PropTypes.arrayOf,
  x: PropTypes.element,
  y: PropTypes.instanceOf,
  z: PropTypes.node,
  aa: PropTypes.objectOf,
  ab: PropTypes.oneOf,
  ac: PropTypes.oneOfType,
  ad: PropTypes.shape,
};


text:
package org.frameworkset.netty;

import org.frameworkset.spi.remote.BaseFutureCall;
import org.frameworkset.spi.remote.RPCAddress;
import org.frameworkset.spi.remote.RPCIOHandler;
import org.frameworkset.spi.remote.RPCMessage;

/**
 *
Title: NettyFutureCall.java

 *
Description:

 *
bboss workgroup

 *
Copyright (c) 2007

 * @Date 2010-4-19 下午11:35:51
 * @author biaoping.yin
 * @version 1.0
 */
public class NettyFutureCall extends BaseFutureCall {

	/**
     * @param srcmsg
     * @param address
     * @param handler
     */
    public NettyFutureCall(RPCMessage srcmsg, RPCAddress address, RPCIOHandler handler)
    {
        super(srcmsg, address, handler);
        // TODO Auto-generated constructor stub
    }

	@Override
	protected RPCMessage _call() throws Exception {
		NettyIOHandler iohandler = (NettyIOHandler)handler;
        NettyClinentTransport transport = NettyClinentTransport.getClinentTransport(srcmsg.getDest(), iohandler);
        transport.write(srcmsg);
        return null;
	}

}


text:
module.exports = function(grunt) {
	grunt.registerTask('importApiBundle', 'Import API bundle under a API proxy name', function() {
		var done = this.async();
		var request = require('request');
		var fs = require('fs');
		var rs = fs.createReadStream('target/' + grunt.config.get("apiproxy")  + '.zip');
		var options = {
			method: 'POST',
			url: grunt.config.get("url_mgmt") + '/v1/organizations/' + grunt.config.get("org") + '/apis?action=import&name=' + grunt.config.get("apiproxy"),
			auth: {
				user: grunt.config.get("username"),
				password: grunt.config.get("password")
			},
			headers : {
				'Content-Type' : 'application/octet-stream',
			},
			strictSSL: false
		};
		rs.pipe(request(options, callback));
		function callback(error, response, body) {
			grunt.log.writeln(options.url)
			grunt.log.writeln(body);
			grunt.log.writeln(response.statusCode);
			done();
		}
	});
};


text:
var geo = ripple('geo'),
    Position = ripple('platform/w3c/1.0/Position'),
    PositionError = ripple('platform/w3c/1.0/PositionError'),
    _watches = {},
    _self;

function createPosition() {
    var position = new Position(),
        positionInfo = geo.getPositionInfo();

    position.coords.latitude = positionInfo.latitude;
    position.coords.longitude = positionInfo.longitude;
    position.coords.altitude = positionInfo.altitude;
    position.coords.altitudeAccuracy = positionInfo.altitudeAccuracy;
    position.coords.accuracy = positionInfo.accuracy;
    position.coords.heading = positionInfo.heading;
    position.coords.speed = positionInfo.speed;
    position.timestamp = positionInfo.timeStamp.getTime();

    return position;
}

_self = {
    getCurrentPosition: function (onSuccess, onError) {
        var delay = ((geo.delay || 0) * 1000) || 1,
            timeout = geo.timeout;

        window.setTimeout(function () {
            if (timeout) {
                var error = new PositionError();
                error.code = PositionError.TIMEOUT;
                error.message = "position timed out";

                onError(error);
            }
            else {
                // TODO: build facility to trigger onError() from emulator
                // see pivotal item: https://www.pivotaltracker.com/story/show/7040343
                _self.lastPosition = createPosition();
                onSuccess(_self.lastPosition);
            }
        }, delay);
    },

    watchPosition: function (geolocationSuccess, geolocationError, geolocationOptions) {
        if (!geolocationOptions) { geolocationOptions = {}; }

        var watchId = (new Date()).getTime().toString(),
            watchObj = {},
            timeout = geolocationOptions.timeout || 10000;

        watchObj = {
            onSuccess: geolocationSuccess,
            onError: geolocationError,
            interval: timeout
        };

        _watches[watchId] = watchObj;

        _watches[watchId].intervalId = window.setInterval(function () {
            _self.getCurrentPosition(_watches[watchId].onSuccess, _watches[watchId].onError);
        }, timeout);

        return watchId;
    },

    lastPosition: null,

    clearWatch: function (watchId) {
        if (_watches[watchId]) {
            window.clearInterval(_watches[watchId].intervalId);
            delete _watches[watchId];
        }
    }
};

module.exports = _self;


text:
#ifndef _OGL_CONTEXT_H_
#define _OGL_CONTEXT_H_

#include "typedefs.h"
#include "GraphicsContext.h"

class COGLGraphicsContext : public CGraphicsContext
{
    friend class OGLRender;
    friend class COGLRenderTexture;
public:
    virtual ~COGLGraphicsContext();

    bool Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed );
    bool ResizeInitialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed );
    void CleanUp();
    void Clear(ClearFlag dwFlags, uint32 color=0xFF000000, float depth=1.0f);

    void UpdateFrame(bool swaponly=false);
    int ToggleFullscreen();     // return 0 as the result is windowed

    bool IsExtensionSupported(const char* pExtName);
    bool IsWglExtensionSupported(const char* pExtName);
    static void InitDeviceParameters();

    //Get methods (TODO, remove all friend class and use get methods instead)
    bool IsSupportAnisotropicFiltering();
    int  getMaxAnisotropicFiltering();

protected:
    friend class OGLDeviceBuilder;
    COGLGraphicsContext();
    void InitState(void);
    void InitOGLExtension(void);
    bool SetFullscreenMode();
    bool SetWindowMode();

    // Important OGL extension features
    bool    m_bSupportMultiTexture;
    bool    m_bSupportTextureEnvCombine;
    bool    m_bSupportSeparateSpecularColor;
    bool    m_bSupportSecondColor;
    bool    m_bSupportFogCoord;
    bool    m_bSupportTextureObject;

    // Optional OGL extension features;
    bool    m_bSupportRescaleNormal;
    bool    m_bSupportLODBias;
    bool    m_bSupportAnisotropicFiltering;
    int     m_maxAnisotropicFiltering;

    // Nvidia OGL only features
    bool    m_bSupportTextureMirrorRepeat;
    bool    m_bSupportTextureLOD;
    bool    m_bSupportNVRegisterCombiner;
    bool    m_bSupportBlendColor;
    bool    m_bSupportBlendSubtract;
    bool    m_bSupportNVTextureEnvCombine4;

    // Minimal requirements, I will even not check them at runtime
    //bool  m_bSupportTextureEnvAdd;
    //bool  m_bSupportVertexArray;

    const unsigned char*    m_pVendorStr;
    const unsigned char*    m_pRenderStr;
    const unsigned char*    m_pExtensionStr;
    const char* m_pWglExtensionStr;
    const unsigned char*    m_pVersionStr;
};

#endif


text:
import Ember from 'ember';
import BaseAuthorizer from './base';

const { isEmpty } = Ember;

/**
  Authorizer that works with the Ruby gem
  [devise](https://github.com/plataformatec/devise); includes the user's token
  and identification from the session data in the `Authorization` HTTP header,
  e.g.,

  ```
  Authorization: token="234rtgjneroigne4" email="user@domain.tld"
  ```

  __As token authentication is not actually part of devise anymore, the server
  needs to implement some customizations__ to work with this authenticator -
  see [this gist](https://gist.github.com/josevalim/fb706b1e933ef01e4fb6).

  @class DeviseAuthorizer
  @module ember-simple-auth/authorizers/devise
  @extends BaseAuthorizer
  @public
*/
export default BaseAuthorizer.extend({
  /**
    The token attribute name.

    @property tokenAttributeName
    @type String
    @default 'token'
    @public
  */
  tokenAttributeName: 'token',

  /**
    The identification attribute name.

    @property identificationAttributeName
    @type String
    @default 'email'
    @public
  */
  identificationAttributeName: 'email',

  /**
    Includes the user's token (see
    {{#crossLink "DeviseAuthenticator/tokenAttributeName:property"}}{{/crossLink}})
    and identification (see
    {{#crossLink "DeviseAuthenticator/identificationAttributeName:property"}}{{/crossLink}})
    in the `Authorization` header.

    @method authorize
    @param {Object} data The data that the session currently holds
    @param {Function} block(headerName,headerContent) The callback to call with the authorization data; will receive the header name and header content as arguments.
    @public
  */
  authorize(data, block) {
    const { tokenAttributeName, identificationAttributeName } = this.getProperties('tokenAttributeName', 'identificationAttributeName');
    const userToken          = data[tokenAttributeName];
    const userIdentification = data[identificationAttributeName];

    if (!isEmpty(userToken) && !isEmpty(userIdentification)) {
      const authData = `${tokenAttributeName}="${userToken}", ${identificationAttributeName}="${userIdentification}"`;
      block('Authorization', `Token ${authData}`);
    }
  }
});


text:
// This file was automatically generated by informer-gen

package externalversions

import (
	runtime "k8s.io/apimachinery/pkg/runtime"
	schema "k8s.io/apimachinery/pkg/runtime/schema"
	cache "k8s.io/client-go/tools/cache"
	clientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
	admissionregistration "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/admissionregistration"
	apps "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/apps"
	autoscaling "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/autoscaling"
	batch "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/batch"
	certificates "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/certificates"
	core "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/core"
	extensions "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/extensions"
	internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/internalinterfaces"
	networking "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/networking"
	policy "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/policy"
	rbac "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/rbac"
	scheduling "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/scheduling"
	settings "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/settings"
	storage "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/storage"
	reflect "reflect"
	sync "sync"
	time "time"
)

type sharedInformerFactory struct {
	client        clientset.Interface
	lock          sync.Mutex
	defaultResync time.Duration

	informers map[reflect.Type]cache.SharedIndexInformer
	// startedInformers is used for tracking which informers have been started.
	// This allows Start() to be called multiple times safely.
	startedInformers map[reflect.Type]bool
}

// NewSharedInformerFactory constructs a new instance of sharedInformerFactory
func NewSharedInformerFactory(client clientset.Interface, defaultResync time.Duration) SharedInformerFactory {
	return &sharedInformerFactory{
		client:           client,
		defaultResync:    defaultResync,
		informers:        make(map[reflect.Type]cache.SharedIndexInformer),
		startedInformers: make(map[reflect.Type]bool),
	}
}

// Start initializes all requested informers.
func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
	f.lock.Lock()
	defer f.lock.Unlock()

	for informerType, informer := range f.informers {
		if !f.startedInformers[informerType] {
			go informer.Run(stopCh)
			f.startedInformers[informerType] = true
		}
	}
}

// WaitForCacheSync waits for all started informers' cache were synced.
func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool {
	informers := func() map[reflect.Type]cache.SharedIndexInformer {
		f.lock.Lock()
		defer f.lock.Unlock()

		informers := map[reflect.Type]cache.SharedIndexInformer{}
		for informerType, informer := range f.informers {
			if f.startedInformers[informerType] {
				informers[informerType] = informer
			}
		}
		return informers
	}()

	res := map[reflect.Type]bool{}
	for informType, informer := range informers {
		res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced)
	}
	return res
}

// InternalInformerFor returns the SharedIndexInformer for obj using an internal
// client.
func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer {
	f.lock.Lock()
	defer f.lock.Unlock()

	informerType := reflect.TypeOf(obj)
	informer, exists := f.informers[informerType]
	if exists {
		return informer
	}
	informer = newFunc(f.client, f.defaultResync)
	f.informers[informerType] = informer

	return informer
}

// SharedInformerFactory provides shared informers for resources in all known
// API group versions.
type SharedInformerFactory interface {
	internalinterfaces.SharedInformerFactory
	ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
	WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool

	Admissionregistration() admissionregistration.Interface
	Apps() apps.Interface
	Autoscaling() autoscaling.Interface
	Batch() batch.Interface
	Certificates() certificates.Interface
	Core() core.Interface
	Extensions() extensions.Interface
	Networking() networking.Interface
	Policy() policy.Interface
	Rbac() rbac.Interface
	Scheduling() scheduling.Interface
	Settings() settings.Interface
	Storage() storage.Interface
}

func (f *sharedInformerFactory) Admissionregistration() admissionregistration.Interface {
	return admissionregistration.New(f)
}

func (f *sharedInformerFactory) Apps() apps.Interface {
	return apps.New(f)
}

func (f *sharedInformerFactory) Autoscaling() autoscaling.Interface {
	return autoscaling.New(f)
}

func (f *sharedInformerFactory) Batch() batch.Interface {
	return batch.New(f)
}

func (f *sharedInformerFactory) Certificates() certificates.Interface {
	return certificates.New(f)
}

func (f *sharedInformerFactory) Core() core.Interface {
	return core.New(f)
}

func (f *sharedInformerFactory) Extensions() extensions.Interface {
	return extensions.New(f)
}

func (f *sharedInformerFactory) Networking() networking.Interface {
	return networking.New(f)
}

func (f *sharedInformerFactory) Policy() policy.Interface {
	return policy.New(f)
}

func (f *sharedInformerFactory) Rbac() rbac.Interface {
	return rbac.New(f)
}

func (f *sharedInformerFactory) Scheduling() scheduling.Interface {
	return scheduling.New(f)
}

func (f *sharedInformerFactory) Settings() settings.Interface {
	return settings.New(f)
}

func (f *sharedInformerFactory) Storage() storage.Interface {
	return storage.New(f)
}


text:
namespace cc {

LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase(
    const LayerTreeSettings& settings)
    : LayerTestCommon::LayerImplTest(settings),
      render_surface_layer_list_count_(0) {
}

LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() {
}

void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting(
    Layer* layer,
    const gfx::Transform& transform,
    const gfx::Point3F& transform_origin,
    const gfx::PointF& position,
    const gfx::Size& bounds,
    bool flatten_transform,
    bool is_3d_sorted) {
  SetLayerPropertiesForTestingInternal(layer, transform, transform_origin,
                                       position, bounds, flatten_transform,
                                       is_3d_sorted);
}

void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting(
    LayerImpl* layer,
    const gfx::Transform& transform,
    const gfx::Point3F& transform_origin,
    const gfx::PointF& position,
    const gfx::Size& bounds,
    bool flatten_transform,
    bool is_3d_sorted,
    bool create_render_surface) {
  SetLayerPropertiesForTestingInternal(layer, transform, transform_origin,
                                       position, bounds, flatten_transform,
                                       is_3d_sorted);
  if (create_render_surface) {
    layer->SetHasRenderSurface(true);
  }
}

void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties(
    Layer* root_layer,
    float device_scale_factor,
    float page_scale_factor,
    Layer* page_scale_layer,
    bool can_use_lcd_text,
    bool layers_always_allowed_lcd_text) {
  EXPECT_TRUE(page_scale_layer || (page_scale_factor == 1.f));
  gfx::Transform identity_matrix;
  gfx::Size device_viewport_size =
      gfx::Size(root_layer->bounds().width() * device_scale_factor,
                root_layer->bounds().height() * device_scale_factor);

  render_surface_layer_list_.reset(new RenderSurfaceLayerList);

  // We are probably not testing what is intended if the root_layer bounds are
  // empty.
  DCHECK(!root_layer->bounds().IsEmpty());
  LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
      root_layer, device_viewport_size, render_surface_layer_list_.get());
  inputs.device_scale_factor = device_scale_factor;
  inputs.page_scale_factor = page_scale_factor;
  inputs.page_scale_layer = page_scale_layer;
  inputs.can_use_lcd_text = can_use_lcd_text;
  inputs.layers_always_allowed_lcd_text = layers_always_allowed_lcd_text;
  inputs.can_adjust_raster_scales = true;
  LayerTreeHostCommon::CalculateDrawProperties(&inputs);
}

void LayerTreeHostCommonTestBase::
    ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* root_layer) {
  DCHECK(root_layer->layer_tree_host());
  LayerTreeHostCommon::PreCalculateMetaInformation(root_layer);

  gfx::Transform identity_transform;
  bool preserves_2d_axis_alignment = false;
  bool can_render_to_separate_surface = true;
  LayerTreeHostCommon::UpdateRenderSurfaces(
      root_layer, can_render_to_separate_surface, identity_transform,
      preserves_2d_axis_alignment);

  Layer* page_scale_layer = nullptr;
  Layer* inner_viewport_scroll_layer =
      root_layer->layer_tree_host()->inner_viewport_scroll_layer();
  Layer* outer_viewport_scroll_layer =
      root_layer->layer_tree_host()->outer_viewport_scroll_layer();
  float page_scale_factor = 1.f;
  float device_scale_factor = 1.f;
  gfx::Size device_viewport_size =
      gfx::Size(root_layer->bounds().width() * device_scale_factor,
                root_layer->bounds().height() * device_scale_factor);
  BuildPropertyTreesAndComputeVisibleRects(
      root_layer, page_scale_layer, inner_viewport_scroll_layer,
      outer_viewport_scroll_layer, page_scale_factor, device_scale_factor,
      gfx::Rect(device_viewport_size), identity_transform,
      root_layer->layer_tree_host()->property_trees(), &update_layer_list_);
}

void LayerTreeHostCommonTestBase::
    ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* root_layer) {
  DCHECK(root_layer->layer_tree_impl());
  LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer);

  gfx::Transform identity_transform;
  LayerImpl* page_scale_layer = nullptr;
  LayerImpl* inner_viewport_scroll_layer =
      root_layer->layer_tree_impl()->InnerViewportScrollLayer();
  LayerImpl* outer_viewport_scroll_layer =
      root_layer->layer_tree_impl()->OuterViewportScrollLayer();
  float page_scale_factor = 1.f;
  float device_scale_factor = 1.f;
  gfx::Size device_viewport_size =
      gfx::Size(root_layer->bounds().width() * device_scale_factor,
                root_layer->bounds().height() * device_scale_factor);
  std::vector<LayerImpl*> update_layer_list;
  BuildPropertyTreesAndComputeVisibleRects(
      root_layer, page_scale_layer, inner_viewport_scroll_layer,
      outer_viewport_scroll_layer, page_scale_factor, device_scale_factor,
      gfx::Rect(device_viewport_size), identity_transform,
      root_layer->layer_tree_impl()->property_trees(), &update_layer_list);
}

void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties(
    LayerImpl* root_layer,
    float device_scale_factor,
    float page_scale_factor,
    LayerImpl* page_scale_layer,
    bool can_use_lcd_text,
    bool layers_always_allowed_lcd_text) {
  host_impl()->SetDeviceScaleFactor(device_scale_factor);
  host_impl()->SetPageScaleOnActiveTree(page_scale_factor);

  gfx::Transform identity_matrix;
  gfx::Size device_viewport_size =
      gfx::Size(root_layer->bounds().width() * device_scale_factor,
                root_layer->bounds().height() * device_scale_factor);

  render_surface_layer_list_impl_.reset(new LayerImplList);

  // We are probably not testing what is intended if the root_layer bounds are
  // empty.
  DCHECK(!root_layer->bounds().IsEmpty());
  LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
      root_layer, device_viewport_size, render_surface_layer_list_impl_.get());
  inputs.device_scale_factor = device_scale_factor;
  inputs.page_scale_factor = page_scale_factor;
  inputs.page_scale_layer = page_scale_layer;
  inputs.can_use_lcd_text = can_use_lcd_text;
  inputs.layers_always_allowed_lcd_text = layers_always_allowed_lcd_text;
  inputs.can_adjust_raster_scales = true;

  ++render_surface_layer_list_count_;
  inputs.current_render_surface_layer_list_id =
      render_surface_layer_list_count_;

  LayerTreeHostCommon::CalculateDrawProperties(&inputs);
}

bool LayerTreeHostCommonTestBase::UpdateLayerListContains(int id) const {
  for (size_t i = 0; i < update_layer_list_.size(); ++i) {
    if (update_layer_list_[i]->id() == id)
      return true;
  }
  return false;
}

LayerTreeHostCommonTest::LayerTreeHostCommonTest()
    : LayerTreeHostCommonTestBase(LayerTreeSettings()) {
}

LayerTreeHostCommonTest::LayerTreeHostCommonTest(
    const LayerTreeSettings& settings)
    : LayerTreeHostCommonTestBase(settings) {
}

}  // namespace cc


text:
<!DOCTYPE html>

		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<title>Foresight.js Demo: jQuery Mobile Demo Page 1</title>
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />

					AJAX Loaded Page

						The global configuration sets the image's max width to 750 browser pixels.

						The second image overrides the global config with its own data-max-width attribute,
						which is set at 640 browser pixels.

					Go Back

					Photos by Michael Gäbler.

								Demos

								Git Hub


text:
@interface UIImage (Extension)
+ (instancetype)imageWithOriginaName:(NSString *)imageName;
@end


text:
/** @@author A0142130A **/
package guitests.guihandles;

import guitests.GuiRobot;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;
import seedu.taskell.TestApp;

/**
 * A handler for the DisplayPanel of the UI
 */

public class DisplayPanelHandle extends GuiHandle {

    public static final String DISPLAY_PANEL_ID = "#displayPanel";

    public DisplayPanelHandle(GuiRobot guiRobot, Stage primaryStage) {
        super(guiRobot, primaryStage, TestApp.APP_TITLE);
    }

    public String getText() {
        return getDisplayPanelAsTextArea().getText();
    }

    private TextArea getDisplayPanelAsTextArea() {
        return (TextArea) getNode(DISPLAY_PANEL_ID);
    }

}


text:
```
Current version (from VERSION_CURRENT file): 1.6.3
--     struct timespec found
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/IST/Downloads/_____teste_____/mongo-c-driver-1.6.3/src/libbson
[ 33%] Built target bson_shared
[ 66%] Built target bson_static
[100%] Built target test-libbson
Install the project...
-- Install configuration: ""
-- Installing: C:/mongo-c-driver/lib/libbson-1.0.dll.a
-- Installing: C:/mongo-c-driver/bin/libbson-1.0.dll
-- Installing: C:/mongo-c-driver/lib/libbson-static-1.0.a
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-config.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-stdint.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-version.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bcon.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-atomic.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-clock.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-compat.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-context.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-decimal128.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-endian.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-error.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-iter.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-json.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-keys.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-macros.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-md5.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-memory.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-oid.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-reader.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-stdint-win32.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-string.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-types.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-utf8.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-value.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-version-functions.h
-- Installing: C:/mongo-c-driver/include/libbson-1.0/bson-writer.h
-- Installing: C:/mongo-c-driver/lib/pkgconfig/libbson-1.0.pc
```


text:
package org.assertj.core.api.filter;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
import static org.assertj.core.api.filter.Filters.filter;

import org.assertj.core.test.Player;
import org.junit.Test;

public class Filter_being_condition_Test extends AbstractTest_filter {

  private PotentialMvpCondition potentialMvp = new PotentialMvpCondition();

  @Test
  public void should_filter_iterable_elements_satisfying_condition() {
    Iterable<Player> potentialMvpPlayers = filter(players).being(potentialMvp).get();
    assertThat(potentialMvpPlayers).containsOnly(rose, james);
    // players is not modified
    assertThat(players).hasSize(4);
  }

  @Test
  public void should_fail_if_filter_condition_is_null() {
    try {
      filter(players).being(null);
      failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
    } catch (IllegalArgumentException e) {
      assertThat(e).hasMessage("The filter condition should not be null");
    }
  }

}


text:
package org.datavec.image.transform;

import org.bytedeco.javacpp.indexer.UByteIndexer;
import org.bytedeco.javacv.CanvasFrame;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.OpenCVFrameConverter;
import org.nd4j.linalg.primitives.Pair;
import org.datavec.api.util.ClassPathResource;
import org.datavec.image.data.ImageWritable;
import org.datavec.image.loader.NativeImageLoader;
import org.junit.Ignore;
import org.junit.Test;

import java.awt.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;

import static org.bytedeco.javacpp.opencv_core.*;
import static org.bytedeco.javacpp.opencv_imgproc.*;
import static org.junit.Assert.*;

/**
 *
 * @author saudet
 */
public class TestImageTransform {
    static final long seed = 10;
    static final Random rng = new Random(seed);
    static final OpenCVFrameConverter.ToMat converter = new OpenCVFrameConverter.ToMat();

    @Test
    public void testCropImageTransform() throws Exception {
        ImageWritable writable = makeRandomImage(0, 0, 1);
        Frame frame = writable.getFrame();
        ImageTransform transform = new CropImageTransform(rng, frame.imageHeight / 2, frame.imageWidth / 2,
                        frame.imageHeight / 2, frame.imageWidth / 2);

        for (int i = 0; i < 100; i++) {
            ImageWritable w = transform.transform(writable);
            Frame f = w.getFrame();
            assertTrue(f.imageHeight <= frame.imageHeight);
            assertTrue(f.imageWidth <= frame.imageWidth);
            assertEquals(f.imageChannels, frame.imageChannels);
        }
        assertEquals(null, transform.transform(null));

        transform = new CropImageTransform(1, 2, 3, 4);
        writable = transform.transform(writable);
        float[] coordinates = {1, 2, 3, 4};
        float[] transformed = transform.query(coordinates);
        assertEquals(1 - 2, transformed[0], 0);
        assertEquals(2 - 1, transformed[1], 0);
        assertEquals(3 - 2, transformed[2], 0);
        assertEquals(4 - 1, transformed[3], 0);
    }

    @Test
    public void testFlipImageTransform() throws Exception {
        ImageWritable writable = makeRandomImage(0, 0, 3);
        Frame frame = writable.getFrame();
        ImageTransform transform = new FlipImageTransform(rng);

        for (int i = 0; i < 100; i++) {
            ImageWritable w = transform.transform(writable);
            Frame f = w.getFrame();
            assertEquals(f.imageHeight, frame.imageHeight);
            assertEquals(f.imageWidth, frame.imageWidth);
            assertEquals(f.imageChannels, frame.imageChannels);
        }
        assertEquals(null, transform.transform(null));

        transform = new FlipImageTransform(-2);
        writable = transform.transform(writable);
        float[] transformed = transform.query(new float[] {10, 20});
        assertEquals(10, transformed[0], 0);
        assertEquals(20, transformed[1], 0);

        transform = new FlipImageTransform(0);
        writable = transform.transform(writable);
        transformed = transform.query(new float[] {30, 40});
        assertEquals(30,                         transformed[0], 0);
        assertEquals(frame.imageHeight - 40 - 1, transformed[1], 0);

        transform = new FlipImageTransform(1);
        writable = transform.transform(writable);
        transformed = transform.query(new float[] {50, 60});
        assertEquals(frame.imageWidth - 50 - 1, transformed[0], 0);
        assertEquals(60,                        transformed[1], 0);

        transform = new FlipImageTransform(-1);
        writable = transform.transform(writable);
        transformed = transform.query(new float[] {70, 80});
        assertEquals(frame.imageWidth  - 70 - 1, transformed[0], 0);
        assertEquals(frame.imageHeight - 80 - 1, transformed[1], 0);
    }

    @Test
    public void testScaleImageTransform() throws Exception {
        ImageWritable writable = makeRandomImage(0, 0, 4);
        Frame frame = writable.getFrame();
        ImageTransform transform = new ScaleImageTransform(rng, frame.imageWidth / 2, frame.imageHeight / 2);

        for (int i = 0; i < 100; i++) {
            ImageWritable w = transform.transform(writable);
            Frame f = w.getFrame();
            assertTrue(f.imageHeight >= frame.imageHeight / 2);
            assertTrue(f.imageHeight <= 3 * frame.imageHeight / 2);
            assertTrue(f.imageWidth >= frame.imageWidth / 2);
            assertTrue(f.imageWidth <= 3 * frame.imageWidth / 2);
            assertEquals(f.imageChannels, frame.imageChannels);
        }
        assertEquals(null, transform.transform(null));

        transform = new ScaleImageTransform(frame.imageWidth, 2 * frame.imageHeight);
        writable = transform.transform(writable);
        float[] coordinates = {5, 7, 11, 13};
        float[] transformed = transform.query(coordinates);
        assertEquals(5 * 2,  transformed[0], 0);
        assertEquals(7 * 3,  transformed[1], 0);
        assertEquals(11 * 2, transformed[2], 0);
        assertEquals(13 * 3, transformed[3], 0);
    }

    @Test
    public void testRotateImageTransform() throws Exception {
        ImageWritable writable = makeRandomImage(0, 0, 1);
        Frame frame = writable.getFrame();
        ImageTransform transform =
                        new RotateImageTransform(rng, 180).interMode(INTER_NEAREST).borderMode(BORDER_REFLECT);

        for (int i = 0; i < 100; i++) {
            ImageWritable w = transform.transform(writable);
            Frame f = w.getFrame();
            assertEquals(f.imageHeight, frame.imageHeight);
            assertEquals(f.imageWidth, frame.imageWidth);
            assertEquals(f.imageChannels, frame.imageChannels);
        }
        assertEquals(null, transform.transform(null));

        transform = new RotateImageTransform(0, 0, -90, 0);
        writable = transform.transform(writable);
        float[] coordinates = {frame.imageWidth / 2, frame.imageHeight / 2, 0, 0};
        float[] transformed = transform.query(coordinates);
        assertEquals(frame.imageWidth  / 2, transformed[0], 0);
        assertEquals(frame.imageHeight / 2, transformed[1], 0);
        assertEquals((frame.imageHeight + frame.imageWidth) / 2 - 1, transformed[2], 0);
        assertEquals((frame.imageHeight - frame.imageWidth) / 2,     transformed[3], 0);
    }

    @Test
    public void testWarpImageTransform() throws Exception {
        ImageWritable writable = makeRandomImage(0, 0, 1);
        Frame frame = writable.getFrame();
        ImageTransform transform = new WarpImageTransform(rng, frame.imageWidth / 10).interMode(INTER_CUBIC)
                        .borderMode(BORDER_REPLICATE);

        for (int i = 0; i < 100; i++) {
            ImageWritable w = transform.transform(writable);
            Frame f = w.getFrame();
            assertEquals(f.imageHeight, frame.imageHeight);
            assertEquals(f.imageWidth, frame.imageWidth);
            assertEquals(f.imageChannels, frame.imageChannels);
        }
        assertEquals(null, transform.transform(null));

        transform = new WarpImageTransform(1, 2, 3, 4, 5, 6, 7, 8);
        writable = transform.transform(writable);
        float[] coordinates = { 0, 0,                                frame.imageWidth, 0,
                                frame.imageWidth, frame.imageHeight, 0, frame.imageHeight};
        float[] transformed = transform.query(coordinates);
        assertEquals(1,                     transformed[0], 0);
        assertEquals(2,                     transformed[1], 0);
        assertEquals(3 + frame.imageWidth,  transformed[2], 0);
        assertEquals(4,                     transformed[3], 0);
        assertEquals(5 + frame.imageWidth,  transformed[4], 0);
        assertEquals(6 + frame.imageHeight, transformed[5], 0);
        assertEquals(7,                     transformed[6], 0);
        assertEquals(8 + frame.imageHeight, transformed[7], 0);
    }

    @Test
    public void testMultiImageTransform() throws Exception {
        ImageWritable writable = makeRandomImage(0, 0, 3);
        Frame frame = writable.getFrame();
        ImageTransform transform = new MultiImageTransform(rng, new CropImageTransform(10),
                        new FlipImageTransform(), new ScaleImageTransform(10), new WarpImageTransform(10));

        for (int i = 0; i < 100; i++) {
            ImageWritable w = transform.transform(writable);
            Frame f = w.getFrame();
            assertTrue(f.imageHeight >= frame.imageHeight - 30);
            assertTrue(f.imageHeight <= frame.imageHeight + 20);
            assertTrue(f.imageWidth >= frame.imageWidth - 30);
            assertTrue(f.imageWidth <= frame.imageWidth + 20);
            assertEquals(f.imageChannels, frame.imageChannels);
        }
        assertEquals(null, transform.transform(null));

        transform = new MultiImageTransform(new ColorConversionTransform(COLOR_BGR2RGB));
        writable = transform.transform(writable);
        float[] transformed = transform.query(new float[] {11, 22});
        assertEquals(11, transformed[0], 0);
        assertEquals(22, transformed[1], 0);
    }

    @Ignore
    @Test
    public void testFilterImageTransform() throws Exception {
        ImageWritable writable = makeRandomImage(0, 0, 4);
        Frame frame = writable.getFrame();
        ImageTransform transform = new FilterImageTransform("noise=alls=20:allf=t+u,format=rgba", frame.imageWidth,
                        frame.imageHeight, frame.imageChannels);

        for (int i = 0; i < 100; i++) {
            ImageWritable w = transform.transform(writable);
            Frame f = w.getFrame();
            assertEquals(f.imageHeight, frame.imageHeight);
            assertEquals(f.imageWidth, frame.imageWidth);
            assertEquals(f.imageChannels, frame.imageChannels);
        }
        assertEquals(null, transform.transform(null));
    }

    @Test
    public void testShowImageTransform() throws Exception {
        if (GraphicsEnvironment.isHeadless()) { return; }

        ImageWritable writable = makeRandomImage(0, 0, 3);
        ImageTransform transform = new ShowImageTransform("testShowImageTransform", 100);

        for (int i = 0; i < 10; i++) {
            ImageWritable w = transform.transform(writable);
            assertEquals(w, writable);
        }

        assertEquals(null, transform.transform(null));

        float[] transformed = transform.query(new float[] {33, 44});
        assertEquals(33, transformed[0], 0);
        assertEquals(44, transformed[1], 0);
    }

    @Test
    public void testConvertColorTransform() throws Exception {
        if (GraphicsEnvironment.isHeadless()) { return; }

        //        Mat origImage = new Mat();
        //        Mat transImage = new Mat();
        //        OpenCVFrameConverter.ToMat converter = new OpenCVFrameConverter.ToMat();
        ImageWritable writable = makeRandomImage(32, 32, 3);
        Frame frame = writable.getFrame();
        ImageTransform showOrig = new ShowImageTransform("Original Image", 50);
        showOrig.transform(writable);
        //        origImage = converter.convert(writable.getFrame());

        ImageTransform transform = new ColorConversionTransform(new Random(42), COLOR_BGR2YCrCb);
        ImageWritable w = transform.transform(writable);
        ImageTransform showTrans = new ShowImageTransform("LUV Image", 50);
        showTrans.transform(writable);
        //        transImage = converter.convert(writable.getFrame());

        Frame newframe = w.getFrame();
        assertNotEquals(frame, newframe);
        assertEquals(null, transform.transform(null));

        float[] transformed = transform.query(new float[] {55, 66});
        assertEquals(55, transformed[0], 0);
        assertEquals(66, transformed[1], 0);
    }

    @Test
    public void testHistEqualization() throws CanvasFrame.Exception {
        if (GraphicsEnvironment.isHeadless()) { return; }

        // TODO pull out historgram to confirm equalization...
        ImageWritable writable = makeRandomImage(32, 32, 3);
        Frame frame = writable.getFrame();
        ImageTransform showOrig = new ShowImageTransform("Original Image", 50);
        showOrig.transform(writable);

        ImageTransform transform = new EqualizeHistTransform(new Random(42), COLOR_BGR2YCrCb);
        ImageWritable w = transform.transform(writable);

        ImageTransform showTrans = new ShowImageTransform("LUV Image", 50);
        showTrans.transform(writable);
        Frame newframe = w.getFrame();
        assertNotEquals(frame, newframe);
        assertEquals(null, transform.transform(null));

        float[] transformed = transform.query(new float[] {66, 77});
        assertEquals(66, transformed[0], 0);
        assertEquals(77, transformed[1], 0);
    }

    @Test
    public void testRandomCropTransform() throws Exception {
        ImageWritable writable = makeRandomImage(0, 0, 1);
        Frame frame = writable.getFrame();
        ImageTransform transform = new RandomCropTransform(frame.imageHeight / 2, frame.imageWidth / 2);

        for (int i = 0; i < 100; i++) {
            ImageWritable w = transform.transform(writable);
            Frame f = w.getFrame();
            assertTrue(f.imageHeight == frame.imageHeight / 2);
            assertTrue(f.imageWidth == frame.imageWidth / 2);
        }
        assertEquals(null, transform.transform(null));

        transform = new RandomCropTransform(frame.imageHeight, frame.imageWidth);
        writable = transform.transform(writable);
        float[] coordinates = {2, 4, 6, 8};
        float[] transformed = transform.query(coordinates);
        assertEquals(2, transformed[0], 0);
        assertEquals(4, transformed[1], 0);
        assertEquals(6, transformed[2], 0);
        assertEquals(8, transformed[3], 0);
    }

    @Test
    public void testProbabilisticPipelineTransform() throws Exception {
        ImageWritable writable = makeRandomImage(0, 0, 3);
        Frame frame = writable.getFrame();

        ImageTransform randCrop = new RandomCropTransform(frame.imageHeight / 2, frame.imageWidth / 2);
        ImageTransform flip = new FlipImageTransform();
        List<Pair<ImageTransform, Double>> pipeline = new LinkedList<>();
        pipeline.add(new Pair<>(randCrop, 1.0));
        pipeline.add(new Pair<>(flip, 0.5));
        ImageTransform transform = new PipelineImageTransform(pipeline, true);

        for (int i = 0; i < 100; i++) {
            ImageWritable w = transform.transform(writable);
            Frame f = w.getFrame();
            assertTrue(f.imageHeight == frame.imageHeight / 2);
            assertTrue(f.imageWidth == frame.imageWidth / 2);
            assertEquals(f.imageChannels, frame.imageChannels);
        }
        assertEquals(null, transform.transform(null));

        transform = new PipelineImageTransform(new EqualizeHistTransform());
        writable = transform.transform(writable);
        float[] transformed = transform.query(new float[] {88, 99});
        assertEquals(88, transformed[0], 0);
        assertEquals(99, transformed[1], 0);
    }

    /**
     * This test code is kind of a manual test using specific image(largestblobtest.jpg)
     * with particular thresholds(blur size, thresholds for edge detector)
     * The cropped largest blob size should be 74x61
     * because we use a specific image and thresholds
     *
     * @throws Exception
     */
    @Test
    public void testLargestBlobCropTransform() throws Exception {
        if (GraphicsEnvironment.isHeadless()) { return; }

        java.io.File f1 = new ClassPathResource("testimages2/largestblobtest.jpg").getFile();
        NativeImageLoader loader = new NativeImageLoader();
        ImageWritable writable = loader.asWritable(f1);

        ImageTransform showOrig = new ShowImageTransform("Original Image", 50);
        showOrig.transform(writable);

        ImageTransform transform =
                        new LargestBlobCropTransform(null, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, 3, 3, 100, 300, true);
        ImageWritable w = transform.transform(writable);

        ImageTransform showTrans = new ShowImageTransform("Largest Blob", 50);
        showTrans.transform(w);
        Frame newFrame = w.getFrame();

        assertEquals(newFrame.imageHeight, 74);
        assertEquals(newFrame.imageWidth, 61);

        float[] transformed = transform.query(new float[] {88, 32});
        assertEquals(0, transformed[0], 0);
        assertEquals(0, transformed[1], 0);
    }

    public static ImageWritable makeRandomImage(int height, int width, int channels) {
        if (height <= 0) {
            height = rng.nextInt() % 100 + 200;
        }
        if (width <= 0) {
            width = rng.nextInt() % 100 + 200;
        }
        Mat img = new Mat(height, width, CV_8UC(channels));
        UByteIndexer idx = img.createIndexer();
        for (int i = 0; i < height; i++) {
            for (int j = 0; j < width; j++) {
                for (int k = 0; k < channels; k++) {
                    idx.put(i, j, k, rng.nextInt());
                }
            }
        }
        Frame frame = converter.convert(img);
        return new ImageWritable(frame);
    }
}


text:
export * from "../../util/formatContext";
export { array } from "../../util";

import { ILocation, isCurrentPackageLocation } from "../../structure";

// Note that react elements are not react fragments; returning bare elements prevents React from auto-assigning keys, so they must be wrapped in an array.
interface ReactFragmentArray extends Array<ReactFragment> { }
interface ReactElementArray extends Array<React.ReactElement<any>> { }
export type ReactFragment = string | null | ReactFragmentArray | ReactElementArray;

export function join(fragments: ReactFragment[], separator: ReactFragment): ReactFragment {
    const last = fragments.length - 1;
    return fragments.map<ReactFragment>((x, i) => i === last ? x : [x, separator]);
}

export function locationDnaid(location: ILocation): string {
    if (!location)
        return '';
    else if (isCurrentPackageLocation(location))
        return location;
    else
        return location.i;
}


text:
"""
The IP Geolocation API allows you to look up IP details.

More information: http://ipinfo.io/developers
"""
from appletea.ipinfo.api import get_ipinfo

__all__ = ['get_ipinfo']


text:
namespace MassTransit.Tests
{
    using System;
    using System.Linq;
    using System.Threading;
    using System.Threading.Tasks;
    using MassTransit.Testing;
    using Metadata;
    using NUnit.Framework;
    using Shouldly;
    using TestFramework;
    using TestFramework.Messages;

    [TestFixture]
    public class A_faulting_consumer :
        InMemoryTestFixture
    {
        [Test]
        public async Task Should_publish_a_single_fault_when_retried()
        {
            await InputQueueSendEndpoint.Send(new PingMessage());

            _consumer.Faults.Select().Count().ShouldBe(1);
        }

        PingConsumer _consumer;

        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _consumer = new PingConsumer(TimeSpan.FromSeconds(5), InMemoryTestHarness.InactivityToken);

            configurator.UseRetry(r => r.Immediate(5));
            _consumer.Configure(configurator);
        }

        class PingConsumer :
            MultiTestConsumer
        {
            readonly ReceivedMessageList<Fault<PingMessage>> _faults;
            readonly ReceivedMessageList<PingMessage> _messages;

            public PingConsumer(TimeSpan timeout, CancellationToken testCompleted)
                : base(timeout, testCompleted)
            {
                _messages = Fault<PingMessage>();
                _faults = Consume<Fault<PingMessage>>();
            }

            public IReceivedMessageList<PingMessage> Messages => _messages;
            public IReceivedMessageList<Fault<PingMessage>> Faults => _faults;
        }
    }

    [TestFixture]
    public class A_faulting_consumer_when_fault_publishing_is_disable :
        InMemoryTestFixture
    {
        [Test]
        public async Task Should_publish_a_single_fault_when_retried()
        {
            await InputQueueSendEndpoint.Send(new PingMessage());

            _consumer.Faults.Select().Count().ShouldBe(0);
        }

        PingConsumer _consumer;

        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            configurator.PublishFaults = false;

            _consumer = new PingConsumer(TimeSpan.FromSeconds(5), InMemoryTestHarness.InactivityToken);

            configurator.UseRetry(r => r.Immediate(5));
            _consumer.Configure(configurator);
        }

        class PingConsumer :
            MultiTestConsumer
        {
            readonly ReceivedMessageList<Fault<PingMessage>> _faults;
            readonly ReceivedMessageList<PingMessage> _messages;

            public PingConsumer(TimeSpan timeout, CancellationToken testCompleted)
                : base(timeout, testCompleted)
            {
                _messages = Fault<PingMessage>();
                _faults = Consume<Fault<PingMessage>>();
            }

            public IReceivedMessageList<PingMessage> Messages => _messages;
            public IReceivedMessageList<Fault<PingMessage>> Faults => _faults;
        }
    }

    [TestFixture]
    public class A_fault_event :
        InMemoryTestFixture
    {
        [Test]
        public async Task Should_include_the_faulted_message_types()
        {
            await InputQueueSendEndpoint.Send<ActualMessageType>(new { });

            _consumer.Faults.Select().Count().ShouldBe(1);

            IReceivedMessage<Fault<BaseMessageType>> fault = _consumer.Faults.Select().FirstOrDefault();
            Assert.That(fault, Is.Not.Null);

            await TestContext.Out.WriteLineAsync(string.Join(Environment.NewLine, fault.Context.Message.FaultMessageTypes));
            await TestContext.Out.WriteLineAsync(string.Join(Environment.NewLine, fault.Context.SupportedMessageTypes));

            Assert.That(fault.Context.Message.FaultMessageTypes.Contains(MessageUrn.ForTypeString<BaseMessageType>()));
            Assert.That(fault.Context.Message.FaultMessageTypes.Contains(MessageUrn.ForTypeString<ActualMessageType>()));

            Assert.That(fault.Context.SupportedMessageTypes.Contains(MessageUrn.ForTypeString<Fault<BaseMessageType>>()));
        }

        BaseMessageConsumer _consumer;

        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _consumer = new BaseMessageConsumer(TimeSpan.FromSeconds(5), InMemoryTestHarness.InactivityToken);

            _consumer.Configure(configurator);
        }

        class BaseMessageConsumer :
            MultiTestConsumer
        {
            readonly ReceivedMessageList<Fault<BaseMessageType>> _faults;

            public BaseMessageConsumer(TimeSpan timeout, CancellationToken testCompleted)
                : base(timeout, testCompleted)
            {
                Fault<BaseMessageType>();
                _faults = Consume<Fault<BaseMessageType>>();
            }

            public IReceivedMessageList<Fault<BaseMessageType>> Faults => _faults;
        }

        public interface BaseMessageType
        {
        }

        public interface ActualMessageType :
            BaseMessageType
        {
        }
    }

    [TestFixture]
    public class A_fault_event_using_try_get_message :
        InMemoryTestFixture
    {
        [Test]
        public async Task Should_include_the_faulted_message_types()
        {
            await InputQueueSendEndpoint.Send<ActualMessageType>(new { });

            _consumer.Faults.Select().Count().ShouldBe(1);

            IReceivedMessage<Fault<BaseMessageType>> fault = _consumer.Faults.Select().FirstOrDefault();
            Assert.That(fault, Is.Not.Null);

            await TestContext.Out.WriteLineAsync(string.Join(Environment.NewLine, fault.Context.Message.FaultMessageTypes));
            await TestContext.Out.WriteLineAsync(string.Join(Environment.NewLine, fault.Context.SupportedMessageTypes));

            Assert.That(fault.Context.Message.FaultMessageTypes.Contains(MessageUrn.ForTypeString<BaseMessageType>()));
            Assert.That(fault.Context.Message.FaultMessageTypes.Contains(MessageUrn.ForTypeString<ActualMessageType>()));

            Assert.That(fault.Context.SupportedMessageTypes.Contains(MessageUrn.ForTypeString<Fault<BaseMessageType>>()));
            Assert.That(fault.Context.SupportedMessageTypes.Contains(MessageUrn.ForTypeString<Fault<ActualMessageType>>()));
        }

        BaseMessageConsumer _consumer;

        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _consumer = new BaseMessageConsumer(TimeSpan.FromSeconds(5), InMemoryTestHarness.InactivityToken);

            _consumer.Configure(configurator);

            configurator.Consumer<FaultConsumer>();
        }

        class FaultConsumer :
            IConsumer<BaseMessageType>
        {
            public Task Consume(ConsumeContext<BaseMessageType> context)
            {
                if (context.TryGetMessage<ActualMessageType>(out ConsumeContext<ActualMessageType> actualContext))
                    return actualContext.NotifyFaulted(TimeSpan.Zero, TypeCache<FaultConsumer>.ShortName, new IntentionalTestException());

                throw new InvalidOperationException("This was not expected, but gets the job done");
            }
        }

        class BaseMessageConsumer :
            MultiTestConsumer
        {
            readonly ReceivedMessageList<Fault<BaseMessageType>> _faults;

            public BaseMessageConsumer(TimeSpan timeout, CancellationToken testCompleted)
                : base(timeout, testCompleted)
            {
                _faults = Consume<Fault<BaseMessageType>>();
            }

            public IReceivedMessageList<Fault<BaseMessageType>> Faults => _faults;
        }

        public interface BaseMessageType
        {
        }

        public interface ActualMessageType :
            BaseMessageType
        {
        }
    }
}


text:
PeerProfile::PeerProfile(QWidget *parent, QString str,User* _user) :
    QMainWindow(parent),
    ui(new Ui::PeerProfile)
{
    ui->setupUi(this);
    user = _user;
    online_user = str;
    imagename = "";
    fillList();
}

PeerProfile::~PeerProfile()
{
    delete ui;
}

void PeerProfile::fillList(){
    std::vector<std::string> temp;
    temp = user->getListOfPeerImages(online_user.toUtf8().constData());
    tempList = temp;
    if(isEmpty()){
        string username = online_user.toUtf8().constData();
        string path = "./LoadedImages/" + username;
        DIR* dir_point = opendir(path.c_str());
        dirent* entry = readdir(dir_point);
        while (entry){									// if !entry then end of directory
            if (entry->d_type == DT_REG){		// if entry is a regular file
                std::string fname = entry->d_name;	// filename
                if(fname != ".default.jpg")
                    temp.push_back(fname.substr(5));		// add filename to results vector
            }
            entry = readdir(dir_point);
        }

    }
    tempList = temp;

    for (int i=0; i<temp.size(); ++i)
        ui->imageList->addItem(QString::fromStdString(temp[i]));
}

void PeerProfile::on_request_clicked()
{
    std::string _imagename = imagename.toUtf8().constData();
    std::string _online = online_user.toUtf8().constData();
    QString x = ui->count->text();
    std:: string _num = x.toUtf8().constData();

    if(imagename!=""&& x!="")
        user->requestPeerImage(_online, _imagename, stoi(_num));
}

bool PeerProfile::isEmpty(){
    return tempList.size() == 0;
}

void PeerProfile::on_back_clicked()
{
    clear();
    this->parentWidget()->show();
    this->close();
}

void PeerProfile::clear(){

    ui->imageList->clear();
    ui->image->clear();
}
void PeerProfile::on_imageList_itemClicked(QListWidgetItem *item)
{
    ui->image->clear();
    imagename = item->text();
    std::string _name = imagename.toUtf8().constData();
    int x = user->allowedViews(online_user.toUtf8().constData(), _name);
    ui->views->setText(QString::number(x));
    cv::Mat img;
    if (x!=0){
        img = user->viewPeerImage(online_user.toUtf8().constData(), _name);
        cv::cvtColor(img, img, cv::COLOR_BGR2RGB);
        cv::Size size(640,610);
        cv::resize(img,img,size);
        ui->image->setPixmap(QPixmap::fromImage(QImage(img.data, img.cols, img.rows, img.step, QImage::Format_RGB888)));
    }
}

void PeerProfile::on_refresh_clicked()
{
    clear();
    fillList();
}


text:
---
uid: SolidEdgePart.ExtrudedCutout.ShowDimensions
summary:
remarks: If this property is True, the dimensions are displayed; if False, the dimensions are hidden.
example: [*content]
---
[!code-vb[Main](..\snippets\SolidEdgePart.ExtrudedCutout.ShowDimensions.vb]
[!code-csharp[Main](..\snippets\SolidEdgePart.ExtrudedCutout.ShowDimensions.cs]


text:
import { ActivatedRoute } from '@angular/router';
import { FormGroup } from '@angular/forms';
import {
    Component, OnInit, ViewEncapsulation,
    ViewChild, Output, EventEmitter, Input
} from '@angular/core';
import { ModalDirective } from 'ng2-bootstrap';
import { CompanySpec, Company } from '../../shared/models';
import { CompanySpecService } from '../../shared/services/index';
import { EditComponent } from '../../core/index';
import { DynamicFormControlModel, DynamicFormService } from '@ng2-dynamic-forms/core';
import { COMPANYSPEC_FORM_MODEL } from './companySpec-form.model';
@Component({
    selector: 'companySpec-edit',
    encapsulation: ViewEncapsulation.None,
    templateUrl: 'form.component.html'

})
export class CompanySpecEditComponent extends EditComponent<CompanySpec> {
    @ViewChild('formModal') formModal: ModalDirective;
    @Output() onSaved: EventEmitter<any> = new EventEmitter();
    @Input() company: Company;
    @Input() key: string;
    constructor(private _service: CompanySpecService, dynamicFormService: DynamicFormService,
        private activatedRoute: ActivatedRoute) {
        super(CompanySpec, _service, dynamicFormService, COMPANYSPEC_FORM_MODEL);
    }
    ngOnInit() {
        if (this.key)
            super.setKey(this.key);
        super.open();
        //this.prepareImgCropper();
        super.ngOnInit();
    }
    setCompany(company: Company): void {
        this.company = company;
    }
}


text:
namespace zuki::tools::llvm::clang {

//---------------------------------------------------------------------------
// DiagnosticCollection Constructor (protected)
//
// Arguments:
//
//	NONE

DiagnosticCollection::DiagnosticCollection()
{
}

//---------------------------------------------------------------------------
// DiagnosticCollection::GetEnumerator
//
// Returns a generic IEnumerator<T> for the member collection
//
// Arguments:
//
//	NONE

IEnumerator<Diagnostic^>^ DiagnosticCollection::GetEnumerator(void)
{
	return gcnew ReadOnlyListEnumerator<Diagnostic^>(this);
}

//---------------------------------------------------------------------------
// DiagnosticCollection::IEnumerable_GetEnumerator
//
// Returns a non-generic IEnumerator for the member collection
//
// Arguments:
//
//	NONE

System::Collections::IEnumerator^ DiagnosticCollection::IEnumerable_GetEnumerator(void)
{
	return GetEnumerator();
}

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

} // zuki::tools::llvm::clang

#pragma warning(pop)


text:
package org.uclab.mm.datamodel.sc.dataadapter.testcases;

import static org.junit.Assert.*;

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

import org.junit.Test;
import org.uclab.mm.datamodel.AbstractDataBridge;
import org.uclab.mm.datamodel.DataAccessInterface;
import org.uclab.mm.datamodel.DatabaseStorage;
import org.uclab.mm.datamodel.sc.UserRewards;
import org.uclab.mm.datamodel.sc.dataadapter.UserRewardsAdapter;

/**
 * This is a class for testing the insertion, fetching, and update of UserRewards
 * @author Taqdir Ali
 *
 */

public class UserRewardsAdapterTest {

	/**
	 * This is function for testing the insertion, fetching, and update of UserRewards
	 */
	@Test
	public void test() {
		/* Preparing input object for insertion*/
		UserRewards objOuterUserRewards = new UserRewards();
		UserRewards objInnerUserRewards = new UserRewards();
		List<UserRewards> objListUserRewards = new  ArrayList<UserRewards>();

		objOuterUserRewards.setUserID(2L);
		objOuterUserRewards.setRewardPoints(4);
		objOuterUserRewards.setRewardDescription("Unit Testing Reward");
		objOuterUserRewards.setRewardDate("2016 12 12 01:30:01");
		objOuterUserRewards.setRewardTypeID(1);

		/* Testing of insertion function*/
		 DataAccessInterface objDAInterface = new UserRewardsAdapter();
         AbstractDataBridge objADBridge = new DatabaseStorage(objDAInterface);
         List<String> lstResponse = objADBridge.SaveUserRewards(objOuterUserRewards);
         if(lstResponse.size() == 2)
         {
        	 /* Testing of fetching function*/
        	 objInnerUserRewards.setUserID(2L);
        	 DataAccessInterface objDAInterfaceRetrieval = new UserRewardsAdapter();
             AbstractDataBridge objADBridgeRetrieval = new DatabaseStorage(objDAInterfaceRetrieval);
        	 objListUserRewards = objADBridgeRetrieval.RetriveUserRewards(objInnerUserRewards);
        	 objInnerUserRewards = objListUserRewards.get(0);
         }

         assertEquals(objOuterUserRewards.getRewardDescription(), objInnerUserRewards.getRewardDescription());

         /* Testing of Update function*/
         objInnerUserRewards.setRewardDescription("Unit Testing Reward Updated");
         objInnerUserRewards.setRewardDate("2016 12 12 01:30:01");
         DataAccessInterface objDAInterfaceUpdate = new UserRewardsAdapter();
         AbstractDataBridge objADBridgeUpdate = new DatabaseStorage(objDAInterfaceUpdate);
         lstResponse = objADBridgeUpdate.UpdateUserRewards(objInnerUserRewards);
         if(lstResponse.size() == 2)
         {
        	 /* Testing of fetching function*/
        	 objInnerUserRewards.setUserID(2L);
        	 DataAccessInterface objDAInterfaceRetrieval = new UserRewardsAdapter();
             AbstractDataBridge objADBridgeRetrieval = new DatabaseStorage(objDAInterfaceRetrieval);
        	 objListUserRewards = objADBridgeRetrieval.RetriveUserRewards(objInnerUserRewards);
        	 objInnerUserRewards = objListUserRewards.get(0);
         }

         assertEquals(objInnerUserRewards.getRewardDescription(), "Unit Testing Reward Updated");
	}

}