text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<TITLE
>ALTER DOMAIN</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 9.6.2 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SQL Commands"
HREF="sql-commands.html"><LINK
REL="PREVIOUS"
TITLE="ALTER DEFAULT PRIVILEGES"
HREF="sql-alterdefaultprivileges.html"><LINK
REL="NEXT"
TITLE="ALTER EVENT TRIGGER"
HREF="sql-altereventtrigger.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2017-02-06T21:56:32">

PostgreSQL 9.6.2 Documentation

Prev	Up		Next

ALTER DOMAIN

Name
ALTER DOMAIN --    change the definition of a domain

Synopsis

ALTER DOMAIN <TT
CLASS="REPLACEABLE"
>name</TT
>
    { SET DEFAULT <TT
CLASS="REPLACEABLE"
>expression</TT
> | DROP DEFAULT }
ALTER DOMAIN <TT
CLASS="REPLACEABLE"
>name</TT
>
    { SET | DROP } NOT NULL
ALTER DOMAIN <TT
CLASS="REPLACEABLE"
>name</TT
>
    ADD <TT
CLASS="REPLACEABLE"
>domain_constraint</TT
> [ NOT VALID ]
ALTER DOMAIN <TT
CLASS="REPLACEABLE"
>name</TT
>
    DROP CONSTRAINT [ IF EXISTS ] <TT
CLASS="REPLACEABLE"
>constraint_name</TT
> [ RESTRICT | CASCADE ]
ALTER DOMAIN <TT
CLASS="REPLACEABLE"
>name</TT
>
     RENAME CONSTRAINT <TT
CLASS="REPLACEABLE"
>constraint_name</TT
> TO <TT
CLASS="REPLACEABLE"
>new_constraint_name</TT
>
ALTER DOMAIN <TT
CLASS="REPLACEABLE"
>name</TT
>
    VALIDATE CONSTRAINT <TT
CLASS="REPLACEABLE"
>constraint_name</TT
>
ALTER DOMAIN <TT
CLASS="REPLACEABLE"
>name</TT
>
    OWNER TO { <TT
CLASS="REPLACEABLE"
>new_owner</TT
> | CURRENT_USER | SESSION_USER }
ALTER DOMAIN <TT
CLASS="REPLACEABLE"
>name</TT
>
    RENAME TO <TT
CLASS="REPLACEABLE"
>new_name</TT
>
ALTER DOMAIN <TT
CLASS="REPLACEABLE"
>name</TT
>
    SET SCHEMA <TT
CLASS="REPLACEABLE"
>new_schema</TT
>

Description

   <TT
CLASS="COMMAND"
>ALTER DOMAIN</TT
> changes the definition of an existing domain.
   There are several sub-forms:

SET/DROP DEFAULT

      These forms set or remove the default value for a domain. Note
      that defaults only apply to subsequent <TT
CLASS="COMMAND"
>INSERT</TT
>
      commands; they do not affect rows already in a table using the domain.

SET/DROP NOT NULL

      These forms change whether a domain is marked to allow NULL
      values or to reject NULL values.  You can only <TT
CLASS="LITERAL"
>SET NOT NULL</TT
>
      when the columns using the domain contain no null values.

ADD <TT
CLASS="REPLACEABLE"
>domain_constraint</TT
> [ NOT VALID ]

      This form adds a new constraint to a domain using the same syntax as
      CREATE DOMAIN.
      When a new constraint is added to a domain, all columns using that
      domain will be checked against the newly added constraint.  These
      checks can be suppressed by adding the new constraint using the
      <TT
CLASS="LITERAL"
>NOT VALID</TT
> option; the constraint can later be made
      valid using <TT
CLASS="COMMAND"
>ALTER DOMAIN ... VALIDATE CONSTRAINT</TT
>.
      Newly inserted or updated rows are always checked against all
      constraints, even those marked <TT
CLASS="LITERAL"
>NOT VALID</TT
>.
      <TT
CLASS="LITERAL"
>NOT VALID</TT
> is only accepted for <TT
CLASS="LITERAL"
>CHECK</TT
> constraints.

DROP CONSTRAINT [ IF EXISTS ]

      This form drops constraints on a domain.
      If <TT
CLASS="LITERAL"
>IF EXISTS</TT
> is specified and the constraint
      does not exist, no error is thrown. In this case a notice is issued instead.

RENAME CONSTRAINT

      This form changes the name of a constraint on a domain.

VALIDATE CONSTRAINT

      This form validates a constraint previously added as
      <TT
CLASS="LITERAL"
>NOT VALID</TT
>, that is, verify that all data in columns using the
      domain satisfy the specified constraint.

OWNER

      This form changes the owner of the domain to the specified user.

<TT
CLASS="LITERAL"
>RENAME</TT
>

      This form changes the name of the domain.

SET SCHEMA

      This form changes the schema of the domain.  Any constraints
      associated with the domain are moved into the new schema as well.

   You must own the domain to use <TT
CLASS="COMMAND"
>ALTER DOMAIN</TT
>.
   To change the schema of a domain, you must also have
   <TT
CLASS="LITERAL"
>CREATE</TT
> privilege on the new schema.
   To alter the owner, you must also be a direct or indirect member of the new
   owning role, and that role must have <TT
CLASS="LITERAL"
>CREATE</TT
> privilege on
   the domain's schema.  (These restrictions enforce that altering the owner
   doesn't do anything you couldn't do by dropping and recreating the domain.
   However, a superuser can alter ownership of any domain anyway.)

Parameters

<TT
CLASS="REPLACEABLE"
>name</TT
>

        The name (possibly schema-qualified) of an existing domain to
        alter.

<TT
CLASS="REPLACEABLE"
>domain_constraint</TT
>

        New domain constraint for the domain.

<TT
CLASS="REPLACEABLE"
>constraint_name</TT
>

        Name of an existing constraint to drop or rename.

<TT
CLASS="REPLACEABLE"
>NOT VALID</TT
>

        Do not verify existing column data for constraint validity.

<TT
CLASS="LITERAL"
>CASCADE</TT
>

        Automatically drop objects that depend on the constraint,
        and in turn all objects that depend on those objects
        (see Section 5.13).

<TT
CLASS="LITERAL"
>RESTRICT</TT
>

        Refuse to drop the constraint if there are any dependent
        objects. This is the default behavior.

<TT
CLASS="REPLACEABLE"
>new_name</TT
>

        The new name for the domain.

<TT
CLASS="REPLACEABLE"
>new_constraint_name</TT
>

        The new name for the constraint.

<TT
CLASS="REPLACEABLE"
>new_owner</TT
>

        The user name of the new owner of the domain.

<TT
CLASS="REPLACEABLE"
>new_schema</TT
>

        The new schema for the domain.

Notes

   Currently, <TT
CLASS="COMMAND"
>ALTER DOMAIN ADD CONSTRAINT</TT
>, <TT
CLASS="COMMAND"
>ALTER
   DOMAIN VALIDATE CONSTRAINT</TT
>, and <TT
CLASS="COMMAND"
>ALTER DOMAIN SET NOT NULL</TT
>
   will fail if the validated named domain or
   any derived domain is used within a composite-type column of any
   table in the database.  They should eventually be improved to be
   able to verify the new constraint for such nested columns.

Examples

   To add a <TT
CLASS="LITERAL"
>NOT NULL</TT
> constraint to a domain:

ALTER DOMAIN zipcode SET NOT NULL;

   To remove a <TT
CLASS="LITERAL"
>NOT NULL</TT
> constraint from a domain:

ALTER DOMAIN zipcode DROP NOT NULL;

   To add a check constraint to a domain:

ALTER DOMAIN zipcode ADD CONSTRAINT zipchk CHECK (char_length(VALUE) = 5);

   To remove a check constraint from a domain:

ALTER DOMAIN zipcode DROP CONSTRAINT zipchk;

   To rename a check constraint on a domain:

ALTER DOMAIN zipcode RENAME CONSTRAINT zipchk TO zip_check;

   To move the domain into a different schema:

ALTER DOMAIN zipcode SET SCHEMA customers;

Compatibility

   <TT
CLASS="COMMAND"
>ALTER DOMAIN</TT
> conforms to the <ACRONYM
CLASS="ACRONYM"
>SQL</ACRONYM
>
   standard, except for the <TT
CLASS="LITERAL"
>OWNER</TT
>, <TT
CLASS="LITERAL"
>RENAME</TT
>, <TT
CLASS="LITERAL"
>SET SCHEMA</TT
>, and
   <TT
CLASS="LITERAL"
>VALIDATE CONSTRAINT</TT
> variants, which are
   PostgreSQL extensions.  The <TT
CLASS="LITERAL"
>NOT VALID</TT
>
   clause of the <TT
CLASS="LITERAL"
>ADD CONSTRAINT</TT
> variant is also a
   PostgreSQL extension.

See Also
CREATE DOMAIN, DROP DOMAIN

Prev	Home	Next

ALTER DEFAULT PRIVILEGES	Up	ALTER EVENT TRIGGER


text:
(function() {

	var baseUrl = GoogleMapsLoader.URL;

	var cb = GoogleMapsLoader.WINDOW_CALLBACK_NAME;

	describe('GoogleMaps', function() {

		beforeEach(function() {
			GoogleMapsLoader.makeMock();
		});

		afterEach(function(done) {
			GoogleMapsLoader.release(function() {
				done();
			});
		});

		describe('#load', function() {

			it('should throw an error if promise style is used', function() {
				expect(function() {
					GoogleMapsLoader.load().then();
				}).to.throw(Error, 'Using promises is not supported anymore. Please take a look in new documentation and use callback instead.');
			});

			it('should load google api object', function(done) {
				GoogleMapsLoader.load(function(google) {
					expect(google).to.be.a('object');
					expect(GoogleMapsLoader.isLoaded()).to.be.true;
					done();
				});
			});

			it('should load google api only for first time and then use stored object', function(done) {
				var count = 0;

				GoogleMapsLoader.onLoad(function() {
					count++;
				});

				GoogleMapsLoader.load();
				GoogleMapsLoader.load();
				GoogleMapsLoader.load();

				GoogleMapsLoader.load(function() {
					expect(count).to.be.equal(1);
					done()
				});
			});
		});

		describe('#release', function() {

			it('should restore google maps package to original state and remove google api object completely and load it again', function(done) {
				GoogleMapsLoader.load(function() {
					expect(GoogleMapsLoader.isLoaded()).to.be.true;

					GoogleMapsLoader.release(function() {
						expect(GoogleMapsLoader.isLoaded()).to.be.false;

						GoogleMapsLoader.makeMock();
						GoogleMapsLoader.load(function() {
							expect(GoogleMapsLoader.isLoaded()).to.be.true;
							done();
						});
					});
				});
			});

		});

		describe('#createUrl', function() {

			it('should create url with sensor support', function() {
				GoogleMapsLoader.SENSOR = true;
				expect(GoogleMapsLoader.createUrl()).to.be.equal(baseUrl + '?callback=' + cb + '&sensor=true');
			});

			it('should create url without sensor support', function() {
				GoogleMapsLoader.SENSOR = false;
				expect(GoogleMapsLoader.createUrl()).to.be.equal(baseUrl + '?callback=' + cb + '&sensor=false');
			});

			it('should create url with key', function() {
				GoogleMapsLoader.KEY = 'abcdefghijkl';
				expect(GoogleMapsLoader.createUrl()).to.be.equal(baseUrl + '?callback=' + cb + '&sensor=false&key=abcdefghijkl');
			});

			it('should create url with one library', function() {
				GoogleMapsLoader.LIBRARIES = ['hello'];
				expect(GoogleMapsLoader.createUrl()).to.be.equal(baseUrl + '?callback=' + cb + '&sensor=false&libraries=hello');
			});

			it('should create url with more libraries', function() {
				GoogleMapsLoader.LIBRARIES = ['hello', 'day'];
				expect(GoogleMapsLoader.createUrl()).to.be.equal(baseUrl + '?callback=' + cb + '&sensor=false&libraries=hello,day');
			});

			it('should create url with client and version', function() {
				GoogleMapsLoader.CLIENT = 'buf';
				GoogleMapsLoader.VERSION = '999';
				expect(GoogleMapsLoader.createUrl()).to.be.equal(baseUrl + '?callback=' + cb + '&sensor=false&client=buf&v=999');
			});

			it('should create url with channel', function() {
				GoogleMapsLoader.CHANNEL = 'abcdefghijkl';
				expect(GoogleMapsLoader.createUrl()).to.be.equal(baseUrl + '?callback=' + cb + '&sensor=false&channel=abcdefghijkl');
			});

			it('should create url with language', function() {
				GoogleMapsLoader.LANGUAGE = 'fr';
				expect(GoogleMapsLoader.createUrl()).to.be.equal(baseUrl + '?callback=' + cb + '&sensor=false&language=fr');
			});
		});

	});

}).call();

redpajama_set_name: RedPajamaGithub


text:
module Main (main) where

import           Control.Monad
import           Control.Applicative
import           Data.List (find, unfoldr, break, isPrefixOf, intercalate)

import           Test.Hspec
import           System.Directory
import qualified Data.Text as T
import qualified Data.Text.Lazy as L
import qualified Data.Text.Lazy.Builder as L

import qualified HIndent

styles :: [FilePath]
styles = ["fundamental", "gibiansky", "chris-done", "johan-tibell"]

testDir, expectedDir :: String
testDir = "tests"
expectedDir = "expected"

main :: IO ()
main = forM_ styles testStyle

testStyle :: FilePath -> IO ()
testStyle style = do
  let Just theStyle = find ((== T.pack style) . HIndent.styleName) HIndent.styles
  testFilenames <- filter (not . isPrefixOf ".") <$> getDirectoryContents tests
  let expFiles = map ((expected ++) . expectedFilename) testFilenames
      testFiles = map (tests ++) testFilenames
  specs <- forM (zip testFiles expFiles) (uncurry $ useTestFiles theStyle)
  hspec $ foldl1 (>>) specs

  where
    tests = "test/" ++ style ++ "/" ++ testDir ++ "/"
    expected = "test/" ++ style ++ "/" ++ expectedDir ++ "/"

    expectedFilename filename = take (length filename - 4) filename ++ "exp"

useTestFiles :: HIndent.Style -> FilePath -> FilePath -> IO Spec
useTestFiles style test exp = do
  testContents <- readFile test
  expContents <- readFile exp
  let testDecls = parsePieces testContents
      expDecls = parsePieces expContents
  when (length testDecls /= length expDecls) $
    error $ concat
              [ "Mismatched number of pieces in files "
              , test
              , " ("
              , show $ length testDecls
              , ")"
              , " and "
              , exp
              , " ("
              , show $ length expDecls
              , ")"
              ]
  return $ describe ("hindent applied to chunks in " ++ test) $ foldl1 (>>) $ zipWith (mkSpec style)
                                                                                testDecls expDecls

mkSpec :: HIndent.Style -> String -> String -> Spec
mkSpec style input desired = it "works" $
  case HIndent.reformat style Nothing (L.pack input) of
    Left err      -> expectationFailure ("Error: " ++ err)
    Right builder -> L.unpack (L.toLazyText builder) `shouldBe` desired

parsePieces :: String -> [String]
parsePieces str = map (intercalate "\n" . map mkNewlines) pieces
  where
    pieces = unfoldr unfolder (lines str)

    unfolder :: [String] -> Maybe ([String], [String])
    unfolder [] = Nothing
    unfolder remaining = Just $
      case break pieceBreak (zip remaining (tail remaining ++ [""])) of
        (nonNull, [])     -> (map fst nonNull, [])
        (nonNull, _:rest) -> (map fst nonNull, map fst rest)

    pieceBreak :: (String, String) -> Bool
    pieceBreak ("", "") = error "Two consecutive line breaks!"
    pieceBreak (line, next) = null line && head next /= ' '

    mkNewlines :: String -> String
    mkNewlines ">" = ""
    mkNewlines x = x


text:
A simple class to easily alphabetize an array of objects.

You might use it to sort an array into alphabetized sections, for use in a tableView like the Phone, Contacts, and Music apps in iOS.

![Demo app](https://raw.githubusercontent.com/chrisladd/CGLAlphabetizer/master/Example/demo.gif)

### Installation

If you're using Cocoapods, like you should, add this to your podfile:

`pod 'CGLAlphabetizer', '~> 0.1'`

Otherwise, you can just download and drag in `CGLAlphabetizer.h` and `CGLAlphabetizer.m` from the `Classes` folder.

### Usage

The CGLAlphabetizer object accepts an array of objects and a key path to alphabetize by, and returns an NSDictionary keyed by first letter, with arrays of objects tied to each.

Assuming you had an object:

````obj-c

@interface CGLContact : NSObject
@property (nonatomic) NSString *firstName;
@property (nonatomic) NSString *lastName;

@property (nonatomic, readonly) NSString *fullName;

@end

````

And you had an array of said objects

````objc-c
CGLContact *steve = [CGLContact contactWithFirstName:@"Steve" lastName:@"Jobs"];
CGLContact *bill = [CGLContact contactWithFirstName:@"Bill" lastName:@"Gates"];
CGLContact *larry = [CGLContact contactWithFirstName:@"Larry" lastName:@"Ellison"];
CGLContact *eric = [CGLContact contactWithFirstName:@"Eric" lastName:@"Jones"];

NSArray *contacts = @[steve, bill, larry, eric];
````

You could sort them like so:

````obj-c

NSDictionary *sortedContacts = [CGLAlphabetizer alphabetizedDictionaryFromObjects:contacts
                                                                     usingKeyPath:@"lastName"];

// => @{
        @"E" : @[larry],
        @"G" : @[bill],
        @"J" : @[steve, eric]
        }

````

Or even like so:

````obj-c

NSDictionary *sortedContacts = [CGLAlphabetizer alphabetizedDictionaryFromObjects:contacts
                                                                     usingKeyPath:@"firstName"];

// => @{
        @"B" : @[bill],
        @"E" : @[eric],
        @"L" : @[larry],
        @"S" : @[steve]
        }

````

And, if you were planning on using them for a tableView, there's a handy method for that, too:

````objc-c

NSArray *indexTitle = [CGLAlphabetizer indexTitlesFromAlphabetizedDictionary:sortedContacts];

// => @[@"B", @"E", @"L", @"S"]

````

### Easy-as-pie Alphabetized UITableView

Putting these pieces together to alphabetize the contents of a UITableViewController might then look something like this:

````obj-c

static NSString * const CGLContactsCellIdentifier = @"CGLContactsCellIdentifier";

@interface CGLContactsTableViewController ()
@property (nonatomic) NSDictionary *alphabetizedDictionary;
@property (nonatomic) NSArray *sectionIndexTitles;
@end

@implementation CGLContactsTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CGLContactsCellIdentifier];
}

- (void)setContacts:(NSArray *)contacts {
    _contacts = contacts;
    self.alphabetizedDictionary = [CGLAlphabetizer alphabetizedDictionaryFromObjects:_contacts usingKeyPath:@"lastName"];
    self.sectionIndexTitles = [CGLAlphabetizer indexTitlesFromAlphabetizedDictionary:self.alphabetizedDictionary];

    [self.tableView reloadData];
}

- (CGLContact *)objectAtIndexPath:(NSIndexPath *)indexPath {
    NSString *sectionIndexTitle = self.sectionIndexTitles[indexPath.section];
    return self.alphabetizedDictionary[sectionIndexTitle][indexPath.row];
}

#pragma mark - Table view data source

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
    return self.sectionIndexTitles;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return [self.sectionIndexTitles count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    NSString *sectionIndexTitle = self.sectionIndexTitles[section];
    return [self.alphabetizedDictionary[sectionIndexTitle] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CGLContactsCellIdentifier forIndexPath:indexPath];

    CGLContact *contact = [self objectAtIndexPath:indexPath];
    cell.textLabel.text = contact.fullName;

    return cell;
}

@end

````


text:
<!DOCTYPE html>
<html>
  <!--
  the-wall-of-quotes
  Copyright 2016-2017, Andrea Sonny, All rights reserved.
  @author: Andrea Sonny <andreasonny83@gmail.com>
  -->
  <head>
    <!-- base url -->
    <base href="<%= htmlWebpackPlugin.options.metadata.baseUrl %>">
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><%= htmlWebpackPlugin.options.title %></title>
    <meta name="description" content="<%= htmlWebpackPlugin.options.title %>">

    <% if (webpackConfig.htmlElements.headTags) { %>
    <!-- Configured Head Tags  -->
    <%= webpackConfig.htmlElements.headTags %>
    <% } %>
  </head>
  <body>
    <app>
      Loading...
    </app>

    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    ga('create', 'UA-93825202-1', 'auto');
    ga('send', 'pageview');
    </script>

    <% if (htmlWebpackPlugin.options.metadata.isDevServer && htmlWebpackPlugin.options.metadata.HMR !== true) { %>
    <!-- Webpack Dev Server reload -->
    <script src="/webpack-dev-server.js"></script>
    <% } %>
  </body>
</html>


text:
// @ts-nocheck

/**
 * @interface {babel.PluginPass}
 * @param {babel} babel
 * @return {babel.PluginObj}
 */
module.exports = function ({template, types: t}) {
  /**
   * Produces a random number that is guaranteed not to be present in str.
   * @param {string} str
   * @return {number}
   */
  function uniqInString(str) {
    while (true) {
      const uniq = Math.floor(Math.random() * 2 ** 31);
      if (!str.includes(uniq)) {
        return uniq;
      }
    }
  }

  /**
   * Transforms a statically computable sourcetext path (aka an AST node) into
   * a JSON stringified value.
   *
   * Special "includes" may be used join multiple nested sections
   * into a single JSONified string.
   *
   * @param {!NodePath} path
   * @return {string}
   */
  function stringifyValue(path) {
    const arg = path.get('arguments.0');

    // sourceText now contains the actual source code written in the file. Eg,
    // `{foo: bar}` in the file is now `"{foo: bar}"`.
    const sourceText = arg.toString();

    // We use a unique number to represent inclusions of nested sections. We'll
    // be able to search the output JSON string for this exact number, and know
    // that we have an inclusion at that location.
    const uniq = uniqInString(sourceText);

    // We're going to build up a template string to replace the object literal
    // in source text. Eg, ({foo: 'bar'}) will turn into (`{"foo": "bar"}`).
    // Each inclusion will generate an expression (the included variable's
    // identifier) and a new quasi (the string part of a template string).
    const quasis = [];
    const expressions = [];

    try {
      // We're using a `with (proxy)` to evaluate the object's source code into
      // this JS environment. The with-proxy is necessary to allow inclusions
      // of nested sections into this section.
      // With statements allow you to inject a dynamic lexical scope into code.
      // Eg, `with (obj) { a = 1 }` will try to lookup/set the `obj.a`
      // property, if `obj` has an `a` property.
      // Proxies behave like meta-objects, allowing you to control get/set/has
      // operations on the object. Eg, `p.foo` looks up the `"foo"` property
      // from `p`.
      // So, using a with-proxy allows us to capture and control the lexical
      // scope of the evaluating code!
      const proxy = new Proxy(
        {},
        {
          has(target, prop) {
            // Anything not on the global is assumed to be an inclusion. This
            // includes the `includeJsonLiteral` function call and the
            // identifier it is passed as an argument.
            return !(prop in global);
          },
          get(target, prop) {
            // With statements first attempt to look up the
            // `Symbol.unscopables` from object. We're explicitly allowing any
            // references, so return nothing.
            if (prop === Symbol.unscopables) {
              return;
            }

            // The only other lookups are inclusions of the form
            // `includeJsonLiteral(foo)`. Both `includeJsonLiteral` and `foo`
            // will be trapped by the with-proxy, allowing us to control the
            // values they represent. For `includeJsonLiteral`, the prop
            // `"includeJsonLiteral"` will be looked up, and `foo` will lookup
            // `"foo"`.

            // `includeJsonLiteral` is being used as a function call, so we
            // must return a function.  We want to propagate its argument, so
            // we return that in the function.
            if (prop === 'includeJsonLiteral') {
              return (s) => s;
            }

            // The argument to `includeJsonLiteral`. We'll create a new
            // identifier reference to it for our template literal expression.
            expressions.push(t.identifier(prop));

            // Finally, we can't actually return the reference's real value
            // (because it may be runtime dynamic, or in another file, etc).
            // But we must return something that is representable in our
            // evaluated object, and that value must be JSON stringable. Our
            // unique number is both, and we can search the JSON string for the
            // unique number later on to figure out where the inclusion was
            // meant to be placed.
            return uniq;
          },
        }
      );

      // To explain the rest, imagine the following:
      // ```js
      // const obj = jsonConfiguration({ foo: 'foo', bar: includeJsonLiteral(bar) });
      // ```
      //
      // We're going to evaluate the source text
      // ```js
      // {foo: 'foo', bar: includeJsonLiteral(bar) }
      // ```
      const evaluate = new Function(
        'proxy',
        `with (proxy) return ${sourceText}`
      );

      // After evaluation, object will be (with 12345 being our unique number):
      // ```js
      // { foo: 'foo', bar: 12345 }
      // ```
      const obj = evaluate(proxy);

      // When we JSON stringify obj, we'll get the string
      // ```js
      // '{ "foo": "foo", "bar": 12345 }'
      // ```
      const json = JSON.stringify(obj);

      // Now, we can search for our unqiue number to find all our inclusions!
      const regex = new RegExp(`((?:(?!${uniq})[^])*)(${uniq}|$)`, 'g');
      let match;
      while ((match = regex.exec(json))) {
        const cooked = match[1];
        // If match[2] is not the unique number, it's the end of string.
        const endOfString = match[2] === '';

        // The first execution, cooked will be '{ "foo": "foo", "bar": ', and
        // endOfString will be false.
        // The second execution, cooked will be ' }', and endOfString will be
        // true.

        // We must escape any escape sequences (and any special template
        // interpolation strings) to generate the raw value (this is an AST
        // requirement).
        if (cooked || !endOfString) {
          const raw = cooked.replace(/\${|\\|`/g, '\\$&');
          quasis.push(t.templateElement({cooked, raw}));
        }

        // Our regex can execute forever (it's happy with empty matches). So,
        // explicitly check for the end of the string to break.
        if (endOfString) {
          break;
        }
      }

      // At this point, quasis will be all of our cooked strings, and
      // expressions will be all our our included sections. As source code, it'
      // looks like:
      // ```js
      // `{ "foo": "foo", "bar": ${bar} }`
      // ```
      return t.templateLiteral(quasis, expressions);
    } catch (e) {
      const ref = arg || path;
      throw ref.buildCodeFrameError(
        'failed to parse JSON value. Is this a statically computable value?'
      );
    }
  }

  const handlers = Object.assign(Object.create(null), {
    jsonConfiguration(path) {
      path.replaceWith(template.expression.ast`
        JSON.parse(${stringifyValue(path)})
      `);
    },

    includeJsonLiteral(path) {
      path.replaceWith(path.node.arguments[0]);
    },

    jsonLiteral(path) {
      path.replaceWith(stringifyValue(path));
    },
  });

  return {
    name: 'transform-json-configuration',

    visitor: {
      CallExpression(path) {
        const handler = handlers[path.node.callee.name];
        if (handler) {
          handler(path);
        }
      },
    },
  };
};


text:
using EPiServer.Cms.UI.AspNetIdentity;
using EPiServer.Reference.Commerce.Shared.Identity;
using EPiServer.Reference.Commerce.Site.Features.Login.Pages;
using EPiServer.Reference.Commerce.Site.Features.Login.Services;
using EPiServer.Reference.Commerce.Site.Features.Shared.Controllers;
using EPiServer.Reference.Commerce.Site.Infrastructure.Facades;
using Microsoft.AspNet.Identity;
using Microsoft.Owin.Security;
using Moq;
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Xunit;

namespace EPiServer.Reference.Commerce.Site.Tests.Features.Shared.Controllers
{
    public class IdentityControllerBaseTests
    {
        [Fact]
        public void RedirectToLocal_WhenReturnUrlIsLocal_ShouldRedirectToReturnUrl()
        {
            const string url = "http://test.com/episerver";
            var result = _subject.RedirectToLocal(url);
            var redirectResult = result as RedirectResult;
            Assert.Equal(url, redirectResult.Url);
        }

        [Fact]
        public void RedirectToLocal_WhenReturnUrlIsNotLocal_ShouldRedirectToHome()
        {
            const string url = "http://tester.com/episerver";
            var result = _subject.RedirectToLocal(url);
            var redirectResult = result as RedirectToRouteResult;
            Assert.Equal("Index", redirectResult.RouteValues["action"]);
        }

        [Fact]
        public void SignOut_ShouldRedirectToHome()
        {
            var result = _subject.SignOut();
            var redirectResult = result as RedirectToRouteResult;
            Assert.Equal("Index", redirectResult.RouteValues["action"]);
        }

        private FakeLoginController _subject;

        public IdentityControllerBaseTests()
        {
            var authenticationManager = new Mock<IAuthenticationManager>();
            var userStore = new Mock<IUserStore<SiteUser>>();
            var userManager = new Mock<ApplicationUserManager<SiteUser>>(userStore.Object);
            var customercontextFacadeMock = new Mock<CustomerContextFacade>();
            var signInManager = new Mock<ApplicationSignInManager<SiteUser>>(userManager.Object, authenticationManager.Object, new ApplicationOptions());
            var request = new Mock<HttpRequestBase>();
            var httpContext = new Mock<HttpContextBase>();
            var userService = new UserService(userManager.Object, signInManager.Object, authenticationManager.Object, null, customercontextFacadeMock.Object);

            request.Setup(
                x => x.Url)
                .Returns(new Uri("http://test.com"));

            httpContext.SetupGet(
                x => x.Request)
                .Returns(request.Object);

            _subject = new FakeLoginController(signInManager.Object, userManager.Object, userService);
            _subject.ControllerContext = new ControllerContext(httpContext.Object, new RouteData(), _subject);
        }

        private class FakeLoginController : IdentityControllerBase<LoginRegistrationPage>
        {
            public FakeLoginController(ApplicationSignInManager<SiteUser> applicationSignInManager, ApplicationUserManager<SiteUser> userManager, UserService userService)
                : base(applicationSignInManager, userManager, userService)
            {

            }
        }
    }
}


text:
Traverse down nested directories and pull/fetch all found git repos.

For simple tasks like updating a slew of projects or performing scripting work
across multiple git repos within the current directory.

## Usage

```
-v, --version           List version information
-h, --help              List commands and information
-l, --list              Find and list all git directories
-d, --dry-run           Don't perform any actions on found git repos
-u, --update            Iterate over every nested repo and fetch/update each
```

## Examples

- `git deep -u` - Update all nested git projects
- `git deep -l` - List all nested git projects, scriptable for solving for things like...

_Who is banned from vacation during the next alpha release?_

```
for microsvc in $(git deep -l); do git --git-dir=$microsvc/.git log --pretty="%ae" remotes/origin/beta..remotes/origin/master 2>/dev/null; done | sort | uniq -c | sort -r
```


text:
<!doctype html>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Empty layer — Google Earth Enterprise 5.3.8 documentation</title>
    <link rel="stylesheet" href="../../static/bizstyle.css" type="text/css" />
    <link rel="stylesheet" href="../../static/pygments.css" type="text/css" />

    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Pyramid data" href="pyramidData.html" />
    <link rel="prev" title="libjpeg.so.62" href="libjpeg_so_62.html" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0">

Navigation

          index

          next |

          previous |

Google Earth Enterprise 5.3.8 documentation »

Troubleshooting and error messages »

Previous topic

libjpeg.so.62

Next topic

Pyramid data

Quick search

    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

Empty layer¶

Error message

No features selected by any of the filters. Layer would be empty.

Description

This error appears in the index of the project Asset log when one
of your layers is set to not display any data.

Resolution

Check and correct for a mistake in a filter, e.g., using a
comma in a filter value (such as 2,000 instead of 2000), selecting
Match all of the following when you mean to select Match any
of the following, selecting equals instead of does not
equal, etc.

Navigation

          index

          next |

          previous |

Google Earth Enterprise 5.3.8 documentation »

Troubleshooting and error messages »

        © Copyright 2020, Open GEE Contributors.
      Created using Sphinx 1.7.5.


text:
namespace Google.Cloud.DataLabeling.V1Beta1.Snippets
{
    // [START datalabeling_v1beta1_generated_DataLabelingService_CreateEvaluationJob_sync_flattened]
    using Google.Cloud.DataLabeling.V1Beta1;

    public sealed partial class GeneratedDataLabelingServiceClientSnippets
    {
        /// <summary>Snippet for CreateEvaluationJob</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateEvaluationJob()
        {
            // Create client
            DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.Create();
            // Initialize request argument(s)
            string parent = "projects/[PROJECT]";
            EvaluationJob job = new EvaluationJob();
            // Make the request
            EvaluationJob response = dataLabelingServiceClient.CreateEvaluationJob(parent, job);
        }
    }
    // [END datalabeling_v1beta1_generated_DataLabelingService_CreateEvaluationJob_sync_flattened]
}


text:
extern "Java"
{
  namespace org
  {
    namespace w3c
    {
      namespace dom
      {
          class DOMError;
          class DOMLocator;
      }
    }
  }
}

class org::w3c::dom::DOMError : public ::java::lang::Object
{

public:
  virtual jshort getSeverity() = 0;
  virtual ::java::lang::String * getMessage() = 0;
  virtual ::java::lang::String * getType() = 0;
  virtual ::java::lang::Object * getRelatedException() = 0;
  virtual ::java::lang::Object * getRelatedData() = 0;
  virtual ::org::w3c::dom::DOMLocator * getLocation() = 0;
  static const jshort SEVERITY_WARNING = 1;
  static const jshort SEVERITY_ERROR = 2;
  static const jshort SEVERITY_FATAL_ERROR = 3;
  static ::java::lang::Class class$;
} __attribute__ ((java_interface));

#endif // __org_w3c_dom_DOMError__


text:
'use strict';

var fs = require('fs');
var extend = require('extend-shallow');
var parse = require('./lib/parse');
var defaults = require('./lib/defaults');
var stringify = require('./lib/stringify');
var excerpt = require('./lib/excerpt');
var engines = require('./lib/engines');
var toFile = require('./lib/to-file');
var utils = require('./lib/utils');
var cache = {};

/**
 * Takes a string or object with `content` property, extracts
 * and parses front-matter from the string, then returns an object
 * with `data`, `content` and other [useful properties](#returned-object).
 *
 * ```js
 * var matter = require('gray-matter');
 * console.log(matter('---\ntitle: Home\n---\nOther stuff'));
 * //=> { data: { title: 'Home'}, content: 'Other stuff' }
 * ```
 * @param {Object|String} `input` String, or object with `content` string
 * @param {Object} `options`
 * @return {Object}
 * @api public
 */

function matter(input, options) {
  var file = {data: {}, content: input, excerpt: '', orig: input};
  if (input === '') return file;

  file = toFile(input);
  var cached = cache[file.content];

  if (!options) {
    if (cached) {
      file = extend({}, cached);
      file.orig = cached.orig;
      return file;
    }
    cache[file.content] = file;
  }

  return parseMatter(file, options);
}

function parseMatter(file, options) {
  var opts = defaults(options);
  var open = opts.delimiters[0];
  var close = '\n' + opts.delimiters[1];
  var str = file.content;

  if (opts.language) {
    file.language = opts.language;
  }

  // get the length of the opening delimiter
  var openLen = open.length;
  if (!utils.startsWith(str, open, openLen)) {
    excerpt(file, opts);
    return file;
  }

  // if the next character after the opening delimiter is
  // a character from the delimiter, then it's not a front-
  // matter delimiter
  if (str.charAt(openLen) === open.slice(-1)) {
    return file;
  }

  // strip the opening delimiter
  str = str.slice(openLen);
  var len = str.length;

  // use the language defined after first delimiter, if it exists
  var language = matter.language(str, opts);
  if (language.name) {
    file.language = language.name;
    str = str.slice(language.raw.length);
  }

  // get the index of the closing delimiter
  var closeIndex = str.indexOf(close);
  if (closeIndex === -1) {
    closeIndex = len;
  }

  // get the raw front-matter block
  file.matter = str.slice(0, closeIndex);

  // create file.data by parsing the raw file.matter block
  file.data = parse(file.language, file.matter, opts);

  // update file.content
  if (closeIndex === len) {
    file.content = '';
  } else {
    file.content = str.slice(closeIndex + close.length);
    if (file.content[0] === '\r') {
      file.content = file.content.slice(1);
    }
    if (file.content[0] === '\n') {
      file.content = file.content.slice(1);
    }
  }

  excerpt(file, opts);
  return file;
}

/**
 * Expose engines
 */

matter.engines = engines;

/**
 * Stringify an object to YAML or the specified language, and
 * append it to the given string. By default, only YAML and JSON
 * can be stringified. See the [engines](#engines) section to learn
 * how to stringify other languages.
 *
 * ```js
 * console.log(matter.stringify('foo bar baz', {title: 'Home'}));
 * // results in:
 * // ---
 * // title: Home
 * // ---
 * // foo bar baz
 * ```
 * @param {String|Object} `file` The content string to append to stringified front-matter, or a file object with `file.content` string.
 * @param {Object} `data` Front matter to stringify.
 * @param {Object} `options` [Options](#options) to pass to gray-matter and [js-yaml].
 * @return {String} Returns a string created by wrapping stringified yaml with delimiters, and appending that to the given string.
 * @api public
 */

matter.stringify = function(file, data, options) {
  if (typeof file === 'string') {
    file = matter(file, options);
  }
  return stringify(file, data, options);
};

/**
 * Synchronously read a file from the file system and parse
 * front matter. Returns the same object as the [main function](#matter).
 *
 * ```js
 * var file = matter.read('./content/blog-post.md');
 * ```
 * @param {String} `filepath` file path of the file to read.
 * @param {Object} `options` [Options](#options) to pass to gray-matter.
 * @return {Object} Returns [an object](#returned-object) with `data` and `content`
 * @api public
 */

matter.read = function(filepath, options) {
  var str = fs.readFileSync(filepath, 'utf8');
  var file = matter(str, options);
  file.path = filepath;
  return file;
};

/**
 * Returns true if the given `string` has front matter.
 * @param  {String} `string`
 * @param  {Object} `options`
 * @return {Boolean} True if front matter exists.
 * @api public
 */

matter.test = function(str, options) {
  var opts = defaults(options);
  return utils.startsWith(str, opts.delimiters[0]);
};

/**
 * Detect the language to use, if one is defined after the
 * first front-matter delimiter.
 * @param  {String} `string`
 * @param  {Object} `options`
 * @return {Object} Object with `raw` (actual language string), and `name`, the language with whitespace trimmed
 */

matter.language = function(str, options) {
  var opts = defaults(options);
  var open = opts.delimiters[0];

  if (matter.test(str)) {
    str = str.slice(open.length);
  }

  var language = str.slice(0, str.search(/\r?\n/));
  return {
    raw: language,
    name: language ? language.trim() : ''
  };
};

/**
 * Expose `matter`
 */

module.exports = matter;


text:
class LRCorrectionParameters
{
    public:
        const BWT* pBWT;
        const BWT* pRBWT;
        const SampledSuffixArray* pSSA;
        LRAlignment::LRParams alignParams;
        int minLength;
};

// Object holding the result of correcting one read
class LRCorrectionResult
{
    public:
        LRCorrectionResult() {}

        // data
        std::string correctedSequence;

};

//
class LRCorrectionProcess
{
    public:
        LRCorrectionProcess(const LRCorrectionParameters params);
        ~LRCorrectionProcess();

        LRCorrectionResult process(const SequenceWorkItem& item);

    private:

        LRCorrectionParameters m_params;
};

// Write the results from the overlap step to an ASQG file
class LRCorrectionPostProcess
{
    public:
        LRCorrectionPostProcess(std::ostream* pCorrectedWriter);
        ~LRCorrectionPostProcess();

        void process(const SequenceWorkItem& item, const LRCorrectionResult& result);

    private:

        std::ostream* m_pCorrectedWriter;

        size_t m_readsKept;
        size_t m_readsDiscarded;
};

#endif


text:
<?php
require_once('vendor/endroid/qrcode/src/QrCode.php');
use Endroid\QrCode\QrCode;
    $servername = getenv('IP');
    $username = "rahul";
    $password = "12345678";
    $database = "c9";
    $dbport = 3306;
      $db = new mysqli($servername, $username, $password, $database, $dbport);
    // Check connection
    if ($db->connect_error) {
        die("Connection failed: " . $db->connect_error);
    }
    $string;
    $temp = 0;
    while($temp == 0){
    $rdrString = generateRandomString();
    $sql = "SELECT Name FROM Invite WHERE Code='" .$rdrString ."'";
$result = $db->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
} else{
    $string = $rdrString;
    $temp = 1;

}
    }

$qrCodeText =  'This is an invitation to Nps Hsr 10th Grade Grad Party At Holiday Inn on 8th of April from 6 pm to 11:30 pm for : ';
$name = $_POST['name'];
$password = $_POST['password'];

$email = $_POST['email'];
//$hashed = "af0133b1b5763e9e571fd77e5be993e4";
//if ($hashed == "af0133b1b5763e9e571fd77e5be993e4" || $hashed == "015c06a32527a5fb677fb29cdb79c807" || $hashed  == "25d55ad283aa400af464c76d713c07ad") {
$go = 0;
$conflict = $_POST['conflict'];
if($conflict != 0){
    if($password == "Rtb12345"){
        $go =1;
    }
}else {
    if($password == "password"){
        $go =1;
    }
}
if($go != 0) {

$qrCodeText = $qrCodeText . $name . ".This invite is only for one." . "Authentication Code is:". $string ;
 $sql = "INSERT INTO Invite (Name, Code)
VALUES ('".$name."','".$string ."')";

if ($db->query($sql) === TRUE) {
    //echo "New record created successfully";
} else {
    echo "Error: " . $sql . "
" . $conn->error;
}
$db->close();
$qrCode = new QrCode();
$qrCode
    //->setText('This is an invitation to Nps Hsr 10th Grade Grad Party At (our location) on 8th of April(mostly) from 7 pm to 11 pm(again to change with change in time) for :')
    ->setText($qrCodeText)
    ->setSize(300)
    ->setPadding(10)
    ->setErrorCorrection('high')
    ->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0])
    ->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0])
    ->setLabel('Scan the code')
    ->setLabelFontSize(16)
    ->setImageType(QrCode::IMAGE_TYPE_PNG)
;

// now we can directly output the qrcode
header('Content-Type: '.$qrCode->getContentType());
$qrCode->render();
// save it to a file
$qrCode->save('qrcode.png');
//enable below to send emails
sendMail($email,$name);
/*
// using phpmailer
require 'vendor/phpmailer/phpmailer/PHPMailerAutoload.php';

//Create a new PHPMailer instance
$mail = new PHPMailer();

//Tell PHPMailer to use SMTP
$mail->isSMTP();

//Enable SMTP debugging

$mail->SMTPDebug = 2;

//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';

//Set the hostname of the mail server
$mail->Host = 'ssl://email-smtp.us-east-1.amazonaws.com';

//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
// I tried PORT 25, 465 too
$mail->Port = 587;

//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';

//Whether to use SMTP authentication
$mail->SMTPAuth = true;

//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "AKIAIIG5KZVRZRJYK7CQ";

//Password to use for SMTP authentication
$mail->Password = "AnAmQG7R3OlH9PcaOn13hOEbitVdmeH3ZKk+siUGKtLT";

//Set who the message is to be sent from
$mail->setFrom('npshsrgrad2017@gmail.com', 'sender');

//Set who the message is to be sent to
$mail->addAddress($email, 'receiver');

//Set the subject line
$mail->Subject = 'Grad Party Invitation';

$mail->Body = 'This is invitaion to grad party from AWS through php mailer';
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';

//send the message, check for errors
if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}

*/
//$response = new Response($qrCode->get(), 200, ['Content-Type' => $qrCode->getContentType()]);
} else {
    echo "Invalid Password";
}
function sendMail($sento,$name){
require_once 'vendor/swiftmailer/swiftmailer/lib/swift_required.php';

$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl")
  ->setUsername('npshsrgrad2017@gmail.com')
  ->setPassword('sherlocked');

$mailer = Swift_Mailer::newInstance($transport);

$message = Swift_Message::newInstance('Nps Hsr Grad Party Invite')
  ->setFrom(array('npshsrgrad2017@gmail.com' => 'Nps Hsr Grad Party'))
  ->setTo(array($sento))
  ->setBody('
Nps Hsr Grad Party Invite For - ' . $name . '

Venue: Holiday Inn

        Time: 6pm To 11:30 pm

        Date: 8th April 2017

Don't forget your QR code, if you want to enter the party! This invite allows the entry of ONE INDIVIDUAL. No guardians shall be allowed into the venue.Also remember that you have paid for only one plate for your food! Don't take anymore plates unless you're willing to pay 1,500 INR more for each plate!
Dress Code is compulsory. Come dressed in your semi-formal best!

The pool is off limits, unless you are willing to pay a fine of INR 50,000.
Under no circumstance can you play a Yash Raj Film song, unless you can miraculously conjure 1.5 lakhs, to pay as a fine!
There will be no refund any circumstance.
Enjoy!
','text/html')

  ->attach(Swift_Attachment::fromPath('qrcode.png'));
$message->setCc(array(
    'rahultarak12345@gmail.com' => 'Rahul Tarak',
    'kasturi.kk14@gmail.com' => 'Kasturi K',
    'dudechubs@gmail.com' => 'Dhruv Saxena'
    ));
$result = $mailer->send($message);
 if (!$mailer->send($message, $failures))
{
  echo "Failures:";
  print_r($failures);
}
}
function generateRandomString() {
    $length = 10;
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
?>


text:
package org.infinispan.loaders.cassandra;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import org.apache.cassandra.config.ConfigurationException;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.io.util.FileUtils;
import org.apache.cassandra.thrift.CassandraDaemon;
import org.apache.thrift.transport.TTransportException;
import org.infinispan.commons.util.SysPropertyActions;

public class EmbeddedServerHelper {
   private static final String TMP = SysPropertyActions.getProperty("java.io.tmpdir")+File.separator+EmbeddedServerHelper.class.getPackage().getName()+"-test";

   private final String yamlFile;
   static CassandraDaemon cassandraDaemon;

   public EmbeddedServerHelper() {
      this("/cassandra.yaml");
   }

   public EmbeddedServerHelper(String yamlFile) {
      this.yamlFile = yamlFile;
   }

   static ExecutorService executor = Executors.newSingleThreadExecutor();

   /**
    * Set embedded cassandra up and spawn it in a new thread.
    *
    * @throws TTransportException
    * @throws IOException
    * @throws InterruptedException
    */
   public void setup() throws TTransportException, IOException, InterruptedException,
            ConfigurationException {
      // delete tmp dir first
      rmdir(TMP);
      // make a tmp dir and copy cassandra.yaml and log4j.properties to it
      copy("/log4j.properties", TMP);
      copy(yamlFile, TMP);
      System.setProperty("cassandra.config", "file:" + TMP + yamlFile);
      System.setProperty("log4j.configuration", "file:" + TMP + "/log4j.properties");
      System.setProperty("cassandra-foreground", "true");

      cleanupAndLeaveDirs();

      executor.execute(new CassandraRunner());
      try {
         TimeUnit.SECONDS.sleep(3);
      } catch (InterruptedException e) {
         throw new AssertionError(e);
      }
   }

   public static void teardown() throws IOException {
      executor.shutdown();
      executor.shutdownNow();
      // delete tmp dir
      rmdir(TMP);
   }

   private static void rmdir(String dir) throws IOException {
      File dirFile = new File(dir);
      if (dirFile.exists()) {
         FileUtils.deleteRecursive(new File(dir));
      }
   }

   /**
    * Copies a resource from within the jar to a directory.
    *
    * @param resource
    * @param directory
    * @throws IOException
    */
   private static void copy(String resource, String directory) throws IOException {
      mkdir(directory);
      InputStream is = EmbeddedServerHelper.class.getResourceAsStream(resource);
      String fileName = resource.substring(resource.lastIndexOf("/") + 1);
      File file = new File(directory + SysPropertyActions.getProperty("file.separator") + fileName);
      OutputStream out = new FileOutputStream(file);
      byte buf[] = new byte[1024];
      int len;
      while ((len = is.read(buf)) > 0) {
         out.write(buf, 0, len);
      }
      out.close();
      is.close();
   }

   /**
    * Creates a directory
    *
    * @param dir
    * @throws IOException
    */
   private static void mkdir(String dir) throws IOException {
      FileUtils.createDirectory(dir);
   }

   public static void cleanupAndLeaveDirs() throws IOException {
      mkdirs();
      cleanup();
      mkdirs();
      CommitLog.instance.resetUnsafe(); // cleanup screws w/ CommitLog, this
      // brings it back to safe state
   }

   public static void cleanup() throws IOException {
      // clean up commitlog
      String[] directoryNames = { DatabaseDescriptor.getCommitLogLocation(), };
      for (String dirName : directoryNames) {
         File dir = new File(dirName);
         if (!dir.exists())
            throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
         FileUtils.deleteRecursive(dir);
      }

      // clean up data directory which are stored as data directory/table/data
      // files
      for (String dirName : DatabaseDescriptor.getAllDataFileLocations()) {
         File dir = new File(dirName);
         if (!dir.exists())
            throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
         FileUtils.deleteRecursive(dir);
      }
   }

   public static void mkdirs() {
      try {
         DatabaseDescriptor.createAllDirectories();
      } catch (IOException e) {
         throw new RuntimeException(e);
      }
   }

   class CassandraRunner implements Runnable {
      @Override
      public void run() {
         cassandraDaemon = new CassandraDaemon();
         cassandraDaemon.activate();
      }
   }
}


text:
package ru.job4j.dopzadanie;

/**
 * Class WordInAnotherWord
 *
 * @author Aglyzin
 * @version 1
 * @since 08.10.2017
 */

public class WordInAnotherWord {

    /**
     * @param origin - one word
     * @param sub    - two word
     * @return - oneword(twoword) true or false
     */

    public boolean contains(String origin, String sub) {
        char[] first = origin.toCharArray();
        char[] second = sub.toCharArray();
        for (int i = 0; i < second.length; i++) {
            for (int j = 0; j < first.length; j++) {

                if (second[i] == first[j]) break;

                if (j == first.length - 1) return false;

            }
        }
        return true;
    }

}


text:
package Games::ABC_Path::Solver::Move::LettersNotInVicinity;

use strict;
use warnings;

use base 'Games::ABC_Path::Solver::Move';

=head1 NAME

Games::ABC_Path::Solver::Move::LettersNotInVicinity - an ABC Path move
that indicates that letters are not in vicinity to one another in a certain
cell.

=head1 VERSION

Version 0.4.0

=cut

our $VERSION = '0.4.0';

=head1 SYNOPSIS

    use Games::ABC_Path::Solver::Move::LettersNotInVicinity;

    my $move = Games::ABC_Path::Solver::Move::LettersNotInVicinity->new(
        {
            vars =>
            {
                target => 6
                coords => [1,2],
                source => 5,
            },
        }
    );

=head1 DESCRIPTION

This is a move that indicates that the C<'letter'> has the last remaining cell
as C<'coords'>.

=cut

sub _format {
    return "%(target){letter} cannot be at %(coords){coords} due to lack of vicinity from %(source){letter}.";
}

=head1 AUTHOR

Shlomi Fish, C<< <shlomif at cpan.org> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-games-abc_path-solver at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-ABC_Path-Solver>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Games::ABC_Path::Solver::Move

You can also look for information at:

=over 4

=item * RT: CPAN's request tracker

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Games-ABC_Path-Solver>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Games-ABC_Path-Solver>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/Games-ABC_Path-Solver>

=item * Search CPAN

L<http://search.cpan.org/dist/Games-ABC_Path-Solver/>

=back

=head1 ACKNOWLEDGEMENTS

=head1 COPYRIGHT & LICENSE

Copyright 2010 Shlomi Fish.

This program is distributed under the MIT (X11) License:
L<http://www.opensource.org/licenses/mit-license.php>

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

=cut

1;


text:
class Admin::UploadProblemsReportController < AdminController
  def index
    @cases_with_upload_problems = TribunalCase.with_upload_problems.order(created_at: :desc)
  end
end


text:
package com.justplay1.shoppist.shared.base.adapters;

import android.content.Context;
import android.support.annotation.ColorInt;
import android.support.v4.content.ContextCompat;
import android.support.v4.util.Pair;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.h6ah4i.android.widget.advrecyclerview.expandable.ExpandableItemAdapter;
import com.justplay1.shoppist.R;
import com.justplay1.shoppist.models.BaseViewModel;
import com.justplay1.shoppist.models.HeaderViewModel;
import com.justplay1.shoppist.models.Priority;

import com.justplay1.shoppist.shared.widget.actionmode.ActionModeInteractionListener;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Mkhytar Mkhoian.
 */
public abstract class BaseExpandableAdapter<T extends BaseViewModel, GVH extends RecyclerView.ViewHolder, CVH extends RecyclerView.ViewHolder>
        extends BaseAdapter<T>
        implements ExpandableItemAdapter<GVH, CVH> {

    protected List<Pair<HeaderViewModel, List<T>>> data;

    @ColorInt private int noPriority;
    @ColorInt private int noPriorityBackground;
    @ColorInt private int highPriority;
    @ColorInt private int lowPriority;
    @ColorInt private int mediumPriority;

    public BaseExpandableAdapter(Context context, ActionModeInteractionListener listener,
                                 RecyclerView recyclerView) {
        super(context, listener, recyclerView);

        noPriority = ContextCompat.getColor(context, R.color.action_mode_toolbar_color);
        noPriorityBackground = ContextCompat.getColor(context, android.R.color.transparent);
        highPriority = ContextCompat.getColor(context, R.color.red_color);
        lowPriority = ContextCompat.getColor(context, R.color.green_500);
        mediumPriority = ContextCompat.getColor(context, R.color.orange_500);

        data = new ArrayList<>(1);
    }

    public List<Pair<HeaderViewModel, List<T>>> getData() {
        return data;
    }

    public void setData(List<Pair<HeaderViewModel, List<T>>> data) {
        this.data = data;
    }

    protected void setPriorityTextColor(@Priority int priority, TextView view) {
        switch (priority) {
            case Priority.HIGH:
                view.setTextColor(highPriority);
                break;
            case Priority.LOW:
                view.setTextColor(lowPriority);
                break;
            case Priority.MEDIUM:
                view.setTextColor(mediumPriority);
                break;
            case Priority.NO_PRIORITY:
                view.setTextColor(noPriority);
                break;
        }
    }

    protected void setPriorityBackgroundColor(@Priority int priority, View view) {
        switch (priority) {
            case Priority.HIGH:
                view.setBackgroundColor(highPriority);
                break;
            case Priority.LOW:
                view.setBackgroundColor(lowPriority);
                break;
            case Priority.MEDIUM:
                view.setBackgroundColor(mediumPriority);
                break;
            case Priority.NO_PRIORITY:
                view.setBackgroundColor(noPriorityBackground);
                break;
        }
    }

    @Override
    protected void refreshInvisibleItems() {
        if (linearLayoutManager.findFirstVisibleItemPosition() > 0) {
            notifyItemRangeChanged(0, linearLayoutManager.findFirstVisibleItemPosition());
        }
        notifyItemRangeChanged(linearLayoutManager.findLastVisibleItemPosition() + 1,
                (getGroupCount() + getChildItemsCount()) - linearLayoutManager.findLastVisibleItemPosition());
    }

    private List<T> getItems(boolean checked) {
        List<T> items = new ArrayList<>();
        for (Pair<HeaderViewModel, List<T>> pair : data) {
            for (T item : pair.second) {
                if (checked) {
                    if (item.isChecked()) {
                        items.add(item);
                    }
                } else {
                    items.add(item);
                }
            }
        }
        return items;
    }

    public int getChildItemsCount() {
        if (data == null) return 0;
        int count = 0;
        for (Pair<HeaderViewModel, List<T>> pair : data) {
            count += pair.second.size();
        }
        return count;
    }

    public List<T> getItems() {
        return getItems(false);
    }

    public List<T> getCheckedItems() {
        return getItems(true);
    }

    public int getGroupItemCount(int groupPosition) {
        if (groupPosition < 0 || groupPosition >= getGroupCount()) {
            throw new IndexOutOfBoundsException("groupPosition = " + groupPosition);
        }
        return data.get(groupPosition).second.size();
    }

    public HeaderViewModel getGroupItem(int groupPosition) {
        if (groupPosition < 0 || groupPosition >= getGroupCount()) {
            throw new IndexOutOfBoundsException("groupPosition = " + groupPosition + " getGroupCount()" + getGroupCount());
        }
        return data.get(groupPosition).first;
    }

    public T getChildItem(int groupPosition, int childPosition) {
        if (groupPosition < 0 || groupPosition >= getGroupCount()) {
            throw new IndexOutOfBoundsException("groupPosition = " + groupPosition);
        }

        final List<T> children = data.get(groupPosition).second;

        if (childPosition < 0 || childPosition >= children.size()) {
            throw new IndexOutOfBoundsException("childPosition = " + childPosition);
        }
        return children.get(childPosition);
    }

    @Override
    public int getGroupCount() {
        if (data == null) return 0;
        return data.size();
    }

    @Override
    public void onBindGroupViewHolder(GVH holder, int groupPosition, int viewType, List<Object> payloads) {
        onBindGroupViewHolder(holder, groupPosition, viewType);
    }

    @Override
    public void onBindChildViewHolder(CVH holder, int groupPosition, int childPosition, int viewType, List<Object> payloads) {
        onBindChildViewHolder(holder, groupPosition, childPosition, viewType);
    }

    @Override
    public int getChildCount(int groupPosition) {
        return data.get(groupPosition).second.size();
    }

    @Override
    public long getGroupId(int groupPosition) {
        return getGroupItem(groupPosition).hashCode();
    }

    @Override
    public long getChildId(int groupPosition, int childPosition) {
        return getChildItem(groupPosition, childPosition).hashCode();
    }

    /**
     * This method will not be called.
     * Override {@link #onCreateGroupViewHolder(android.view.ViewGroup, int)} and
     * {@link #onCreateChildViewHolder(android.view.ViewGroup, int)} instead.
     *
     * @param parent   not used
     * @param viewType not used
     * @return null
     */
    @Override
    public final RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return null;
    }

    /**
     * This method will not be called.
     * Override {@link #getGroupId(int)} and {@link #getChildId(int, int)} instead.
     *
     * @param position not used
     * @return {@link RecyclerView#NO_ID}
     */
    @Override
    public final long getItemId(int position) {
        return RecyclerView.NO_ID;
    }

    /**
     * This method will not be called.
     * Override {@link #getGroupItemViewType(int)} and {@link #getChildItemViewType(int, int)} instead.
     *
     * @param position not used
     * @return 0
     */
    @Override
    public final int getItemViewType(int position) {
        return 0;
    }

    /**
     * This method will not be called.
     * Override {@link #getGroupCount()} and {@link #getChildCount(int)} instead.
     *
     * @return 0
     */
    @Override
    public final int getItemCount() {
        return getChildItemsCount();
    }

    /**
     * This method will not be called.
     * Override {@link #onBindGroupViewHolder(RecyclerView.ViewHolder, int, int)} ()} and
     * {@link #onBindChildViewHolder(RecyclerView.ViewHolder, int, int, int)} instead.
     *
     * @param holder   not used
     * @param position not used
     */
    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {

    }

    /**
     * Override this method if need to customize the behavior.
     * {@inheritDoc}
     */
    @Override
    public boolean onHookGroupExpand(int groupPosition, boolean fromUser) {
        return true;
    }

    /**
     * Override this method if need to customize the behavior.
     * {@inheritDoc}
     */
    @Override
    public boolean onHookGroupCollapse(int groupPosition, boolean fromUser) {
        return true;
    }
}


text:
START_ATF_NAMESPACE
    typedef unsigned int error_status_t;
END_ATF_NAMESPACE


text:
package org.cloudfoundry.samples.music.web;

import org.springframework.stereotype.Component;

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

/**
 * Created by shijian on 21/02/2017.
 */
@Component
public class CORSConfig implements Filter {

    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletResponse response = (HttpServletResponse) res;
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, OPTIONS, DELETE, PATCH");
        response.setHeader("Access-Control-Max-Age", "3600");
        response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
        response.setHeader("Access-Control-Expose-Headers", "Location");
        chain.doFilter(req, res);
    }

    public void init(FilterConfig filterConfig) {}

    public void destroy() {}

}


text:
//
//  NSDate+Extension.m
//
//
//  Created by apple on 14/12/13.
//  Copyright (c) 2014年 KNKane. All rights reserved.
//

#import "NSDate+Extension.h"

@implementation NSDate (Extension)

///**
// *  计算toDate和self的时间差距
// */
//- (NSDateComponents *)componentsToDate:(NSDate *)toDate
//{
//    NSCalendar *calendar = [NSCalendar currentCalendar];
//    int unit = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
//    return [calendar components:unit fromDate:self toDate:toDate options:0];
//}
//
///**
// *  是否为今年
// */
//- (BOOL)isThisYear
//{
//    NSCalendar *calendar = [NSCalendar currentCalendar];
//    NSInteger nowYear = [calendar component:NSCalendarUnitYear fromDate:[NSDate date]];
//    NSInteger selfYear = [calendar component:NSCalendarUnitYear fromDate:self];
//    return nowYear == selfYear;
//}
//
///**
// *  是否为今天
// */
//- (BOOL)isToday
//{
//    NSCalendar *calendar = [NSCalendar currentCalendar];
//    return [calendar components:NSCalendarUnitDay fromDate:[NSDate date].ymd toDate:self.ymd options:0].day == 0;
//}
//
///**
// *  是否为昨天
// */
//- (BOOL)isYesterday
//{
//    // 1.获得系统自带的日历对象
//    NSCalendar *calendar = [NSCalendar currentCalendar];
//
//    // 2.比较2个时间的差距
//    NSDateComponents *cmps = [calendar components:NSCalendarUnitDay fromDate:self.ymd toDate:[NSDate date].ymd options:0];
//    return cmps.day == 1;
//}
//
///**
// *  是否为明天
// */
//- (BOOL)isTomorrow
//{
//    // 1.获得系统自带的日历对象
//    NSCalendar *calendar = [NSCalendar currentCalendar];
//
//    // 2.比较2个时间的差距
//    NSDateComponents *cmps = [calendar components:NSCalendarUnitDay fromDate:self.ymd toDate:[NSDate date].ymd options:0];
//    return cmps.day == -1;
//}
//
///**
// *  将一个时间变为只有年月日的时间(时分秒都是0)
// */
//- (NSDate *)ymd
//{
//    NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
//    fmt.dateFormat = @"yyyy-MM-dd";
//    return [fmt dateFromString:[fmt stringFromDate:self]];
//}

- (BOOL)isInSevenDays
{
    NSDate *anotherDate = [NSDate date];
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSUInteger unitFlags = NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
    NSDateComponents *anotherComponents = [calendar components:unitFlags fromDate:anotherDate];
    int oneDaySec = 60*60*24;
    if ([anotherDate timeIntervalSince1970] - anotherComponents.hour*60*60 - anotherComponents.minute*60 - anotherComponents.second - oneDaySec*7 - [self timeIntervalSince1970] <= 0) {
        return true;
    }else{
        return false;
    }
}

@end


text:
Please follow these instructions carefully to set up a new exercise for the students in course. The instructions demonstrate setting up a Java exercise, however this can be adapted to any programming language supported by the build server.

## Exercise Preparation
**Requirements:** [Apache Maven](https://maven.apache.org/), [Git](https://git-scm.com/)
1. Create a new Maven project using the CLI (insert your own group ID and exercise name):

        mvn -B archetype:generate \
            -DarchetypeGroupId=org.apache.maven.archetypes \
            -DgroupId=de.tum.cs.i1.pse2016 \
            -DartifactId=exercisename

2. Configure the Maven project:
    * Add your dependencies to `pom.xml`
    * Set compiler level to Java 8 in `pom.xml`.
3. Add your code:
    - Add the assignment code to `src/main/java/`.
    - Add the testing code to `src/test/java/`.
    - Add testing resources to `src/test/resources`.
4. Initialize the Git repositories:
    - `git init` in exercise root folder.
    - Add `src/test/*` to the repository's `.gitignore`.
    - `git init` in `src/test`.
    - Add and commit files.

## Bitbucket Setup

You will need to create a unique Bitbucket project per exercise.

1. Choose an appropriate project name and key. E.g. for the exercise "*State Chart*" in the course "*Introduction to Software Engineering (Summer 2016)*" a suitable project key would be `EIST16SC`.
2. Give the user *artemis* admin permissions on the project.
3. Inside the project, create two repositories:
    1. Repository containing the exercise code for the students. Since the repository contains no reference to the Bitbucket project outside of the Bitbucket UI, we recommend to name this repository with the project key. Add this repository as a remote for your local exercise repository and push.
    2. Repository containing the testing code. Choose a descriptive name, e.g. "*TEST*". Add this repository as a remote for your local exercise's test repository and push.

## Bamboo Setup

1. Create a new plan:
    1. Choose to create it inside a new project. Preferably you should use the same project key as in Bitbucket.
    2. Give the plan a descriptive key such as "*BASE*". The plan name and description are not important.
    3. Choose an arbitrary linked repository (Will be deleted later on since we do not use linked repositories).
    4. Click "*Configure plan*".
    5. Click  "*Create*" (Setup will be completed in next step).
2. Configure the plan (`Open plan` -> `Actions` -> `Configure plan`):
    * Permissions: Remove the *View* permission for logged in and anonymous users. Add admin permissions for the user *artemis*.
    * Repositories:
        1. Remove the repository which was linked during the initial setup.
        2. Click "*Add repository*".
        3. Add the exercise code repository. **Important:** Give it the name "*Assignment*".
        4. Add the test repository. Here, an arbitrary name can be chosen.
    * Stages:
        1. Choose the default job in the default stage.
        2. Edit the source code checkout task: Add the exercise code repository (make sure it points to the repository and **not** to the default repository) and the test repository (set the checkout directory so it is checked out into `src/test/`).
        3. Add a Maven 3.x task with goal `clean test`. Check "*This build will produce test results*". Other settings might depend on your specific code setup.
        4. Add a script task with the following (inline) content:

                curl -k -X POST https://artemis.ase.in.tum.de/api/results/${bamboo.planKey}
        5. *Optional*: Add a requirement "*AgentType equals Amazon*" to the job if it should only be built on remote build agents.

## [ArTEMiS Application Setup](https://artemis.ase.in.tum)

Make sure you are in user group *ls1instructor* to have admin permissions in ArTEMiS.

1. If you have not created a course yet, do so now (`Entities` -> `Course` -> `Create a new Course`). The student group name defines in which group (in JIRA) users need to be to see this course.

2. Create a new exercise (`Entities` -> `Course` -> `Create a new Exercise`) with the following parameters:
    * *Title*: A descriptive title for the exercise
    * *Base Repository URL*: The URL of the repository containing the exercise code (e.g. *https://repobruegge.in.tum.de/scm/EIST16SC/EIST16SC.git*)
    * *Base Build Plan ID*: The identifier of the base build plan in the format `PROJECTKEY-PLANKEY` (e.g. *EIST16SC-BASE*)
    * *Publish Build Plan URL*: When set to true, students will see a link to their personalized build plan (e.g. for teaching release management)
    * *Release Date*: When the exercise will be visible to students (**Not respected yet**)
    * *Due Date*: (**Not implemented yet**)
    * *Course*: The course with which this exercise should be associated

## Known Limitations
* **Usernames**: Plans can only be cloned for users without underscores (*_*) in their usernames. This is due to restrictions on Bamboo's plan keys.
* **Test results**: Bamboo's REST API only allows access to details on failed tests via each job inside a plan. We currently only retrieve those details for the default job.


text:
<?php
namespace Hostnet\Bundle\WebpackBundle\DependencyInjection;

use Hostnet\Component\Webpack\Configuration\Config\ConfigInterface;
use Hostnet\Component\Webpack\Configuration\Loader\LoaderInterface;
use Hostnet\Component\Webpack\Configuration\Plugin\PluginInterface;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * @author Harold Iedema <hiedema@hostnet.nl>
 */
class Configuration implements ConfigurationInterface
{
    const CONFIG_ROOT = 'webpack';

    private $bundles;
    private $plugins;

    /**
     * @param array $bundles
     * @param array $plugins
     */
    public function __construct(array $bundles = [], array $plugins = [])
    {
        $this->bundles = $bundles;
        $this->plugins = $plugins;
    }

    /** {@inheritdoc} */
    public function getConfigTreeBuilder()
    {
        $tree_builder = new TreeBuilder();
        $root_node    = $tree_builder->root(self::CONFIG_ROOT);
        $children     = $root_node->children();

        $root_node->fixXmlConfig('bundle');

        $this->addNodeJSConfiguration($children);
        $this->addParentConfiguration($children);
        $this->addBundleConfiguration($children);
        $this->addLoaderConfiguration($children);
        $this->addPluginConfiguration($children);

        $children->end();

        return $tree_builder;
    }

    /**
     * Adds node-js specific configuration to the tree builder.
     *
     * @param NodeBuilder $node
     */
    private function addNodeJSConfiguration(NodeBuilder $node)
    {
        $node
            ->arrayNode('node')
            ->addDefaultsIfNotSet()
            ->children()
                ->arrayNode('binary')
                    ->addDefaultsIfNotSet()
                    ->beforeNormalization()
                    ->ifString()
                        ->then(function ($value) {
                            return [
                                'win32'     => $value,
                                'win64'     => $value,
                                'linux_x32' => $value,
                                'linux_x64' => $value,
                                'darwin'    => $value,
                                'fallback'  => $value
                            ];
                        })
                    ->end()
                    ->children()
                        ->scalarNode('win32')->defaultValue('node')->end()
                        ->scalarNode('win64')->defaultValue('node')->end()
                        ->scalarNode('linux_x32')->defaultValue('node')->end()
                        ->scalarNode('linux_x64')->defaultValue('node')->end()
                        ->scalarNode('darwin')->defaultValue('node')->end()
                        ->scalarNode('fallback')->defaultValue('node')->end()
                    ->end()
                ->end()
                ->scalarNode('npm_packages_path')->defaultNull()->end()
                ->scalarNode('node_modules_path')->defaultNull()->end()
            ->end();
    }

    /**
     * Adds generic configuration to the tree builder in the parent (root) node.
     *
     * @param NodeBuilder $node
     */
    private function addParentConfiguration(NodeBuilder $node)
    {
        $this->applyConfigurationFromClass(ConfigInterface::class, $node);
    }

    /**
     * Adds bundle configuration to the tree builder.
     *
     * @param NodeBuilder $node
     */
    private function addBundleConfiguration(NodeBuilder $node)
    {
        $node
            ->arrayNode('bundles')
                ->defaultValue($this->bundles)
                ->prototype('scalar')
                    ->validate()
                    ->ifNotInArray($this->bundles)
                    ->thenInvalid('%s is not a valid bundle.')
                ->end()
            ->end();
    }

    /**
     * @param NodeBuilder $node
     */
    private function addPluginConfiguration(NodeBuilder $node)
    {
        $children = $node
            ->arrayNode('plugins')
            ->addDefaultsIfNotSet()
            ->children();

        $this->applyConfigurationFromClass(PluginInterface::class, $children);
        $children->end();
    }

    /**
     * Adds loader configuration to the tree builder.
     *
     * @param NodeBuilder $node
     */
    private function addLoaderConfiguration(NodeBuilder $node)
    {
        $children = $node
            ->arrayNode('loaders')
            ->addDefaultsIfNotSet()
            ->children();

        $this->applyConfigurationFromClass(LoaderInterface::class, $children);
        $children->end();
    }

    /**
     * @param string      $interface
     * @param NodeBuilder $node_builder
     */
    private function applyConfigurationFromClass($interface, NodeBuilder $node_builder)
    {
        foreach ($this->plugins as $name => $class_name) {
            // Only accept plugins of type PluginInterface.
            if (! in_array($interface, class_implements($class_name))) {
                continue;
            }

            /* @var $class_name \Hostnet\Component\Webpack\Configuration\ConfigExtensionInterface */
            $class_name::applyConfiguration($node_builder);
        }
    }
}


text:
<!DOCTYPE HTML>

	<title>Firefox OS - App Trade Centre</title>

	<meta charset="UTF-8">
	<meta name="viewport" content="width=1274, user-scalable=no">
	<link rel="stylesheet" href="themes/mozilla/styles/style.css">

Firefox OS

Fernando Agüero, @fjaguero

App Trade Centre - 24/10/13 - Valencia, Spain

			App Trade Centre - 24/10/13 - Valencia, Spain

Who am I?

My name is Fernando Agüero

Community member at Mozilla Hispano

Frontend  Developer at Aluana Labs

On Twitter - @fjaguero

What is Mozilla?

Community powered

Ongoing work…

A new challenge

			Photo by Jason Weaver

Hardware lockout

				Photo by Doug Geisler

Web API work

				http://arewemobileyet.com

What is Firefox OS

				GONK + GECKO + GAIA

Firefox on Firefox OS

				A browser inside a browser?

Just -Powerful- Javascript

SMS API Example

In good company

LG just launched "LG Fireweb" on Brasil

Already Launched

Telefonica: Spain, Brasil, Colombia and Venezuela

Deutsche Telekom: Poland

Congstar: Germany

Launching soon

Greece

Hungary

Serbia and Montenegro

Marketplace

One official marketplace. Have your own descentralized market.

In the market

Google recently launched its official Youtube app

Easy WebPayments

In-app payments

Whatsapp coming this year

Free

Just kidding

It's trendy since Apple offers free software on keynotes

Firefox OS offers

Ownership and control over relationships with customers

Customized phones that meet the specific needs of various target markets

Easier access to developers

Why The Web?

Huge potential

Google Chromebook

Huge potential

Google Glass

Huge potential

Amazon App Store supports Web Apps

The future of gaming

          It marks the end of drivers, installation, all the other weird quirks of legacy game development

Tim Sweeney, Epic Games

DEMO

GooEngine and Asm.js

WEBRTC

No plugins, only the browser

DEMO

Talky.io

Multiplatform

Install apps everywhere, even like a native OS app

DEMO

Installing a Web App on a native OS

Introducing App Maker

We want to make it possible for anyone to make amazing personal mobile apps

¡NO SDK!

Choose your favorite IDE

The web is the platform

Thanks!


text:
<?php

namespace Damejidlo\ACL;

use Nette\Security\IRole;

interface IUser
{

	/**
	 * @return mixed
	 */
	public function getEntity();

	/**
	 * @return IRole[]|string[]
	 */
	public function getRoles();

}


text:
/**
@ Autor :@yonax73 | yonax73@gmail.com
@ Version: 0.1
@ Date : 5/3/2015
@ Date update: 5/3/2015
@ Update by: @yonax73  | yonax73@gmail.com
@ Description: partner crop
**/
var PartnerCrop = (function () {
    function PartnerCrop(dataURI) {
        this.takePictureBtn = document.getElementById('take-picture-pc-btn');
        this.importPictureBtn = document.getElementById('import-picture-pc-btn');
        PartnerCrop.PartnerCropImg = document.getElementById('picture-crop-img');
        PartnerCrop.PartnerCropImg.src = dataURI;
    }
    PartnerCrop.prototype.init = function () {
        //init croppper
        var $image = $('.img-container > img');
        $image.cropper({
            autoCropArea: 0.65,
            highlight: false,
            dragCrop: false,
            movable: false,
            resizable: false,
            minContainerWidth: 350,
            minContainerHeight: 250,
            minCropBoxWidth: 300,
            minCropBoxHeight: 200
        });
        // Methods
        $(document.body).on('click', '[data-method]', function () {
            var data = $(this).data(), $target, result;
            if (data.method) {
                data = $.extend({}, data); // Clone a new one
                if (typeof data.target !== 'undefined') {
                    $target = $(data.target);
                    if (typeof data.option === 'undefined') {
                        try {
                            data.option = JSON.parse($target.val());
                        }
                        catch (e) {
                            console.log(e.message);
                        }
                    }
                }
                result = $image.cropper(data.method, data.option);
                if (data.method === 'getCroppedCanvas') {
                    if (PartnerCrop.saveChangesActionFn) {
                        try {
                            PartnerCrop.saveChangesActionFn(result);
                        }
                        catch (ex) {
                            $('#modal-loader').closeModal();
                            alert(ex.message);
                            console.log(ex);
                        }
                    }
                }
            }
        }).on('keydown', function (e) {
            switch (e.which) {
                case 37:
                    e.preventDefault();
                    $image.cropper('move', -1, 0);
                    break;
                case 38:
                    e.preventDefault();
                    $image.cropper('move', 0, -1);
                    break;
                case 39:
                    e.preventDefault();
                    $image.cropper('move', 1, 0);
                    break;
                case 40:
                    e.preventDefault();
                    $image.cropper('move', 0, 1);
                    break;
            }
        });
    };
    PartnerCrop.prototype.saveChangesAction = function (fn) {
        PartnerCrop.saveChangesActionFn = fn;
    };
    PartnerCrop.prototype.takePictureAction = function (parameters) {
        var _this = this;
        this.takePictureBtn.onclick = function () {
            _this.getPicture(parameters);
        };
    };
    PartnerCrop.prototype.importPictureAction = function (parameters) {
        var _this = this;
        this.importPictureBtn.onclick = function () {
            _this.getPicture(parameters);
        };
    };
    PartnerCrop.prototype.getPicture = function (parameters) {
        try {
            $('#modal-loader').openModal();
            PartnerCrop.disabled(true);
            navigator.camera.getPicture(this.onSuccess, this.onError, parameters);
        }
        catch (ex) {
            $('#modal-loader').closeModal();
            PartnerCrop.disabled(false);
            alert(ex.message);
            console.log(ex);
        }
    };
    PartnerCrop.prototype.onSuccess = function (dataURI) {

        PartnerCrop.refresh(dataURI);
    };
    PartnerCrop.prototype.onError = function (message) {
        alert('failed because: ' + message);
        $('#modal-loader').closeModal();
        PartnerCrop.disabled(false);
    };
    PartnerCrop.refresh = function (dataURI) {
        try {
            var $image = $('.img-container > img');
            $image.one('built.cropper', function () {
                $('#modal-loader').closeModal();
                PartnerCrop.disabled(false);
            }).cropper('reset', true).cropper('replace', dataURI);
        }
        catch (ex) {
            PartnerCrop.disabled(false);
            alert(ex.message);
            console.log(ex);
        }
    };
    PartnerCrop.disabled = function (value) {
        document.getElementById('zoom-plus-pc-btn').disabled = value;
        document.getElementById('zoom-minus-pc-btn').disabled = value;
        document.getElementById('rotate-pc-btn').disabled = value;
        document.getElementById('save-changes-pc-btn').disabled = value;
        document.getElementById('import-picture-pc-btn').disabled = value;
        document.getElementById('take-picture-pc-btn').disabled = value;
    };
    return PartnerCrop;
})();


text:
/* $This file is distributed under the terms of the license in LICENSE$ */

package edu.cornell.mannlib.vitro.webapp.web.templatemodels.customlistview;

/**
 * Indicates that there is a problem with the custom configuration. Perhaps the
 * file can't be found, can't be parsed, or the information it contains is
 * erroneous.
 */
public class InvalidConfigurationException extends Exception {

	public InvalidConfigurationException() {
		super();
	}

	public InvalidConfigurationException(String message, Throwable cause) {
		super(message, cause);
	}

	public InvalidConfigurationException(String message) {
		super(message);
	}

	public InvalidConfigurationException(Throwable cause) {
		super(cause);
	}

}


text:
@interface KSCrashInstallationStandard_Tests : XCTestCase @end

@implementation KSCrashInstallationStandard_Tests

- (void) testInstall
{
    KSCrashInstallationStandard* installation = [KSCrashInstallationStandard sharedInstance];
    installation.url = [NSURL URLWithString:@"www.google.com"];
    [installation install];
    [installation sendAllReportsWithCompletion:^(__unused NSArray *filteredReports, BOOL completed, NSError *error)
     {
         // There are no reports, so this will succeed.
         XCTAssertTrue(completed, @"");
         XCTAssertNil(error, @"");
     }];
}

@end


text:
package org.springframework.boot.configurationsample.endpoint.incremental;

import org.springframework.boot.configurationsample.JmxEndpoint;

/**
 * A meta-annotated endpoint.
 *
 * @author Stephane Nicoll
 * @author Andy Wilkinson
 */
@JmxEndpoint(id = "incremental")
public class IncrementalSpecificEndpoint {

}


text:
package org.dragon.core.location;

import java.util.Date;
import java.util.List;
import java.util.Observable;

import org.dragon.rmm.RmmSettings;

import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;

/**
 * 增强功能的LocationListener,该监听器还具备观察者通知的功能,可以做到实时地理位置通知。 通过优良的算法,节约了频繁获取地理位置电力的消耗和精准度的选择。
 *
 * @author dengjie
 * @since 1.0
 */
public class BestLocationListener extends Observable implements LocationListener {

    /**
     * location update minimize time
     */
    public static final long LOCATION_UPDATE_MIN_TIME = 0;
    /**
     * location update minimize distance
     */
    public static final long LOCATION_UPDATE_MIN_DISTANCE = 0;
    /**
     * slow location update min time
     */
    public static final long SLOW_LOCATION_UPDATE_MIN_TIME = 1000 * 60 * 5;
    /**
     * slow location update minimize distance
     */
    public static final long SLOW_LOCATION_UPDATE_MIN_DISTANCE = 50;
    /**
     * requested first search accuracy in meters
     */
    public static final float REQUESTED_FIRST_SEARCH_ACCURACY_IN_METERS = 100.0f;
    /**
     * requested first search max delta threshold
     */
    public static final int REQUESTED_FIRST_SEARCH_MAX_DELTA_THRESHOLD = 1000 * 60 * 5;
    /**
     * location update maximize delta threshold
     */
    public static final long LOCATION_UPDATE_MAX_DELTA_THRESHOLD = 1000 * 60 * 5;

    private static final String TAG = "BestLocationListener";
    private static final boolean DEBUG = RmmSettings.LOCATION_DEBUG;

    private Location mLastLocation;

    /**
     * constructor
     */
    public BestLocationListener() {
        super();
    }

    @Override
    public void onLocationChanged(Location location) {
        if (DEBUG) {
            Log.d(TAG, "onLocationChanged: " + location);
        }
        updateLocation(location);
    }

    @Override
    public void onProviderDisabled(String provider) {
        // do nothing.
    }

    @Override
    public void onProviderEnabled(String provider) {
        // do nothing.
    }

    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {
        // do nothing.
    }

    /**
     * on best location changed
     *
     * @param location
     *            location
     */
    public synchronized void onBestLocationChanged(Location location) {
        if (DEBUG) {
            Log.d(TAG, "onBestLocationChanged: " + location);
        }
        mLastLocation = location;
        setChanged();
        notifyObservers(location);
    }

    /**
     * 同步获取最新地理位置信息
     *
     * @return 最新地理位置信息
     */
    public synchronized Location getLastKnownLocation() {
        return mLastLocation;
    }

    /**
     * 同步清空最新地理位置信息
     */
    public synchronized void clearLastKnownLocation() {
        mLastLocation = null;
    }

    /**
     * 根据算法选择是否更新传入的地理位置,这个是内部算法,外部无须调用
     *
     * @param location
     *            地理位置信息
     */
    public void updateLocation(Location location) {
        if (DEBUG) {
            Log.d(TAG, "updateLocation: Old: " + mLastLocation);
            Log.d(TAG, "updateLocation: New: " + location);
        }

        // Cases where we only have one or the other.
        if (location != null && mLastLocation == null) {
            if (DEBUG) {
                Log.d(TAG, "updateLocation: Null last location");
            }
            onBestLocationChanged(location);
            return;

        } else if (location == null) {
            if (DEBUG) {
                Log.d(TAG, "updated location is null, doing nothing");
            }
            return;
        }

        long now = new Date().getTime();
        long locationUpdateDelta = now - location.getTime();
        long lastLocationUpdateDelta = now - mLastLocation.getTime();
        boolean locationIsInTimeThreshold = locationUpdateDelta <= LOCATION_UPDATE_MAX_DELTA_THRESHOLD;
        boolean lastLocationIsInTimeThreshold = lastLocationUpdateDelta <= LOCATION_UPDATE_MAX_DELTA_THRESHOLD;
        boolean locationIsMostRecent = locationUpdateDelta <= lastLocationUpdateDelta;

        boolean accuracyComparable = location.hasAccuracy() || mLastLocation.hasAccuracy();
        boolean locationIsMostAccurate = false;
        if (accuracyComparable) {
            // If we have only one side of the accuracy, that one is more
            // accurate.
            if (location.hasAccuracy() && !mLastLocation.hasAccuracy()) {
                locationIsMostAccurate = true;
            } else if (!location.hasAccuracy() && mLastLocation.hasAccuracy()) {
                locationIsMostAccurate = false;
            } else {
                // If we have both accuracies, do a real comparison.
                locationIsMostAccurate = location.getAccuracy() <= mLastLocation.getAccuracy();
            }
        }

        if (DEBUG) {
            Log.d(TAG, "locationIsMostRecent:\t\t\t" + locationIsMostRecent);
            Log.d(TAG, "locationUpdateDelta:\t\t\t" + locationUpdateDelta);
            Log.d(TAG, "lastLocationUpdateDelta:\t\t" + lastLocationUpdateDelta);
            Log.d(TAG, "locationIsInTimeThreshold:\t\t" + locationIsInTimeThreshold);
            Log.d(TAG, "lastLocationIsInTimeThreshold:\t" + lastLocationIsInTimeThreshold);

            Log.d(TAG, "accuracyComparable:\t\t\t" + accuracyComparable);
            Log.d(TAG, "locationIsMostAccurate:\t\t" + locationIsMostAccurate);
        }

        // Update location if its more accurate and w/in time threshold or if
        // the old location is
        // too old and this update is newer.
        if (accuracyComparable && locationIsMostAccurate && locationIsInTimeThreshold) {
            onBestLocationChanged(location);
        } else if (locationIsInTimeThreshold && !lastLocationIsInTimeThreshold) {
            onBestLocationChanged(location);
        }
    }

    /**
     * is accurate enough
     *
     * @param location
     *            location
     * @return boolean
     */
    public boolean isAccurateEnough(Location location) {
        if (location != null && location.hasAccuracy()
                && location.getAccuracy() <= REQUESTED_FIRST_SEARCH_ACCURACY_IN_METERS) {
            long locationUpdateDelta = new Date().getTime() - location.getTime();
            if (locationUpdateDelta < REQUESTED_FIRST_SEARCH_MAX_DELTA_THRESHOLD) {
                if (DEBUG) {
                    Log.d(TAG, "Location is accurate: " + location.toString());
                }
                return true;
            }
        }
        if (DEBUG) {
            Log.d(TAG, "Location is not accurate: " + location);
        }
        return false;
    }

    /**
     * 注册监听器
     *
     * @param locationManager
     *            MierApplication传入的locationManager
     * @param gps
     *            是否使用gps定位
     */
    public void register(LocationManager locationManager, boolean gps) {
        if (DEBUG) {
            Log.d(TAG, "Registering this location listener: " + this.toString());
        }
        long updateMinTime = SLOW_LOCATION_UPDATE_MIN_TIME;
        long updateMinDistance = SLOW_LOCATION_UPDATE_MIN_DISTANCE;
        if (gps) {
            updateMinTime = LOCATION_UPDATE_MIN_TIME;
            updateMinDistance = LOCATION_UPDATE_MIN_DISTANCE;
        }
        List<String> providers = locationManager.getProviders(true);
        int providersCount = providers.size();
        for (int i = 0; i < providersCount; i++) {
            String providerName = providers.get(i);
            if (locationManager.isProviderEnabled(providerName)) {
                updateLocation(locationManager.getLastKnownLocation(providerName));
            }
            // Only register with GPS if we've explicitly allowed it.
            if (gps || !LocationManager.GPS_PROVIDER.equals(providerName)) {
                locationManager.requestLocationUpdates(providerName, updateMinTime, updateMinDistance, this);
            }
        }
    }

    /**
     * 注销监听器
     *
     * @param locationManager
     *            MierApplication传入的locationManager
     */
    public void unregister(LocationManager locationManager) {
        if (DEBUG) {
            Log.d(TAG, "Unregistering this location listener: " + this.toString());
        }
        locationManager.removeUpdates(this);
    }

    /**
     * Updates the current location with the last known location without registering any location listeners.
     *
     * @param locationManager
     *            the LocationManager instance from which to retrieve the latest known location
     */
    public synchronized void updateLastKnownLocation(LocationManager locationManager) {
        List<String> providers = locationManager.getProviders(true);
        for (int i = 0, providersCount = providers.size(); i < providersCount; i++) {
            String providerName = providers.get(i);
            if (locationManager.isProviderEnabled(providerName)) {
                updateLocation(locationManager.getLastKnownLocation(providerName));
            }
        }
    }
}