text:
// (C) Copyright 2015 Martin Dougiamas
//
// 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.

import { Component } from '@angular/core';
import { NavParams } from 'ionic-angular';
import { TranslateService } from '@ngx-translate/core';
import { CoreSitesProvider } from '@providers/sites';
import { AddonMessagesProvider } from '../../providers/messages';
import { CoreDomUtilsProvider } from '@providers/utils/dom';
import { CoreAppProvider } from '@providers/app';
import { CoreEventsProvider } from '@providers/events';

/**
 * Component that displays the list of contacts.
 */
@Component({
    selector: 'addon-messages-contacts',
    templateUrl: 'addon-messages-contacts.html',
})
export class AddonMessagesContactsComponent {

    protected currentUserId: number;
    protected searchingMessages: string;
    protected loadingMessages: string;
    protected siteId: string;
    protected noSearchTypes = ['online', 'offline', 'blocked', 'strangers'];

    loaded = false;
    discussionUserId: number;
    contactTypes = this.noSearchTypes;
    searchType = 'search';
    loadingMessage = '';
    hasContacts = false;
    contacts = {
        search: []
    };
    searchString = '';

    constructor(sitesProvider: CoreSitesProvider, translate: TranslateService, private appProvider: CoreAppProvider,
            private messagesProvider: AddonMessagesProvider, private domUtils: CoreDomUtilsProvider, navParams: NavParams,
            private eventsProvider: CoreEventsProvider) {

        this.currentUserId = sitesProvider.getCurrentSiteUserId();
        this.siteId = sitesProvider.getCurrentSiteId();
        this.searchingMessages = translate.instant('core.searching');
        this.loadingMessages = translate.instant('core.loading');
        this.loadingMessage = this.loadingMessages;

        this.discussionUserId = navParams.get('discussionUserId') || false;
    }

    /**
     * Component loaded.
     */
    ngOnInit(): void {
        if (this.discussionUserId) {
            // There is a discussion to load, open the discussion in a new state.
            this.gotoDiscussion(this.discussionUserId);
        }

        this.fetchData().then(() => {
            if (!this.discussionUserId && this.hasContacts) {
                let contact;
                for (const x in this.contacts) {
                    if (this.contacts[x].length > 0) {
                        contact = this.contacts[x][0];
                        break;
                    }
                }

                if (contact) {
                    // Take first and load it.
                    this.gotoDiscussion(contact.id, true);
                }
            }
        }).finally(() => {
            this.loaded = true;
        });
    }

    /**
     * Refresh the data.
     *
     * @param {any} [refresher] Refresher.
     * @return {Promise<any>} Promise resolved when done.
     */
    refreshData(refresher?: any): Promise<any> {
        let promise;

        if (this.searchString) {
            // User has searched, update the search.
            promise = this.performSearch(this.searchString);
        } else {
            // Update contacts.
            promise = this.messagesProvider.invalidateAllContactsCache(this.currentUserId).then(() => {
                return this.fetchData();
            });
        }

        return promise.finally(() => {
            refresher.complete();
        });
    }

    /**
     * Fetch contacts.
     *
     * @return {Promise<any>} Promise resolved when done.
     */
    protected fetchData(): Promise<any> {
        this.loadingMessage = this.loadingMessages;

        return this.messagesProvider.getAllContacts().then((contacts) => {
            for (const x in contacts) {
                if (contacts[x].length > 0) {
                    this.contacts[x] = this.sortUsers(contacts[x]);
                } else {
                    this.contacts[x] = [];
                }
            }

            this.clearSearch();
        }).catch((error) => {
            this.domUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingcontacts', true);
        });
    }

    /**
     * Sort user list by fullname
     * @param  {any[]} list List to sort.
     * @return {any[]}      Sorted list.
     */
    protected sortUsers(list: any[]): any[] {
        return list.sort((a, b) => {
            const compareA = a.fullname.toLowerCase(),
                compareB = b.fullname.toLowerCase();

            return compareA.localeCompare(compareB);
        });
    }

    /**
     * Clear search and show all contacts again.
     */
    clearSearch(): void {
        this.searchString = ''; // Reset searched string.
        this.contactTypes = this.noSearchTypes;

        this.hasContacts = false;
        for (const x in this.contacts) {
            if (this.contacts[x].length > 0) {
                this.hasContacts = true;

                return;
            }
        }
    }

    /**
     * Search users from the UI.
     *
     * @param  {string}       query Text to search for.
     * @return {Promise<any>}       Resolved when done.
     */
    search(query: string): Promise<any> {
        this.appProvider.closeKeyboard();

        this.loaded = false;
        this.loadingMessage = this.searchingMessages;

        return this.performSearch(query).finally(() => {
            this.loaded = true;
        });
    }

    /**
     * Perform the search of users.
     *
     * @param  {string}       query Text to search for.
     * @return {Promise<any>}       Resolved when done.
     */
    protected performSearch(query: string): Promise<any> {
        return this.messagesProvider.searchContacts(query).then((result) => {
            this.hasContacts = result.length > 0;
            this.searchString = query;
            this.contactTypes = ['search'];

            this.contacts['search'] = this.sortUsers(result);
        }).catch((error) => {
            this.domUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingcontacts', true);
        });
    }

    /**
     * Navigate to a particular discussion.
     *
     * @param {number} discussionUserId Discussion Id to load.
     * @param {boolean} [onlyWithSplitView=false]  Only go to Discussion if split view is on.
     */
    gotoDiscussion(discussionUserId: number, onlyWithSplitView: boolean = false): void {
        this.discussionUserId = discussionUserId;

        const params = {
            discussion: discussionUserId,
            onlyWithSplitView: onlyWithSplitView
        };
        this.eventsProvider.trigger(AddonMessagesProvider.SPLIT_VIEW_LOAD_EVENT, params, this.siteId);
    }
}

redpajama_set_name: RedPajamaGithub


text:
[![Build Status](https://travis-ci.org/databricks/spark-sql-perf.svg)](https://travis-ci.org/databricks/spark-sql-perf)

This is a performance testing framework for [Spark SQL](https://spark.apache.org/sql/) in [Apache Spark](https://spark.apache.org/) 2.2+.

**Note: This README is still under development. Please also check our source code for more information.**

# Quick Start

## Running from command line.

```
$ bin/run --help

spark-sql-perf 0.2.0
Usage: spark-sql-perf [options]

  -b <value> | --benchmark <value>
        the name of the benchmark to run
  -f <value> | --filter <value>
        a filter on the name of the queries to run
  -i <value> | --iterations <value>
        the number of iterations to run
  --help
        prints this usage text

$ bin/run --benchmark DatasetPerformance
```

The first run of `bin/run` will build the library.

## Build

Use `sbt package` or `sbt assembly` to build the library jar.

# MLlib tests

To run MLlib tests, run `/bin/run-ml yamlfile`, where `yamlfile` is the path to a YAML configuration
file describing tests to run and their parameters.

# TPC-DS

## Setup a benchmark

Before running any query, a dataset needs to be setup by creating a `Benchmark` object. Generating
the TPCDS data requires dsdgen built and available on the machines. We have a fork of dsdgen that
you will need. The fork includes changes to generate TPCDS data to stdout, so that this library can
pipe them directly to Spark, without intermediate files. Therefore, this library will not work with
the vanilla TPCDS kit.

TPCDS kit needs to be installed on all cluster executor nodes under the same path!

It can be found [here](https://github.com/databricks/tpcds-kit).

```
import com.databricks.spark.sql.perf.tpcds.TPCDSTables

// Set:
val rootDir = ... // root directory of location to create data in.
val databaseName = ... // name of database to create.
val scaleFactor = ... // scaleFactor defines the size of the dataset to generate (in GB).
val format = ... // valid spark format like parquet "parquet".
// Run:
val tables = new TPCDSTables(sqlContext,
    dsdgenDir = "/tmp/tpcds-kit/tools", // location of dsdgen
    scaleFactor = scaleFactor,
    useDoubleForDecimal = false, // true to replace DecimalType with DoubleType
    useStringForDate = false) // true to replace DateType with StringType

tables.genData(
    location = rootDir,
    format = format,
    overwrite = true, // overwrite the data that is already there
    partitionTables = true, // create the partitioned fact tables
    clusterByPartitionColumns = true, // shuffle to get partitions coalesced into single files.
    filterOutNullPartitionValues = false, // true to filter out the partition with NULL key value
    tableFilter = "", // "" means generate all tables
    numPartitions = 100) // how many dsdgen partitions to run - number of input tasks.

// Create the specified database
sql(s"create database $databaseName")
// Create metastore tables in a specified database for your data.
// Once tables are created, the current database will be switched to the specified database.
tables.createExternalTables(rootDir, "parquet", databaseName, overwrite = true, discoverPartitions = true)
// Or, if you want to create temporary tables
// tables.createTemporaryTables(location, format)

// For CBO only, gather statistics on all columns:
tables.analyzeTables(databaseName, analyzeColumns = true)
```

## Run benchmarking queries
After setup, users can use `runExperiment` function to run benchmarking queries and record query execution time. Taking TPC-DS as an example, you can start an experiment by using

```
import com.databricks.spark.sql.perf.tpcds.TPCDS

val tpcds = new TPCDS (sqlContext = sqlContext)
// Set:
val databaseName = ... // name of database with TPCDS data.
val resultLocation = ... // place to write results
val iterations = 1 // how many iterations of queries to run.
val queries = tpcds.tpcds2_4Queries // queries to run.
val timeout = 24*60*60 // timeout, in seconds.
// Run:
sql(s"use $databaseName")
val experiment = tpcds.runExperiment(
  queries,
  iterations = iterations,
  resultLocation = resultLocation,
  forkThread = true)
experiment.waitForFinish(timeout)
```

By default, experiment will be started in a background thread.
For every experiment run (i.e. every call of `runExperiment`), Spark SQL Perf will use the timestamp of the start time to identify this experiment. Performance results will be stored in the sub-dir named by the timestamp in the given `spark.sql.perf.results` (for example `/tmp/results/timestamp=1429213883272`). The performance results are stored in the JSON format.

## Retrieve results
While the experiment is running you can use `experiment.html` to get a summary, or `experiment.getCurrentResults` to get complete current results.
Once the experiment is complete, you can still access `experiment.getCurrentResults`, or you can load the results from disk.

```
// Get all experiments results.
val resultTable = spark.read.json(resultLocation)
resultTable.createOrReplaceTempView("sqlPerformance")
sqlContext.table("sqlPerformance")
// Get the result of a particular run by specifying the timestamp of that run.
sqlContext.table("sqlPerformance").filter("timestamp = 1429132621024")
// or
val specificResultTable = spark.read.json(experiment.resultPath)
```

You can get a basic summary by running:
```
experiment.getCurrentResults // or: spark.read.json(resultLocation).filter("timestamp = 1429132621024")
  .withColumn("Name", substring(col("name"), 2, 100))
  .withColumn("Runtime", (col("parsingTime") + col("analysisTime") + col("optimizationTime") + col("planningTime") + col("executionTime")) / 1000.0)
  .select('Name, 'Runtime)
```

## Running in Databricks.

There are example notebooks in `src/main/notebooks` for running TPCDS in the Databricks environment.

### tpcds_datagen notebook

This notebook can be used to install dsdgen on all worker nodes, run data generation, and create the TPCDS database.
Note that because of the way dsdgen is installed, it will not work on an autoscaling cluster, and `num_workers` has
to be updated to the number of worker instances on the cluster.
Data generation may also break if any of the workers is killed - the restarted worker container will not have `dsdgen` anymore.

### tpcds_run notebook

This notebook can be used to run TPCDS queries.

For running parallel TPCDS streams:
* Create a Cluster and attach the spark-sql-perf library to it.
* Create a Job using the notebook and attaching to the created cluster as "existing cluster".
* Allow concurrent runs of the created job.
* Launch appriopriate number of Runs of the Job to run in parallel on the cluster.


text:
package org.apache.camel.model.language;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import org.apache.camel.spi.Metadata;

/**
 * For HL7 terser expressions and predicates
 *
 * @version
 */
@Metadata(firstVersion = "2.11.0", label = "language,hl7", title = "HL7 Terser")
@XmlRootElement(name = "terser")
@XmlAccessorType(XmlAccessType.FIELD)
public class TerserExpression extends ExpressionDefinition {

    public TerserExpression() {
    }

    public TerserExpression(String expression) {
        super(expression);
    }

    public String getLanguage() {
        return "terser";
    }
}


text:
define({
  "_widgetLabel": "Traccia di rete",
  "configError": "Widget non configurato correttamente.",
  "clearButtonValue": "Cancellare",
  "GPExecutionFailed": "Impossibile completare la traccia. Riprovare.",
  "backButtonValue": "Indietro",
  "exportToCSVSuccess": "Esportazione in CSV completata correttamente.",
  "lblInputLocTab": "Posizioni di input",
  "lblBlockLocTab": "Posizioni di blocco",
  "lblInputLocation": "Feature di input",
  "lblBlockLocation": "Feature di blocco",
  "lblInputLocHeader": "Posizioni di input (0)",
  "lblBlockLocHeader": "Posizioni di blocco (0)",
  "inputTabTitle": "Input",
  "outputTabTitle": "Output",
  "exportSelectAllCheckBoxLabel": "Seleziona tutto",
  "lblSkipLocHeader": "Posizioni di salto (0)",
  "lblSkipLocation": "Localizzazione",
  "lblSkipLocTab": "Posizioni di salto",
  "skipAllLocationButtonLabel": "Tutte le posizioni di salto",
  "allLocationSkippedMessage": "Tutte le posizioni saltate",
  "locationAlreadySkippedMessage": "Posizione già saltata",
  "locationSkippedMessage": "Posizione saltata",
  "removeAllSkipLocationLabel": "Elimina tutto",
  "newProjectOptionText": "Nuovo progetto",
  "selectProject": "Seleziona progetto",
  "saveButtonLabel": "Salva",
  "exportToCSVText": "Esporta in CSV",
  "editProjectAttributesToolTip": "Modifica gli attributi progetto",
  "projectNameLabel": "Nome progetto",
  "saveProjectPopupTitle": "Salva",
  "saveAsLabel": "Salva con nome",
  "saveChangesMsg": "Salvare le modifiche a <b>${loadProjectDropdownlabel}</b> o salvare come nuovo progetto?",
  "creatingNewProjectErrorMessage": "Errore durante la creazione di un nuovo progetto. Riprovare.",
  "projectNameFetchingErr": "Errore durante il recupero dei nomi di progetto esistenti. Riprovare.",
  "projectAttributeLoadingErr": "Errore durante il caricamento di attributi di progetto. Riprovare.",
  "attributeUpdatedMsg": "Attributi aggiornati correttamente.",
  "projectAttributeUpdatingErr": "Errore durante l'aggiornamento di attributi di progetto.",
  "loadingProjectDetailsErrorMessage": "Errore durante il recupero di flag, barriere e posizioni di salto. Riprovare.",
  "savingProjectDetailsErr": "Errore durante il salvataggio dei dettagli del progetto. Provare a salvare di nuovo il progetto.",
  "updatingOutagePolygonErr": "Errore durante l'aggiornamento del poligono di interruzione. Provare a salvare di nuovo il progetto.",
  "deletingExistingPolygonErr": "Errore durante l'eliminazione del poligono di interruzione esistente. Provare a salvare di nuovo il progetto.",
  "loadingProjectFeaturesErr": "Errore durante il caricamento di feature di progetto. Provare a caricare di nuovo il progetto.",
  "addingProjectFeaturesErr": "Errore durante l'aggiunta di feature di progetto. Provare a salvare di nuovo il progetto.",
  "deletingExistingProjectFeaturesErr": "Errore durante l'eliminazione delle feature di progetto esistenti. Provare a salvare di nuovo il progetto.",
  "projectNotFoundErr": "Progetto non trovato",
  "projectLayersNotFound": "I layer delle impostazioni di progetto configurati non sono disponibili nella mappa. Il widget verrà caricato in 'Modalità schizzo'.",
  "fetchingOutagePolygonMessage": "Errore durante il recupero del poligono di interruzione. Provare a caricare di nuovo il progetto.",
  "projectNameExistsMessage": "Nome progetto già esistente. Utilizzare un nome progetto univoco.",
  "fetchingProjectNamesErrorMessage": "Errore durante il recupero dei nomi di progetto esistenti. Provare a salvare di nuovo il progetto.",
  "enterProjectNameMessage": "Immettere il nome progetto.",
  "projectLengthErrorMessage": "Il nome progetto non può essere maggiore di",
  "gpServiceNotAccessible": "L'account non ha accesso al servizio richiesto per eseguire questa traccia.",
  "loadingClonedLayerErrorMessage": "Errore durante il caricamento del feature layer clonato. Riprovare.",
  "addingFeatureInClonedLayerError": "Errore durante l'aggiunta di grafica nel feature layer clonato. Riprovare.",
  "selectingFeatureInClonedLayerError": "Errore durante la selezione di grafica nel feature layer clonato. Riprovare.",
  "filteredProjectError": "Errore durante il controllo del recupero dei dettagli di progetto filtrati. Riprovare.",
  "filteredProjectMessage": "Gli attributi di progetto selezionati non sono disponibili a causa dei filtri applicati da mappa web o un altro widget. Cancellare i filtri e riprovare.",
  "filteredProjectLoadMessage": "Il progetto non è più disponibile. Selezionare un progetto attivo.",
  "defaultValueForRunButton": "Esegui",
  "closeButtonLabel": "Rimuovi"
});


text:
@interface PPServiceUser : PPUser

+ (instancetype)userWithDictionary:(NSDictionary*)userDictionary;

@property (nonatomic) NSString *accessToken;
@property (nonatomic) BOOL login;
@property (nonatomic) BOOL active;
@property (nonatomic) NSString *password;
@property (nonatomic) NSString *signature;

@end


text:
package net.thekramers.linklist.model;

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

public class Folder {

	private final long id;
	private String name;
	public List<Link> links;

	public Folder(Long id, String name) {
		this.id = id;
		this.name = name;
		 links = new ArrayList<Link>();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public long getId() {
		return id;
	}

	public List<Link> getLinks() {
		return links;
	}

	public void setLinks(List<Link> links) {
		this.links = links;
	}

	public void addLink(Link link) {
		this.links.add(link);
	}

}


text:
package io.subutai.common.host;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import com.google.gson.annotations.SerializedName;

/**
 * Host interface
 */
public class HostInterfaceModel implements HostInterface
{
    @SerializedName( "interfaceName" )
    @JsonProperty( "interfaceName" )
    private String name;
    @SerializedName( "ip" )
    @JsonProperty( "ip" )
    private String ip;

    public HostInterfaceModel()
    {
    }

    public HostInterfaceModel( final String name, final String ip )
    {
        this.name = name;
        this.ip = ip;
    }

    public HostInterfaceModel( final HostInterface hostInterface )
    {
        this.name = hostInterface.getName();
        this.ip = hostInterface.getIp();
    }

    @Override
    public String getName()
    {
        return name;
    }

    @Override
    public String getIp()
    {
        return ip;
    }

    @Override
    public String toString()
    {
        return MoreObjects.toStringHelper( this ).add( "name", name ).add( "ip", ip ).toString();
    }
}


text:
Article 321
----
Sauf lorsqu'elles sont enfermées par la loi dans un autre délai, les actions
relatives à la filiation se prescrivent par dix ans à compter du jour où la
personne a été privée de l'état qu'elle réclame, ou a commencé à jouir de l'état
qui lui est contesté. A l'égard de l'enfant, ce délai est suspendu pendant sa
minorité.


text:
package org.apache.phoenix.hbase.index.covered.update;

import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
import org.apache.phoenix.hbase.index.util.ReadOnlyImmutableBytesPtr;

/**
 *
 */
public class ColumnReference implements Comparable<ColumnReference> {

  public static final byte[] ALL_QUALIFIERS = new byte[0];

  private static int calcHashCode(ImmutableBytesWritable familyPtr, ImmutableBytesWritable qualifierPtr) {
    final int prime = 31;
    int result = 1;
    result = prime * result + familyPtr.hashCode();
    result = prime * result + qualifierPtr.hashCode();
    return result;
  }

    private final int hashCode;
    protected volatile byte[] family;
    protected volatile byte[] qualifier;
    private final ImmutableBytesPtr familyPtr;
    private final ImmutableBytesPtr qualifierPtr;

    public ColumnReference(byte[] family, byte[] qualifier) {
        this.familyPtr = new ReadOnlyImmutableBytesPtr(family);
        this.qualifierPtr = new ReadOnlyImmutableBytesPtr(qualifier);
        this.hashCode = calcHashCode(this.familyPtr, this.qualifierPtr);
    }

    public ColumnReference(byte[] family, int familyOffset, int familyLength, byte[] qualifier,
            int qualifierOffset, int qualifierLength) {
        this.familyPtr = new ReadOnlyImmutableBytesPtr(family, familyOffset, familyLength);
        this.qualifierPtr = new ReadOnlyImmutableBytesPtr(qualifier, qualifierOffset, qualifierLength);
        this.hashCode = calcHashCode(this.familyPtr, this.qualifierPtr);
    }

    public byte[] getFamily() {
        if (this.family == null) {
            synchronized (this.familyPtr) {
                if (this.family == null) {
                    this.family = this.familyPtr.copyBytesIfNecessary();
                }
            }
        }
        return this.family;
    }

    public byte[] getQualifier() {
        if (this.qualifier == null) {
            synchronized (this.qualifierPtr) {
                if (this.qualifier == null) {
                    this.qualifier = this.qualifierPtr.copyBytesIfNecessary();
                }
            }
        }
        return this.qualifier;
    }

    public ImmutableBytesPtr getFamilyWritable() {
        return this.familyPtr;
    }

    public ImmutableBytesPtr getQualifierWritable() {
        return this.qualifierPtr;
    }

  public boolean matches(Cell kv) {
    if (matchesFamily(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength())) {
      return matchesQualifier(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength());
    }
    return false;
  }

  /**
   * @param qual to check against
   * @return <tt>true</tt> if this column covers the given qualifier.
   */
  public boolean matchesQualifier(byte[] qual) {
    return matchesQualifier(qual, 0, qual.length);
  }

    public boolean matchesQualifier(byte[] bytes, int offset, int length) {
        return allColumns() ? true : match(bytes, offset, length, qualifierPtr.get(),
            qualifierPtr.getOffset(), qualifierPtr.getLength());
    }

  /**
   * @param family to check against
   * @return <tt>true</tt> if this column covers the given family.
   */
  public boolean matchesFamily(byte[] family) {
    return matchesFamily(family, 0, family.length);
  }

  public boolean matchesFamily(byte[] bytes, int offset, int length) {
    return match(bytes, offset, length, familyPtr.get(), familyPtr.getOffset(), familyPtr.getLength());
  }

  /**
   * @return <tt>true</tt> if this should include all column qualifiers, <tt>false</tt> otherwise
   */
  public boolean allColumns() {
    return getQualifier() == ALL_QUALIFIERS;
  }

    /**
     * Check to see if the passed bytes match the stored bytes
     * @param first
     * @param storedKey the stored byte[], should never be <tt>null</tt>
     * @return <tt>true</tt> if they are byte-equal
     */
    private boolean match(byte[] first, int offset1, int length1, byte[] storedKey, int offset2,
            int length2) {
        return first == null ? false : Bytes.equals(first, offset1, length1, storedKey, offset2,
            length2);
    }

    public KeyValue getFirstKeyValueForRow(byte[] row) {
        return KeyValue.createFirstOnRow(row, getFamily(), getQualifier() == ALL_QUALIFIERS ? null
                : getQualifier());
    }

  @Override
  public int compareTo(ColumnReference o) {
    int c = familyPtr.compareTo(o.familyPtr);
    if (c == 0) {
      // matching families, compare qualifiers
      c = qualifierPtr.compareTo(o.qualifierPtr);
    }
    return c;
  }

  @Override
  public boolean equals(Object o) {
    if (o instanceof ColumnReference) {
      ColumnReference other = (ColumnReference) o;
      if (hashCode == other.hashCode && familyPtr.equals(other.familyPtr)) {
        return qualifierPtr.equals(other.qualifierPtr);
      }
    }
    return false;
  }

  @Override
  public int hashCode() {
    return hashCode;
  }

  @Override
  public String toString() {
    return "ColumnReference - " + Bytes.toString(getFamily()) + ":" + Bytes.toString(getQualifier());
  }
}


text:
/**
 * <html>
 * <head>
 * <title>org.owasp.dependencycheck.data.lucene</title>
 * </head>
 * <body>
 * Contains classes used to work with the Lucene Indexes.
 * </body>
 * </html>
*/

package org.owasp.dependencycheck.data.lucene;


text:
XMLVM_FORWARD_DECL(java_util_Iterator)
#endif

XMLVM_DEFINE_CLASS(java_util_Set, 0, 0)

extern JAVA_OBJECT __CLASS_java_util_Set;
extern JAVA_OBJECT __CLASS_java_util_Set_1ARRAY;
extern JAVA_OBJECT __CLASS_java_util_Set_2ARRAY;
extern JAVA_OBJECT __CLASS_java_util_Set_3ARRAY;
#ifndef XMLVM_FORWARD_DECL_java_util_Set
#define XMLVM_FORWARD_DECL_java_util_Set
typedef struct java_util_Set java_util_Set;
#endif

void __INIT_java_util_Set();
void __INIT_IMPL_java_util_Set();

#endif


text:
[![Join the chat at https://gitter.im/scalameta/scalameta](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scalameta/scalameta?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Scala.meta is based on a principle that metaprogramming should be completely decoupled from compiler internals.
This project is a clean-room implementation of a metaprogramming toolkit for Scala, designed to be simple, robust and portable.
We are striving for scala.meta to become a successor of scala.reflect, the current de facto standard in Scala ecosystem.

Scala.meta is an experiment into a fundamental hypothesis that programs in Scala can be represented, analyzed
and manipulated using their concrete syntax and nothing else.
This document explains our current progress with realizing this hypothesis and shows how our vision translates into code.

### How to download

This project is still in a pre-alpha stage, so it's not supposed to be immediately usable just yet.
Nevertheless, we are regularly publishing snapshot builds to Sonatype, so it is already possible to experiment with scala.meta
as described at [https://github.com/scalameta/example](https://github.com/scalameta/example).

As with any snapshot software, things may crash and burn and APIs may noticeably change overnight,
but if you're brave enough, proceed using the instructions, and you may find hidden treasures!
If you have any comments or suggestions during your journey, let us know at
[https://groups.google.com/forum/#!forum/scalameta](https://groups.google.com/forum/#!forum/scalameta).

### How to use

Scala.meta provides services that can be categorized into two big groups: syntactic APIs and semantic APIs.
The former are only interested in how the code looks like, whereas the latter are also concerned about what the code actually means.
This conceptual difference leads to a significant difference in how these APIs are used.

Syntactic APIs are implemented completely within scala.meta, so their use is as simple as importing the right package
and selecting a syntactic profile, called *dialect*. This enables quasiquotes, as well as functionality for tokenization, parsing and prettyprinting.

```
import scala.meta._
import scala.meta.dialects.Scala211
```

Semantic APIs require a full-blown typechecker to make sense of code, enabling scala.meta to resolve references, list members and so on.
Implementing such a typechecker would be a humongous task, so we piggyback on existing implementations (e.g. scalac or Intellij),
called *hosts*, to obtain necessary information. This means that, in order to use semantic APIs, you will have to have a host
(an instance of scala.meta.semantic.Context) at hand:

```
import scala.meta._
implicit val c: scala.meta.semantic.Context = ...
```

At the moment, there exist implementations of compile-time and runtime hosts based on scala.tools.nsc.Global (the standard scalac compiler).
Consult [https://github.com/scalameta/scalahost](https://github.com/scalameta/scalahost) to see how to instantiate and use these hosts.
In the future, we plan to have implementations of hosts for the Intellij Scala plugin and the Dotty compiler.

### Working with syntax

In scala.reflect, our current metaprogramming toolkit, quasiquotes have proven to be an excellent tool
to construct and deconstruct syntax trees, so we're utilizing quasiquotes in scala.meta as well.
A specification can be found in [/docs/quasiquotes.md](/docs/quasiquotes.md).

At the moment, we don't have a reliably working implementation of quasiquotes for scala.meta,
but there exists some rudimentary support for constructing terms and types with `q"..."` and `t"..."`
(don't even try deconstruction in pattern matches - it's not going to work).

```
scala> q"class C { def x = 2 }"
res0: meta.internal.ast.Defn.Class = class C { def x = 2 }
```

In the meanwhile, if our rudimentary quasiquotes end up not working for your scenario,
you will have to assemble and take apart syntax trees by hand.
For that, you might want to enlist the help of good old friends showCode and showRaw from scala.reflect,
which are now generalized and called `show[Syntax]` and `show[Structure]`:

```
scala> res0.show[Syntax]
res1: String = class C { def x = 2 }

scala> res0.show[Structure]
res2: String = Defn.Class(Nil, Type.Name("C"), Nil, Ctor.Primary(Nil, Ctor.Ref.Name("this"), Nil), Template(Nil, Nil, Term.Param(Nil, Name.Anonymous(), None, None), Some(List(Defn.Def(Nil, Term.Name("x"), Nil, Nil, None, Lit.Int(2))))))
```

The full list of nodes that comprise scala.meta syntax trees can be found in [Trees.scala](/scalameta/src/main/scala/scala/meta/Trees.scala),
and it is quite involved, because we have to model the entire wealth of Scala's syntax.
However, most of the classes there are just an implementation detail that will be hidden
once we implement full-fledged support for quasiquotes.

### Tokenization and parsing

Scala.meta features its own parser, heavily based on the one from scalac, but customized
to provide fine-grained control over tokenization and ensure ultimate ease of use.
Functionality of our parser is exposed in two simple methods: `tokens` and `parse`.

```
scala> "class C { def x = 2 }".tokens
res3: meta.Tokens = Tokens(class (0..4),   (5..5), C (6..6),   (7..7), { (8..8),   (9..9), def (10..12),   (13..13), x (14..14),   (15..15), = (16..16),   (17..17), 2 (18..18),   (19..19), } (20..20), EOF (21..20))

scala> "class C { def x = 2 }".parse[Stat]
res4: scala.meta.Stat = class C { def x = 2 }

scala> "class C { def x = 2 }".parse[Term]
scala.meta.ParseException: illegal start of simple expression at class (0..4)
  at scala.meta.ParseException$.apply(Exception.scala:5)
  at scala.meta.syntactic.parsers.Reporter$class.syntaxError(Reporter.scala:12)
  at scala.meta.syntactic.parsers.Reporter$$anon$1.syntaxError(Reporter.scala:17)
  at scala.meta.syntactic.parsers.AbstractParser.simpleExpr(Parsers.scala:1256)
  ...
```

The full list of tokens returned by the tokenizer can be found in
[Token.scala](/scalameta/src/main/scala/scala/meta/syntactic/Token.scala).
The full list of non-terminals that can be used as targets for the parser is provided
as a list of implicit instances of the Parse[T] typeclass
in [syntactic/Api.scala](/scalameta/src/main/scala/scala/meta/syntactic/Api.scala).

As a quick remark, you can tokenize and parse anything that can be converted to
an [Input](/scalameta/src/main/scala/scala/meta/syntactic/Input.scala) by the means of
the [Convert](/foundation/src/main/scala/org/scalameta/convert/Convert.scala) typeclass.
At the moment, it's just strings and files, but you can provide your own instances
that will then seamlessly work with the existing API.

### Working with semantics

Central to the semantic API of scala.meta are the notions of `Name`, `Member` and `Type`.
This area of scala.meta is just freshly implemented and is barely tested, so,
in this section, we will only briefly explain the fundamental notions and their interactions.
The full list of semantic APIs can be found in [semantic/Api.scala](/scalameta/src/main/scala/scala/meta/semantic/Api.scala).

### Names

Everything related to bindings is modeled with names. If a program element introduces a definition
or refers to a definition, that will be represented by a name of some sort. Let's see a quick example
that will illustrate the point.

```
scala> q"class C { def x = 2; def y = new C().x }"
res6: meta.internal.ast.Defn.Class =
class C {
  def x = 2
  def y = new C().x
}

scala> res6.show[Structure]
res7: String = Defn.Class(
  Nil, Type.Name("C"), Nil,
  Ctor.Primary(Nil, Ctor.Ref.Name("this"), Nil),
  Template(
    Nil, Nil, Term.Param(Nil, Name.Anonymous(), None, None),
    Some(List(
      Defn.Def(Nil, Term.Name("x"), Nil, Nil, None, Lit.Int(2)),
      Defn.Def(Nil, Term.Name("y"), Nil, Nil, None, Term.Select(Term.New(Template(Nil, List(Term.Apply(Ctor.Ref.Name("C"), Nil)), Term.Param(Nil, Name.Anonymous(), None, None), None)), Term.Name("x")))))))
```

We can see that all definitions, including the class C and methods x and y have names at their core.
Even a self-type definition for the class C, which wasn't specified and was set to a default value,
has a name, albeit an anonymous one.
In the same vein, all references, i.e. a constructor that we're invoking and a method that we're calling
on a constructed object, have names in them.

Now, one of the main goals of the semantic API is to match names of references with their corresponding definitions.
This is done under the covers with the help of a host that users provide when invoking semantic APIs.
Once the semantics of a snippet of code has been established, you can compare names for equality with `==`,
and this represents the way how tree comparison works in scala.meta - trees only compare equal if they mean exactly the same thing.

### Members

Once we have a naked name (represented by `Name`) or a qualified name (represented by subtypes of `Ref`),
we can ask the semantic API to resolve it to a definition that it refers to. If the meaning of a name
can be figured out by scala.meta, we'll get a result represented by `Member`.

```
scala> q"scala.collection.immutable.List".defn
res8: scala.meta.Member.Term = object List extends SeqFactory[List] with Serializable { ... }
```

We can also go back from a member to a name by simply calling `Member.name`.
Unlike `Ref.defn`, this is a conceptually trivial operation - we simply look into the syntax tree of a member,
find its name there and return it.

```
scala> res8.name
res9: scala.meta.Name with scala.meta.Term.Ref = List
```

If you're familiar with the scala.reflect API, you will notice that this looks very similar to how symbols work.
In scala.reflect, when we have a RefTree, i.e. a Tree with a Name, we can inspect its Symbol, and that will provide us with
a representation of the corresponding definition.
Again, in scala.reflect, we can also easily reference the symbol by unquoting it into a tree.

Note, however, that in scala.meta we have just a single concept to represent everything (both names and members are trees),
whereas in scala.reflect there are three different concepts of Name, Tree and Symbol to describe bindings.
We consider the design of scala.meta to be particularly elegant in this regard.

Also, just as one would expect, scala.meta makes it possible to inspect various properties of members.
For instance, let's dig into the List that we obtained and get its member method called apply.

```
scala> res8.defs("apply")
res10: scala.meta.Member.Term = override def apply[A](xs: A*): List[A] = ???
```

Note that in addition to signatures, members also carry their bodies. In fact, a `Member` obtained via `Ref.defn`
and a `Member` obtained by parsing and typechecking corresponding source code are supposed to be the same
because of the overarching principle of scala.meta - everything should be represented and operated on via concrete syntax.
This is going to be somewhat tricky to implement, but with the help of the recent initiative of persisting
typed syntax trees we will get there. In the meanwhile, `Ref.defns` is going to include full bodies only
for members declared in the currently processed compilation run.

### Hygiene

Now let's consider the topic of "if the meaning of a name can be figured out by scala.meta" that we glossed over
in the previous section. In order to resolve references, scala.meta needs to know what names mean, and that's
what is planned to be taken care of with hygiene.

In a nutshell, hygiene is about remembering lexical contexts of syntax trees. This enables metaprograms
to operate with snippets of code and not worry that meaning of names might change if these snippets
are split apart and/or inserted into bigger snippets that come from somewhere else.

While a full-fledged design of hygiene in Scala that works with arbitrary untyped code snippets
remains to be developed, there is a reasonable approximation that we have implemented for the time being.
If a tree comes from a host (e.g. during macro expansion), then all names in that tree are going to be hygienic.
Otherwise, if a tree is created in scala.meta (e.g. via quasiquotes), then the names in that tree will be hygienic
only if the tree can be statically typechecked.

In the examples below, we are going to expose information about hygiene in names defined by simple quasiquotes.
This information is hidden under the covers and is unavailable for reading or writing via the public API,
but `show[Summary]` can shed light on it.

```
scala> t"List[Int]".show[Semantics]
res11: String =
Type.Apply(Type.Name("List")[1], List(Type.Name("Int")[2]))
[1] Type.Singleton(Term.Name("package")[3])::scala.package#List
[2] Type.Singleton(Term.Name("scala")[4])::scala#Int
[3] Type.Singleton(Term.Name("scala")[4])::scala.package
[4] Type.Singleton(Term.Name("_root_")[5])::scala
[5] 0::_root_
```

The first example features a type quasiquote that represents List[Int]. This quasiquote can be statically typechecked,
so its names are hygienic. We can see that the internal bookkeeping data structures associated with names
not only include fully-qualified names, but also prefixes, which are essential to hygiene due to Scala's object-oriented nature.

```
scala> t"List[X]".show[Semantics]
res12: String = Type.Apply(Type.Name("List")[0], List(Type.Name("X")[0]))
```

The second example showcases a type quasiquote that represents an application of an unknown type X to the type constructor List.
We don't know what X is at the point where we write a quasiquote, but later on, when we insert it into a bigger tree,
it will make sense. This pattern is very frequently used in popular Scala macros and is crucial to their modularity.
Unfortunately, this pattern also prevents us from typechecking this quasiquote in advance and, as a result, from populating
its names with hygiene information. Consequently, if you try to dereference one of those names with `Ref.defn`, you will get an error.

A smart implementation of hygiene could analyze List[X] piece-by-piece, trying to resolve every name in isolation
and remembering as much information as possible about those, but that's much harder to implement than it sounds,
so we will get to this later. We consider hygiene to be a very important part of a metaprogramming API, so getting it right
is very high on our list of priorities.

### Types

Drawing inspiration from the negative experience with scala.reflect,
where types are special data structures that are opaque to quasiquotes and hence hard to analyze and create,
in scala.meta we demystify types by: 1) asserting that all publicly available types can be represented with syntax,
2) noting that most types are nothing but one or several names bunched together, and describing those names is all that's needed
to completely describe semantics of types.

```
scala> t"List[Int]".show[Semantics]
res13: String =
Type.Apply(Type.Name("List")[1], List(Type.Name("Int")[2]))
[1] Type.Singleton(Term.Name("package")[3])::scala.package#List
[2] Type.Singleton(Term.Name("scala")[4])::scala#Int
[3] Type.Singleton(Term.Name("scala")[4])::scala.package
[4] Type.Singleton(Term.Name("_root_")[5])::scala
[5] 0::_root_
```

If we go back to the example with List[Int], we can see that `t"List[Int]"` contains all the information that we would like to know
about the List[Int] type (and, to reiterate, all that information is ultimately stored in names).
So, without further ado of calling c.typecheck or typeOf, like we'd do in scala.reflect,
we can take our type quasiquote and use it like we'd use a type in scala.reflect.

```
scala> t"List[Int]" <:< t"List[Any]"
res14: Boolean = true

scala> t"List[Int]".defs
res15: scala.collection.immutable.Seq[scala.meta.Member.Term] = List(...)

scala> res15.foreach(println)
override def companion: GenericCompanion[List] = ...
def ::[B >: Int](x: B): List[B] = ...
...
```

Two things in this printout are noteworthy: 1) when we go through a list of members of a `Type`, we get see our old friends `Member`s
that were discussed several sections above, 2) type signatures of these members are adjusted accordingly to accommodate
instantiated type parameters and/or prefixes of enclosing classes.

### Putting this all together

Now that we're well-versed in the fundamental concepts of `Name`/`Ref`, `Member` and `Type`, let's take a final example
that showcase the interaction of these concepts within the semantic API of scala.meta.

```
scala> val tpe = t"List"
tpe: meta.internal.ast.Type.Name = List
```

We start with something as simple as just a `List` (note the absense of the `[_]` part that should be familiar
to those of you who've been working with typeOf in scala.reflect). `List` is a simple `Name`, but, as we know,
names carry a wealth of semantic information. With this information, we can, for example, resolve a name to a member.

```
scala> val member = tpe.defn
member: scala.meta.Member = type List[+A] = List[A]
```

The member that we obtain is nothing magical - it's just the syntax of the definition provided in the `scala` package object.
We can inspect this syntax via usual means (currently, we have to use manual pattern matching and/or show[Structure], but soon
we'll implement quasiquotes to fill this role).

```
scala> member.show[Structure]
res18: String = Defn.Type(Nil, Type.Name("List"), List(Type.Param(List(Mod.Covariant()), Type.Name("A"), Nil, Type.Bounds(None, None), Nil, Nil)), Type.Apply(Type.Name("List"), List(Type.Name("A"))))
```

When inspecting the structure of the member, we can see that it has a name. As we recollect, both definition and reference
parts of bindings are represented with names, and now we can make a practical experiment to illustrate this design.
If you can understand how a type can be equal to a name, then you understand the main ideas of scala.meta.

```
// NOTE: in the future, we'll be using quasiquotes here!
scala> import scala.meta.internal.ast._
import scala.meta.internal.ast._

scala> val Defn.Type(_, name, _, _) = member
name: meta.internal.ast.Type.Name = List

scala> tpe == name
res21: Boolean = true
```

Here we observe how scala.meta unifies trees, symbols and types into one coherent concept,
which gives rise to scala.meta's semantic API, a clearly defined and intuitive way of navigating program structure.
All the bookkeeping information that makes this possible is hidden behind names and only names,
which provides a simple and reliable mental model for understanding scala.meta programs.

### Roadmap

  1. Replace manual tree construction/deconstruction via `import scala.meta.internal.ast._` with familiar quasiquote-based API. The `internal` API will either be hidden and discouraged or will go into oblivion completely.

  2. Remember all the details of how underlying programs were written (formatting, comments, etc). After this is implemented, it will become possible to implement precise code rewritings that don't lose any formatting. Also, we will get position information, which will allow to emit targetted warning and error messages.

  3. Transparently and automatically persist typed syntax trees of programs being compiled, so that they can be redistributed via Maven repositories and then obtained by metaprograms on demand.

  4. Develop more hosts. Firstly, we plan to allow writing macros in scala.meta, which means that it will be possible to write metaprograms against syntactic and semantic APIs of scala.meta, and then have the macro engine automatically call those metaprograms and pass them an instance of `scala.meta.semantic.Context`. Secondly, we may want to explore and expose other kinds of hosts (e.g. a host based on an SBT project).

  5. Implement full-fledged support for hygiene. This will make names remember and preserve their meaning regardless of whether the enclosing quasiquotes can or cannot be typechecked statically.

### Summary

Scala.meta is a next-generation metaprogramming toolkit for Scala that focuses on simplicity, robustness and portability.
Its syntactic APIs provide facilities to create and analyze program elements via a uniform interface based on syntax trees.
Its semantic APIs turn syntax trees into graphs with references and definitions connected by names.

We are building scala.meta to supersede scala.reflect, the de facto standard for metaprogramming Scala,
learning from the experience that we gained from designing, implementing and supporting compile-time and runtime reflection
in production releases of Scala 2.10 and 2.11.

At the moment, scala.meta is still in a pre-alpha stage, so it's not supposed to be immediately usable just yet.
However, it is already possible to experiment with our design using nightly builds of scalameta/scalameta and scalameta/scalahost
as described at [https://github.com/scalameta/example](https://github.com/scalameta/example).
If you would like to share your comments, experiences and ideas, you're always welcome on our mailing list at
[https://groups.google.com/forum/#!forum/scalameta](https://groups.google.com/forum/#!forum/scalameta).


text:
!function(modules) {
    function __webpack_require__(moduleId) {
        if (installedModules[moduleId]) return installedModules[moduleId].exports;
        var module = installedModules[moduleId] = {
            exports: {},
            id: moduleId,
            loaded: !1
        };
        return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
        module.loaded = !0, module.exports;
    }
    var installedModules = {};
    return __webpack_require__.m = modules, __webpack_require__.c = installedModules,
    __webpack_require__.p = "", __webpack_require__(0);
}({
    0: function(module, exports, __webpack_require__) {
        module.exports = __webpack_require__(324);
    },
    324: function(module, exports, __webpack_require__) {
        window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
        window.jasmine, window.Microsoft;
        window.jsCommon = window.jsCommon || {}, window.powerbi = window.powerbi || {},
        window.debug = window.debug || {}, window.InJs = window.InJs || {}, __webpack_require__(325),
        __webpack_require__(328), __webpack_require__(329), __webpack_require__(330), __webpack_require__(331),
        __webpack_require__(332), __webpack_require__(333), __webpack_require__(334), __webpack_require__(335),
        __webpack_require__(336), __webpack_require__(337), __webpack_require__(338), __webpack_require__(339),
        __webpack_require__(340), __webpack_require__(341), __webpack_require__(342), __webpack_require__(343),
        __webpack_require__(344), __webpack_require__(345), __webpack_require__(346), __webpack_require__(347),
        __webpack_require__(348), __webpack_require__(349), __webpack_require__(350), __webpack_require__(351),
        __webpack_require__(352), __webpack_require__(353), __webpack_require__(354), __webpack_require__(355),
        __webpack_require__(356), __webpack_require__(357), __webpack_require__(358), __webpack_require__(359),
        __webpack_require__(360), __webpack_require__(361), __webpack_require__(362), __webpack_require__(363),
        __webpack_require__(364), __webpack_require__(365), __webpack_require__(366), __webpack_require__(367),
        __webpack_require__(368), __webpack_require__(369), __webpack_require__(370), __webpack_require__(371),
        __webpack_require__(372);
    },
    325: function(module, exports, __webpack_require__) {
        window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
        window.jasmine, window.Microsoft;
        __webpack_require__(326), __webpack_require__(327);
    },
    326: function(module, exports) {
        window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
        window.jasmine, window.Microsoft;
    },
    327: function(module, exports) {
        var powerbi, powerbi = (window.jsCommon, window.powerbi);
        window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
        !function(powerbi) {
            !function(VisualDataRoleKind) {
                VisualDataRoleKind[VisualDataRoleKind.Grouping = 0] = "Grouping", VisualDataRoleKind[VisualDataRoleKind.Measure = 1] = "Measure",
                VisualDataRoleKind[VisualDataRoleKind.GroupingOrMeasure = 2] = "GroupingOrMeasure";
            }(powerbi.VisualDataRoleKind || (powerbi.VisualDataRoleKind = {}));
            powerbi.VisualDataRoleKind;
            !function(VisualDataChangeOperationKind) {
                VisualDataChangeOperationKind[VisualDataChangeOperationKind.Create = 0] = "Create",
                VisualDataChangeOperationKind[VisualDataChangeOperationKind.Append = 1] = "Append";
            }(powerbi.VisualDataChangeOperationKind || (powerbi.VisualDataChangeOperationKind = {}));
            powerbi.VisualDataChangeOperationKind;
            !function(VisualUpdateType) {
                VisualUpdateType[VisualUpdateType.Data = 2] = "Data", VisualUpdateType[VisualUpdateType.Resize = 4] = "Resize",
                VisualUpdateType[VisualUpdateType.ViewMode = 8] = "ViewMode", VisualUpdateType[VisualUpdateType.Style = 16] = "Style",
                VisualUpdateType[VisualUpdateType.ResizeEnd = 32] = "ResizeEnd", VisualUpdateType[VisualUpdateType.All = 62] = "All";
            }(powerbi.VisualUpdateType || (powerbi.VisualUpdateType = {}));
            powerbi.VisualUpdateType;
            !function(VisualPermissions) {}(powerbi.VisualPermissions || (powerbi.VisualPermissions = {}));
            var visuals;
            powerbi.VisualPermissions;
            !function(visuals) {
                var telemetry;
                !function(telemetry) {
                    !function(ErrorSource) {
                        ErrorSource[ErrorSource.PowerBI = 0] = "PowerBI", ErrorSource[ErrorSource.External = 1] = "External",
                        ErrorSource[ErrorSource.User = 2] = "User";
                    }(telemetry.ErrorSource || (telemetry.ErrorSource = {}));
                    telemetry.ErrorSource;
                }(telemetry = visuals.telemetry || (visuals.telemetry = {}));
            }(visuals = powerbi.visuals || (powerbi.visuals = {}));
        }(powerbi || (powerbi = {}));
    },
    328: function(module, exports) {},
    329: function(module, exports) {},
    330: function(module, exports) {},
    331: function(module, exports) {},
    332: function(module, exports) {},
    333: function(module, exports) {},
    334: function(module, exports) {},
    335: function(module, exports) {},
    336: function(module, exports) {},
    337: function(module, exports) {},
    338: function(module, exports) {},
    339: function(module, exports) {},
    340: function(module, exports) {},
    341: function(module, exports) {},
    342: function(module, exports) {},
    343: function(module, exports) {},
    344: function(module, exports) {},
    345: function(module, exports) {},
    346: function(module, exports) {},
    347: function(module, exports) {},
    348: function(module, exports) {},
    349: function(module, exports) {},
    350: function(module, exports) {},
    351: function(module, exports) {},
    352: function(module, exports) {},
    353: function(module, exports) {},
    354: function(module, exports) {},
    355: function(module, exports) {},
    356: function(module, exports) {},
    357: function(module, exports) {},
    358: function(module, exports) {},
    359: function(module, exports) {},
    360: function(module, exports) {},
    361: function(module, exports) {},
    362: function(module, exports) {},
    363: function(module, exports) {},
    364: function(module, exports) {},
    365: function(module, exports) {},
    366: function(module, exports) {},
    367: function(module, exports) {},
    368: function(module, exports) {},
    369: function(module, exports) {},
    370: function(module, exports) {},
    371: function(module, exports) {},
    372: function(module, exports) {}
});


text:
import base64
import datetime
import mock
import os
import pytest
import sh
import struct
import tempfile
import time
import uuid

from OpenSSL import crypto

from app import utils

test_conf_self_referencing = '''
    "n1":
      "nn1": "n1_nn1_v"
      "nn2": "{{ n3.nn1 }}"
    "n2": "{{ n1.nn1 }}"
    "n3":
      "nn1": "n3_nn1_v"
      "nn2": "n3_nn2_v"
    "n4": "{{ n2 }}"
    "n5":
      "nn1": "n5_nn1_v"
    "n6": "n6_v"
'''

test_conf_self_rendered = '''
    "n1":
      "nn1": "n1_nn1_v"
      "nn2": "n3_nn1_v"
    "n2": "n1_nn1_v"
    "n3":
      "nn1": "n3_nn1_v"
      "nn2": "n3_nn2_v"
    "n4": "n1_nn1_v"
    "n5":
      "nn1": "n5_nn1_v"
    "n6": "n6_v"
'''

class TestHelper():
    """Helper class for the tests in this file"""

    _test_dir = None

    @staticmethod
    def get_test_dir():
        if TestHelper._test_dir is None:
            TestHelper._test_dir = TestHelper._create_test_dir()
        return TestHelper._test_dir

    @staticmethod
    def _create_test_dir():
        dir_prefix = os.path.join(
            "/tmp", 'app-tests_' + datetime.datetime.fromtimestamp(time.time()).strftime('%Y%m%d%H%M%S') + "_")
        tmp_dir_path = tempfile.mkdtemp(prefix=dir_prefix)
        return tmp_dir_path

class TestExecUtils(TestHelper):
    def test_exec_command(self):

        # Will Succeed
        output, exception = utils.ExecUtils.exec_command('ps')
        assert output is not None and len(output) > 0
        assert exception is None
        # Will Fail
        output, exception = utils.ExecUtils.exec_command('not_a_command')
        assert output is not None and len(output) == 0
        assert exception is not None and len(str(exception)) > 0

class TestFileUtils(TestHelper):
    def test_write_and_read_file(self):
        write_content = "Hello_world\n"
        filename = os.path.join(TestHelper.get_test_dir(), self.__class__.__name__ + "_test_write_and_read_file.txt")
        utils.FileUtils.write_string_to_file(write_content, filename)
        read_content = utils.FileUtils.read_string_from_file(filename)
        assert write_content == read_content

def test_ensure_removed_dir(tmpdir):
    d = tmpdir.mkdir('sub')
    assert d.check(dir=True)
    utils.FileUtils.ensure_removed(d.strpath)
    assert d.check(exists=False)
    utils.FileUtils.ensure_removed(d.strpath)

def test_ensure_removed_file(tmpdir):
    f = tmpdir.join('meow')
    f.write('wat')
    assert f.check(file=True)
    utils.FileUtils.ensure_removed(f.strpath)
    assert f.check(exists=False)
    utils.FileUtils.ensure_removed(f.strpath)

class TestJinjaUtils(TestHelper):
    def test_self_render(self):
        d1 = utils.YamlUtils.yaml_dict_from_string(test_conf_self_referencing)
        d2 = utils.JinjaUtils.dict_self_render(d1)
        d3 = utils.YamlUtils.yaml_dict_from_string(test_conf_self_rendered)
        assert utils.YamlUtils.yaml_dict_to_string(d2) == \
            utils.YamlUtils.yaml_dict_to_string(d3)

    def test_jinja_keyword_raise(self):
        try:
            utils.JinjaUtils._jinja_keyword_raise("message")
            assert False, "Should never get here"
        except Exception as e:
            assert e is not None

    def test_jinja_keyword_gen_names(self):
        l1 = utils.JinjaUtils._jinja_keyword_gen_names('prefix', 1)
        assert len(l1) == 1
        assert 'prefix' in l1

        l2 = utils.JinjaUtils._jinja_keyword_gen_names('prefix', 2)
        assert len(l2) == 2
        assert 'prefix-0001' in l2
        assert 'prefix-0002' in l2

    def test_mkpass(self):
        assert len(utils.JinjaUtils.mkpass(length=99)) == 99

    def test_keygen(self):
        comment = 'Hello how are you I\'m a turtle'
        try:
            priv, pub = utils.JinjaUtils.keygen(bits=1024, keytype='rsa', comment=comment)
        except sh.CommandNotFound:
            pytest.skip('ssh-keygen is not available')

        assert 'OPENSSH PRIVATE KEY' in priv
        assert pub.endswith(comment + '\n')

    def test_self_signed_cert_gen(self):
        # Test cert settings
        key_type = crypto.TYPE_RSA
        key_bits = 3072
        country = "US"
        state_province = "Alaska"
        locality = "Anchorage"
        org = "Test Org"
        org_unit = "Test Unit"
        common_name = "test.domain.com"
        subject_alt_names = ["DNS:*.sub.domain.com", "DNS:domain.top"]
        validity_days = 1 * 365

        # Create the cert
        priv_key, cert = utils.JinjaUtils.self_signed_cert_gen(
            key_type=key_type,
            key_bits=key_bits,
            country=country,
            state_province=state_province,
            locality=locality,
            org=org,
            org_unit=org_unit,
            common_name=common_name,
            subject_alt_names=subject_alt_names,  # alternative dns names list
            validity_days=validity_days)

        # Check taht the cert and priv_key have been created
        assert priv_key and len(priv_key) > 0
        assert cert and len(cert) > 0

        # Load the cert and read the details
        c = crypto.load_certificate(crypto.FILETYPE_PEM, cert)
        key = c.get_pubkey()
        subject = c.get_subject()

        # Read back and check the cert
        assert subject.C == country
        assert subject.ST == state_province
        assert subject.L == locality
        assert subject.O == org  # noqa: E741
        assert subject.OU == org_unit
        assert subject.CN == common_name
        assert key.type() == key_type
        assert key.bits() == key_bits
        c.get_extension(0) == ", ".join(subject_alt_names)

    @mock.patch.object(utils.os, 'urandom', return_value=b'0123456789012345')
    def test_ceph_key(self, mock_urandom):
        result = utils.JinjaUtils.ceph_key()

        # First, decode the base64
        raw_result = base64.b64decode(result.encode('ascii'))

        # Decompose into a header and a key
        hdr_struct = struct.Struct('<hiih')
        header = raw_result[:hdr_struct.size]
        key = raw_result[hdr_struct.size:]

        # Interpret the header
        _type, _secs, _nanosecs, key_len = hdr_struct.unpack(header)
        assert key_len == len(key)

        # Verify that the key is what it should be
        assert key == b'0123456789012345'

    def test_uuid(self):
        # Grab a UUID object
        uuid_value = uuid.uuid4()

        # Get the result of calling the uuid helper
        with mock.patch.object(utils.uuid, 'uuid4', return_value=uuid_value):
            result = utils.JinjaUtils.uuid()

        # Verify that it's what we expected
        assert result == str(uuid_value)

class TestStringUtils(TestHelper):
    def test_pad_str(self):
        assert utils.StringUtils.pad_str(" ", 2, "") == "  "
        assert utils.StringUtils.pad_str(" ", 3, "  ") == "     "
        assert utils.StringUtils.pad_str("  ", 3, " ") == "       "
        assert utils.StringUtils.pad_str("aa", 2, "") == "aaaa"

class TestTypeUtils(TestHelper):

    scenarios = [
        ('none', dict(text=None, expect=False)),
        ('empty', dict(text='', expect=False)),
        ('junk', dict(text='unlikely', expect=False)),
        ('no', dict(text='no', expect=False)),
        ('yes', dict(text='yes', expect=True)),
        ('0', dict(text='0', expect=False)),
        ('1', dict(text='1', expect=False)),
        ('True', dict(text='True', expect=True)),
        ('False', dict(text='False', expect=False)),
        ('true', dict(text='true', expect=True)),
        ('false', dict(text='false', expect=False)),
        ('shouty', dict(text='TRUE', expect=True)),
    ]

    def test_str_to_bool(self):
        for scenario_name, scenario in TestTypeUtils.scenarios:
            input_text = scenario['text']
            expected_result = scenario['expect']
            calculated_result = utils.TypeUtils.str_to_bool(input_text)
            assert expected_result == calculated_result

class TestYamlUtils(TestHelper):
    def test_write_and_read_string(self):
        dict1 = utils.YamlUtils.yaml_dict_from_string(test_conf_self_rendered)
        str1 = utils.YamlUtils.yaml_dict_to_string(dict1)
        dict2 = utils.YamlUtils.yaml_dict_from_string(str1)
        str2 = utils.YamlUtils.yaml_dict_to_string(dict2)
        assert str1 == str2

    def test_write_and_read_file(self):
        filename = os.path.join(TestHelper.get_test_dir(), self.__class__.__name__ + "_test_write_and_read_file.txt")
        dict1 = utils.YamlUtils.yaml_dict_from_string(test_conf_self_rendered)
        utils.YamlUtils.yaml_dict_to_file(dict1, filename)
        dict2 = utils.YamlUtils.yaml_dict_from_file(filename)
        str1 = utils.YamlUtils.yaml_dict_to_string(dict1)
        str2 = utils.YamlUtils.yaml_dict_to_string(dict2)
        assert str1 == str2


text:
package org.jboss.resteasy.client.jaxrs.internal.proxy.extractors;

import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashMap;

/**
 * This class represents the proxying functionality for creating a
 * "rich response object" that has the @ResponseObject annotation. The method
 * implementations ware created in ResponseObjectEntityExtractorFactory
 *
 * @author Solomon Duskis
 * @version $Revision: 1 $
 * @see EntityExtractor , ResponseObjectEntityExtractorFactory
 */

@SuppressWarnings("unchecked")
public class ResponseObjectProxy<T> implements EntityExtractor
{
   private Class<T> returnType;
   private HashMap<Method, EntityExtractor<?>> methodHandlers;

   public ResponseObjectProxy(Method method, EntityExtractorFactory extractorFactory)
   {
      this.returnType = (Class<T>) method.getReturnType();
      this.methodHandlers = new HashMap<Method, EntityExtractor<?>>();
      for (Method interfaceMethod : this.returnType.getMethods())
      {
         this.methodHandlers.put(interfaceMethod, extractorFactory.createExtractor(interfaceMethod));
      }
   }

   public Object extractEntity(ClientContext context, Object... args)
   {
      Class<?>[] intfs = {returnType};
      ClientResponseProxy clientProxy = new ClientResponseProxy(context, methodHandlers, returnType);
      return Proxy.newProxyInstance(returnType.getClassLoader(), intfs, clientProxy);
   }

}


text:
skmanager
=========

Suicide Kings loot list manager

Cloud Foundry Setup
-------------------

Start by setting up your account on [Pivotal's Cloud Foundry](http://run.pivotal.io). Deploy the application once (following the directions below) to setup the environment then create your datasource service (postgres by default) and bind it to the app.  Make sure to note the service name as you'll need it later.

Edit ```build.gradle```

    def cf_username = 'user@example.com' // <--- CHANGE THIS!!
    def cf_password = 's3cr3t'           // <--- CHANGE THIS!!
    def cf_space = 'development' // Change this to your space name (optional)

Edit ```grails-app/conf/DataSource.groovy```

    def dbInfo = cloud.getServiceInfo('skmanager-db-postgres') // CHANGE THIS TO MATCH YOUR SERVICE NAME

Then execute the build script: ```./gradlew grails-clean grails-war cfPush```


text:
require File.expand_path('../../../shared/rational/Rational', __FILE__)

ruby_version_is ""..."1.9" do
  describe "Rational()" do
    it_behaves_like :kernel_Rational, :Rational
  end
end


text:
module EmberBootstrapRails
  class Engine < ::Rails::Engine
  end
end


text:
				Your day-to-day life - going out

				<fieldset class="inline">

					<legend class="form-label-bold" for="communicating">Do you need help to plan and follow a route to another place?</legend>

This includes help from a person, guide dog or specialist aid.

							<input id="communicating-yes" type="radio" name="communicating" value="Yes">
							Yes

							<input id="communicating-no" type="radio" name="communicating" value="No">
							No

				</fieldset>

					<fieldset class="inline">

							<legend class="form-label-bold" for="aids-appliances">Do you need help from another person to plan a route to somewhere you know?</legend>

								<input id="aids-appliances-yes" type="radio" name="aids-appliances" value="Yes">
								Yes

								<input id="aids-appliances-no" type="radio" name="aids-appliances" value="No">
								No

							Tell us about the type of help that you need and how much your need varys.
							<textarea type="text" class="form-control-3-4" id="aids-appliances-details-box"></textarea>

					</fieldset>

					<fieldset class="inline">

							Do you need help from another person, guide dog or specialist aid to get to a location that is unfamiliar to you?

								<input id="another-person-yes" type="radio" name="another-person" value="Yes">
								Yes

								<input id="another-person-no" type="radio" name="another-person" value="No">
								No

							Tell us more about the help you need and how much it varys.
							<textarea type="text" class="form-control-3-4" id="another-person-details-box"></textarea>

					</fieldset>

				<fieldset class="inline">

					<legend class="form-label-bold add-padding" for="anxiety">Are you unable to leave the house because of severe anxiety or distress?</legend>

							<input id="anxiety-yes" type="radio" name="anxiety" value="Yes">
							Yes

							<input id="anxiety-no" type="radio" name="anxiety" value="No">
							No

				</fieldset>

					Tell us more about the anxiety or stress you suffer from before, during and after leaving the house.
					<textarea type="text" class="form-control-3-4" id="another-person-details-box"></textarea>

					<input type="submit" class="button" value="Continue">

				<button class="button">Save</button>


text:
package org.apache.camel.impl;
import java.util.Map;

import org.apache.camel.NoSuchBeanException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class SimpleRegistryTest extends Assert {

    private SimpleRegistry registry;

    @Before
    public void setUp() throws Exception {
        registry = new SimpleRegistry();
        registry.put("a", "b");
        registry.put("c", 1);
    }

    @Test
    public void testLookupByName() {
        assertEquals("b", registry.lookupByName("a"));
    }

    @Test
    public void testLookupByWrongName() {
        assertNull(registry.lookupByName("x"));
    }

    @Test
    public void testLookupByNameAndType() {
        assertEquals("b", registry.lookupByNameAndType("a", String.class));
    }

    @Test
    public void testLookupByNameAndWrongType() {
        try {
            registry.lookupByNameAndType("a", Float.class);
            fail();
        } catch (NoSuchBeanException e) {
            // expected
            assertEquals("a", e.getName());
            assertTrue(e.getMessage().endsWith("of type: java.lang.String expected type was: class java.lang.Float"));
        }
    }

    @Test
    public void testLookupByType() {
        Map<?, ?> map = registry.findByTypeWithName(String.class);
        assertEquals(1, map.size());
        assertEquals("b", map.get("a"));
        map = registry.findByTypeWithName(Object.class);
        assertEquals(2, map.size());
        assertEquals("b", map.get("a"));
        assertEquals(1, map.get("c"));
    }

    @Test
    public void testLookupByWrongType() {
        Map<?, ?> map = registry.findByTypeWithName(Float.class);
        assertEquals(0, map.size());
    }

}