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

<title>Cassandra (apache-cassandra API)</title>
<meta name="date" content="2016-04-09">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

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.apache.cassandra.thrift

Class Cassandra

java.lang.Object

org.apache.cassandra.thrift.Cassandra

public class Cassandra
extends java.lang.Object

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

static class
Cassandra.add_args

static class
Cassandra.add_result

static class
Cassandra.AsyncClient

static interface
Cassandra.AsyncIface

static class
Cassandra.AsyncProcessor<I extends Cassandra.AsyncIface>

static class
Cassandra.atomic_batch_mutate_args

static class
Cassandra.atomic_batch_mutate_result

static class
Cassandra.batch_mutate_args

static class
Cassandra.batch_mutate_result

static class
Cassandra.cas_args

static class
Cassandra.cas_result

static class
Cassandra.Client

static class
Cassandra.describe_cluster_name_args

static class
Cassandra.describe_cluster_name_result

static class
Cassandra.describe_keyspace_args

static class
Cassandra.describe_keyspace_result

static class
Cassandra.describe_keyspaces_args

static class
Cassandra.describe_keyspaces_result

static class
Cassandra.describe_local_ring_args

static class
Cassandra.describe_local_ring_result

static class
Cassandra.describe_partitioner_args

static class
Cassandra.describe_partitioner_result

static class
Cassandra.describe_ring_args

static class
Cassandra.describe_ring_result

static class
Cassandra.describe_schema_versions_args

static class
Cassandra.describe_schema_versions_result

static class
Cassandra.describe_snitch_args

static class
Cassandra.describe_snitch_result

static class
Cassandra.describe_splits_args

static class
Cassandra.describe_splits_ex_args

static class
Cassandra.describe_splits_ex_result

static class
Cassandra.describe_splits_result

static class
Cassandra.describe_token_map_args

static class
Cassandra.describe_token_map_result

static class
Cassandra.describe_version_args

static class
Cassandra.describe_version_result

static class
Cassandra.execute_cql_query_args

static class
Cassandra.execute_cql_query_result

static class
Cassandra.execute_cql3_query_args

static class
Cassandra.execute_cql3_query_result

static class
Cassandra.execute_prepared_cql_query_args

static class
Cassandra.execute_prepared_cql_query_result

static class
Cassandra.execute_prepared_cql3_query_args

static class
Cassandra.execute_prepared_cql3_query_result

static class
Cassandra.get_args

static class
Cassandra.get_count_args

static class
Cassandra.get_count_result

static class
Cassandra.get_indexed_slices_args

static class
Cassandra.get_indexed_slices_result

static class
Cassandra.get_multi_slice_args

static class
Cassandra.get_multi_slice_result

static class
Cassandra.get_paged_slice_args

static class
Cassandra.get_paged_slice_result

static class
Cassandra.get_range_slices_args

static class
Cassandra.get_range_slices_result

static class
Cassandra.get_result

static class
Cassandra.get_slice_args

static class
Cassandra.get_slice_result

static interface
Cassandra.Iface

static class
Cassandra.insert_args

static class
Cassandra.insert_result

static class
Cassandra.login_args

static class
Cassandra.login_result

static class
Cassandra.multiget_count_args

static class
Cassandra.multiget_count_result

static class
Cassandra.multiget_slice_args

static class
Cassandra.multiget_slice_result

static class
Cassandra.prepare_cql_query_args

static class
Cassandra.prepare_cql_query_result

static class
Cassandra.prepare_cql3_query_args

static class
Cassandra.prepare_cql3_query_result

static class
Cassandra.Processor<I extends Cassandra.Iface>

static class
Cassandra.remove_args

static class
Cassandra.remove_counter_args

static class
Cassandra.remove_counter_result

static class
Cassandra.remove_result

static class
Cassandra.set_cql_version_args

static class
Cassandra.set_cql_version_result

static class
Cassandra.set_keyspace_args

static class
Cassandra.set_keyspace_result

static class
Cassandra.system_add_column_family_args

static class
Cassandra.system_add_column_family_result

static class
Cassandra.system_add_keyspace_args

static class
Cassandra.system_add_keyspace_result

static class
Cassandra.system_drop_column_family_args

static class
Cassandra.system_drop_column_family_result

static class
Cassandra.system_drop_keyspace_args

static class
Cassandra.system_drop_keyspace_result

static class
Cassandra.system_update_column_family_args

static class
Cassandra.system_update_column_family_result

static class
Cassandra.system_update_keyspace_args

static class
Cassandra.system_update_keyspace_result

static class
Cassandra.trace_next_query_args

static class
Cassandra.trace_next_query_result

static class
Cassandra.truncate_args

static class
Cassandra.truncate_result

Constructor Summary

Constructors

Constructor and Description

Cassandra()

Method Summary

Methods inherited from class java.lang.Object

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

Constructor Detail

Cassandra

public Cassandra()

Skip navigation links

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

Copyright © 2016 The Apache Software Foundation


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

namespace Toxy
{
    public class DateTimeParser
    {

        private static Hashtable ZoneTable;

        private static string[][] TimeZones = new string[][] {
            new string[] {"ACDT", "+1030", "Australian Central Daylight"},
            new string[] {"ACST", "+0930", "Australian Central Standard"},
            new string[] {"ADT", "-0300", "(US) Atlantic Daylight"},
            new string[] {"AEDT", "+1100", "Australian East Daylight"},
            new string[] {"AEST", "+1000", "Australian East Standard"},
            new string[] {"AHDT", "-0900", ""},
            new string[] {"AHST", "-1000", ""},
            new string[] {"AST", "-0400", "(US) Atlantic Standard"},
            new string[] {"AT", "-0200", "Azores"},
            new string[] {"AWDT", "+0900", "Australian West Daylight"},
            new string[] {"AWST", "+0800", "Australian West Standard"},
            new string[] {"BAT", "+0300", "Bhagdad"},
            new string[] {"BDST", "+0200", "British Double Summer"},
            new string[] {"BET", "-1100", "Bering Standard"},
            new string[] {"BST", "-0300", "Brazil Standard"},
            new string[] {"BT", "+0300", "Baghdad"},
            new string[] {"BZT2", "-0300", "Brazil Zone 2"},
            new string[] {"CADT", "+1030", "Central Australian Daylight"},
            new string[] {"CAST", "+0930", "Central Australian Standard"},
            new string[] {"CAT", "-1000", "Central Alaska"},
            new string[] {"CCT", "+0800", "China Coast"},
            new string[] {"CDT", "-0500", "(US) Central Daylight"},
            new string[] {"CED", "+0200", "Central European Daylight"},
            new string[] {"CET", "+0100", "Central European"},
            new string[] {"CEST", "+0200", "Central European Summer Time (Daylight Saving Time)"},
            new string[] {"CST", "-0600", "(US) Central Standard"},
            new string[] {"CENTRAL", "-0600", "(US) Central Standard"},
            new string[] {"EAST", "+1000", "Eastern Australian Standard"},
            new string[] {"EDT", "-0400", "(US) Eastern Daylight"},
            new string[] {"EED", "+0300", "Eastern European Daylight"},
            new string[] {"EET", "+0200", "Eastern Europe"},
            new string[] {"EEST", "+0300", "Eastern Europe Summer"},
            new string[] {"EST", "-0500", "(US) Eastern Standard"},
            new string[] {"EASTERN", "-0500", "(US) Eastern Standard"},
            new string[] {"FST", "+0200", "French Summer"},
            new string[] {"FWT", "+0100", "French Winter"},
            new string[] {"GMT", "-0000", "Greenwich Mean"},
            new string[] {"GST", "+1000", "Guam Standard"},
            new string[] {"HDT", "-0900", "Hawaii Daylight"},
            new string[] {"HST", "-1000", "Hawaii Standard"},
            new string[] {"IDLE", "+1200", "Internation Date Line East"},
            new string[] {"IDLW", "-1200", "Internation Date Line West"},
            new string[] {"IST", "+0530", "Indian Standard"},
            new string[] {"IT", "+0330", "Iran"},
            new string[] {"JST", "+0900", "Japan Standard"},
            new string[] {"JT", "+0700", "Java"},
            new string[] {"MDT", "-0600", "(US) Mountain Daylight"},
            new string[] {"MED", "+0200", "Middle European Daylight"},
            new string[] {"MET", "+0100", "Middle European"},
            new string[] {"MEST", "+0200", "Middle European Summer"},
            new string[] {"MEWT", "+0100", "Middle European Winter"},
            new string[] {"MST", "-0700", "(US) Mountain Standard"},
            new string[] {"MOUNTAIN", "-0700", "(US) Mountain Standard"},
            new string[] {"MT", "+0800", "Moluccas"},
            new string[] {"NDT", "-0230", "Newfoundland Daylight"},
            new string[] {"NFT", "-0330", "Newfoundland"},
            new string[] {"NT", "-1100", "Nome"},
            new string[] {"NST", "+0630", "North Sumatra"},
            new string[] {"NZ", "+1100", "New Zealand "},
            new string[] {"NZST", "+1200", "New Zealand Standard"},
            new string[] {"NZDT", "+1300", "New Zealand Daylight "},
            new string[] {"NZT", "+1200", "New Zealand"},
            new string[] {"PDT", "-0700", "(US) Pacific Daylight"},
            new string[] {"PST", "-0800", "(US) Pacific Standard"},
            new string[] {"PACIFIC", "-0800", "(US) Pacific Standard"},
            new string[] {"ROK", "+0900", "Republic of Korea"},
            new string[] {"SAD", "+1000", "South Australia Daylight"},
            new string[] {"SAST", "+0900", "South Australia Standard"},
            new string[] {"SAT", "+0900", "South Australia Standard"},
            new string[] {"SDT", "+1000", "South Australia Daylight"},
            new string[] {"SST", "+0200", "Swedish Summer"},
            new string[] {"SWT", "+0100", "Swedish Winter"},
            new string[] {"USZ3", "+0400", "USSR Zone 3"},
            new string[] {"USZ4", "+0500", "USSR Zone 4"},
            new string[] {"USZ5", "+0600", "USSR Zone 5"},
            new string[] {"USZ6", "+0700", "USSR Zone 6"},
            new string[] {"UT", "-0000", "Universal Coordinated"},
            new string[] {"UTC", "-0000", "Universal Coordinated"},
            new string[] {"UZ10", "+1100", "USSR Zone 10"},
            new string[] {"WAT", "-0100", "West Africa"},
            new string[] {"WET", "-0000", "West European"},
            new string[] {"WST", "+0800", "West Australian Standard"},
            new string[] {"YDT", "-0800", "Yukon Daylight"},
            new string[] {"YST", "-0900", "Yukon Standard"},
            new string[] {"ZP4", "+0400", "USSR Zone 3"},
            new string[] {"ZP5", "+0500", "USSR Zone 4"},
            new string[] {"ZP6", "+0600", "USSR Zone 5"},
        };
        static DateTimeParser()
        {
            ZoneTable = new Hashtable(50);

            foreach (string[] TimeZone in TimeZones)
            {
                ZoneTable.Add(TimeZone[0], TimeZone[1]);
            }
        }
        public static DateTime Parse(string StrDate)
        {
            DateTime ConvertedDate;

            try
            {
                if (StrDate.LastIndexOf("+") > 0 || StrDate.LastIndexOf("-") > 0)
                {
                    int braceStart = StrDate.LastIndexOf("(");
                    if (braceStart > 0 && StrDate.IndexOf(")", braceStart) > 0)
                    {
                        StrDate = StrDate.Substring(0, braceStart); //replace (Timezone) string to ""
                    }
                }

                ConvertedDate = DateTime.Parse(StrDate, CultureInfo.InvariantCulture);
                // just a plain date
                return ConvertedDate;
            }
            catch (FormatException)
            {

                // try finding a timezone in the date
                int TZstart = StrDate.LastIndexOf(" ");

                if (TZstart>0)
                {
                    string TZstr = StrDate.Substring(TZstart + 1); // +1 to avoid the space character
                    string TZvalue = ZoneTable[TZstr] as string;

                    // its a timezone problem ...
                    if (TZvalue != null)
                    {
                        // replace timezone name with actual hours (AEST = +1000)
                        string NewDateStr = StrDate.Replace(TZstr, TZvalue);

                            ConvertedDate = DateTime.Parse(NewDateStr, CultureInfo.InvariantCulture);

                            // success this time
                            return ConvertedDate;

                    }

                }
            }
            throw new FormatException("invalid datetime string: "+StrDate);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import math
import re

def make_list_of_string(string_list):
    """ Makes a list of a string that is made like a list

    :param string_list: a string written in listchar
    :return: a list of the strings
    """

    new_list = re.sub("\[|\]|,|'", '', string_list)
    return new_list.split(' ')

def find_tweets_with_keywords(tweets, keywords, combination=1):
    """ Tries to find tweets that have at least one of the keywords in them
    :param tweets: The to be checked tweets
    :param article: The article
    :param combination: The minimal number of keywords that need to be in the tweet to select it
    :return: A list of the ids that are in the article
    """

    article_tweets = []

    for tweet in tweets:
        combi_number = 0
        for keyword in keywords:
            tweet_keywords = tweet.get_keywords()
            if keyword in tweet_keywords:
                combi_number += 1
            if combi_number == combination:
                article_tweets.append(tweet)
                break

    return article_tweets

def find_tweets_with_keywords_idf(tweets, keywords, idf, idf_treshold=5):
    """ Tries to find tweets that have at least one of the keywords in them
    :param tweets: The to be checked tweets
    :param article: The article
    :param idf_treshold: The minimal som of mathing idf values that need to be in the tweet to select it
    :return: A list of the [idf_sum, tweet] that are related to the article
    """
    article_tweets_idfs = []
    for tweet in tweets:
        idf_sum = 0
        p = False
        for keyword in keywords:
            tweet_keywords = tweet.get_keywords()
            if keyword in tweet_keywords:
                if keyword not in idf:
                    print("Could not find idf value of %s" % idf)
                    idf_sum += 3
                else:
                    idf_sum += idf[keyword]
            if idf_sum >= idf_treshold:
                p = True
        if p:
            article_tweets_idfs.append((idf_sum, tweet, ))
    return article_tweets_idfs

def cluster_tweets_by_time(tweets, time):
    """ Clusters the tweets by time
    :param tweets: A list of tweets
    :param time: The time tho cluster the tweets (int)
    :return: A listed list of tweets
    """

    min_time = int(tweets[1]['n_unicode'])
    max_time = int(tweets[1]['n_unicode'])
    for tweet in tweets:
        if int(tweet['n_unicode']) < min_time:
            min_time = int(tweet['n_unicode'])
        elif int(tweet['n_unicode']) > max_time:
            max_time = int(tweet['n_unicode'])

    time_span = max_time - min_time

    clusters = []

    for i in range(math.ceil(time_span / time)):
        clusters.append([])

    for tweet in tweets:
        index = math.floor((int(tweet['n_unicode']) - min_time) / time)
        clusters[index].append(tweet)

    return clusters


text:
module.exports = function(context, options) {
  if(context.page && context['building-blocks'][context.page]) {
    context.block = context['building-blocks'][context.page];
    return options.fn(context);
  } else {
    return options.fn(context);
  }
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Icon. Pl. 2: t. 168. 1837

#### Original name
null

### Remarks
null


text:
package io.oasp.gastronomy.restaurant.offermanagement.logic.api.usecase;

import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.OfferCto;
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.OfferEto;
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.OfferFilter;
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.OfferSearchCriteriaTo;
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.OfferSortBy;
import io.oasp.module.jpa.common.api.to.PaginatedListTo;

import java.util.List;

/**
 * Interface of UcFindOffer to centralize documentation and signatures of methods.
 *
 * @author mbrunnli
 * @since dev
 */
public interface UcFindOffer {

  /**
   * Gets an {@link OfferEto} using its entity identifier.
   *
   * @param id is the {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Offer#getId() offer ID}.
   * @return the requested {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Offer} or {@code null} if no
   *         such {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Offer} exists.
   */
  OfferEto findOffer(Long id);

  /**
   * Gets an {@link OfferCto} using its entity identifier.
   *
   * @param id is the {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Offer#getId() offer ID}.
   * @return the requested {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Offer} or {@code null} if no
   *         such {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Offer} exists.
   */
  OfferCto findOfferCto(Long id);

  /**
   * @return the {@link List} with all available {@link OfferEto}s.
   */
  List<OfferEto> findAllOffers();

  /**
   * Returns a list of offers matching the search criteria.
   *
   * @param criteria the {@link OfferSearchCriteriaTo}.
   * @return the {@link List} of matching {@link OfferEto}s.
   */
  PaginatedListTo<OfferEto> findOfferEtos(OfferSearchCriteriaTo criteria);

  /**
   * @param offerFilterBo is the {@link OfferFilter offers filter criteria}
   * @param sortBy is the {@link OfferSortBy} attribute, which defines the sorting.
   * @return the {@link List} with all {@link OfferEto}s that match the {@link OfferFilter} criteria.
   */
  List<OfferEto> findOffersFiltered(OfferFilter offerFilterBo, OfferSortBy sortBy);

}


text:
angular.module('showpadHighcharts.services')
    .factory('SplineChartConfig', ['showpadHighcharts.config', 'BaseChartConfig', 'utils', function (config, BaseChartConfig, utils) {

        var defaultConfig = {
            chart: {
                type: 'spline'
            }
        };

        var SplineChartConfig = function SplineChartConfig(config) {

            // Call parent constructor
            BaseChartConfig.call(this, arguments);

            // Deep extend
            utils.extend(true, this, defaultConfig, config);
        };

        // Initialize prototype as new object who's prototype is the BaseCharConfig prototype
        SplineChartConfig.prototype = new (angular.extend(
            function () {
            },
            {
                prototype: BaseChartConfig.prototype
            }
        ))();

        return SplineChartConfig;
    }]);


text:
<?php

namespace GuzzleHttp\Command\Guzzle\RequestLocation;

use GuzzleHttp\Command\Guzzle\GuzzleCommandInterface;
use GuzzleHttp\Command\Guzzle\Parameter;
use GuzzleHttp\Message\RequestInterface;
use GuzzleHttp\Stream\Stream;

/**
 * Adds a body to a request
 */
class BodyLocation extends AbstractLocation
{
    public function visit(
        GuzzleCommandInterface $command,
        RequestInterface $request,
        Parameter $param,
        array $context
    ) {
        $value = $command[$param->getName()];
        $request->setBody(Stream::factory($param->filter($value)));
    }
}


text:
package org.apache.camel.component.google.calendar;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Random;

import com.google.api.services.calendar.model.Calendar;

import org.apache.camel.CamelContext;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.camel.util.IntrospectionSupport;
import org.junit.After;
import org.junit.Before;

/**
 * Abstract base class for GoogleCalendar Integration tests generated by Camel
 * API component maven plugin.
 */
public class AbstractGoogleCalendarTestSupport extends CamelTestSupport {

    private static final String TEST_OPTIONS_PROPERTIES = "/test-options.properties";
    private Calendar calendar;

    @Before
    public void createTestCalendar() {
        Calendar calendar = new Calendar();
        Random rand = new Random();

        calendar.setSummary("camel-calendar-" + rand.nextInt());
        calendar.setTimeZone("America/St_Johns");

        this.calendar = requestBody("google-calendar://calendars/insert?inBody=content", calendar);
    }

    @After
    public void deleteTestCalendar() {
        try {
            if (calendar != null) {
                requestBody("google-calendar://calendars/delete?inBody=calendarId", getCalendar().getId());
                setCalendar(null);
            }
        } catch (Exception e) {
        }
    }

    @Override
    protected CamelContext createCamelContext() throws Exception {

        final CamelContext context = super.createCamelContext();

        // read GoogleCalendar component configuration from
        // TEST_OPTIONS_PROPERTIES
        final Properties properties = new Properties();
        try {
            properties.load(getClass().getResourceAsStream(TEST_OPTIONS_PROPERTIES));
        } catch (Exception e) {
            throw new IOException(String.format("%s could not be loaded: %s", TEST_OPTIONS_PROPERTIES, e.getMessage()), e);
        }

        Map<String, Object> options = new HashMap<String, Object>();
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            options.put(entry.getKey().toString(), entry.getValue());
        }

        final GoogleCalendarConfiguration configuration = new GoogleCalendarConfiguration();
        IntrospectionSupport.setProperties(configuration, options);

        // add GoogleCalendarComponent to Camel context
        final GoogleCalendarComponent component = new GoogleCalendarComponent(context);
        component.setConfiguration(configuration);
        context.addComponent("google-calendar", component);

        return context;
    }

    @Override
    public boolean isCreateCamelContextPerClass() {
        // only create the context once for this class
        return true;
    }

    @SuppressWarnings("unchecked")
    protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws CamelExecutionException {
        return (T) template().requestBodyAndHeaders(endpointUri, body, headers);
    }

    @SuppressWarnings("unchecked")
    protected <T> T requestBody(String endpoint, Object body) throws CamelExecutionException {
        return (T) template().requestBody(endpoint, body);
    }

    public Calendar getCalendar() {
        if (calendar == null) {
            createTestCalendar();
        }
        return calendar;
    }

    public void setCalendar(Calendar calendar) {
        this.calendar = calendar;
    }
}


text:
/*
 * 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.
 */
package io.trino.hdfs;

import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.net.HostAndPort;
import com.google.common.primitives.Shorts;
import io.airlift.configuration.Config;
import io.airlift.configuration.ConfigDescription;
import io.airlift.configuration.validation.FileExists;
import io.airlift.units.Duration;
import io.airlift.units.MinDuration;
import org.apache.hadoop.fs.permission.FsPermission;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import java.io.File;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;

import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.lang.Integer.parseUnsignedInt;
import static java.util.Objects.requireNonNull;

public class HdfsConfig
{
    public static final String SKIP_DIR_PERMISSIONS = "skip";
    private static final Splitter SPLITTER = Splitter.on(',').trimResults().omitEmptyStrings();

    private List<File> resourceConfigFiles = ImmutableList.of();
    private String newDirectoryPermissions = "0777";
    private boolean newFileInheritOwnership;
    private boolean verifyChecksum = true;
    private Duration ipcPingInterval = new Duration(10, TimeUnit.SECONDS);
    private Duration dfsTimeout = new Duration(60, TimeUnit.SECONDS);
    private Duration dfsConnectTimeout = new Duration(500, TimeUnit.MILLISECONDS);
    private int dfsConnectMaxRetries = 5;
    private Duration dfsKeyProviderCacheTtl = new Duration(30, TimeUnit.MINUTES);
    private String domainSocketPath;
    private HostAndPort socksProxy;
    private boolean wireEncryptionEnabled;
    private int fileSystemMaxCacheSize = 1000;
    private Integer dfsReplication;

    @NotNull
    public List<@FileExists File> getResourceConfigFiles()
    {
        return resourceConfigFiles;
    }

    @Config("hive.config.resources")
    public HdfsConfig setResourceConfigFiles(String files)
    {
        this.resourceConfigFiles = SPLITTER.splitToList(files).stream()
                .map(File::new)
                .collect(toImmutableList());
        return this;
    }

    public HdfsConfig setResourceConfigFiles(List<File> files)
    {
        this.resourceConfigFiles = ImmutableList.copyOf(files);
        return this;
    }

    public Optional<FsPermission> getNewDirectoryFsPermissions()
    {
        if (newDirectoryPermissions.equalsIgnoreCase(HdfsConfig.SKIP_DIR_PERMISSIONS)) {
            return Optional.empty();
        }
        return Optional.of(FsPermission.createImmutable(Shorts.checkedCast(parseUnsignedInt(newDirectoryPermissions, 8))));
    }

    @Pattern(regexp = "(skip)|0[0-7]{3}", message = "must be either 'skip' or an octal number, with leading 0")
    public String getNewDirectoryPermissions()
    {
        return this.newDirectoryPermissions;
    }

    @Config("hive.fs.new-directory-permissions")
    @ConfigDescription("File system permissions for new directories")
    public HdfsConfig setNewDirectoryPermissions(String newDirectoryPermissions)
    {
        this.newDirectoryPermissions = requireNonNull(newDirectoryPermissions, "newDirectoryPermissions is null");
        return this;
    }

    public boolean isNewFileInheritOwnership()
    {
        return newFileInheritOwnership;
    }

    @Config("hive.fs.new-file-inherit-ownership")
    @ConfigDescription("File system permissions for new directories")
    public HdfsConfig setNewFileInheritOwnership(boolean newFileInheritOwnership)
    {
        this.newFileInheritOwnership = newFileInheritOwnership;
        return this;
    }

    public boolean isVerifyChecksum()
    {
        return verifyChecksum;
    }

    @Config("hive.dfs.verify-checksum")
    public HdfsConfig setVerifyChecksum(boolean verifyChecksum)
    {
        this.verifyChecksum = verifyChecksum;
        return this;
    }

    @NotNull
    @MinDuration("1ms")
    public Duration getIpcPingInterval()
    {
        return ipcPingInterval;
    }

    @Config("hive.dfs.ipc-ping-interval")
    public HdfsConfig setIpcPingInterval(Duration pingInterval)
    {
        this.ipcPingInterval = pingInterval;
        return this;
    }

    @NotNull
    @MinDuration("1ms")
    public Duration getDfsTimeout()
    {
        return dfsTimeout;
    }

    @Config("hive.dfs-timeout")
    public HdfsConfig setDfsTimeout(Duration dfsTimeout)
    {
        this.dfsTimeout = dfsTimeout;
        return this;
    }

    @MinDuration("1ms")
    @NotNull
    public Duration getDfsConnectTimeout()
    {
        return dfsConnectTimeout;
    }

    @Config("hive.dfs.connect.timeout")
    public HdfsConfig setDfsConnectTimeout(Duration dfsConnectTimeout)
    {
        this.dfsConnectTimeout = dfsConnectTimeout;
        return this;
    }

    @Min(0)
    public int getDfsConnectMaxRetries()
    {
        return dfsConnectMaxRetries;
    }

    @Config("hive.dfs.connect.max-retries")
    public HdfsConfig setDfsConnectMaxRetries(int dfsConnectMaxRetries)
    {
        this.dfsConnectMaxRetries = dfsConnectMaxRetries;
        return this;
    }

    @NotNull
    @MinDuration("0ms")
    public Duration getDfsKeyProviderCacheTtl()
    {
        return dfsKeyProviderCacheTtl;
    }

    @Config("hive.dfs.key-provider.cache-ttl")
    public HdfsConfig setDfsKeyProviderCacheTtl(Duration dfsClientKeyProviderCacheTtl)
    {
        this.dfsKeyProviderCacheTtl = dfsClientKeyProviderCacheTtl;
        return this;
    }

    public String getDomainSocketPath()
    {
        return domainSocketPath;
    }

    @Config("hive.dfs.domain-socket-path")
    public HdfsConfig setDomainSocketPath(String domainSocketPath)
    {
        this.domainSocketPath = domainSocketPath;
        return this;
    }

    public HostAndPort getSocksProxy()
    {
        return socksProxy;
    }

    @Config("hive.hdfs.socks-proxy")
    public HdfsConfig setSocksProxy(HostAndPort socksProxy)
    {
        this.socksProxy = socksProxy;
        return this;
    }

    public boolean isWireEncryptionEnabled()
    {
        return wireEncryptionEnabled;
    }

    @Config("hive.hdfs.wire-encryption.enabled")
    @ConfigDescription("Should be turned on when HDFS wire encryption is enabled")
    public HdfsConfig setWireEncryptionEnabled(boolean wireEncryptionEnabled)
    {
        this.wireEncryptionEnabled = wireEncryptionEnabled;
        return this;
    }

    public int getFileSystemMaxCacheSize()
    {
        return fileSystemMaxCacheSize;
    }

    @Config("hive.fs.cache.max-size")
    @ConfigDescription("Hadoop FileSystem cache size")
    public HdfsConfig setFileSystemMaxCacheSize(int fileSystemMaxCacheSize)
    {
        this.fileSystemMaxCacheSize = fileSystemMaxCacheSize;
        return this;
    }

    @Min(1)
    public Integer getDfsReplication()
    {
        return dfsReplication;
    }

    @Config("hive.dfs.replication")
    @ConfigDescription("Hadoop FileSystem replication factor")
    public HdfsConfig setDfsReplication(Integer dfsReplication)
    {
        this.dfsReplication = dfsReplication;
        return this;
    }
}


text:
import youplay
import unittest

class YouPlayTest(unittest.TestCase):

    def test_no_artist_no_track(self):
        # https://www.youtube.com/watch?v=q_NspcNZjLM
        # Nirvana - Smells Like Teen Spirit
        (artists, tracks) = youplay.extract('q_NspcNZjLM')
        self.assertEqual(len(artists), 1)
        self.assertEqual(len(tracks), 1)
        self.assertEqual(artists[0].mid, '/m/0b1zz')
        self.assertEqual(tracks[0].mid, '/m/0dt1wtv')
        return

    def test_no_artist_one_track(self):
        # Need more data
        return

    def test_no_artist_multiple_tracks(self):
        # Need more data
        return

    def test_one_artist_no_track(self):
        # https://www.youtube.com/watch?v=lidFipyLG8k
        # Jerry Lee Lewis - Great Balls of Fire
        (artists, tracks) = youplay.extract('lidFipyLG8k')
        self.assertEqual(len(artists), 1)
        self.assertEqual(len(tracks), 1)
        self.assertEqual(artists[0].mid, '/m/0p7h7')
        self.assertEqual(tracks[0].mid, '/m/0ldg06')
        # https://www.youtube.com/watch?v=3y6oWTigBu0
        # Agnostic Front - Victim in Pain
        (artists, tracks) = youplay.extract('3y6oWTigBu0')
        self.assertEqual(len(artists), 1)
        self.assertEqual(len(tracks), 1)
        self.assertEqual(artists[0].mid, '/m/022tqm')
        self.assertEqual(tracks[0].mid, '/m/0wwyj5')
        return

    def test_one_artist_one_track(self):
        # https://www.youtube.com/watch?v=c-_vFlDBB8A
        # Dropkick Murphys - Worker's Song
        (artists, tracks) = youplay.extract('c-_vFlDBB8A')
        self.assertEqual(len(artists), 1)
        self.assertEqual(len(tracks), 1)
        self.assertEqual(artists[0].mid, '/m/02t3ln')
        self.assertEqual(tracks[0].mid, '/m/0qgggv')
        # https://www.youtube.com/watch?v=pAOQkSFTKMw
        # The Rolling Stones - Let's Spend the Night Together
        (artists, tracks) = youplay.extract('pAOQkSFTKMw')
        self.assertEqual(len(artists), 1)
        self.assertEqual(len(tracks), 1)
        self.assertEqual(artists[0].mid, '/m/07mvp')
        self.assertEqual(tracks[0].mid, '/m/0rmqd9')
        return

    def test_one_artist_multiple_tracks(self):
        # Need more data
        return

    def test_multiple_artists_no_track(self):
        # https://www.youtube.com/watch?v=3fIqq5XVFKQ
        # Nirvana - Lithium
        (artists, tracks) = youplay.extract('3fIqq5XVFKQ')
        self.assertEqual(len(artists), 1)
        self.assertEqual(len(tracks), 1)
        self.assertEqual(artists[0].mid, '/m/0b1zz')
        self.assertEqual(tracks[0].mid, '/m/0vwkfq')
        # https://www.youtube.com/watch?v=6W_joHLBr5k
        # Blondie - Atomic
        (artists, tracks) = youplay.extract('6W_joHLBr5k')
        self.assertEqual(len(artists), 1)
        self.assertEqual(len(tracks), 1)
        self.assertEqual(artists[0].mid, '/m/017lb_')
        self.assertEqual(tracks[0].mid, '/m/0_k5sk')
        return

    def test_multiple_artists_one_track(self):
        # https://www.youtube.com/watch?v=zYxkezUr8MQ
        # Nirvana - Smells Like Teen Spirit
        (artists, tracks) = youplay.extract('zYxkezUr8MQ')
        self.assertEqual(len(artists), 1)
        self.assertEqual(len(tracks), 1)
        self.assertEqual(artists[0].mid, '/m/0b1zz')
        self.assertEqual(tracks[0].mid, '/m/0nft9n')
        # https://www.youtube.com/watch?v=0UjsXo9l6I8
        # Jay-Z and Alicia Keys - Empire State of Mind
        (artists, tracks) = youplay.extract('0UjsXo9l6I8')
        self.assertEqual(len(artists), 2)
        self.assertEqual(len(tracks), 1)
        self.assertTrue('/m/01vw20h' in [a.mid for a in artists])
        self.assertTrue('/m/0g824' in [a.mid for a in artists])
        self.assertEqual(tracks[0].mid, '/m/0fvh4xz')
        # https://www.youtube.com/watch?v=sp7PBrYXD6c
        # RHCP and Snoop Dogg - Scar Tissue
        (artists, tracks) = youplay.extract('sp7PBrYXD6c')
        self.assertEqual(len(artists), 2)
        self.assertEqual(len(tracks), 1)
        self.assertTrue('/m/06mj4' in [a.mid for a in artists])
        self.assertTrue('/m/01vw8mh' in [a.mid for a in artists])
        self.assertEqual(tracks[0].mid, '/m/0tw82f')
        return

    def test_multiple_artists_multiple_tracks(self):
        # Need more data
        return

if __name__ == '__main__':
    unittest.main()


text:
package com.google.gwt.sample.stockwatcher.client;

import java.io.Serializable;

public class DelistedException extends Exception implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = 9217289749063979133L;
	private String symbol;

	public DelistedException() {
	}

	public DelistedException(String symbol) {
		this.symbol = symbol;
	}

	public String getSymbol() {
		return this.symbol;
	}
}


text:
function AddCustomDateFilterBtn(){
    var label='Date Range: ';
    var button='Apply Filter';
    var fields='<input type="text" id="start" placeholder="Start Date" /><input type="text" id="end" placeholder="End Date" />';
    var tpl = label+fields+button;
    $('controls-top').insertAdjacentHTML("beforeend", tpl);

    var picker = new Pikaday({
        field: document.getElementById('start'),
        firstDay: 1,
        minDate: new Date('2006-01-01'),
        format:'L',
        yearRange: [2006,2037],
        onSelect: function() {
            picker2.setMinDate(this.getDate());
            $('start').value=this.toString('L');
        }
    });
    var picker2 = new Pikaday({
        field: document.getElementById('end'),
        firstDay: 1,
        minDate: new Date('2006-01-01'),
        format:'L',
        yearRange: [2006,2037],
        onSelect: function() {
            picker.setMaxDate(this.getDate());
            $('end').value=this.toString('L');
        }
    });
}
function AddDateFilterBtn(el,description,filterCode){
    var title="Apply this date filter";
    var tpl='{1}';
    var btn=tpl.format(title,description,filterCode);
    el.insertAdjacentHTML("beforeend", btn);
}
function bindDateFilterHandlers(){
    document.querySelectorAll("a.date-range").forEach(function (el) {
        el.addEventListener("click", filterbByDate);
    });

    bindClearDateFilter("#search-clear");
    bindClearDateFilter("#search-date a");

}

function bindClearDateFilter(btn){
    document.querySelectorAll(btn).forEach(function (el) {
        el.addEventListener("click", function(){
            document.querySelectorAll('a.date-range.selected').forEach(function(node){
                node.classList.remove('selected');
            });
            window.location.hash="";
        });
    });
}
function filterbByDate(){
    var filterCode=this.getAttribute('data-filter');
    switch (filterCode){
        case "tw":
            SetFilter(getWeekRange(false));
            break;
        case "lw":
            SetFilter(getWeekRange(true));
            break;
        case "tm":
            SetFilter(getMonthRange(false));
            break;
        case "lm":
            SetFilter(getMonthRange(true));
            break;
        case "xy":
            SetFilter(getCustomRange());
            break;

    }
    document.querySelectorAll('a.date-range.selected').forEach(function(node){
        node.classList.remove('selected');
    });
    this.classList.add('selected');
}

function getCustomRange(){
    var start=$('start').value;
    var end = $('end').value;
    return {    startDate:start, endDate:end}
}

function getWeekRange(isLastWeek){
    var today=new Date();
    var deltaFactor=(today.getDay()==0)?-6:1;
    var monday= today.addDays(-(today.getDay()-deltaFactor));
    if(isLastWeek){monday=monday.addDays(-7);}
    var sunday= monday.addDays(6);
    return {    startDate:monday.toShortDateString(),    endDate:sunday.toShortDateString()}
}

function getMonthRange(isLastMonth){
    var dt = new Date();
    dt.setDate(1);
    if(isLastMonth){
        dt.setMonth(dt.getMonth()-1);
    }
    var first=dt.toShortDateString();
    var last=getLastDayOfMonth(dt).toShortDateString();
    return {    startDate:first,    endDate:last}
}

function getLastDayOfMonth(dt){
    return new Date(dt.getFullYear(), dt.getMonth()+1, 0);
}

function parseFilterFromUrl(){
    var thisHash=window.location.hash;

    var filter=null;
    if(thisHash.indexOf("#location")!=-1){
        //There is already a filter applied, we need to parse it and preserve it
        var location = decodeURIComponent(thisHash.replace('#location:', ''));
        filter = JSON.parse(location);
        filter.filterType = filter.typeFilter || '';
    }
    return filter
}

function SetFilter(objDates){
    var data=parseFilterFromUrl();
    //If period All was part of filter, remove this property, as it prevents date range from working
    if(data && data.period){   delete data.period;       }
    else {
        //Create default filter object
        data={};
        data.query="";
        data.offset=0;
        data.typeFilter="cash";
        data.typeSort=8;
    }
    //Inject our date filter
    data.startDate=objDates.startDate;
    data.endDate=objDates.endDate;
    var newHash="#location:"+encodeURIComponent(JSON.stringify(data));
    window.location.hash=newHash;

}

//Code to add date range buttons
(function () {
    if (window.location.href.indexOf('transaction.event') == -1) {    return;    }
    var target = document.getElementById('body-mint');
    var observer = new window.MutationObserver(function (mutations) {
        var transactionControls = $('controls-top');
        var hasButtons=document.querySelectorAll('a.date-range').length>0;
        if (transactionControls != undefined && !hasButtons ) {
            AddDateFilterBtn(transactionControls,"This Week","tw");
            AddDateFilterBtn(transactionControls,"Last Week","lw");
            AddDateFilterBtn(transactionControls,"This Month","tm");
            AddDateFilterBtn(transactionControls,"Last Month","lm");
            AddCustomDateFilterBtn();
            bindDateFilterHandlers();
            observer.hasTransactions=true;
            observer.disconnect();
        }
    });
    observer.observe(target, { childList: true, subtree: true });
})();


text:
/** @author Brian Cavalier */
/** @author John Hann */

/**
 * Sink that accepts functions to apply to each event, and to end, and error
 * signals.
 */
"use strict";

Object.defineProperty(exports, "__esModule", {
   value: true
});

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Observer = (function () {
   /**
    * @param {function(x:*):void} event function to be applied to each event
    * @param {function(x:*):void} end function to apply to end signal value.
    * @param {function(e:Error|*):void} error function to apply to error signal value.
    */

   function Observer(event, end, error) {
      _classCallCheck(this, Observer);

      this._event = event;
      this._end = end;
      this._error = error;
      this.active = true;
   }

   Observer.prototype.event = function event(t, x) {
      if (!this.active) {
         return;
      }
      this._event(x);
   };

   Observer.prototype.end = function end(t, x) {
      if (!this.active) {
         return;
      }
      this.active = false;
      this._end(x);
   };

   Observer.prototype.error = function error(t, e) {
      this.active = false;
      this._error(e);
   };

   return Observer;
})();

exports["default"] = Observer;
module.exports = exports["default"];


text:
package networking;

import crypto.Envelope;
import data.Message;
import data.SQLiteManager;
import data.User;
import data.contents.*;

import javax.crypto.SecretKey;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.security.KeyPair;
import java.security.PublicKey;
import java.util.ArrayList;
import java.util.Calendar;

/**
 * @author Gary
 * @version 2013/11/29
 *          This single server thread handles one single client.
 */
public class SChatServerThread extends Thread {
    private final SChatServer server;
    private Socket clientSocket;
    private User client;
    private SecretKey secretKey;
    private ObjectInputStream in;
    private ObjectOutputStream out;
    private SQLiteManager dbmanager;

    /**
     * Create a server thread, which will be handle a single client connected
     * to this server.
     *
     * @param clientSocket the socket of the client
     * @param server       the server
     * @throws IOException
     */
    public SChatServerThread(Socket clientSocket, SChatServer server) throws IOException {
        this.clientSocket = clientSocket;
        this.server = server;
        this.in = new ObjectInputStream(clientSocket.getInputStream());
        this.out = new ObjectOutputStream(clientSocket.getOutputStream());
        this.client = null;
        this.dbmanager = new SQLiteManager(SChatServer.SERVER_DB);
    }

    /**
     * Handle the login of the user and check whether it was successful or not.
     *
     * @param login the login data
     * @return whether the login of the user was successful or not
     */
    public boolean handleLogin(Login login) {
        if (server.findUser(login.getId())) {
            client = dbmanager.getUserFromGivenId(login.getId());
            server.addUser(client.getId(), out);

            sendStoredMessages();
            sendLoginSuccess(true);
            return true;
        } else {
            sendLoginSuccess(false);
            return false;
        }
    }

    /**
     * Sends to server whether the login was successful or not
     *
     * @param success
     */
    public void sendLoginSuccess(boolean success) {
        Message<LoginSuccess> pkResponse = new Message<>(Calendar.getInstance().getTime(), SChatServer.SERVER_ID,
                client.getId(), new LoginSuccess(success));
        PublicKey senderPk = dbmanager.getPublicKeyFromId(client.getId());
        sendEnvelope(new Envelope(pkResponse, secretKey, senderPk, server.getKeyPair().getPrivate()));
    }

    /**
     * Return whether the user is logged in or not.
     *
     * @return whether the user is logged in or not
     */
    public boolean isLoggedIn() {
        return client != null;
    }

    /**
     * Sends the stored messages to the user.
     * <p/>
     * The stored messages are the messages, that were not successfully sent to the user because of some
     * network error or because the user was offline at the sending time.
     * They are saved in the database and will be erased after being sent successfully.
     */
    public void sendStoredMessages() {
        ArrayList<Envelope> envelopes = dbmanager.loadEncryptedMessagesFromReceiver(client.getId());
        for (Envelope e : envelopes) {
            if (!sendEnvelope(e))
                break;
            dbmanager.removeEncryptedMessage(e);
        }
    }

    /**
     * Runs the main logic of this server
     */
    public void run() {
        boolean isRunning = true;
        while (isRunning) {
            try {
                Envelope envelope = (Envelope) in.readObject();
                this.secretKey = envelope.getUnwrappedKey(server.getKeyPair().getPrivate());

                switch (envelope.getType()) {
                    case CHAT_MESSAGE:
                        if (!isLoggedIn()) {
                            isRunning = false;
                        } else {
                            handleRedirecting(envelope);
                        }
                        break;
                    case LOGIN:
                        Message<Login> loginMessage = envelope.<Login>decryptMessage(secretKey, server.getKeyPair().getPublic());
                        if (!handleLogin(loginMessage.getContent()))
                            isRunning = false;
                        break;
                    case REGISTRATION:
                        if (!handleRegistration(envelope)) {
                            isRunning = false;
                        }
                        break;
                    case PUBLIC_KEY_REQUEST:
                        handlePublicKeyRequest(envelope);
                        break;
                }
            } catch (IOException e) {
                System.err.println("Connection to " + client + " closed.");
                isRunning = false;
            } catch (ClassNotFoundException e) {
                System.err.println("Class not found: " + e.getMessage());
            }
        }
        // Close and kill everything
        try {
            clientSocket.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        server.eraseUser(client.getId());
    }

    /**
     * Handles the public key request
     *
     * @param envelope
     */
    private void handlePublicKeyRequest(Envelope envelope) {
        secretKey = envelope.getUnwrappedKey(server.getKeyPair().getPrivate()); // Still needed in the first version.
        PublicKeyRequest pkRequest = envelope.<PublicKeyRequest>decryptMessage(secretKey, client.getPublicKey()).getContent();
        PublicKey requestPK = dbmanager.getPublicKeyFromId(pkRequest.getRequestId());
        Message<PublicKeyResponse> pkResponse = new Message<PublicKeyResponse>(Calendar.getInstance().getTime(), SChatServer.SERVER_ID,
                envelope.getSender(), new PublicKeyResponse(pkRequest.getRequestId(), requestPK));
        PublicKey senderPk = dbmanager.getPublicKeyFromId(envelope.getSender());
        sendEnvelope(new Envelope(pkResponse, secretKey, senderPk, server.getKeyPair().getPrivate()));
    }

    /**
     * Handles the redirecting of the messages
     *
     * @param envelope
     */
    private void handleRedirecting(Envelope envelope) {
        redirectMessage(envelope);
    }

    /**
     * Redirects the message to the receiver.
     *
     * @param envelope
     */
    public void redirectMessage(Envelope envelope) {
        if (!sendEnvelope(envelope)) {
            dbmanager.insertEncryptedMessage(envelope);
        }
    }

    /**
     * @param envelope
     * @return whether the sending was successful or not
     */
    public boolean sendEnvelope(Envelope envelope) {
        System.out.println(envelope.getSender() + " sending to " + envelope.getReceiver());
        ObjectOutputStream out = server.getObjectOutputStreamById(envelope.getReceiver());
        if (out == null)
            return false;
        try {
            out.writeObject(envelope);
            out.flush();
        } catch (IOException e) {
            System.err.println(e.getMessage());
            return false;
        }
        return true;
    }

    /**
     * Handle the registration of a user.
     * The registration can fail if the given id already exists.
     *
     * @param envelope the envelope
     * @return if the registration was successful or not
     */
    private boolean handleRegistration(Envelope envelope) {
        Registration registration = envelope.<Registration>decryptMessage(secretKey).getContent();
        Login login = registration.getLogin();
        if (dbmanager.userExists(login.getId())) {
            // System.err.println("Registration failed because id already exists");
            return handleLogin(registration.getLogin());
        }
        client = new User(login.getId(), new KeyPair(registration.getPublicKey(), null), secretKey);
        dbmanager.insertUser(client);
        System.out.println("New user " + login.getId() + " registered!");
        handleLogin(registration.getLogin());
        return true;
    }
}


text:
import {gql} from "apollo-server-express";
import {pubsub} from "../helpers/subscriptionManager";
import {getFolders} from "../helpers/uploadAsset";
import path from "path";
import os from "os";
import {ncp} from "ncp";
import {download} from "../bootstrap/init";
import uuid from "uuid";
import fs from "fs";
import assetDir from "../helpers/assetDir";
const mutationHelper = require("../helpers/mutationHelper").default;

// We define a schema that encompasses all of the types
// necessary for the functionality in this file.
const schema = gql`
  type Asset {
    assetKey: String!
    url: String!
  }

  type AssetObject {
    id: ID!
    name: String!
    folderPath: String!
    fullPath: String!
    url: String!
  }

  type AssetFolder {
    id: ID!
    name: String!
    folderPath: String!
    fullPath: String!
    objects: [AssetObject!]!
  }

  input RemoteAsset {
    url: String
    name: String
  }

  type SimulatorAssets {
    mesh: String
    texture: String
    side: String
    top: String
    logo: String
    bridge: String
  }

  input SimulatorAssetsInput {
    mesh: String
    texture: String
    side: String
    top: String
    logo: String
    bridge: String
  }

  extend type Simulator {
    assets: SimulatorAssets
    soundEffects: JSON
  }
  extend type Query {
    asset(assetKey: String!): Asset
    assets(assetKeys: [String!]!): [Asset]
    assetFolders(name: String, names: [String]): [AssetFolder]
  }
  extend type Mutation {
    addAssetFolder(
      name: String!
      folderPath: String!
      fullPath: String!
    ): String
    removeAssetFolder(fullPath: String!): String
    removeAssetObject(fullPath: String!): String
    downloadRemoteAssets(folderPath: String!, files: [RemoteAsset!]!): String
  }
  extend type Subscription {
    assetFolderChange: [AssetFolder!]!
  }
`;

const resolver = {
  Query: {
    asset(root, {assetKey}) {
      return {assetKey, url: `/assets${assetKey}`};
    },
    assets(root, {assetKeys}) {
      return assetKeys.map(a => ({assetKey: a, url: `/assets${a}`}));
    },
    assetFolders(root, {name, names}) {
      const folders = getFolders(assetDir);
      if (name) return folders.filter(f => f.name === name);
      if (names) return folders.filter(f => names.indexOf(f.name) > -1);
      return folders;
    },
  },
  Mutation: {
    ...mutationHelper(schema, ["downloadRemoteAssets"]),
    downloadRemoteAssets(root, {folderPath, files}, context) {
      Promise.all(
        files.map(file => {
          const filePath = `${assetDir}${folderPath}/${file.name}`;
          const dest = path.resolve(`${os.tmpdir()}/${file.name}-${uuid.v4()}`);
          return new Promise(resolve =>
            download(file.url, dest, err => {
              if (err) {
                console.error("There was an error", err);
              }
              ncp(dest, filePath, err => {
                if (err) {
                  console.error("Error!", err);
                }
                resolve();
              });
            }),
          );
        }),
      ).then(() => {
        pubsub.publish("assetFolderChange", getFolders(assetDir));
      });
    },
  },
  Subscription: {
    assetFolderChange: {
      resolve(rootValue) {
        return rootValue;
      },
      subscribe: rootValue => {
        const id = uuid.v4();
        process.nextTick(() => {
          const returnVal = getFolders(assetDir);
          pubsub.publish(id, returnVal);
        });
        return pubsub.asyncIterator([id, "assetFolderChange"]);
      },
    },
  },
  AssetFolder: {
    objects({name, fullPath}) {
      return fs
        .readdirSync(assetDir + fullPath)
        .filter(
          f =>
            fs.lstatSync(assetDir + fullPath + "/" + f).isFile() &&
            f[0] !== ".",
        )
        .map(f => ({
          url: `/assets${fullPath}/${f}`,
          name: f,
          fullPath: `${fullPath}/${f}`,
          folderPath: fullPath,
          id: `${fullPath}/${f}`,
        }));
    },
  },
};

export default {schema, resolver};


text:
set(proj qxmlrpc)

set(${proj}_DEPENDENCIES "")

ExternalProject_Include_Dependencies(${proj}
  PROJECT_VAR proj
  DEPENDS_VAR ${proj}_DEPENDENCIES
  EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS
  USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}
  )

if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
  message(FATAL_ERROR "Enabling ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} is not supported !")
endif()

# Sanity checks
if(DEFINED qxmlrpc_DIR AND NOT EXISTS ${qxmlrpc_DIR})
  message(FATAL_ERROR "qxmlrpc_DIR variable is defined but corresponds to non-existing directory")
endif()

if(NOT DEFINED qxmlrpc_DIR)

  set(revision_tag 1d46d0e24d68049e726269dd3c6438671cd693ea)
  if(${proj}_REVISION_TAG)
    set(revision_tag ${${proj}_REVISION_TAG})
  endif()

  set(location_args )
  if(${proj}_URL)
    set(location_args URL ${${proj}_URL})
  elseif(${proj}_GIT_REPOSITORY)
    set(location_args GIT_REPOSITORY ${${proj}_GIT_REPOSITORY}
                      GIT_TAG ${revision_tag})
  else()
    set(location_args GIT_REPOSITORY "${git_protocol}://github.com/commontk/qxmlrpc.git"
                      GIT_TAG ${revision_tag})
  endif()

  ExternalProject_Add(${proj}
    ${${proj}_EXTERNAL_PROJECT_ARGS}
    SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
    BINARY_DIR ${proj}-build
    PREFIX ${proj}${ep_suffix}
    ${location_args}
    INSTALL_COMMAND ""
    CMAKE_CACHE_ARGS
      ${ep_common_cache_args}
      -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
    DEPENDS
      ${${proj}_DEPENDENCIES}
    )
  set(qxmlrpc_DIR "${CMAKE_BINARY_DIR}/${proj}-build")

else()
  ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
endif()

mark_as_superbuild(
  VARS qxmlrpc_DIR:PATH
  LABELS "FIND_PACKAGE"
  )


text:
package validation

import (
	"log"

	"github.com/docker/distribution/reference"
)

// ImageReferenceValiditySpec is a specification of an image reference validation request.
type ImageReferenceValiditySpec struct {
	// Reference of the image
	Reference string `json:"reference"`
}

// ImageReferenceValidity describes validity of the image reference.
type ImageReferenceValidity struct {
	// True when the image reference is valid.
	Valid bool `json:"valid"`
	// Error reason when image reference is valid
	Reason string `json:"reason"`
}

// ValidateImageReference validates image reference.
func ValidateImageReference(spec *ImageReferenceValiditySpec) (*ImageReferenceValidity, error) {
	log.Printf("Validating %s as an image reference", spec.Reference)

	s := spec.Reference
	_, err := reference.ParseNamed(s)
	if err != nil {
		return &ImageReferenceValidity{Valid: false, Reason: err.Error()}, nil
	}
	return &ImageReferenceValidity{Valid: true}, nil
}


text:
using System;
using System.Threading;
using System.Threading.Tasks;

namespace GiTracker.Services.DataLoader
{
    public interface ILoader
    {
        bool IsLoading { get; }
        event EventHandler LoadingChanged;
        Task LoadAsync(Func<CancellationToken, Task> taskFactory);
        void CancelLoading();
    }
}


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('uma', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='user',
            name='headImg',
            field=models.FileField(upload_to=b'uma/'),
        ),
    ]


text:
Mailbox = {}

Mailbox._mt = {}
setmetatable(Mailbox, Mailbox._mt)

Mailbox._mt.__call = function (self, account, mailbox)
    local object = {}

    object._type = 'mailbox'
    object._account = account
    object._mailbox = mailbox
    object._string =  account._account.username .. '@' ..
                      account._account.server .. '/' .. mailbox

    for key, value in pairs(Mailbox) do
        if type(value) == 'function' then object[key] = value end
    end

    object._mt = {}
    object._mt.__index = object._attach_message
    setmetatable(object, object._mt)

    return object
end

function Mailbox._check_connection(self)
    if not self._account._account.session then
        if not _daemon then
            error('not connected to ' .. self._account._string, 0)
        else
            return false
        end
    end
    return true
end

function Mailbox._check_result(self, request, result)
    if result == nil then
        self._account._account.session = nil
        self._account._account.selected = nil
        if not _daemon then
            error(request .. ' request to ' .. self._account._string ..
                  ' failed', 0)
        end
    end
end

function Mailbox._attach_message(self, uid)
    self[uid] = Message(self._account, self, uid)
    return self[uid]
end

function Mailbox._detach_message(self, uid)
    self[uid] = nil
end

function Mailbox._cached_select(self)
    if self._account._account.selected == nil or
        self._account._account.selected ~= self._mailbox then

        if not self._check_connection(self) then return end
        local r = ifcore.select(self._account._account.session, self._mailbox)
        self._check_result(self, 'select', r)
        if r == false then return false end

        self._account._account.selected = self._mailbox
    end
    return true
end

function Mailbox._cached_close(self)
    if not self._check_connection(self) then return end
    local r = ifcore.close(self._account._account.session)
    self._check_result(self, 'close', r)
    if r == false then return false end

    self._account._account.selected = nil

    return true
end

function Mailbox._send_query(self, criteria, messages)
    _check_optional(criteria, { 'string', 'table' })
    _check_optional(messages, 'table')

    if self._cached_select(self) ~= true then return {} end

    local mesgs
    if messages == nil then
        mesgs = nil
    else
        mesgs = _extract_messages(self, messages)
    end
    if mesgs == nil or #mesgs == 0 or
       options.limit > 0 and #mesgs > options.limit then
        mesgs = 'ALL'
    else
        mesgs = _make_range(mesgs)
        mesgs = 'UID ' .. table.concat(mesgs, ',')
    end

    local query
    if criteria == nil then
        query = mesgs
    elseif type(criteria) == 'string' then
        query = mesgs .. ' ' .. criteria
    else
        query = _make_query(criteria, mesgs)
    end

    if type(options.charset) == 'string' then
        charset = options.charset
    else
        charset = ''
    end

    if not self._check_connection(self) then return end
    local r, results = ifcore.search(self._account._account.session, query,
                                     charset)
    self._check_result(self, 'search', r)
    if r == false then return false end

    if options.close == true then self._cached_close(self) end
    if results == nil then return {} end

    local t = {}
    for n in string.gmatch(results, '%d+') do
        table.insert(t, { self, tonumber(n) })
    end

    return t
end

function Mailbox._flag_messages(self, mode, flags, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local f = ''
    if #flags ~= 0 then f = table.concat(flags, ' ') end

    local r = false
    local m = _make_range(messages)
    local n = #m
    local l = n
    if options.limit > 0 then l = options.limit end
    for i = 1, n, l do
        j = i + l - 1
        if n < j then j = n end
        if not self._check_connection(self) then return end
        r = ifcore.store(self._account._account.session, table.concat(m, ',',
                         i, j), mode, f)
        self._check_result(self, 'store', r)
        if r == false then break end
    end

    if options.close == true then self._cached_close(self) end

    return r
end

function Mailbox._copy_messages(self, dest, messages)
    if not messages or #messages == 0 then return end

    local r = false
    if self._account._account.session == dest._account._account.session then
        if self._cached_select(self) ~= true then return end

        local m = _make_range(messages)
        local n = #m
        local l = n
        if options.limit > 0 then l = options.limit end
        for i = 1, n, l do
            j = i + l - 1
            if n < j then j = n end
            if not self._check_connection(self) then return end
            r = ifcore.copy(self._account._account.session,
                            table.concat(m, ',', i, j), dest._mailbox)
            self._check_result(self, 'copy', r)
            if r == false then break end
        end

        if options.close == true then self._cached_close(self) end
    else
        local fast = self._fetch_fast(self, messages)
        local mesgs = self._fetch_message(self, messages)

        for i in pairs(fast) do
            for k, v in ipairs(fast[i]['flags']) do
                if string.lower(v) == '\\recent' then
                    table.remove(fast[i]['flags'], k)
                end
            end

            if not self._check_connection(dest) then return end
            r = ifcore.append(dest._account._account.session, dest._mailbox,
                              mesgs[i], table.concat(fast[i]['flags'], ' '),
                              fast[i]['date'])
            self._check_result(dest, 'append', r)
            if r == false then break end
        end
    end

    return r
end

function Mailbox._fetch_fast(self, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local results = {}
    for _, m in ipairs(messages) do
        if not self._check_connection(self) then return end
        local r, flags, date, size =
            ifcore.fetchfast(self._account._account.session, tostring(m))
        self._check_result(self, 'fetchfast', r)
        if r == false then break end

        if flags ~= nil and date ~= nil and size ~= nil  then
            local f = {}
            for s in string.gmatch(flags, '%S+') do
                table.insert(f, s)
            end
            results[m] = {}
            results[m]['flags'] = f
            results[m]['date'] = date
            results[m]['size'] = size
        end
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox._fetch_flags(self, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local results = {}
    for _, m in ipairs(messages) do
        if not self._check_connection(self) then return end
        local r, flags = ifcore.fetchflags(self._account._account.session,
                                           tostring(m))
        self._check_result(self, 'fetchfast', r)
        if r == false then break end

        if flags ~= nil then
            local f = {}
            for s in string.gmatch(flags, '%S+') do
                table.insert(f, s)
            end
            results[m] = f
        end
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox._fetch_date(self, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local results = {}
    for _, m in ipairs(messages) do
        if options.cache == true and
            self[m]._date then
            results[m] = self[m]._date
        else
            if not self._check_connection(self) then return end
            local r, date = ifcore.fetchdate(self._account._account.session,
                                             tostring(m))
            self._check_result(self, 'fetchdate', r)
            if r == false then break end

            if date ~= nil then
                results[m] = date
                if options.cache == true then self[m]._date = date end
            end
        end
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox._fetch_size(self, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local results = {}
    for _, m in ipairs(messages) do
        if options.cache == true and
            self[m]._size then
            results[m] = self[m]._size
        else
            if not self._check_connection(self) then return end
            local r, size = ifcore.fetchsize(self._account._account.session,
                                             tostring(m))
            self._check_result(self, 'fetchsize', r)
            if r == false then break end

            if size ~= nil then
                results[m] = tonumber(size)
                if options.cache == true then self[m]._size = tonumber(size) end
            end
        end
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox._fetch_header(self, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local results = {}
    for _, m in ipairs(messages) do
        if options.cache == true and
            self[m]._header then
            results[m] = self[m]._header
        else
            if not self._check_connection(self) then return end
            local r, header = ifcore.fetchheader(self._account._account.session,
                                                 tostring(m))
            self._check_result(self, 'fetchheader', r)
            if r == false then break end

            if header ~= nil then
                results[m] = header
                if options.cache == true then self[m]._header = header end
            end
        end
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox._fetch_body(self, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local results = {}
    for _, m in ipairs(messages) do
        if options.cache == true and
            self[m]._body then
            results[m] = self[m]._body
        else
            if not self._check_connection(self) then return end
            local r, body = ifcore.fetchbody(self._account._account.session,
                                             tostring(m))
            self._check_result(self, 'fetchbody', r)
            if r == false then break end

            if body ~= nil then
                results[m] = body
                if options.cache == true then self[m]._body = body end
            end
        end
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox._fetch_message(self, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local header = self._fetch_header(self, messages)
    local body = self._fetch_body(self, messages)

    local results = {}
    for _, m in ipairs(messages) do
        if header[m] == nil then
            results[m] = nil
        elseif body[m] == nil then
            results[m] = header[m]
        else
            results[m] = header[m] .. body[m]
        end
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox._fetch_fields(self, fields, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local results = {}
    for _, m in ipairs(messages) do
        results[m] = ''
        for _, f in ipairs(fields) do
            if options.cache == true and
                self[m]._fields[f] then
                results[m] = results[m] .. self[m]._fields[f]
            else
                if not self._check_connection(self) then return end
                local r, field =
                    ifcore.fetchfields(self._account._account.session,
                                       tostring(m), f)

                self._check_result(self, 'fetchfields', r)
                if r == false then break end

                if field ~= nil then
                    field = string.gsub(field, '\r\n\r\n$', '\n')
                    results[m] = results[m] .. field
                    if options.cache == true then self[m]._fields[f] = field end
                end
            end
        end
        results[m] = string.gsub(results[m], '\n$', '')
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox._fetch_structure(self, messages)
    if not messages or #messages == 0 then return end
    if self._cached_select(self) ~= true then return end

    local results = {}
    for _, m in ipairs(messages) do
        if options.cache == true and
            self[m]._structure then
            results[m] = self[m]._structure
        else
            if not self._check_connection(self) then return end
            local r, structure =
                ifcore.fetchstructure(self._account._account.session,
                                      tostring(m))
            self._check_result(self, 'fetchstructure', r)
            if r == false then break end

            if structure ~= nil then
                local parsed = _parse_structure({ ['s'] = structure,
                                                ['i'] = 1 })
                results[m] = parsed
                if options.cache == true then self[m]._structure = parsed end
            end
        end
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox._fetch_parts(self, parts, message)
    if self._cached_select(self) ~= true then return end

    local results = {}
    for _, part in ipairs(parts) do
        results[part] = ''
        if options.cache == true and
            self[message]._parts[part] then
            results[part] = self[message]._parts[part]
        else
            if not self._check_connection(self) then return end
            local r, bodypart = ifcore.fetchpart(self._account._account.session,
                                                 tostring(message), part)
            self._check_result(self, 'fetchpart', r)
            if r == false then break end

            if bodypart ~= nil then
                results[part] = bodypart
                self[message]._parts[part] = bodypart
            end
        end
    end

    if options.close == true then self._cached_close(self) end

    return results
end

function Mailbox.check_status(self)
    if not self._check_connection(self) then return end
    local r, exist, recent, unseen, uidnext =
        ifcore.status(self._account._account.session,self._mailbox)
    self._check_result(self, 'status', r)
    if r == false then return -1, -1, -1, -1 end

    if options.info == true then
        print(exist .. ' messages, ' .. recent .. ' recent, ' .. unseen ..
              ' unseen, in ' .. self._string .. '.')
    end

    return exist, recent, unseen, uidnext
end

function Mailbox.send_query(self, criteria, messages)
    return Set(self._send_query(self, criteria, messages))
end

function Mailbox.select_all(self)
    return self.send_query(self)
end

function Mailbox.add_flags(self, flags, messages)
    _check_required(flags, 'table')
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'add', flags, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages flagged in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.remove_flags(self, flags, messages)
    _check_required(flags, 'table')
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'remove', flags, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages flagged in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.replace_flags(self, flags, messages)
    _check_required(flags, 'table')
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'replace', flags, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages flagged in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.mark_answered(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'add', { '\\Answered' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages marked answered in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.mark_deleted(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'add', { '\\Deleted' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages marked deleted in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.mark_draft(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'add', { '\\Draft' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages marked draft in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.mark_flagged(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'add', { '\\Flagged' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages marked flagged in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.mark_seen(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'add', { '\\Seen' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages marked seen in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.unmark_answered(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'remove', { '\\Answered' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages unmarked answered in ' .. self._string ..
              '.')
    end

    return r
end

function Mailbox.unmark_deleted(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'remove', { '\\Deleted' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages unmarked deleted in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.unmark_draft(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'remove', { '\\Draft' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages unmarked draft in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.unmark_flagged(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'remove', { '\\Flagged' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages unmarked flagged in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.unmark_seen(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'remove', { '\\Seen' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages unmarked seen in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.delete_messages(self, messages)
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._flag_messages(self, 'add', { '\\Deleted' }, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages deleted in ' .. self._string .. '.')
    end

    return r
end

function Mailbox.copy_messages(self, dest, messages)
    _check_required(dest, 'table')
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local r = self._copy_messages(self, dest, mesgs)
    if options.info == true and r == true then
        print(#mesgs .. ' messages copied from ' .. self._string .. ' to ' ..
              dest._string .. '.')
    end

    return r
end

function Mailbox.move_messages(self, dest, messages)
    _check_required(dest, 'table')
    _check_required(messages, 'table')

    local mesgs = _extract_messages(self, messages)
    local rc = self._copy_messages(self, dest, mesgs)
    local rf = false
    if rc == true then
        rf = self._flag_messages(self, 'add', { '\\Deleted' }, mesgs)
    end
    if options.info == true and rc == true and rf == true then
        print(#mesgs .. ' messages moved from ' .. self._string .. ' to ' ..
              dest._string .. '.')
    end

    return rc == true and rf == true
end

function Mailbox.fetch_flags(self, messages)
    _check_required(messages, 'table')
    return self._fetch_flags(self, _extract_messages(self, messages))
end

function Mailbox.fetch_date(self, messages)
    _check_required(messages, 'table')
    return self._fetch_date(self, _extract_messages(self, messages))
end

function Mailbox.fetch_size(self, messages)
    _check_required(messages, 'table')
    return self._fetch_size(self, _extract_messages(self, messages))
end

function Mailbox.fetch_header(self, messages)
    _check_required(messages, 'table')
    return self._fetch_header(self, _extract_messages(self, messages))
end

function Mailbox.fetch_body(self, messages)
    _check_required(messages, 'table')
    return self._fetch_body(self, _extract_messages(self, messages))
end

function Mailbox.fetch_message(self, messages)
    _check_required(messages, 'table')
    return self._fetch_message(self, _extract_messages(self, messages))
end

function Mailbox.fetch_fields(self, fields, messages)
    _check_required(fields, 'table')
    _check_required(messages, 'table')
    return self._fetch_fields(self, fields, _extract_messages(self, messages))
end

function Mailbox.fetch_structure(self, messages)
    _check_required(messages, 'table')
    return self._fetch_structure(self, _extract_messages(self, messages))
end

function Mailbox.fetch_parts(self, parts, message)
    _check_required(parts, 'table')
    _check_required(message, 'number')
    return self._fetch_parts(self, parts, message)
end

function Mailbox.append_message(self, message, flags, date)
    _check_required(message, 'string')
    _check_optional(flags, { 'string', 'table' })
    _check_optional(date, 'string')

    if type(flags) == 'table' then flags = table.concat(flags, ' ') end
    if not self._check_connection(self) then return end
    r = ifcore.append(self._account._account.session, self._mailbox, message,
                      flags, date)
    self._check_result(self, 'append', r)
    if r == false then return false end

    if options.info == true and r == true then
        print('Appended message of ' .. #message .. ' octets to ' ..
              self._string .. '.')
    end

    return true
end

function Mailbox.is_answered(self, messages)
    return self.send_query(self, 'ANSWERED', messages)
end

function Mailbox.is_deleted(self, messages)
    return self.send_query(self, 'DELETED', messages)
end

function Mailbox.is_draft(self, messages)
    return self.send_query(self, 'DRAFT', messages)
end

function Mailbox.is_flagged(self, messages)
    return self.send_query(self, 'FLAGGED', messages)
end

function Mailbox.is_new(self, messages)
    return self.send_query(self, 'NEW', messages)
end

function Mailbox.is_old(self, messages)
    return self.send_query(self, 'OLD', messages)
end

function Mailbox.is_recent(self, messages)
    return self.send_query(self, 'RECENT', messages)
end

function Mailbox.is_seen(self, messages)
    return self.send_query(self, 'SEEN', messages)
end

function Mailbox.is_unanswered(self, messages)
    return self.send_query(self, 'UNANSWERED', messages)
end

function Mailbox.is_undeleted(self, messages)
    return self.send_query(self, 'UNDELETED', messages)
end

function Mailbox.is_undraft(self, messages)
    return self.send_query(self, 'UNDRAFT', messages)
end

function Mailbox.is_unflagged(self, messages)
    return self.send_query(self, 'UNFLAGGED', messages)
end

function Mailbox.is_unseen(self, messages)
    return self.send_query(self, 'UNSEEN', messages)
end

function Mailbox.is_larger(self, size, messages)
    _check_required(size, 'number')
    _check_optional(messages, 'table')
    return self.send_query(self, 'LARGER ' .. tostring(size), messages)
end

function Mailbox.is_smaller(self, size, messages)
    _check_required(size, 'number')
    _check_optional(messages, 'table')
    return self.send_query(self, 'SMALLER ' .. tostring(size), messages)
end

function Mailbox.arrived_on(self, date, messages)
    _check_required(date, 'string')
    return self.send_query(self, 'ON ' .. date, messages)
end

function Mailbox.arrived_before(self, date, messages)
    _check_required(date, 'string')
    return self.send_query(self, 'BEFORE ' .. date, messages)
end

function Mailbox.arrived_since(self, date, messages)
    _check_required(date, 'string')
    return self.send_query(self, 'SINCE ' .. date, messages)
end

function Mailbox.sent_on(self, date, messages)
    _check_required(date, 'string')
    return self.send_query(self, 'SENTON ' .. date, messages)
end

function Mailbox.sent_before(self, date, messages)
    _check_required(date, 'string')
    return self.send_query(self, 'SENTBEFORE ' .. date, messages)
end

function Mailbox.sent_since(self, date, messages)
    _check_required(date, 'string')
    return self.send_query(self, 'SENTSINCE ' .. date, messages)
end

function Mailbox.is_newer(self, days, messages)
    _check_required(days, 'number')
    return self.send_query(self, 'SINCE ' .. form_date(days), messages)
end

function Mailbox.is_older(self, days, messages)
    _check_required(days, 'number')
    return self.send_query(self, 'BEFORE ' .. form_date(days), messages)
end

function Mailbox.has_flag(self, flag, messages)
    _check_required(flag, 'string')
    return self.send_query(self, 'KEYWORD "' .. flag .. '"', messages)
end

function Mailbox.contain_field(self, field, string, messages)
    _check_required(field, 'string')
    _check_required(string, 'string')
    return self.send_query(self, 'HEADER ' .. field .. ' "' .. string .. '"',
                           messages)
end

function Mailbox.contain_bcc(self, string, messages)
    _check_required(string, 'string')
    return self.send_query(self, 'BCC "' .. string .. '"', messages)
end

function Mailbox.contain_cc(self, string, messages)
    _check_required(string, 'string')
    return self.send_query(self, 'CC "' .. string .. '"', messages)
end

function Mailbox.contain_from(self, string, messages)
    _check_required(string, 'string')
    return self.send_query(self, 'FROM "' .. string .. '"', messages)
end

function Mailbox.contain_subject(self, string, messages)
    _check_required(string, 'string')
    return self.send_query(self, 'SUBJECT "' .. string .. '"', messages)
end

function Mailbox.contain_to(self, string, messages)
    _check_required(string, 'string')
    return self.send_query(self, 'TO "' .. string .. '"', messages)
end

function Mailbox.contain_header(self, string, messages)
    _check_required(string, 'string')
    return self.send_query(self, 'TEXT "' .. string .. '" NOT BODY "' ..
        string .. '"', messages)
end

function Mailbox.contain_body(self, string, messages)
    _check_required(string, 'string')
    return self.send_query(self, 'BODY "' .. string .. '"', messages)
end

function Mailbox.contain_message(self, string, messages)
    _check_required(string, 'string')
    return self.send_query(self, 'TEXT "' .. string .. '"', messages)
end

function Mailbox.match_field(self, field, pattern, messages)
    _check_required(field, 'string')
    _check_required(pattern, 'string')

    if not messages then messages = self._send_query(self) end
    local mesgs = _extract_messages(self, messages)
    local fields = self._fetch_fields(self, { field }, mesgs)
    if #mesgs == 0 or fields == nil then return Set({}) end
    local results = {}
    for m, f in pairs(fields) do
        if regex_search(pattern, (string.gsub(f, '^[^:]*: ?(.*)$', '%1'))) then
            table.insert(results, {self, m})
        end
    end

    return Set(results)
end

function Mailbox.match_bcc(self, pattern, messages)
    _check_required(pattern, 'string')
    return self.match_field(self, 'Bcc', pattern, messages)
end

function Mailbox.match_cc(self, pattern, messages)
    _check_required(pattern, 'string')
    return self.match_field(self, 'Cc', pattern, messages)
end

function Mailbox.match_from(self, pattern, messages)
    _check_required(pattern, 'string')
    return self.match_field(self, 'From', pattern, messages)
end

function Mailbox.match_subject(self, pattern, messages)
    _check_required(pattern, 'string')
    return self.match_field(self, 'Subject', pattern, messages)
end

function Mailbox.match_to(self, pattern, messages)
    _check_required(pattern, 'string')
    return self.match_field(self, 'To', pattern, messages)
end

function Mailbox.match_header(self, pattern, messages)
    _check_required(pattern, 'string')

    if not messages then messages = self._send_query(self) end
    local mesgs = _extract_messages(self, messages)
    local header = self._fetch_header(self, mesgs)
    if #mesgs == 0 or header == nil then return Set({}) end
    local results = {}
    for m, h in pairs(header) do
        if regex_search(pattern, h) then table.insert(results, {self, m}) end
    end

    return Set(results)
end

function Mailbox.match_body(self, pattern, messages)
    _check_required(pattern, 'string')

    if not messages then messages = self._send_query(self) end
    local mesgs = _extract_messages(self, messages)
    local body = self._fetch_body(self, mesgs)
    if #mesgs == 0 or body == nil then return Set({}) end
    local results = {}
    for m, b in pairs(body) do
        if regex_search(pattern, b) then table.insert(results, {self, m}) end
    end

    return Set(results)
end

function Mailbox.match_message(self, pattern, messages)
    _check_required(pattern, 'string')

    if not messages then messages = self._send_query(self) end
    local mesgs = _extract_messages(self, messages)
    local full = self._fetch_message(self, mesgs)
    if #mesgs == 0 or full == nil then return Set({}) end
    local results = {}
    for m, f in pairs(full) do
        if regex_search(pattern, f) then table.insert(results, {self, m}) end
    end

    return Set(results)
end

function Mailbox.enter_idle(self)
    if self._cached_select(self) ~= true then return false end

    if not self._check_connection(self) then return end
    local r, event = ifcore.idle(self._account._account.session)
    self._check_result(self, 'idle', r)
    if r == false then return false end

    if options.close == true then self._cached_close(self) end

    return true, string.upper(event)
end

Mailbox.open = _cached_select
Mailbox.close = _cached_close

Mailbox._mt.__index = function () end
Mailbox._mt.__newindex = function () end


text:
'use strict';

function YAMLException(reason, mark) {
    this.name = 'YAMLException';
    this.reason = reason;
    this.mark = mark;
    this.message = this.toString(false);
}

YAMLException.prototype.toString = function toString(compact) {
    var result;

    result = 'JS-YAML: ' + (this.reason || '(unknown reason)');

    if (!compact && this.mark) {
        result += ' ' + this.mark.toString();
    }

    return result;
};

module.exports = YAMLException;


text:
<?php

class Google_Service_Proximitybeacon_ListDiagnosticsResponse extends Google_Collection
{
  protected $collection_key = 'diagnostics';
  protected $diagnosticsType = 'Google_Service_Proximitybeacon_Diagnostics';
  protected $diagnosticsDataType = 'array';
  public $nextPageToken;

  public function setDiagnostics($diagnostics)
  {
    $this->diagnostics = $diagnostics;
  }
  public function getDiagnostics()
  {
    return $this->diagnostics;
  }
  public function setNextPageToken($nextPageToken)
  {
    $this->nextPageToken = $nextPageToken;
  }
  public function getNextPageToken()
  {
    return $this->nextPageToken;
  }
}


text:
======================
salt.renderers.msgpack
======================

.. automodule:: salt.renderers.msgpack
    :members:


text:
require File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. .. spec_helper]))

describe Admin::LayoutsController, "#route_for" do
  it "should map { :controller => 'admin/layouts', :action => 'index' } to /admin/layouts" do
    route_for(:controller => "admin/layouts", :action => "index").should == "/admin/layouts"
  end

  it "should map { :controller => 'layouts', :action => 'new' } to /admin/layouts/new" do
    route_for(:controller => "admin/layouts", :action => "new").should == "/admin/layouts/new"
  end

  it "should map { :controller => 'layouts', :action => 'show', :id => 1 } to /admin/layouts/1" do
    route_for(:controller => "admin/layouts", :action => "show", :id => '1').should == "/admin/layouts/1"
  end

  it "should map { :controller => 'layouts', :action => 'edit', :id => 1 } to /admin/layouts/1/edit" do
    route_for(:controller => "admin/layouts", :action => "edit", :id => '1').should == "/admin/layouts/1/edit"
  end

  it "should map { :controller => 'layouts', :action => 'update', :id => 1} to /admin/layouts/1" do
    route_for(:controller => "admin/layouts", :action => "update", :id => '1').should ==  { :path => "/admin/layouts/1", :method => 'put' }
  end

  it "should map { :controller => 'layouts', :action => 'destroy', :id => 1} to /admin/layouts/1" do
    route_for(:controller => "admin/layouts", :action => "destroy", :id => '1').should == { :path => "/admin/layouts/1", :method => 'delete' }
  end

  it "should map { :controller => 'layouts', :action => 'default', :id => 1} to /admin/layouts/1/default" do
    route_for(:controller => "admin/layouts", :action => "default", :id => '1').should ==  { :path => "/admin/layouts/1/default", :method => 'put' }
  end
end

describe Admin::LayoutsController, "#params_from" do

  it "should generate params { :controller => 'layouts', action => 'index' } from GET /admin/layouts" do
    params_from(:get, "/admin/layouts").should == {:controller => "admin/layouts", :action => "index"}
  end

  it "should generate params { :controller => 'layouts', action => 'new' } from GET /admin/layouts/new" do
    params_from(:get, "/admin/layouts/new").should == {:controller => "admin/layouts", :action => "new"}
  end

  it "should generate params { :controller => 'layouts', action => 'create' } from POST /admin/layouts" do
    params_from(:post, "/admin/layouts").should == {:controller => "admin/layouts", :action => "create"}
  end

  it "should generate params { :controller => 'layouts', action => 'show', id => '1' } from GET /admin/layouts/1" do
    params_from(:get, "/admin/layouts/1").should == {:controller => "admin/layouts", :action => "show", :id => "1"}
  end

  it "should generate params { :controller => 'layouts', action => 'edit', id => '1' } from GET /admin/layouts/1/edit" do
    params_from(:get, "/admin/layouts/1/edit").should == {:controller => "admin/layouts", :action => "edit", :id => "1"}
  end

  it "should generate params { :controller => 'layouts', action => 'update', id => '1' } from PUT /admin/layouts/1" do
    params_from(:put, "/admin/layouts/1").should == {:controller => "admin/layouts", :action => "update", :id => "1"}
  end

  it "should generate params { :controller => 'layouts', action => 'destroy', id => '1' } from DELETE /admin/layouts/1" do
    params_from(:delete, "/admin/layouts/1").should == {:controller => "admin/layouts", :action => "destroy", :id => "1"}
  end

  it "should generate params { :controller => 'layouts', action => 'default', id => '1' } from PUT /admin/layouts/1/default" do
    params_from(:put, "/admin/layouts/1/default").should == {:controller => "admin/layouts", :action => "default", :id => "1"}
  end
end


text:
@protocol CRFPagingCell <NSObject>

- (void)setLoading:(BOOL)loading animated:(BOOL)animated;

@end

////////////////////////////////////////////////////////////////////////////////

@interface CRFPagingCellView : UITableViewCell <CRFPagingCell>

@property (nonatomic, strong) NSString                * moreText;
@property (nonatomic, strong) NSString                * loadingText;
@property (nonatomic, strong) UIActivityIndicatorView * activityIndicator;
@property (nonatomic, assign) BOOL                      loading;

- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier;

@end


text:
'use strict'

// an async function fails early in Node.js versions prior to 8.
async function requiresNode8OrGreater () {}
requiresNode8OrGreater()

const { Yargs, rebase } = require('./build/lib/yargs')
const Parser = require('yargs-parser')

exports = module.exports = Yargs
exports.rebase = rebase

// allow consumers to directly use the version of yargs-parser used by yargs
exports.Parser = Parser


text:
<ion-view view-title="Settings">
    <ion-content>

GENERAL

Default Currency$

Manage CategoriesFood, Grocery...

Confirm before delete
                    <input type="checkbox">

REPORTS

Email FrequencyWeekly

NOTIFICATIONS

Push Notifications
                    <input type="checkbox" checked>

Notify via Email
                    <input type="checkbox" checked>

ACCOUNT

Change Password

Logout

    </ion-content>
</ion-view>