text:
import os
import sys
import random
import argparse
import parse_hist

# Compare types
COMPARE_BASELINE = 0
COMPARE_ADJACENT = 1

parser = argparse.ArgumentParser(description="Arguments for %s" % __file__)
parser.add_argument("--verbose", "-v", action="count", default=0)
parser.add_argument("--debug", "-d", action="store_true", default=False)
parser.add_argument("--rand-seed", type=int, help="random seed", default=894291)
parser.add_argument("--compare", "-c", default="baseline")
parser.add_argument("--baseline", "-b", default="0")
parser.add_argument("--print-stdout", action="store_true", default=False)
parser.add_argument("--gen-csv", action="store_true", default=False)
parser.add_argument("--kmedoids", action="store_true", default=False)
parser.add_argument("--nummedoids", type=int, default=2)
parser.add_argument("--percenttrials", type=int, default=10)  # 10% by default
parser.add_argument("inputs", metavar="history files", nargs="+", help="history files to be processed")
args = parser.parse_args()

verbosity = args.verbose
if (args.compare == "baseline"):
    compareType = COMPARE_BASELINE
elif (args.compare == "adjacent"):
    compareType = COMPARE_ADJACENT
else:
    print("Error: Unrecognized argument %s" % (args.compare))
    sys.exit(1)

if (compareType == COMPARE_BASELINE):
    # parse baseline indices
    # e.g., --baseline=0,2-4,10
    baselineList = []
    indexRanges = args.baseline.split(",")
    for eachIndexRange in indexRanges:
        rangeMinMax = eachIndexRange.split("-")
        if (len(rangeMinMax) == 1):
            baselineList.append(int(rangeMinMax[0]))
        elif (len(rangeMinMax) == 2):
            minIndex = int(rangeMinMax[0])
            maxIndex = int(rangeMinMax[1]) + 1
            for i in range(minIndex, maxIndex):
                baselineList.append(i)
    assert(len(baselineList) >= 1)
    if (verbosity > 0):
        print("INFO: Comparison type %d" % (compareType))
        if (verbosity > 1):
            if (len(baselineList) == 1):
                print("(baseline: %d)" % (baselineList[0]))
            else:
                print("(baselines: %s)" % (baselineList))
elif (compareType == COMPARE_ADJACENT):
    if (verbosity > 0):
        print("INFO: Comparison type %d" % (compareType))
    print("ERROR: Currently not fully implemented")  # FIXME
    assert(False)
# NOTE: Add here when you add additional types of comparisons in the future

############################################################
## Parse the history log file
############################################################

hist = parse_hist.parseHistoryFile(args.inputs, verbosity)

# debug
if args.debug:
    for executionIndex in hist:
        for threadIndex in hist[executionIndex]:
            sys.stdout.write("Execution %d T%d" % (executionIndex, threadIndex))
            sys.stdout.write("\n")
            for registerIndex in hist[executionIndex][threadIndex]:
                sys.stdout.write("R%d" % (registerIndex))
                for loadValue in hist[executionIndex][threadIndex][registerIndex]:
                    sys.stdout.write(" %X" % (loadValue))
                sys.stdout.write("\n")

############################################################
## Diffing two executions: execution A (baseline) vs execution B
############################################################
mismatchCountAll = dict()
for baselineIndex in baselineList:
    mismatchCountBase = dict()
    assert(baselineIndex in hist)  # baselineIndex is the index of base execution (A)
    if verbosity > 0:
        print("## Baseline Index: %d" % baselineIndex)
    # NOTE: Multiple executions of a same program, thus same number of threads, registers, loaded values
    for executionIndex in hist:
        mismatchCountBase[executionIndex] = 0
        if (executionIndex == baselineIndex):
            continue
        if verbosity > 1:
            print("# Comparing %d (baseline %d)" % (executionIndex, baselineIndex))
        histA = hist[baselineIndex]
        histB = hist[executionIndex]
        assert(len(histA) == len(histB))
        for threadIndex in histA:
            assert(len(histA[threadIndex]) == len(histB[threadIndex]))
            for registerIndex in histA[threadIndex]:
                assert(len(histA[threadIndex][registerIndex]) == len(histB[threadIndex][registerIndex]))
                for loadIndex in range(len(histA[threadIndex][registerIndex])):
                    if (histA[threadIndex][registerIndex][loadIndex] != histB[threadIndex][registerIndex][loadIndex]):
                        mismatchCountBase[executionIndex] += 1
                        if verbosity > 1:
                            print("Mismatch T%d R%d L%d base %X curr %X" % (threadIndex, registerIndex, loadIndex, histA[threadIndex][registerIndex][loadIndex], histB[threadIndex][registerIndex][loadIndex]))
    mismatchCountAll[baselineIndex] = mismatchCountBase

############################################################
## Reporting mismatch statistics
############################################################
if (args.print_stdout or args.gen_csv):
    ## 1. Colleting all information in one string
    # First line (note)
    outString = ",baselines\n"
    # Second line (baseline indices)
    outString += "execution"
    for baselineIndex in baselineList:
        outString += ",%d" % baselineIndex
    outString += ",total mismatch,best mismatch,best baseline\n"
    # Third+ line (mismatch count for executions, each execution in a line)
    for executionIndex in hist:
        outString += "%d" % executionIndex
        # individual mismatch counts
        totalMismatchCount = 0
        minMismatchCount = sys.maxint
        minMismatchBaselineIndex = -1
        for baselineIndex in baselineList:
            #print("baseline %d execution %d" % (baselineIndex, executionIndex))
            currMismatchCount = mismatchCountAll[baselineIndex][executionIndex]
            outString += ",%d" % currMismatchCount
            totalMismatchCount += currMismatchCount
            if currMismatchCount < minMismatchCount:
                minMismatchCount = currMismatchCount
                minMismatchBaselineIndex = baselineIndex
        # total mismatch counts for this execution across baseline
        outString += ",%d" % totalMismatchCount
        # minimum mismatch count, and its baseline index
        outString += ",%d,%d\n" % (minMismatchCount, minMismatchBaselineIndex)
    # Last line (total mismatch count for baselines, each baseline in a column)
    outString += "total"
    for baselineIndex in baselineList:
        totalMismatchCount = 0
        for executionIndex in hist:
            totalMismatchCount += mismatchCountAll[baselineIndex][executionIndex]
        outString += ",%d" % totalMismatchCount
    outString += "\n"

    ## 2. Priting out to stdout and csv file
    if args.print_stdout:
        print("\n### Mismatch count matrix")
        sys.stdout.write(outString)
    if args.gen_csv:
        diffFileName = "diff.csv"
        diffFP = open(diffFileName, "w")
        diffFP.write(outString)
        diffFP.close()
        print("### %s generated" % diffFileName)

############################################################
## k-medoids clustering (Partitioning Around Medoids (PAM) algorithm)
# NOTE: algorithm is adopted from
# https://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/Partitioning_Around_Medoids_(PAM)
# https://en.wikipedia.org/wiki/K-medoids
# NOTE: my implementation uses minimum dissimilarity to a medoid as a cost function
############################################################
if args.kmedoids:
    if (len(baselineList) != len(hist)):
        print("Warning: baseline executions are a subset of the entire executions...")
        print("# baseline executions %d vs. # entire executions %d" % (len(baselineList), len(hist)))
    else:
        ## Preprocessing (data structure)
        # 'mat' is a dissimilarity matrix between executions
        # For faster speed, data structure is re-created using 2-dimensional list, instead of dictionary
        execIdxs = sorted(baselineList)
        #print("unsorted baseline execution indices %s" % baselineList)
        #print("  sorted baseline execution indices %s" % execIdxs)
        mat = []
        for i in range(len(execIdxs)):
            matRow = []
            for j in range(len(execIdxs)):
                matRow.append(mismatchCountAll[execIdxs[i]][execIdxs[j]])
            mat.append(matRow)
        #print(mat)

        if (args.nummedoids <= 0):
            print("Error: nummedoids should be positive integer")
            sys.exit(1)
        elif (len(execIdxs) < args.nummedoids):
            print("Warning: nummedoids is set to %d but only %d baseline executions exist" % (args.nummedoids, len(baselineList)))
        numMedoids = min(args.nummedoids, len(execIdxs))

        # Number of pairs (medoid and non-medoid) to be swapped
        numSwaps = numMedoids * (len(execIdxs) - numMedoids)
        numSwapTrials = int(round(numSwaps * args.percenttrials / float(100)))
        print("numSwaps %d numSwapTrials %d" % (numSwaps, numSwapTrials))

        random.seed(args.rand_seed)

        ## MAIN ALGORITHM
        # 1. Build phase
        # 1.1. Choose k medoid entities
        initMethod = 1  # This variable selects one of the initialization methods below
        if (initMethod == 0):    # 1st type: uniform random assignment
            medoids = random.sample(range(execIdxs), numMedoids)
        elif (initMethod == 1):  # 2nd type: equi-distance assignment
            medoids = []
            for i in range(0, numMedoids):
                if (numMedoids == 1):
                    percentile = 0.0
                else:
                    percentile = float(i) / (numMedoids - 1)
                index_float = (len(execIdxs) - 1) * percentile
                index_int = int(round(index_float))
                medoids.append(index_int)
            # sanity check (no duplicate)
            assert(len(list(set(medoids))) == numMedoids)
        elif (initMethod == 2):  # 3rd type: successive selection based on distances from others (original PAM method)
            # FIXME: implement here!
            # See page 7 of https://wis.kuleuven.be/stat/robust/papers/publications-1987/kaufmanrousseeuw-clusteringbymedoids-l1norm-1987.pdf
            print("Error: this intiialization method (%d) is not implemented" % (initMethod))
            sys.exit(1)
        else:
            print("Error: unrecognized initialization method (%d) for k-medoids clustering" % (initMethod))
            sys.exit(1)
        if (verbosity > 0):
            print("INFO: k-medoids clustering... initial medoids %s" % (medoids))

        nonmedoids = []
        for i in range(len(execIdxs)):
            if not i in medoids:
                nonmedoids.append(i)

        # 1.2. Assign every entity to its closest medoid
        cluster = [-1 for i in range(len(execIdxs))]
        totalCost = 0
        for i in range(len(execIdxs)):
            if i in medoids:
                cluster[i] = i
                totalCost += 0
            else:
                bestCost = sys.maxint
                bestCluster = -1
                for idx in medoids:
                    if (mat[i][idx] < bestCost):
                        bestCost = mat[i][idx]
                        bestCluster = idx
                cluster[i] = bestCluster
                totalCost += bestCost

        if (verbosity > 0):
            print("INFO: initial clustering cost %d, cluster %s" % (totalCost, cluster))

        # 2. Swap phase
        # 2.1. For each cluster search if any of the entities of the cluster
        # lower the average dissimilarity coefficient, if it does select the
        # entity that lowers this coefficient the most as the medoid for this
        # cluster.
        while True:
            changed = False
            trialCnt = 0
            trialHistory = set()
            while trialCnt < numSwapTrials:
                # Pick a pair of numbers to be swapped (one from medoid, another from non-medoid)
                # Uniform random... Monte-Carlo sampling (sampling with rejection)
                while True:
                    idxMedoid = random.randint(0, len(medoids)-1)
                    idxNonmedoid = random.randint(0, len(nonmedoids)-1)
                    execMedoid = medoids[idxMedoid]
                    execNonmedoid = nonmedoids[idxNonmedoid]
                    if not (execMedoid, execNonmedoid) in trialHistory:
                        break
                if (verbosity > 1):
                    print("INFO: medoid %d <-> non-medoid %d" % (execMedoid, execNonmedoid))
                trialCnt += 1
                trialHistory.add((execMedoid, execNonmedoid))

                # Create a new set of medoids and non-medoids
                # NOTE: Be careful not to forget manipulating medoids and nonmedoids later...
                medoids.append(execNonmedoid)
                medoids.remove(execMedoid)

                # Compute new cost and cluster assignment
                newCluster = [-1 for i in range(len(execIdxs))]
                newTotalCost = 0
                for i in range(len(execIdxs)):
                    if i in medoids:
                        newCluster[i] = i
                        newTotalCost += 0
                    else:
                        bestCost = sys.maxint
                        bestCluster = -1
                        for idx in medoids:
                            if (mat[i][idx] < bestCost):
                                bestCost = mat[i][idx]
                                bestCluster = idx
                        newCluster[i] = bestCluster
                        newTotalCost += bestCost

                if (newTotalCost < totalCost):
                    changed = True
                    cluster = newCluster
                    totalCost = newTotalCost
                    # Change nonmedoids accordingly (medoids was changed already)
                    nonmedoids.append(execMedoid)
                    nonmedoids.remove(execNonmedoid)
                    if (verbosity > 0):
                        print("INFO: successful swap (medoid %d <-> non-medoid %d)" % (execMedoid, execNonmedoid))
                else:
                    # Revert change in medoids
                    medoids.append(execMedoid)
                    medoids.remove(execNonmedoid)

            # 2.2. If at least one medoid has changed, then re-assign entities, else end the algorithm
            # Check if we should exit 'while True'
            if not changed:
                break

        # Print out resulting medroid
        print("### k-medoids clustering results")
        print("medoids: %s" % medoids)
        print("cluster: %s" % cluster)
        print("cost: %d" % totalCost)


text:
<!--
Copyright 2020 Google LLC

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

    https://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.
-->

We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.

## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution;
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.

You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.

## Code reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

## Community Guidelines

This project follows
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).

redpajama_set_name: RedPajamaGithub


text:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

          <title></title>
          <meta name="description" content="" />
          <meta name="keywords" content="" />
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

      <link href="../lib/ref-index.css" media="screen" type="text/css" rel="stylesheet" />

SPARK_VERSION

spark

SchemaRDD

sql

SortByFeatureUDFWrapper

ftvec

Strategy

sql

scaling

ftvec

sha1

HivemallOps

sigmoid

HivemallOps

sort_by_feature

HivemallOps

spark

apache

sql

spark

streaming

spark


text:
<?php

namespace garethp\ews\API\Message;

/**
 * Class representing GetItemResponse
 */
class GetItemResponse extends GetItemResponseType
{

}


text:
=head1 LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2022] 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.

=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>.

=head1 NAME

Bio::EnsEMBL::ProbeFeature - A module to represent an nucleotide probe
genomic mapping.

=head1 SYNOPSIS

use Bio::EnsEMBL::Funcgen::ProbeFeature;

my $feature = Bio::EnsEMBL::Funcgen::ProbeFeature->new
 (
	-PROBE         => $probe,
	-MISMATCHCOUNT => 0,
	-SLICE         => $chr_1_slice,
	-START         => 1000000,
	-END           => 1000024,
	-STRAND        => -1,
  -ANALYSIS      => $analysis,
  -CIGAR_STRING  => '1U2M426D2M1m21M',
 );

=head1 DESCRIPTION

An ProbeFeature object represents the genomic placement of an Probe
object. The data are stored in the probe_feature table.

=cut

package Bio::EnsEMBL::Funcgen::ProbeFeature;

use strict;
use warnings;
use Bio::EnsEMBL::Utils::Argument          qw( rearrange );
use Bio::EnsEMBL::Utils::Exception         qw( throw );
use Bio::EnsEMBL::Funcgen::Utils::EFGUtils qw( median );

use base qw( Bio::EnsEMBL::Feature Bio::EnsEMBL::Funcgen::Storable );
use constant SEQUENCE_ONTOLOGY => {'acc' => 'SO:0000001', 'term'=>'region'};

=head2 new

  Arg [-PROBE]        : Bio::EnsEMBL::Funcgen::Probe - probe
        A ProbeFeature must have a probe. This probe must already be stored if
		you plan to store the feature.
  Arg [-MISMATCHCOUNT]: int
        Number of mismatches over the length of the probe.
  Arg [-SLICE]        : Bio::EnsEMBL::Slice
        The slice on which this feature is.
  Arg [-START]        : int
        The start coordinate of this feature relative to the start of the slice
		it is sitting on. Coordinates start at 1 and are inclusive.
  Arg [-END]          : int
        The end coordinate of this feature relative to the start of the slice
		it is sitting on. Coordinates start at 1 and are inclusive.
  Arg [-STRAND]       : int
        The orientation of this feature. Valid values are 1, -1 and 0.
  Arg [-dbID]         : (optional) int
        Internal database ID.
  Arg [-ADAPTOR]      : (optional) Bio::EnsEMBL::DBSQL::BaseAdaptor
        Database adaptor.
  Example    : my $feature = Bio::EnsEMBL::Funcgen::ProbeFeature->new(
				   -PROBE         => $probe,
				   -MISMATCHCOUNT => 0,
				   -SLICE         => $chr_1_slice,
				   -START         => 1_000_000,
				   -END           => 1_000_024,
				   -STRAND        => -1,
				   -ANALYSIS      => $analysis,
                   -CIGARLINE     => '15M2m3d4M',
                   #Can represent transcript alignment as gapped genomic alignments
                   #D(eletions) representing introns
                   #Lowercase m's showing sequence mismatches
			   );
  Description: Constructor for ProbeFeature objects.
  Returntype : Bio::EnsEMBL::Funcgen::ProbeFeature
  Exceptions : None
  Caller     : General
  Status     : At risk

=cut

sub new {
  my $caller = shift;

  my $class = ref($caller) || $caller;

  my $self = $class->SUPER::new(@_);

  my ($probe, $mismatchcount, $pid, $cig_line, $hit_id, $source)
    = rearrange(['PROBE', 'MISMATCHCOUNT', 'PROBE_ID', 'CIGAR_STRING', 'HIT_ID', 'SOURCE'], @_);

  $self->{'probe_id'} = $pid if $pid;
  $self->probe($probe) if $probe;
  $self->mismatchcount($mismatchcount)  if defined $mismatchcount;#do not remove until probe mapping pipeline fixed
  $self->cigar_string($cig_line)        if defined $cig_line;
  $self->hit_id($hit_id)                if defined $hit_id;
  $self->source($source)                if defined $source;

  return $self;
}

=head2 new_fast

  Args       : Hashref with all internal attributes set
  Example    : none
  Description: Quick and dirty version of new. Only works if the code is very
               disciplined.
  Returntype : Bio::EnsEMBL::Funcgen::ProbeFeature
  Exceptions : None
  Caller     : General
  Status     : At Risk

=cut

sub new_fast {
  bless ($_[1], $_[0]);
}

=head2 probeset

  Arg [1]    : (optional) string - probeset
  Example    : my $probeset = $feature->probeset();
  Description: Getter and setter for the probeset for this feature. Shortcut
               for $feature->probe->probeset(), which should be used instead.
			   Probeset is not persisted if set with this method.
  Returntype : string
  Exceptions : None
  Caller     : General
  Status     : Medium Risk
             : Use $feature->probe->probeset() because this may be removed

=cut

sub probeset {
  my $self = shift;

  $self->{'probeset'} = shift if @_;

  if (! $self->{'probeset'}) {
    $self->{'probeset'} = $self->probe->probe_set;
  }
  return $self->{'probeset'};
}

sub probe_set_id {
  my $self = shift;

  if (! defined $self->{'_probe_set_id'}) {
    my $probe_set = $self->probeset;
    if (defined $probe_set) {
      $self->{'_probe_set_id'} = $probe_set->dbID;
    }
  }
  return $self->{'_probe_set_id'};
}

# probe_set is more logical.
sub probe_set {
  my $self = shift;
  return $self->probeset;
}

=head2 mismatchcount

  Arg [1]    : int - number of mismatches
  Example    : my $mismatches = $feature->mismatchcount();
  Description: Getter and setter for number of mismatches for this feature.
  Returntype : int
  Exceptions : None
  Caller     : General
  Status     : High Risk

=cut

sub mismatchcount {
    my $self = shift;
    $self->{'mismatchcount'} = shift if @_;
    return $self->{'mismatchcount'};
}

=head2 hit_id

  Arg [1]    : String - identifier of the sequence on which the match from which the probe feature was created was found
  Example    : my $hit_id = $feature->hit_id;
  Description: Getter and setter for the hit id of this feature.
  Returntype : int
  Exceptions : None
  Caller     : General

=cut
sub hit_id {
    my $self = shift;
    $self->{'hit_id'} = shift if @_;
    return $self->{'hit_id'};
}

=head2 source

  Arg [1]    : Enum[String] - Either 'genomic' or 'transcript'
  Example    : my $source = $feature->source;
  Description: Returns 'genomic', if the match for this probe feature was on genomic sequence, 'transcript', if it was found on a transcript.
  Returntype : Enum[String] - Either 'genomic' or 'transcript'
  Exceptions : None
  Caller     : General

=cut
sub source {
    my $self = shift;
    $self->{'source'} = shift if @_;
    return $self->{'source'};
}

=head2 cigar_string

  Arg [1]    : str - Cigar line alignment annotation (M = Align & Seq match, m = Align matcht & Seq mismatch, D = Deletion in ProbeFeature wrt genome, U = Unknown at time of alignment)
  Example    : my $cg = $feature->cigar_string();
  Description: Getter and setter for number of the cigar line attribute for this feature.
  Returntype : str
  Exceptions : None
  Caller     : General
  Status     : High Risk

=cut

sub cigar_string {
  my $self = shift;
  $self->{'cigar_string'} = shift if @_;
  return $self->{'cigar_string'};
}

=head2 probe

  Arg [1]    : Bio::EnsEMBL::Funcgen::Probe - probe
  Example    : my $probe = $feature->probe();
  Description: Getter, setter and lazy loader of probe attribute for
               ProbeFeature objects. Features are retrieved from the database
               without attached probes, so retrieving probe information for a
               feature will involve another query.
  Returntype : Bio::EnsEMBL::Funcgen::Probe
  Exceptions : None
  Caller     : General
  Status     : at risk

=cut

sub probe {
  my $self  = shift;
  my $probe = shift;

  if ($probe) {
    if ( !ref $probe || !$probe->isa('Bio::EnsEMBL::Funcgen::Probe') ) {
      throw('Probe must be a Bio::EnsEMBL::Funcgen::Probe object');
    }
    $self->{'probe'} = $probe;
  }

  if ( ! defined $self->{'probe'}){
    $self->{'probe'} = $self->adaptor()->db()->get_ProbeAdaptor()->fetch_by_dbID($self->probe_id());
  }
  return $self->{'probe'};
}

=head2 probe_id

  Example    : my $probe_id = $pfeature->probe_id();
  Description: Getter for the probe db id of the ProbeFeature
  Returntype : int
  Exceptions : None
  Caller     : General
  Status     : at risk

=cut

sub probe_id {
  my $self = shift;
  return $self->{'probe_id'} || $self->probe->dbID();
}

=head2 summary_as_hash

  Example       : $probe_feature_summary = $probe_feature->summary_as_hash;
  Description   : Retrieves a textual summary of this ProbeFeature.
  Returns       : Hashref of descriptive strings
  Status        : Intended for internal use (REST)

=cut

sub summary_as_hash {
  my $self = shift;

  my $probe     = $self->probe;
  my $probe_set = defined $probe->probe_set ? $probe->probe_set->name : '';

  return {
    seq_region_name   => $self->seq_region_name,
    start             => $self->seq_region_start,
    end               => $self->seq_region_end,
    strand            => $self->strand,
    feature_type      => 'probe_feature',
    microarray        => $probe->array_chip->name,
    probe_name        => $probe->name,
    probe_set         => $probe_set,
    probe_length      => $probe->length,
   };
}

1;


text:
package lib

import scala.util.{Failure, Success, Try}

sealed abstract class Datatype(val name: String)

object Datatype {
  sealed abstract class Primitive(override val name: String)
    extends Datatype(name)

  object Primitive {
    def apply(name: String): Try[Primitive] = Try(name match {
      case "boolean" => Boolean
      case "double" => Double
      case "integer" => Integer
      case "long" => Long
      case "date-iso8601" => DateIso8601
      case "date-time-iso8601" => DateTimeIso8601
      case "decimal" => Decimal
      case "object" => Object
      case "json" => JsonValue
      case "string" => String
      case "unit" => Unit
      case "uuid" => Uuid
    })

    case object Boolean extends Primitive("boolean")
    case object Double extends Primitive("double")
    case object Integer extends Primitive("integer")
    case object Long extends Primitive("long")
    case object DateIso8601 extends Primitive("date-iso8601")
    case object DateTimeIso8601 extends Primitive("date-time-iso8601")
    case object Decimal extends Primitive("decimal")
    case object Object extends Primitive("object")
    case object JsonValue extends Primitive("json")
    case object String extends Primitive("string")
    case object Unit extends Primitive("unit")
    case object Uuid extends Primitive("uuid")
  }

  sealed abstract class UserDefined(override val name: String)
    extends Datatype(name)

  object UserDefined {
    case class Model(override val name: String) extends UserDefined(name)

    case class Enum(override val name: String) extends UserDefined(name)

    case class Union(override val name: String) extends UserDefined(name)
  }

  sealed abstract class Container(val inner: Datatype, prefix: String, suffix: String)
    extends Datatype(s"${prefix}${inner.name}${suffix}")

  object Container {
    case class List(override val inner: Datatype) extends Container(inner, "[", "]")

    case class Map(override val inner: Datatype) extends Container(inner, "map[", "]")

    case class Option(override val inner: Datatype) extends Container(inner, "option[", "]")
  }
}

case class DatatypeResolver(
  enumNames: Iterable[String],
  unionNames: Iterable[String],
  modelNames: Iterable[String]
) {

  private[this] val userDefinedTypes = {
    val builder = Map.newBuilder[String, Datatype.UserDefined]
    enumNames.foreach { name =>
      builder += name -> Datatype.UserDefined.Enum(name)
    }
    unionNames.foreach { name =>
      builder += name -> Datatype.UserDefined.Union(name)
    }
    modelNames.foreach { name =>
      builder += name -> Datatype.UserDefined.Model(name)
    }
    builder.result
  }

  private object UserDefined {
    def unapply(value: String): Option[Datatype.UserDefined] = {
      userDefinedTypes.get(value)
    }
  }

  private final val ListRx = "^\\[(.*)\\]$".r
  private final val MapRx = "^map\\[(.*)\\]$".r
  private final val MapDefaultRx = "^map$".r

  /**
    * Parses a type string into an instance of a Datatype.
    *
    * @param value: Examples: "string", "uuid"
    */
  def parse(value: String, makePrimitiveType: Boolean = true): Try[Datatype] = {
    val dt = value match {
      case "boolean" => Success(Datatype.Primitive.Boolean)
      case "double" => Success(Datatype.Primitive.Double)
      case "integer" => Success(Datatype.Primitive.Integer)
      case "long" => Success(Datatype.Primitive.Long)
      case "date-iso8601" => Success(Datatype.Primitive.DateIso8601)
      case "date-time-iso8601" => Success(Datatype.Primitive.DateTimeIso8601)
      case "decimal" => Success(Datatype.Primitive.Decimal)
      case "object" => Success(Datatype.Primitive.Object)
      case "json" => Success(Datatype.Primitive.JsonValue)
      case "string" => Success(Datatype.Primitive.String)
      case "unit" => Success(Datatype.Primitive.Unit)
      case "uuid" => Success(Datatype.Primitive.Uuid)

      case ListRx(inner) => parse(inner).map(Datatype.Container.List)
      case MapRx(inner) => parse(inner).map(Datatype.Container.Map)
      case MapDefaultRx() => Success(Datatype.Container.Map(Datatype.Primitive.String))

      case UserDefined(dt) => Success(dt)
      case _ => Failure(new RuntimeException(s"Cannot map class[${value.getClass.getName}] to datatype"))
    }

    if (makePrimitiveType) dt else dt.map(Datatype.Container.Option)
  }

}


text:
package org.elasticsearch.integration.storm;

import java.util.LinkedHashSet;
import java.util.Properties;
import java.util.Set;

import org.elasticsearch.hadoop.LocalEs;
import org.elasticsearch.hadoop.util.TestSettings;
import org.elasticsearch.hadoop.util.unit.TimeValue;
import org.junit.ClassRule;
import org.junit.rules.ExternalResource;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import backtype.storm.Config;
import backtype.storm.ILocalCluster;
import backtype.storm.LocalCluster;
import backtype.storm.generated.StormTopology;

@RunWith(Suite.class)
//@Suite.SuiteClasses({ AbstractStormBoltTests.class, AbstractStormSpoutTests.class })
@Suite.SuiteClasses({ AbstractStormBoltTests.class })
public class StormSuite {

    static ILocalCluster stormCluster;
    static Config cfg = new Config();

    static boolean isLocal = true;
    static Set<String> topologies = new LinkedHashSet<String>();

    public static Counter COMPONENT_HAS_COMPLETED;

    // storm + suite
    //public static final Counter DONE = new Counter(2);

    @ClassRule
    public static ExternalResource resource = new LocalEs() {

        @Override
        protected void after() {
            super.after();
        }
    };

    @ClassRule
    public static ExternalResource storm = new ExternalResource() {
        @Override
        protected void before() throws Throwable {

            Properties props = TestSettings.TESTING_PROPS;

            for (String property : TestSettings.TESTING_PROPS.stringPropertyNames()) {
                cfg.put(property, props.get(property));
            }

            String stormMode = props.getProperty("storm", "local");

            isLocal = "local".equals(stormMode);
            //cfg.setDebug(true);
            cfg.setNumWorkers(Integer.parseInt(props.getProperty("storm.numworkers", "3")));

            stormCluster = new LocalCluster();
        }

        @Override
        protected void after() {
            try {
                if (stormCluster != null) {
                    for (String topo : topologies) {
                        stormCluster.killTopology(topo);
                    }
                    stormCluster.shutdown();
                    stormCluster = null;
                }
            } catch (Exception ex) {
            }
        }
    };

    public static void run(final String name, final StormTopology topo, final Counter counter) throws Exception {
        Thread th = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    start(name, topo);
                    counter.waitForZero(TimeValue.timeValueSeconds(25));
                } finally {
                    stop(name);
                }

            }
        }, "test-storm-runner");
        th.setDaemon(true);
        th.start();
    }

    public static void start(String name, StormTopology topo) {
        try {
            topologies.add(name);
            stormCluster.submitTopology(name, cfg, topo);
        } catch (Exception ex) {
            throw new RuntimeException("Cannot submit topology " + name, ex);
        }
    }

    public static void stop(String name) {
        if (topologies.remove(name)) {
            try {
                stormCluster.killTopology(name);
            } catch (Exception ex) {
                throw new RuntimeException("Cannot kill topology " + name, ex);
            }
        }
    }
}


text:
using namespace Imath;
using namespace IECore;
using namespace GafferUI;

IE_CORE_DEFINERUNTIMETYPED( TranslateHandle );

TranslateHandle::TranslateHandle( Style::Axes axes )
	:	Handle( defaultName<TranslateHandle>() ), m_axes( Style::X )
{
	setAxes( axes );
}

TranslateHandle::~TranslateHandle()
{
}

void TranslateHandle::setAxes( Style::Axes axes )
{
	if( axes == m_axes )
	{
		return;
	}

	if( axes > Style::Z )
	{
		/// \todo Support XYZ as motion in the camera plane,
		/// and XY, XZ and YZ as motion in those planes.
		throw IECore::Exception( "Unsupported axes" );
	}

	m_axes = axes;
 	requestRender();
}

Style::Axes TranslateHandle::getAxes() const
{
	return m_axes;
}

float TranslateHandle::translation( const DragDropEvent &event ) const
{
	return m_drag.position( event ) - m_drag.startPosition();
}

void TranslateHandle::renderHandle( const Style *style, Style::State state ) const
{
	style->renderTranslateHandle( m_axes, state );
}

void TranslateHandle::dragBegin( const DragDropEvent &event )
{
	V3f handle( 0.0f );
	handle[m_axes] = 1.0f;
	m_drag = LinearDrag( this, LineSegment3f( V3f( 0 ), handle ), event );
}


text:
package net.ljcomputing.logging;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * Log event manager. Defines various cut points to allow for logging.
 *
 * @author James G. Willmore
 *
 */
@Aspect
@Component
public class LogEventManager {

  /**
   * Log event.
   */
  @Pointcut("execution(* *(..))")
  public void logEvent() {
  }

  /**
   * Log controller response.
   */
  @Pointcut("execution(* *(..))")
  public void logResponse() {
  }

}


text:
using UnityEngine;
using System.Collections;

/*
    THIS SPELL CASTS A FIREBALL IN THE HAND OF THE CASTER
    THAT CAN BE FIRED AT ANY DIRECTION
*/
[RequireComponent (typeof(CircleCollider2D))]
[RequireComponent (typeof(SpriteRenderer))]
public class FireBallSpell : ISpell {

	public override float spellDuration     { get { return 5f; } }
	public override float finalizeDuration  { get { return 1f; } }

    // REFERENCES
    private Transform        handTransform;
	private CircleCollider2D ballCollider;
	private SpriteRenderer   fireBallSprite;
	private ParticleSystem   sparks;
	private ParticleSystem   fireBallExplode;
    private Rigidbody2D      rigid;

    // ATTRIBUTES
	public float speed = 50f;
	private bool isFired;
    private bool hasFired;
    private bool canFire;
	private bool explode;

	void Start()
	{
        // FIND COMPONENTS
		ballCollider = GetComponent<CircleCollider2D> ();
		fireBallSprite = GetComponent<SpriteRenderer> ();
		foreach (ParticleSystem p in GetComponentsInChildren<ParticleSystem> (false)) {
			if (p.name == "FireBallExplode")
				fireBallExplode = p;
			else if(p.name == "Flare")
				sparks = p;
		}
		if (fireBallExplode == null)
			Debug.LogError ("NO PARTICLE SYSTEM FOUND IN FIREBALL: FIREBALLEXPLODE");

        if (_caster == null)
            _caster = this.gameObject;
        handTransform = _caster.transform.Find("IK").GetChild(4);
        rigid = GetComponent<Rigidbody2D>();

        isFired = false;
        canFire = false;
	}

	protected override void SpellFunction()
	{
        // FIREBALL IS NOW IN YOUR HAND
        if (!isFired)
        {
            // CHECK IF IT CAN BE FIRED

            // get left stick input
            float LX = Input.GetAxis("Horizontal");
            float LY = Input.GetAxis("Vertical");

            Vector2 targetDirection = new Vector2(LX, LY) / 2f;
            Vector2 direction = Vector2.zero;
            direction = targetDirection;

            // stick has to be in idle first
            if ((Mathf.Abs(LX) < 0.3f || Mathf.Abs(LY) < 0.3f))
            {
                Invoke("SetCanFire", 1f);
            }

            // stick has moved out of idle
            if (Mathf.Abs(targetDirection.sqrMagnitude) > 0.7f)
			{
                // FIRE
				isFired = true;
				Vector3 dir = _targetPosition - transform.position;
				float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg - 90f;
				transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
			}
        }

        // FIREBALL IS BEEING FIRED
        if (isFired)
        {
            // BUT HASN'T LEFT THE HAND YET
            if (!hasFired)
            {
                // LEAVE HAND -> ADD FORCE
                hasFired = true;
                rigid.isKinematic = (false);
                rigid.AddForce(direction.normalized * speed * 3f, ForceMode2D.Impulse);
            }
        }
        // FIREBALL ALWAYS IN HAND WHEN NOT FIRED
        else
        {
            transform.position = handTransform.position;
        }
    }

    // INVOKED AFTER 1 SEC DELAY
    // PLAYER CAN NOW FIRE THE FIREBALL
    private void SetCanFire()
    {
        canFire = true;
        hasFired = false;
    }

	protected override void FinalizeFunction()
    {
        // FIREBALL VANISHES WHEN NOT FIRED IN TIME (see: spellDuration)
		if (!isFired) {
			transform.position = _caster.transform.position + Vector3.up * 3f;
			fireBallSprite.transform.localScale = Vector3.Lerp (fireBallSprite.transform.localScale, new Vector3 (0, 0, 0), Time.fixedDeltaTime*5f);
			fireBallSprite.color = Color.Lerp (fireBallSprite.color, new Color (1f, 1f, 1f, 0f), Time.fixedDeltaTime * 5f);
			sparks.gameObject.SetActive (false);
		}
	}

    // EXPLODE ON COLLISION
    void OnCollisionEnter2D(Collision2D c)
    {
        // get spell target
        GameObject g = c.gameObject;
        if(g.CompareTag("SpellTarget"))
        {
            g.GetComponent<ISpellTarget>().TakeSpell(SpellType.FIRE);
        }
        // force the spell to finish, even if spellTime is still not zero (FinalizeFunction will be called from now on)
        Finalize();

        // play animation
		fireBallExplode.Play ();
        // play sound
		if(fireBallSprite.enabled)
			fireBallExplode.GetComponent<AudioSource> ().Play ();

        // deactivate fireball and spark emitter
        sparks.gameObject.SetActive(false);
        fireBallSprite.enabled = false;
    }
}


text:
package net.imagej.ops.transform.subsampleView;

import static org.junit.Assert.assertEquals;

import java.util.Random;

import net.imagej.ops.AbstractOpTest;
import net.imglib2.Cursor;
import net.imglib2.RandomAccess;
import net.imglib2.RandomAccessible;
import net.imglib2.img.Img;
import net.imglib2.img.array.ArrayImgFactory;
import net.imglib2.type.numeric.real.DoubleType;
import net.imglib2.view.SubsampleView;
import net.imglib2.view.Views;

import org.junit.Test;

/**
 * Tests {@link net.imagej.ops.Ops.Transform.SubsampleView} ops.
 * <p>
 * This test only checks if the op call works with all parameters and that the
 * result is equal to that of the {@link Views} method call. It is not a
 * correctness test of {@link Views} itself.
 * </p>
 *
 * @author Tim-Oliver Buchholz, University of Konstanz
 */
public class SubsampleViewTest extends AbstractOpTest {

	@Test
	public void defaultSubsampleTest() {
		Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
		Random r = new Random();
		for (DoubleType d : img) {
			d.set(r.nextDouble());
		}

		SubsampleView<DoubleType> il2 = Views.subsample((RandomAccessible<DoubleType>) img, 2);
		SubsampleView<DoubleType> opr = ops.transform().subsample(img, 2);

		Cursor<DoubleType> il2C = Views.interval(il2, new long[] { 0, 0 }, new long[] { 4, 4 }).localizingCursor();
		RandomAccess<DoubleType> oprRA = opr.randomAccess();

		while (il2C.hasNext()) {
			il2C.next();
			oprRA.setPosition(il2C);
			assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
		}
	}

	@Test
	public void defaultSubsampleStepsTest() {
		Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
		Random r = new Random();
		for (DoubleType d : img) {
			d.set(r.nextDouble());
		}

		SubsampleView<DoubleType> il2 = Views.subsample((RandomAccessible<DoubleType>) img, 2, 1);
		SubsampleView<DoubleType> opr = ops.transform().subsample(img, 2, 1);

		Cursor<DoubleType> il2C = Views.interval(il2, new long[] { 0, 0 }, new long[] { 4, 9 }).localizingCursor();
		RandomAccess<DoubleType> oprRA = opr.randomAccess();

		while (il2C.hasNext()) {
			il2C.next();
			oprRA.setPosition(il2C);
			assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
		}
	}
}


text:
select distinct p1.Email
from Person p1
inner join Person p2
on p1.Email = p2.Email
where p1.Id != p2.Id


text:
Ruby lib for retrieving UK bank holidays

## Installation

Add this line to your application's Gemfile:

    gem 'bank_holidays'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install bank_holidays

## Usage

Return all bank holidays

    holidays = BankHolidays.all

    holidays.each do |holiday|
      puts holiday.date
      puts holiday.summary
    end

Use a custom URL

    holidays = BankHolidays.all('http://example.com/my-own-calendar-file.ics')

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
#ifndef _FALCLIB_H
#define _FALCLIB_H

#include "F4Vu.h"

#pragma pack(1)

typedef struct
{
    ushort size;
    ushort type;
} EventIdData;

#pragma pack ()

extern FILE* F4EventFile;

// ==================================
// FreeFalcon Event stuff
// ==================================

class FalconEvent : public VuMessage
{
public:
    enum HandlingThread
    {
        NoThread                     = 0x0, // This would be rather pointless
        SimThread                    = 0x1,
        CampaignThread               = 0x2,
        UIThread  = 0x4,
        VuThread  = 0x8, // Realtime thread carefull with what you send here
        AllThreads                   = 0xff
    };

    HandlingThread handlingThread;

    virtual int Size() const;
    virtual int Decode(VU_BYTE **buf, long *rem);
    virtual int Encode(VU_BYTE **buf);

protected:
    FalconEvent(
        VU_MSG_TYPE type, HandlingThread threadID, VU_ID entityId, VuTargetEntity *target, VU_BOOL loopback = TRUE
    );
    FalconEvent(
        VU_MSG_TYPE type, HandlingThread threadID, VU_ID senderid, VU_ID target
    );
    virtual ~FalconEvent(void);
    virtual int Activate(VuEntity *ent);
    virtual int Process(uchar autodisp) = 0;

private:
    virtual int LocalSize() const;
};

// ==================================
// FreeFalcon Message filter
// ==================================
// sfr: why must all threads process Deletes??
#define MF_DONT_PROCESS_DELETE 1
class FalconMessageFilter : public VuMessageFilter
{
public:
#if VU_USE_ENUM_FOR_TYPES
    /** which thread should get these messages and shall it process vu messages? */
    FalconMessageFilter(FalconEvent::HandlingThread theThread, bool processVu = false);
#else
    FalconMessageFilter(FalconEvent::HandlingThread theThread, ulong vuMessageBits);
#endif
    virtual ~FalconMessageFilter();
    virtual VU_BOOL Test(VuMessage *event) const;
    virtual VuMessageFilter *Copy() const;

private:
    FalconEvent::HandlingThread filterThread;
#if VU_USE_ENUM_FOR_TYPES
    bool processVu;
#else
    ulong vuFilterBits;
#endif
};

// ==================================
// Functions
// ==================================

void FalconSendMessage(VuMessage* theEvent, BOOL reliableTransmit = FALSE);

#endif


text:
export var BackgroundNotificationResult;
(function (BackgroundNotificationResult) {
    BackgroundNotificationResult[BackgroundNotificationResult["NoData"] = 1] = "NoData";
    BackgroundNotificationResult[BackgroundNotificationResult["NewData"] = 2] = "NewData";
    BackgroundNotificationResult[BackgroundNotificationResult["Failed"] = 3] = "Failed";
})(BackgroundNotificationResult || (BackgroundNotificationResult = {}));
//# sourceMappingURL=BackgroundNotificationTasksModule.types.js.map


text:
package com.googlecode.guice;

import com.google.inject.AllTests;
import com.google.inject.internal.ImmutableSet;
import com.google.inject.internal.MapMakerTestSuite;
import com.google.inject.internal.MapMakerTestSuite.ReferenceMapTest;
import com.google.inject.internal.MapMakerTestSuite.ComputingTest;
import java.io.FilePermission;
import java.security.AccessControlException;
import java.security.Permission;
import java.util.Arrays;
import java.util.PropertyPermission;
import java.util.Set;
import junit.framework.Test;

/**
 * Runs a subset of our tests in a more secure environment. It loads the tests in another
 * classloader, and runs them with a specific security manager. Note that no security manager is in
 * place when test instances are constructed.
 *
 * @author jessewilson@google.com (Jesse Wilson)
 */
public class StrictContainerTestSuite {

  /** Tests tests require background threads to pass, which the strict container forbids */
  private static final Set<String> SUPPRESSED_TEST_NAMES = ImmutableSet.of(
      "testValueCleanupWithWeakKey(" + ReferenceMapTest.class.getName() + ")",
      "testValueCleanupWithSoftKey(" + ReferenceMapTest.class.getName() + ")",
      "testKeyCleanupWithWeakKey(" + ReferenceMapTest.class.getName() + ")",
      "testKeyCleanupWithSoftKey(" + ReferenceMapTest.class.getName() + ")",
      "testKeyCleanupWithWeakValue(" + ReferenceMapTest.class.getName() + ")",
      "testKeyCleanupWithSoftValue(" + ReferenceMapTest.class.getName() + ")",
      "testInternedValueCleanupWithWeakKey(" + ReferenceMapTest.class.getName() + ")",
      "testInternedValueCleanupWithSoftKey(" + ReferenceMapTest.class.getName() + ")",
      "testInternedKeyCleanupWithWeakValue(" + ReferenceMapTest.class.getName() + ")",
      "testInternedKeyCleanupWithSoftValue(" + ReferenceMapTest.class.getName() + ")",
      "testSleepConcurrency(" + ComputingTest.class.getName() + ")",
      "testBusyConcurrency(" + ComputingTest.class.getName() + ")",
      "testFastConcurrency(" + ComputingTest.class.getName() + ")",
      "testSleepCanonical(" + ComputingTest.class.getName() + ")",
      "testBusyCanonical(" + ComputingTest.class.getName() + ")",
      "testFastCanonical(" + ComputingTest.class.getName() + ")"
  );

  public static Test suite() {
    SecurityManager securityManager = new SecurityManager() {
      @Override public void checkPermission(Permission permission) {
        if (permission instanceof FilePermission
            || permission instanceof PropertyPermission) {
          return; // avoid creating a stacktrace for common permissions
        }

        String stacktrace = Arrays.toString(new Throwable().getStackTrace());
        if (stacktrace.contains("Thread.<init>")
            || stacktrace.contains(".getSystemClassLoader(")) {
          throw new AccessControlException("StrictContainerTestSuite forbids this!");
        }
      }

      @Override public void checkPermission(Permission permission, Object context) {
        checkPermission(permission);
      }
    };

    StrictContainerTestSuiteBuilder builder = new StrictContainerTestSuiteBuilder(securityManager);
    /*if[AOP]*/
    builder.add(BytecodeGenTest.class.getName());
    /*end[AOP]*/
    builder.addSuite(MapMakerTestSuite.class.getName());

    return AllTests.removeSuppressedTests(builder.build(), SUPPRESSED_TEST_NAMES);
  }
}


text:
package com.example.ixn.login.mylogin;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class signup extends AppCompatActivity {
    private EditText txtUsername, txtPwd1, txtPwd2;
    private Button btnSignUp;
    private DBAdapter db;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        db = new DBAdapter(this);
        db.open();
        setContentView(R.layout.activity_signup);

        txtUsername = (EditText) findViewById(R.id.editText3);
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(txtUsername, InputMethodManager.SHOW_IMPLICIT);

        txtPwd1 = (EditText) findViewById(R.id.editText4);
        txtPwd2 = (EditText) findViewById(R.id.editText5);
        btnSignUp = (Button) findViewById(R.id.button3);

        btnSignUp.setOnClickListener(new View.OnClickListener() {
            @Override
            final public void onClick(View view)
            {
                if (txtPwd1.getText().toString().equals(txtPwd2.getText().toString())){
                    Username username = new Username();
                    username.setUsername(txtUsername.getText().toString());
                    username.setPassword(txtPwd1.getText().toString());
                    if (db.createUsername(username)){
                        Toast.makeText(getApplicationContext(), "Save Success.", Toast.LENGTH_LONG).show();
                        finish();
                    }
                    else{
                        Toast.makeText(getApplicationContext(), "Save Failed.", Toast.LENGTH_LONG).show();
                    }
                }
                else{
                    Toast.makeText(getApplicationContext(), "Password Not Equel.", Toast.LENGTH_LONG).show();
                }
            }
        });
    }
}


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

<TITLE>
Uses of Class org.springframework.aop.target.EmptyTargetSource (Spring Framework API 2.5)
</TITLE>

<META NAME="date" CONTENT="2007-11-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

The Spring Framework

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
org.springframework.aop.target.EmptyTargetSource

Packages that use EmptyTargetSource

org.springframework.aop.target
This package contains implementations of the org.springframework.aop.TargetSource interface.

Uses of EmptyTargetSource in org.springframework.aop.target

Fields in org.springframework.aop.target declared as EmptyTargetSource

static EmptyTargetSource
EmptyTargetSource.INSTANCE

          The canonical (Singleton) instance of this EmptyTargetSource.

Methods in org.springframework.aop.target that return EmptyTargetSource

static EmptyTargetSource
EmptyTargetSource.forClass(Class targetClass)

          Return an EmptyTargetSource for the given target Class.

static EmptyTargetSource
EmptyTargetSource.forClass(Class targetClass,
         boolean isStatic)

          Return an EmptyTargetSource for the given target Class.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

The Spring Framework

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2002-2007 The Spring Framework.


text:
    <title>IzPack - Readme</title>

IzPack overview

What it can do for you

IzPack is a powerful software installers generator for the Java[tm]
    platform. It uses a very modular architecture that lets you make the
    installers work as you want, not as the software wants it to work. It is also
    possible to extend it to suit your needs since it has been designed with this
    purpose in mind from the start.

Package once, install anywhere

The installers generated by IzPack are independent of the target operating
    system. It has been running successfully on Linux/i386, FreeBSD, Solaris,
    MacOS X and Win32. All it needs is a Java[tm] Runtime Environment.

Cool licensing

IzPack is published under the terms of Apache License Version 2.0.

Version check:


text:
using AngleSharp;
using AngleSharp.Dom.Html;
using Discord;
using Discord.WebSocket;
using NadekoBot.Common;
using NadekoBot.Common.Replacements;
using NadekoBot.Core.Services.Database.Models;
using NadekoBot.Extensions;
using NadekoBot.Modules.CustomReactions.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace NadekoBot.Modules.CustomReactions.Extensions
{
    public static class Extensions
    {
        private static readonly Regex imgRegex = new Regex("%(img|image):(?<tag>.*?)%", RegexOptions.Compiled);

        private static Dictionary<Regex, Func<Match, Task<string>>> regexPlaceholders { get; } = new Dictionary<Regex, Func<Match, Task<string>>>()
        {
            { imgRegex, async (match) => {
                var tag = match.Groups["tag"].ToString();
                if(string.IsNullOrWhiteSpace(tag))
                    return "";

                var fullQueryLink = $"http://imgur.com/search?q={ tag }";
                var config = Configuration.Default.WithDefaultLoader();
                using(var document = await BrowsingContext.New(config).OpenAsync(fullQueryLink).ConfigureAwait(false))
                {
                    var elems = document.QuerySelectorAll("a.image-list-link").ToArray();

                    if (!elems.Any())
                        return "";

                    var img = (elems.ElementAtOrDefault(new NadekoRandom().Next(0, elems.Length))?.Children?.FirstOrDefault() as IHtmlImageElement);

                    if (img?.Source == null)
                        return "";

                    return " " + img.Source.Replace("b.", ".", StringComparison.InvariantCulture) + " ";
                }
            } }
        };

        private static string ResolveTriggerString(this string str, IUserMessage ctx, DiscordSocketClient client)
        {
            var rep = new ReplacementBuilder()
                .WithUser(ctx.Author)
                .WithMention(client)
                .Build();

            str = rep.Replace(str.ToLowerInvariant());

            return str;
        }

        private static async Task<string> ResolveResponseStringAsync(this string str, IUserMessage ctx, DiscordSocketClient client, string resolvedTrigger, bool containsAnywhere)
        {
            var substringIndex = resolvedTrigger.Length;
            if (containsAnywhere)
            {
                var pos = ctx.Content.GetWordPosition(resolvedTrigger);
                if (pos == WordPosition.Start)
                    substringIndex += 1;
                else if (pos == WordPosition.End)
                    substringIndex = ctx.Content.Length;
                else if (pos == WordPosition.Middle)
                    substringIndex += ctx.Content.IndexOf(resolvedTrigger, StringComparison.InvariantCulture);
            }

            var rep = new ReplacementBuilder()
                .WithDefault(ctx.Author, ctx.Channel, (ctx.Channel as ITextChannel)?.Guild as SocketGuild, client)
                .WithOverride("%target%", () => ctx.Content.Substring(substringIndex).Trim())
                .Build();

            str = rep.Replace(str);
#if !GLOBAL_NADEKO
            foreach (var ph in regexPlaceholders)
            {
                str = await ph.Key.ReplaceAsync(str, ph.Value).ConfigureAwait(false);
            }
#endif
            return str;
        }

        public static string TriggerWithContext(this CustomReaction cr, IUserMessage ctx, DiscordSocketClient client)
            => cr.Trigger.ResolveTriggerString(ctx, client);

        public static Task<string> ResponseWithContextAsync(this CustomReaction cr, IUserMessage ctx, DiscordSocketClient client, bool containsAnywhere)
            => cr.Response.ResolveResponseStringAsync(ctx, client, cr.Trigger.ResolveTriggerString(ctx, client), containsAnywhere);

        public static async Task<IUserMessage> Send(this CustomReaction cr, IUserMessage ctx, DiscordSocketClient client, CustomReactionsService crs)
        {
            var channel = cr.DmResponse ? await ctx.Author.GetOrCreateDMChannelAsync().ConfigureAwait(false) : ctx.Channel;

            if (CREmbed.TryParse(cr.Response, out CREmbed crembed))
            {
                var trigger = cr.Trigger.ResolveTriggerString(ctx, client);
                var substringIndex = trigger.Length;
                if (cr.ContainsAnywhere)
                {
                    var pos = ctx.Content.GetWordPosition(trigger);
                    if (pos == WordPosition.Start)
                        substringIndex += 1;
                    else if (pos == WordPosition.End)
                        substringIndex = ctx.Content.Length;
                    else if (pos == WordPosition.Middle)
                        substringIndex += ctx.Content.IndexOf(trigger, StringComparison.InvariantCulture);
                }

                var rep = new ReplacementBuilder()
                    .WithDefault(ctx.Author, ctx.Channel, (ctx.Channel as ITextChannel)?.Guild as SocketGuild, client)
                    .WithOverride("%target%", () => ctx.Content.Substring(substringIndex).Trim())
                    .Build();

                rep.Replace(crembed);

                return await channel.EmbedAsync(crembed.ToEmbed(), crembed.PlainText?.SanitizeMentions() ?? "").ConfigureAwait(false);
            }
            return await channel.SendMessageAsync((await cr.ResponseWithContextAsync(ctx, client, cr.ContainsAnywhere).ConfigureAwait(false)).SanitizeMentions()).ConfigureAwait(false);
        }

        public static WordPosition GetWordPosition(this string str, string word)
        {
            var wordIndex = str.IndexOf(word, StringComparison.InvariantCulture);
            if (wordIndex == -1)
                return WordPosition.None;

            if (wordIndex == 0)
            {
                if (word.Length < str.Length && str.isValidWordDivider(word.Length))
                    return WordPosition.Start;
            }
            else if ((wordIndex + word.Length) == str.Length)
            {
                if (str.isValidWordDivider(wordIndex - 1))
                    return WordPosition.End;
            }
            else if (str.isValidWordDivider(wordIndex - 1) && str.isValidWordDivider(wordIndex + word.Length))
                return WordPosition.Middle;

            return WordPosition.None;
        }

        private static bool isValidWordDivider(this string str, int index)
        {
            var ch = str[index];
            if (ch >= 'a' && ch <= 'z')
                return false;
            if (ch >= 'A' && ch <= 'Z')
                return false;

            return true;
        }
    }

    public enum WordPosition
    {
        None,
        Start,
        Middle,
        End,
    }
}


text:
package com.andrey7mel.stepbystep.view;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ProgressBar;

import com.andrey7mel.stepbystep.R;
import com.andrey7mel.stepbystep.presenter.vo.Repository;
import com.andrey7mel.stepbystep.view.fragments.RepoInfoFragment;
import com.andrey7mel.stepbystep.view.fragments.RepoListFragment;

import butterknife.Bind;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity implements ActivityCallback {

    private static String TAG = "TAG";

    @Bind(R.id.toolbar)
    protected Toolbar toolbar;

    @Bind(R.id.toolbar_progress_bar)
    protected ProgressBar progressBar;

    private FragmentManager fragmentManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        setSupportActionBar(toolbar);
        fragmentManager = getSupportFragmentManager();

        Fragment fragment = fragmentManager.findFragmentByTag(TAG);
        if (fragment == null) replaceFragment(new RepoListFragment(), false);
    }

    private void replaceFragment(Fragment fragment, boolean addBackStack) {
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.replace(R.id.container, fragment, TAG);
        if (addBackStack) transaction.addToBackStack(null);
        transaction.commit();
    }

    @Override
    public void startRepoInfoFragment(Repository repository) {
        replaceFragment(RepoInfoFragment.newInstance(repository), true);
    }

    @Override
    public void showProgressBar() {
        progressBar.setVisibility(View.VISIBLE);
    }

    @Override
    public void hideProgressBar() {
        progressBar.setVisibility(View.INVISIBLE);
    }

}


text:
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>dom4j</groupId>
  <artifactId>dom4j</artifactId>
  <name>dom4j</name>
  <version>1.6</version>
  <description>dom4j: the flexible XML framework for Java</description>
  <url>http://dom4j.org</url>
  <issueManagement>
    <url>http://sourceforge.net/tracker/?group_id=16035</url>
  </issueManagement>
  <ciManagement>
    <notifiers>
      <notifier>
        <address>dom4j-dev@lists.sourceforge.net</address>
      </notifier>
    </notifiers>
  </ciManagement>
  <inceptionYear>2001</inceptionYear>
  <mailingLists>
    <mailingList>
      <name>dom4j user list</name>
      <subscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-user</subscribe>
      <unsubscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-user</unsubscribe>
      <archive>http://www.mail-archive.com/dom4j-user%40lists.sourceforge.net/</archive>
    </mailingList>
    <mailingList>
      <name>dom4j developer list</name>
      <subscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-dev</subscribe>
      <unsubscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-dev</unsubscribe>
      <archive>http://www.mail-archive.com/dom4j-dev%40lists.sourceforge.net/</archive>
    </mailingList>
    <mailingList>
      <name>dom4j commits list</name>
      <subscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-commits</subscribe>
      <unsubscribe>http://lists.sourceforge.net/lists/listinfo/dom4j-commits</unsubscribe>
    </mailingList>
  </mailingLists>
  <developers>
    <developer>
      <id>carnold</id>
      <name>Curt Arnold</name>
      <email>carnold@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>ddlucas</id>
      <name>David Lucas</name>
      <email>ddlucas@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>drwhite</id>
      <name>David White</name>
      <email>drwhite@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>jjenkov</id>
      <name>Jakob Jenkov</name>
      <email>jjenkov@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>jstrachan</id>
      <name>James Strachan</name>
      <email>jstrachan@apache.org</email>
      <organization>SpiritSoft, Inc.</organization>
    </developer>
    <developer>
      <id>laramiec</id>
      <name>Laramie Crocker</name>
      <email>laramiec@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>maartenc</id>
      <name>Maarten Coene</name>
      <email>maartenc@users.sourceforge.net</email>
      <organization>Cronos</organization>
    </developer>
    <developer>
      <id>mskells</id>
      <name>Michael Skells</name>
      <email>mskells@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>nicksanderson</id>
      <name>Nick Sanderson</name>
      <email>nicksanderson@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>slehmann</id>
      <name>Steen Lehmann</name>
      <email>slehmann@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>tradem</id>
      <name>Tobias Rademacher</name>
      <email>tradem@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>werken</id>
      <name>Bob McWhirter</name>
      <email>werken@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>wolfftw</id>
      <name>Todd Wolff</name>
      <email>wolfftw@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>yeekee</id>
      <name>OuYang Chen</name>
      <email>yeekee@users.sourceforge.net</email>
    </developer>
    <developer>
      <id>yruan2</id>
      <name>Yuxin Ruan</name>
      <email>yruan2@users.sourceforge.net</email>
    </developer>
  </developers>
  <scm>
    <connection>scm:cvs:pserver:anonymous@cvs.sourceforge.net:/cvsroot/dom4j:dom4j</connection>
    <developerConnection>scm:cvs:ext:${maven.username}@cvs.sourceforge.net:/cvsroot/dom4j:dom4j</developerConnection>
    <url>http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dom4j/dom4j/</url>
  </scm>
  <organization>
    <name>MetaStuff Ltd.</name>
    <url>http://sourceforge.net/projects/dom4j</url>
  </organization>
  <build>
    <sourceDirectory>src/java</sourceDirectory>
    <testSourceDirectory>src/test</testSourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <include>**/*Test.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>jaxme</groupId>
      <artifactId>jaxme-api</artifactId>
      <version>0.3</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>jaxen</groupId>
      <artifactId>jaxen</artifactId>
      <version>1.1-beta-4</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>msv</groupId>
      <artifactId>xsdlib</artifactId>
      <version>20030807</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>msv</groupId>
      <artifactId>relaxngDatatype</artifactId>
      <version>20030807</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>pull-parser</groupId>
      <artifactId>pull-parser</artifactId>
      <version>2</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>xpp3</groupId>
      <artifactId>xpp3</artifactId>
      <version>1.1.3.3</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>stax</groupId>
      <artifactId>stax-api</artifactId>
      <version>1.0</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>xml-apis</groupId>
      <artifactId>xml-apis</artifactId>
      <version>1.0.b2</version>
    </dependency>
    <dependency>
      <groupId>junitperf</groupId>
      <artifactId>junitperf</artifactId>
      <version>1.8</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>stax</groupId>
      <artifactId>stax-ri</artifactId>
      <version>1.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>xerces</groupId>
      <artifactId>xercesImpl</artifactId>
      <version>2.6.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>xalan</groupId>
      <artifactId>xalan</artifactId>
      <version>2.5.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <distributionManagement>
    <site>
      <id>default</id>
      <name>Default Site</name>
      <url>scp://dom4j.org//home/groups/d/do/dom4j/htdocs</url>
    </site>
  </distributionManagement>
</project>


text:
var contentTypeFactory = {
    getTemplate: function (config) {
        var name = config.name, ContentType = config.ContentType, Extension = config.Extension, PartName = config.PartName;
        return {
            name: name,
            properties: {
                rawMap: {
                    Extension: Extension,
                    PartName: PartName,
                    ContentType: ContentType
                }
            }
        };
    }
};
export default contentTypeFactory;


text:
<?php

/**
 * User acl role
 *
 * @method Mage_Admin_Model_Resource_Acl_Role _getResource()
 * @method Mage_Admin_Model_Resource_Acl_Role getResource()
 * @method int getParentId()
 * @method Mage_Admin_Model_Acl_Role setParentId(int $value)
 * @method int getTreeLevel()
 * @method Mage_Admin_Model_Acl_Role setTreeLevel(int $value)
 * @method int getSortOrder()
 * @method Mage_Admin_Model_Acl_Role setSortOrder(int $value)
 * @method string getRoleType()
 * @method Mage_Admin_Model_Acl_Role setRoleType(string $value)
 * @method int getUserId()
 * @method Mage_Admin_Model_Acl_Role setUserId(int $value)
 * @method string getRoleName()
 * @method Mage_Admin_Model_Acl_Role setRoleName(string $value)
 *
 * @category    Mage
 * @package     Mage_Admin
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_Admin_Model_Acl_Role extends Mage_Core_Model_Abstract
{
    /**
     * Initialize resource model
     *
     */
    protected function _construct()
    {
        $this->_init('admin/acl_role');
    }
}


text:
import gdb
import physmem
import utils
import traceback

class Kdump(gdb.Command, utils.OneArgAutoCompleteMixin):
    """ examine current kernel state

    Currently supported commands:
     * segments   - all memory segments
     * free_pages - free pages per segment
    """
    def __init__(self):
        super(Kdump, self).__init__("kdump", gdb.COMMAND_USER)
        # classes instead of functions in case we decide to store
        # information about structures in the debugger itself later on
        self.structure = {
            'segments': physmem.KernelSegments(),
            'free_pages': physmem.KernelFreePages(),
        }

    def invoke(self, args, from_tty):
        if len(args) < 1:
            raise(gdb.GdbError('Usage: kdump [structure]. Structures: {}.'
                               .format(self.structure.keys())))
        if args not in self.structure:
            raise gdb.GdbError('No such structure - {}.'.format(args))
        try:
            self.structure[args].invoke()
        except:
            traceback.print_exc()

    def options(self):
        return self.structure.keys()


text:
using System;
using System.Collections.Generic;
using System.Text;

namespace Meru.Commands
{
    public class Module : CommandEntity
    {
        public Module()
        {
        }

        public Module(CommandEntity entity) : base(entity)
        {
        }

        public Module(Module module) : base(module)
        {
        }
    }
}


text:
class RequestForProposal < ApplicationRecord
  include AASM

  validates :issue, presence: true
  validates :budget, numericality: { greater_than_or_equal_to: 0 }, allow_blank: true

  has_account class_name: "Account::RequestForProposal"

  belongs_to :person
  belongs_to :issue
  has_one :tracker, :through => :issue
  has_many :proposals
  delegate :team, to: :issue

  aasm column: 'state' do
    state :pending, initial: true
    state :pending_fulfillment
    state :fulfilled

    event :begin_fulfillment do
      transitions from: :pending, to: :pending_fulfillment
    end

    event :reverse_fulfillment do
      transitions from: :pending_fulfillment, to: :pending
    end

    event :fulfill do
      transitions from: :pending_fulfillment, to: :fulfilled
    end
  end

  def pending_proposals
    proposals.pending
  end

  def notify_admins_and_developers
    team.admins_and_developers.each { |member| member.send_email(:member_accepted_proposal) }
  end

  # Person can manage this RFP.
  # 1. A team manages the issue tracker
  # 2. The team has RFP enabled
  # 3. Person is a member of the team as an admin or developer
  def person_can_manage?(person)
    team && team.rfp_enabled? && begin
      rel = team.member_relations.find_by(person: person)
      rel.present? && (rel.developer? || rel.admin?)
    end
  end
end


text:
package org.deri.iris.api.graph;

import java.util.Collection;
import java.util.Comparator;
import java.util.Set;

import org.deri.iris.api.basics.IPredicate;
import org.deri.iris.api.basics.IRule;
import org.deri.iris.graph.LabeledEdge;

/**
 *

 * A graph to determine the dependencies of rules and predicates to each other.
 *

 *

 * $Id$
 *

 *
 * @author Richard Pöttler (richard dot poettler at deri dot org)
 * @version $Revision$
 */
public interface IPredicateGraph {
    /**
     * Adds a rule to the graph.
     *
     * @param rule
     *            the rule to add
     * @throws NullPointerException
     *             if the rule is {@code null}
     */
    public abstract void addRule(final IRule rule);

    /**
     * Determines whether the rules are recursive.
     *
     * @return {@code true} if they are recursive, otherwise {@code false}
     */
    public abstract boolean detectCycles();

    /**
     * Determines the vertexes contained in the cycle.
     *
     * @return a Set containing all the vertexes
     */
    public abstract Set<IPredicate> findVertexesForCycle();

    /**
     * Determines the edges contained in the cycle.
     *
     * @return a Set containing all the vertexes
     */
    public abstract Set<LabeledEdge<IPredicate, Boolean>> findEdgesForCycle();

    /**
     * Returns the number of negative Literals in the cycle.
     *
     * @return the number of negative literals
     */
    public abstract int countNegativesForCycle();

    /**
     * Adds a collection of rules to the graph.
     *
     * @param r
     *            the collection of rules
     * @throws NullPointerException
     *             if the collections is or contains {@code null}
     */
    public abstract void addRule(final Collection<IRule> r);

    /**
     * Returns a set of predicates the given one depends on.
     *
     * @param p
     *            predicate for which to check for dependencies
     * @return the predicates the predicate depends on
     * @throws NullPointerException
     *             if the predicate is {@code null}
     */
    public abstract Set<IPredicate> getDepends(final IPredicate p);

    /**
     *

     * Returns a compareator which compares two predicates depending on their
     * dependencies of their rules.
     *

     *

     * If one of the compared predicate isn't in the graph, or there isn't a
     * path from one predicate to the other {@code 0} will be returned. If the
     * first predicate depends on the second one, the first one will be
     * determined to be bigger, and vice versa.
     *

     *
     * @return the comparator
     */
    public abstract Comparator<IPredicate> getPredicateComparator();

    /**
     *

     * Returs a comparator which compares two rules depending on their
     * dependencies of each other.
     *

     *

     * The rules will compared according to their headpredicates.
     *

     *
     * @return the comparator
     * @see IPredicateGraph#getPredicateComparator()
     */
    public abstract Comparator<IRule> getRuleComparator();
}


text:
// source:

package nl.esciencecenter.glite.lfc.internal;

import java.io.DataInputStream;
import java.io.IOException;

import nl.esciencecenter.glite.lfc.LFCServer;
import nl.esciencecenter.glite.lfc.Messages;

/**
 *  Abstraction of the LFC communication response, <br>
 *  all Cns*Response extends this class
 *  @see AbstractCnsRequest
 *  @see CnsConstants
 */
public abstract class AbstractCnsResponse
{
  protected int head=0;
  protected int size=0;
  public int type=0;

  /**
   * Note that this value is associated with low level protocol implementation
   * and should be used to debug/trace only.
   *
   * @return the header value
   */
  public int getHeader() {
    return this.head;
  }

  /**
   * Note that this value is associated with low level protocol implementation
   * and should be used to debug/trace only.
   *
   * @return type of the response, {@link CnsConstants}
   */
  public int getType() {
    return this.type;
  }
  /**
   * Note that this value is associated with low level protocol implementation
   * and should be used to debug/trace only.
   *
   * @return the size of link description
   */
  public int getSize() {
    return this.size;
  }

  /**
   * Return error code. Note that this contains meaningful information after
   * full response is received.
   *
   * @return error code of the message
   */
  public int getErrorCode()
  {
	 // PdB: if an error occured the 'size' field holds the error number !
     return this.size;
  }
  /**
   * Receives header from specified stream
   * @param input stream where header is stored
   * @return size of expected response
   * @throws IOException
   */
  public int receiveHeader( final DataInputStream input ) throws IOException {
    int timeout = 8;
    int delay = 100;
    while ( ( input.available() < 12 ) && timeout-- > 0 ) {
      try {
        LFCServer.staticLogIOMessage( "\t HEAD: waiting "+delay+" [ms]... AVAIL=" + input.available() + ", EXP=12" );
        Thread.sleep( delay );
        delay*=2;
      } catch( InterruptedException exc ) {
       LFCServer.staticLogIOException( exc );
      }
    }
    if ( input.available() < 12 ) {
      throw new IOException( "Connection timeout during receiving header." );
    }

    this.head = input.readInt();
    this.type = input.readInt();
    this.size = input.readInt();
    LFCServer.staticLogIOMessage( String.format( Messages.lfc_log_recv_header,
                                         Integer.toHexString( this.head ),
                                         Integer.toHexString( this.type ),
                                         new Integer( this.size ),
                                         CnsConstants.getResponseType( this.type  ) ) );
    return this.size;
  }

  /**
   * Reads the response from the binary data and store it in more convenient way
   *
   * @param input stream where data is stored
   * @throws IOException
   */
  public void readFrom( final DataInputStream input ) throws IOException {
    //Header
    this.size = this.receiveHeader( input );
  }

}


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

<title>MultiSegmentSequenceModifier</title>
<meta name="date" content="2014-01-13">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.drip.spline.stretch

Class MultiSegmentSequenceModifier

java.lang.Object

org.drip.spline.stretch.MultiSegmentSequenceModifier

public class MultiSegmentSequenceModifier
extends java.lang.Object

MultiSegmentSequenceModifier exports Stretch modification/alteration methods to generate customized basis
  splines, with customized segment behavior using the segment control. It exposes the following stretch
  modification methods:
  - Insert the specified Predictor Ordinate Knot into the specified Stretch, using the specified Response
        Value.
        - Append a Segment to the Right of the Specified Stretch using the Supplied Constraint.
        - Insert the Predictor Ordinate Knot into the specified Stretch.
        - Insert a Cardinal Knot into the specified Stretch at the specified Predictor Ordinate Location.
        - Insert a Catmull-Rom Knot into the specified Stretch at the specified Predictor Ordinate Location.

Constructor Summary

Constructors

Constructor and Description

MultiSegmentSequenceModifier()

Method Summary

Methods

Modifier and Type
Method and Description

static MultiSegmentSequence
AppendSegment(MultiSegmentSequence mssIn,
             double dblPredictorOrdinateAppendRight,
             SegmentResponseValueConstraint srvc,
             SegmentCustomBuilderControl scbc,
             BoundarySettings bs,
             int iCalibrationDetail)

Append a Segment to the Right of the Specified Stretch using the Supplied Constraint

static MultiSegmentSequence
InsertCardinalKnot(MultiSegmentSequence mssIn,
                  double dblPredictorOrdinate,
                  double dblCardinalTension)

Insert a Cardinal Knot into the specified Stretch at the specified Predictor Ordinate Location

static MultiSegmentSequence
InsertCatmullRomKnot(MultiSegmentSequence mssIn,
                    double dblPredictorOrdinate)

Insert a Catmull-Rom Knot into the specified Stretch at the specified Predictor Ordinate Location

static MultiSegmentSequence
InsertKnot(MultiSegmentSequence mssIn,
          double dblPredictorOrdinate,
          double dblResponseValue,
          BoundarySettings bs,
          int iCalibrationDetail)

Insert the specified Predictor Ordinate Knot into the specified Stretch, using the specified Response
        Value

static MultiSegmentSequence
InsertKnot(MultiSegmentSequence mssIn,
          double dblPredictorOrdinate,
          SegmentPredictorResponseDerivative sprdLeftSegmentRightEdge,
          SegmentPredictorResponseDerivative sprdRightSegmentLeftEdge)

Insert the Predictor Ordinate Knot into the specified Stretch

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

MultiSegmentSequenceModifier

public MultiSegmentSequenceModifier()

Method Detail

InsertKnot

public static final MultiSegmentSequence InsertKnot(MultiSegmentSequence mssIn,
                              double dblPredictorOrdinate,
                              double dblResponseValue,
                              BoundarySettings bs,
                              int iCalibrationDetail)

Insert the specified Predictor Ordinate Knot into the specified Stretch, using the specified Response
        Value

Parameters:

mssIn - Input Stretch

dblPredictorOrdinate - Predictor Ordinate Knot

dblResponseValue - Response Value

bs - The Calibration Boundary Condition

iCalibrationDetail - The Calibration Detail

Returns:

The Stretch with the Knot inserted

AppendSegment

public static final MultiSegmentSequence AppendSegment(MultiSegmentSequence mssIn,
                                 double dblPredictorOrdinateAppendRight,
                                 SegmentResponseValueConstraint srvc,
                                 SegmentCustomBuilderControl scbc,
                                 BoundarySettings bs,
                                 int iCalibrationDetail)

Append a Segment to the Right of the Specified Stretch using the Supplied Constraint

Parameters:

mssIn - Input Stretch

dblPredictorOrdinateAppendRight - The Predictor Ordinate at the Right Edge of the Segment to be
        appended

srvc - The Segment Response Value Constraint

scbc - Segment Builder Parameters

bs - The Calibration Boundary Condition

iCalibrationDetail - The Calibration Detail

Returns:

The Stretch with the Segment Appended

InsertKnot

public static final MultiSegmentSequence InsertKnot(MultiSegmentSequence mssIn,
                              double dblPredictorOrdinate,
                              SegmentPredictorResponseDerivative sprdLeftSegmentRightEdge,
                              SegmentPredictorResponseDerivative sprdRightSegmentLeftEdge)

Insert the Predictor Ordinate Knot into the specified Stretch

Parameters:

mssIn - Input Stretch

dblPredictorOrdinate - Knot Predictor Ordinate

sprdLeftSegmentRightEdge - Response Values for the Right Edge of the Left Segment

sprdRightSegmentLeftEdge - Response Values for the Left Edge of the Right segment

Returns:

The Stretch with the Predictor Ordinate Knot inserted

InsertCardinalKnot

public static final MultiSegmentSequence InsertCardinalKnot(MultiSegmentSequence mssIn,
                                      double dblPredictorOrdinate,
                                      double dblCardinalTension)

Insert a Cardinal Knot into the specified Stretch at the specified Predictor Ordinate Location

Parameters:

mssIn - Input Stretch

dblPredictorOrdinate - Knot Predictor Ordinate

dblCardinalTension - Cardinal Tension Parameter

Returns:

The Stretch with the Knot inserted

InsertCatmullRomKnot

public static final MultiSegmentSequence InsertCatmullRomKnot(MultiSegmentSequence mssIn,
                                        double dblPredictorOrdinate)

Insert a Catmull-Rom Knot into the specified Stretch at the specified Predictor Ordinate Location

Parameters:

mssIn - Input Stretch

dblPredictorOrdinate - Knot Predictor Ordinate

Returns:

The Stretch with the Knot inserted

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text: Author: Frau Blücher


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/color_bg_error"
    android:gravity="center">

    <ImageView
        android:layout_marginLeft="-16dp"
        android:id="@+id/iconError"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_centerVertical="true"
        android:src="@drawable/ic_error_outline_white_24dp"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="16dp"
        android:layout_toRightOf="@+id/iconError"
        android:gravity="center_vertical"
        android:text="@string/connection_error_text"
        android:textColor="@color/color_white" />

</RelativeLayout>


text:
var searchData=
[
  ['layoutinterf',['LayoutInterf',['../class_layout_interf.html',1,'']]]
];


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
var baseurl = window.location.pathname;
var user = null;

function login(elem) {
    // alert();
    $("#logo").addClass("flip");

    var data = $("#loginForm").serialize();
    console.log(data);
    setTimeout(function () {
        $.ajax({
            url: "../server/controller/administradorController.php",
            data: data,
            type: "POST",
            success: function (data) {
                console.log(data);
                if (data === "false") {
                    showError("Error en usuario o contraseña");
                } else {
                    user = data;
                }
                $("#logo").removeClass("flip");
            },
            error: function (data) {
                $("#logo").removeClass("flip");
                showError(data);
            }
        });
    }, 1000);
}

function showError(text) {
    $("#error").slideDown("slow");
    $("#error").text(text);
    setTimeout(function () {
        $("#error").slideUp();
    }, 3000);

}


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { AppsComponent } from './apps/apps.component';
import { AppsDetailsComponent } from './appsdetails/appsdetails.component';
import { Gui2FwLibModule } from 'org_onosproject_onos/web/gui2-fw-lib/public_api';

/**
 * ONOS GUI -- Apps View Module
 *
 * Note: This has been updated from onos-gui-1.0.0 where it was called 'app'
 * whereas here it is now called 'apps'. This is to avoid any confusion with
 * the 'app' folder which is the root of the complete framework
 */
@NgModule({
    imports: [
        CommonModule,
        Gui2FwLibModule,
        RouterModule.forChild([{path: '', component: AppsComponent}]),
        FormsModule
    ],
    declarations: [
        AppsComponent,
        AppsDetailsComponent
    ]
})
export class AppsModule { }


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

namespace Reference.Lib.DataStructures.Graphs
{
    public interface IWeightedGraph<TV, TW> : IGraph<TV>
        where TV : IComparable<TV>
        where TW : IComparable<TW>
    {
        new IEnumerable<IWeightedEdge<TV, TW>> Edges { get; }

        bool AddEdge(TV origin, TV destination, TW weight);

        new IEnumerable<IWeightedEdge<TV, TW>> GetIncomingEdges(TV vertex);

        new IEnumerable<IWeightedEdge<TV, TW>> GetOutgoingEdges(TV vertex);

        void UpdateEdgeWeight(TV origin, TV destination, TW weight);
    }
}


text:
namespace igl
{
  namespace tetgen
  {
    // Load a vertex list and face list into a tetgenio object
    // Inputs:
    //   V  #V by 3 vertex position list
    //   F  #F list of polygon face indices into V (0-indexed)
    // Outputs:
    //   in  tetgenio input object
    // Returns true on success, false on error
    IGL_INLINE bool mesh_to_tetgenio(
      const std::vector<std::vector<REAL > > & V,
      const std::vector<std::vector<int> > & F,
      tetgenio & in);

    // Wrapper with Eigen types
    // Templates:
    //   DerivedV  real-value: i.e. from MatrixXd
    //   DerivedF  integer-value: i.e. from MatrixXi
    template <typename DerivedV, typename DerivedF>
    IGL_INLINE bool mesh_to_tetgenio(
      const Eigen::PlainObjectBase<DerivedV>& V,
      const Eigen::PlainObjectBase<DerivedF>& F,
      tetgenio & in);
  }
}

#ifndef IGL_STATIC_LIBRARY
#  include "mesh_to_tetgenio.cpp"
#endif

#endif


text:
@interface NSString (DES)

+(NSString *) encryptUseDES:(NSString *)clearText key:(NSString *)key;

+(NSString *) decryptUseDES:(NSString *)plainText key:(NSString *)key;

@end


text:
package org.codehaus.jremoting.itests.tools.generator;

/**
 * Interface TstRemoteInterface
 * Test Interface for which the stub would be generated
 * The test is automated in the sense given the input args and expected
 * return of the function and the testcase will test for the same .
 * The method is invoked on the BCEL generated  proxy and then
 * the invocationhandler associated with the proxy  will
 * be used to complete the test cycle for the client side stub
 *
 * @author Vinay Chandrasekharan
 * @version 1.0
 */
public interface TstRemoteInterface {

    String test0(String name);

    String test0_arg0 = "a for apple";
    String test0_retValue = "b for bat";

    String test1(int me);

    String test1_retValue = "c for cat";
    Integer test1_arg0 = new Integer(1);

    int test2(int you, String str);

    Integer test2_retValue = new Integer(7654);
    Integer test2_arg0 = new Integer(1);
    String test2_arg1 = new String("d for dog");

    Integer test3();

    Integer test3_retValue = new Integer(1010);

    float test4();

    Float test4_retValue = new Float(100.10);

    byte test6(byte[] lotsofdata);

    byte[] test6_arg0 = new byte[100];
    byte test6_retValue = (byte) 10;

    double test5(int[] ia, String[] sa);

    int[] test5_arg0 = {1, 2, 3};
    String[] test5_arg1 = {"a", "b", "z"};
    Double test5_retValue = new Double(1010.4545);

    void test7();

    Float test7_arg0 = new Float(10);

    StringBuffer test8(String something);

    String test8_arg0 = "";
    StringBuffer test8_retValue = new StringBuffer("I am here , Where are you?");

    StringBuffer test9(float f, double d1, Long d2, double s3, String s);

    Float test9_arg0 = new Float(10);
    Double test9_arg1 = new Double(1000);
    Long test9_arg2 = new Long(1000);
    Double test9_arg3 = new Double(1000);
    String test9_arg4 = new String("s for so long, are you a fool");
    StringBuffer test9_retValue = new StringBuffer("e for elephant");

}