text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.ActiveDirectory.Models;
using Microsoft.Azure.Commands.Resources.Models.ActiveDirectory;
using System.Collections.Generic;
using System.Management.Automation;
using System;

namespace Microsoft.Azure.Commands.ActiveDirectory
{
    /// <summary>
    /// Creates a new AD application.
    /// </summary>
    [Cmdlet(VerbsCommon.New, "AzureRMADApplication", DefaultParameterSetName = ParameterSet.ApplicationWithoutCredential), OutputType(typeof(PSADApplication))]
    public class NewAzureADApplicationCommand : ActiveDirectoryBaseCmdlet
    {
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithoutCredential,
            HelpMessage = "The display name for the application.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordPlain,
            HelpMessage = "The display name for the application.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordCredential,
            HelpMessage = "The display name for the application.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyPlain,
            HelpMessage = "The display name for the application.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyCredential,
            HelpMessage = "The display name for the application.")]
        [ValidateNotNullOrEmpty]
        public string DisplayName { get; set; }

        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithoutCredential,
            HelpMessage = "The URL to the application's homepage.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordPlain,
            HelpMessage = "The URL to the application's homepage.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordCredential,
            HelpMessage = "The URL to the application's homepage.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyPlain,
            HelpMessage = "The URL to the application's homepage.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyCredential,
            HelpMessage = "The URL to the application's homepage.")]
        [ValidateNotNullOrEmpty]
        public string HomePage { get; set; }

        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithoutCredential,
            HelpMessage = "The URIs that identify the application.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordPlain,
            HelpMessage = "The URIs that identify the application.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordCredential,
            HelpMessage = "The URIs that identify the application.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyPlain,
            HelpMessage = "The URIs that identify the application.")]
        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyCredential,
            HelpMessage = "The URIs that identify the application.")]
        [ValidateNotNullOrEmpty]
        public string[] IdentifierUris { get; set; }

        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordCredential,
            HelpMessage = "The collection of password credentials associated with the application.")]
        public PSADPasswordCredential[] PasswordCredentials { get; set; }

        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyCredential,
            HelpMessage = "The collection of key credentials associated with the application.")]
        public PSADKeyCredential[] KeyCredentials { get; set; }

        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordPlain,
            HelpMessage = "The value for the password credential associated with the application that will be valid for one year by default.")]
        [ValidateNotNullOrEmpty]
        public string Password { get; set; }

        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyPlain,
            HelpMessage = "The value for the key credentials associated with the application that will be valid for one year by default.")]
        [ValidateNotNullOrEmpty]
        public string KeyValue { get; set; }

        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyPlain,
            HelpMessage = "The type of the key credentials associated with the application. Acceptable values are 'AsymmetricX509Cert', 'Password' and 'Symmetric'. Default is 'AsymmetricX509Cert'")]
        public string KeyType  { get; set; }

        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyPlain,
           HelpMessage = "The usage of the key credentials associated with the application. Acceptable values are 'Sign' and 'Verify'. Default is 'Verify'")]
        public string KeyUsage { get; set; }

        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordPlain,
            HelpMessage = "The start date after which password or key would be valid. Default value is current time.")]
        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyPlain,
            HelpMessage = "The start date after which password or key would be valid. Default value is current time.")]
        public DateTime StartDate { get; set; }

        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithPasswordPlain,
            HelpMessage = "The end date till which password or key is valid. Default value is one year after current time.")]
        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ApplicationWithKeyPlain,
            HelpMessage = "The end date till which password or key is valid. Default value is one year after current time.")]
        public DateTime EndDate { get; set; }

        public NewAzureADApplicationCommand()
        {
            DateTime currentTime = DateTime.UtcNow;
            StartDate = currentTime;
            EndDate = currentTime.AddYears(1);
            KeyType = "AsymmetricX509Cert";
            KeyUsage = "Verify";
        }

        protected override void ProcessRecord()
        {
            CreatePSApplicationParameters createParameters = new CreatePSApplicationParameters
            {
                DisplayName = DisplayName,
                HomePage = HomePage,
                IdentifierUris = IdentifierUris
            };

            switch (ParameterSetName)
            {
                case ParameterSet.ApplicationWithPasswordPlain:
                    createParameters.PasswordCredentials = new PSADPasswordCredential[]
                    {
                        new PSADPasswordCredential
                        {
                            StartDate = StartDate,
                            EndDate = EndDate,
                            KeyId = Guid.NewGuid(),
                            Value = Password
                        }
                    };
                    break;

                case ParameterSet.ApplicationWithPasswordCredential:
                    createParameters.PasswordCredentials = PasswordCredentials;
                    break;

                case ParameterSet.ApplicationWithKeyPlain:
                    createParameters.KeyCredentials = new PSADKeyCredential[]
                    {
                        new PSADKeyCredential
                        {
                            StartDate = StartDate,
                            EndDate = EndDate,
                            KeyId = Guid.NewGuid(),
                            Type = KeyType,
                            Usage = KeyUsage,
                            Value = KeyValue
                        }
                    };
                    break;

                case ParameterSet.ApplicationWithKeyCredential:
                    createParameters.KeyCredentials = KeyCredentials;
                    break;
            }

            WriteObject(ActiveDirectoryClient.CreateApplication(createParameters));
        }
    }
}


text:
using System;
using Skybrud.Social.Http;
using Skybrud.Social.Json;
using Skybrud.Social.Twitter.Objects.Lists;

namespace Skybrud.Social.Twitter.Responses.Lists {

    ///
    /// Class respresenting the response for a list of lists.
    ///
    public class TwitterListsResponse : TwitterResponse<TwitterList[]> {

        #region Constructors

        private TwitterListsResponse(SocialHttpResponse response) : base(response) { }

        #endregion

        #region Static methods

        ///
        /// Parses and validates the specified response.
        ///
        /// <param name="response">The response to be parsed.</param>
        public static TwitterListsResponse ParseResponse(SocialHttpResponse response) {

            // Some input validation
            if (response == null) throw new ArgumentNullException("response");

            // Validate the response
            ValidateResponse(response);

            // Initialize the response object
            return new TwitterListsResponse(response) {
                Body = JsonArray.ParseJson(response.Body).ParseMultiple(TwitterList.Parse)
            };

        }

        #endregion

    }

}

redpajama_set_name: RedPajamaGithub


text:
layout: page
#subheadline:  "Time for Pie!"
title:  "Montreal - Day 2"
slug:  "montreal-day-2"
teaser: "Our 2008 summer vacation was a trip to Montreal"
categories:
    - photography
tags:
    - gallery
    - photography
    - travel
    - canada
    - international
image:
   thumb: "photography/2008-07-04-montreal/thumbs/2008-07-04-14-51-12_250x250.jpg"
header:
  image_fullwidth: "photography/2008-07-04-montreal/2008-07-04-14-51-12.jpg"
  title: ""
---

Here are a few photos from the second day of our trip to Montreal, in Canada. We had a great time walking the city, "crashing" the Jazz Fest and enjoying the food.

  {% for image in site.data.photography.2008_07_04_montreal.images %}

  {% endfor %}


text:
package com.google.fpl.gim.examplegame.gui;

import android.app.Fragment;
import android.app.ListFragment;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.google.fpl.gim.examplegame.MainActivity;
import com.google.fpl.gim.examplegame.utils.MissionParseException;
import com.google.fpl.gim.examplegame.utils.MissionParser;
import com.google.fpl.gim.examplegame.R;
import com.google.fpl.gim.examplegame.utils.Utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

/**
 * A UI fragment that represents the game's mission selection screen. No data is stored in this
 * fragment.
 */
public class MissionSelectionFragment extends ListFragment {

    private static final String TAG = MissionSelectionFragment.class.getSimpleName();

    private ArrayList<String> mAssetNames = new ArrayList<>();
    private ArrayList<String> mMissionNames = new ArrayList<>();

    private String mSelectedMissionName;
    private String mSelectedAssetPath;

    private static final String MISSION_ASSET_FOLDER_NAME = "missions";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (mMissionNames.size() == 0) {
            // Needs access to a Context in order to access the assets folder.
            AssetManager assetManager = getActivity().getAssets();
            String[] missionFileNames = new String[0];
            try {
                // Obtain the files in assets/missions.
                missionFileNames = assetManager.list(MISSION_ASSET_FOLDER_NAME);
            } catch (IOException e) {
                e.printStackTrace();
            }

            // Open the missions to obtain plain text names.
            for (String missionFileName : missionFileNames) {
                // Open a stream for the mission.
                InputStream stream;
                try {
                    // All missions should be in the assets/missions folder.
                    ArrayList<String> subDirectories = new ArrayList<>();
                    subDirectories.add(missionFileName);
                    stream = assetManager
                            .open(Utils.makeFilePath(MISSION_ASSET_FOLDER_NAME, subDirectories));
                } catch (IOException e) {
                    e.printStackTrace();
                    continue;
                }

                // Find the mission name.
                String missionName;
                try {
                    missionName = MissionParser.getMissionName(stream);
                } catch (MissionParseException e) {
                    e.printStackTrace();
                    missionName = "Description failed.";
                }

                // Close the stream.
                try {
                    stream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                mMissionNames.add(missionName);
                mAssetNames.add(missionFileName);
            }
        }
        setListAdapter(new ArrayAdapter<>(getActivity(), R.layout.menu_list_item,
                R.id.list_item_text, mMissionNames));
    }

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.menu_mission_list, container, false);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        onMissionSelected(position);
    }

    @Override public void onResume() {
        super.onResume();
        ((MainActivity)getActivity()).setActionBarTitle(R.string.select_mission_title);
    }

    public void onMissionSelected(int position) {
        Utils.logDebug(TAG, "onMissionSelected - Mission #" + (position + 1) +
                " has been selected!");

        mSelectedMissionName = mMissionNames.get(position);

        ArrayList<String> subDirectories = new ArrayList<>();
        subDirectories.add(mAssetNames.get(position));
        mSelectedAssetPath = Utils.makeFilePath(MISSION_ASSET_FOLDER_NAME, subDirectories);

        // Display RunSpecificationSelectionFragment.
        Fragment runSpecificationsFragment =
                ((MainActivity) getActivity()).getGameViews().getRunSpecificationsFragment();
        getActivity().getFragmentManager().beginTransaction()
                .setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left)
                .remove(this)
                .add(R.id.container, runSpecificationsFragment, GameViews.RUN_SPECIFICATIONS_TAG)
                .addToBackStack(null)
                .commit();
    }

    public String getSelectedMissionName() {
        return mSelectedMissionName;
    }

    public String getSelectedAssetPath() {
        return mSelectedAssetPath;
    }
}


text:
'use strict';

var assert = require('assert');
var grainstore = require('../lib/grainstore');
var step = require('step');
var http = require('http');
var fs = require('fs');

const xml2js = require('xml2js');
const xpath = require('xml2js-xpath');

var server;

var serverPort = 8033;

var DEFAULT_POINT_STYLE = [
    '#layer {',
    '  marker-fill: #FF6600;',
    '  marker-opacity: 1;',
    '  marker-width: 16;',
    '  marker-line-color: white;',
    '  marker-line-width: 3;',
    '  marker-line-opacity: 0.9;',
    '  marker-placement: point;',
    '  marker-type: ellipse;',
    '  marker-allow-overlap: true;',
    '}'
].join('');

[false, true].forEach(function (useWorkers) {
    describe('mml_builder multilayer use_workers=' + useWorkers, function () {
        var queryMakeLine = 'SELECT ST_MakeLine(ST_MakePoint(-10,-5),ST_MakePoint(10,-5))';
        var queryMakePoint = 'SELECT ST_MakePoint(0,0)';

        var styleLine = '#layer1 { line-color:red; }';
        var stylePoint = '#layer0 { marker-width:3; }';

        before(function (done) {
            // Start a server to test external resources
            server = http.createServer(function (request, response) {
                var filename = 'test/support/resources' + request.url;
                fs.readFile(filename, 'binary', function (err, file) {
                    if (err) {
                        response.writeHead(404, { 'Content-Type': 'text/plain' });
                        console.log("File '" + filename + "' not found");
                        response.write('404 Not Found\n');
                    } else {
                        response.writeHead(200);
                        response.write(file, 'binary');
                    }
                    response.end();
                });
            });
            server.listen(serverPort, done);
        });

        after(function () {
            server.close();
        });

        it('accept sql array with style array', function (done) {
            var style0 = '#layer0 { marker-width:3; }';
            var style1 = '#layer1 { line-color:red; }';
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: ['SELECT ST_MakePoint(0,0)', 'SELECT ST_MakeLine(ST_MakePoint(-10,-5),ST_MakePoint(10,-5))'],
                        style: [style0, style1],
                        style_version: '2.1.0'
                    }).toXML(this);
                },
                function checkXML0 (err, xml) {
                    if (err) { done(err); return; }
                    xml2js.parseString(xml, (err, xmlDoc) => {
                        if (err) { done(err); return; }

                        const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                        assert.ok(layer0);

                        let geomField = layer0.Datasource[0].Parameter.find(param => param.$.name === 'geometry_field');
                        assert.equal(geomField._, 'the_geom_webmercator');

                        const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                        assert.ok(layer1);

                        geomField = layer1.Datasource[0].Parameter.find(param => param.$.name === 'geometry_field');
                        assert.equal(geomField._, 'the_geom_webmercator');

                        const style0 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer0');
                        assert.ok(style0);

                        const style1 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer1');
                        assert.ok(style1);

                        done();
                    });
                }
            );
        });

        // See http://github.com/CartoDB/grainstore/issues/92
        it('accept sql array with style array and gcols array', function (done) {
            var style0 = '#layer0 { marker-width:3; }';
            var style1 = '#layer1 { line-color:red; }';
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: ['SELECT ST_MakePoint(0,0) g', 'SELECT ST_MakeLine(ST_MakePoint(-10,-5),ST_MakePoint(10,-5)) g2'],
                        style: [style0, style1],
                        gcols: [null, 'g2'], // first intentionally blank
                        style_version: '2.1.0'
                    }).toXML(this);
                },
                function checkXML0 (err, xml) {
                    if (err) { done(err); return; }

                    xml2js.parseString(xml, (err, xmlDoc) => {
                        if (err) { done(err); return; }

                        const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                        assert.ok(layer0);
                        assert.equal(layer0.Datasource.length, 1);
                        let geomField = layer0.Datasource[0].Parameter.find(param => param.$.name === 'geometry_field');
                        assert.equal(geomField._, 'the_geom_webmercator');

                        const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                        assert.ok(layer1);
                        assert.equal(layer1.$.name, 'layer1');

                        geomField = layer1.Datasource[0].Parameter.find(param => param.$.name === 'geometry_field');
                        assert.equal(geomField._, 'g2');

                        done();
                    });
                }
            );
        });

        [
            [
                { type: 'geometry', name: 'g' },
                { type: 'raster', name: 'r' }
            ],
            [
                'g',
                { type: 'raster', name: 'r' }
            ],
            [
                { name: 'g' },
                { type: 'raster', name: 'r' }
            ]
        ].forEach(function (gcols) {
            // See http://github.com/CartoDB/grainstore/issues/93
            it('accept types in gcols', function (done) {
                var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

                step(
                    function initBuilder () {
                        mmlStore.mml_builder({
                            dbname: 'my_database',
                            sql: ['SELECT ST_MakePoint(0,0) g',
                                'SELECT ST_AsRaster(ST_MakePoint(0,0),1.0,1.0) r'],
                            style: [DEFAULT_POINT_STYLE, DEFAULT_POINT_STYLE],
                            gcols: gcols,
                            style_version: '2.1.0'
                        }).toXML(this);
                    },
                    function checkXML0 (err, xml) {
                        if (err) { done(err); return; }
                        xml2js.parseString(xml, (err, xmlDoc) => {
                            if (err) { done(err); return; }

                            const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                            assert.ok(layer0);
                            assert.equal(layer0.Datasource.length, 1);
                            const geomField = layer0.Datasource[0].Parameter.find(param => param.$.name === 'geometry_field');
                            assert.equal(geomField._, 'g');

                            const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                            assert.ok(layer1);
                            assert.equal(layer1.Datasource.length, 1);

                            const rasterField = layer1.Datasource[0].Parameter.find(param => param.$.name === 'raster_field');
                            const type = layer1.Datasource[0].Parameter.find(param => param.$.name === 'type');
                            assert.equal(rasterField._, 'r');
                            assert.equal(type._, 'pgraster');

                            done();
                        });
                    }
                );
            });
        });

        // See http://github.com/CartoDB/grainstore/issues/93
        it('accept rcolbands and extra_ds_opts arrays', function (done) {
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: ['SELECT ST_MakePoint(0,0) g',
                            'SELECT ST_AsRaster(ST_MakePoint(0,0),1.0,1.0) r',
                            'SELECT ST_AsRaster(ST_MakePoint(0,0),1.0,1.0) r2'],
                        style: [DEFAULT_POINT_STYLE, DEFAULT_POINT_STYLE, DEFAULT_POINT_STYLE],
                        gcols: [
                            { type: 'geometry', name: 'g' },
                            { type: 'raster', name: 'r' },
                            { type: 'raster', name: 'r2' }
                        ],
                        extra_ds_opts: [
                            { geometry_field: 'fake' }, // will not override
                            { use_overviews: 1, prescale_rasters: true },
                            { band: 1, clip_rasters: 1 }
                        ],
                        style_version: '2.1.0'
                    }).toXML(this);
                },
                function checkXML0 (err, xml) {
                    if (err) { done(err); return; }
                    xml2js.parseString(xml, (err, xmlDoc) => {
                        if (err) { done(err); return; }

                        const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                        assert.ok(layer0);
                        assert.equal(layer0.Datasource.length, 1);
                        const geomField = layer0.Datasource[0].Parameter.find(param => param.$.name === 'geometry_field');
                        assert.equal(geomField._, 'g');

                        const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                        assert.ok(layer1);
                        assert.equal(layer1.Datasource.length, 1);
                        let rasterField = layer1.Datasource[0].Parameter.find(param => param.$.name === 'raster_field');
                        let type = layer1.Datasource[0].Parameter.find(param => param.$.name === 'type');
                        let band = layer1.Datasource[0].Parameter.find(param => param.$.name === 'band');
                        let clipCasters = layer1.Datasource[0].Parameter.find(param => param.$.name === 'clip_rasters');
                        let useOverviews = layer1.Datasource[0].Parameter.find(param => param.$.name === 'use_overviews');
                        let prescaleRasters = layer1.Datasource[0].Parameter.find(param => param.$.name === 'prescale_rasters');
                        assert.equal(rasterField._, 'r');
                        assert.equal(type._, 'pgraster');
                        assert.equal(band, undefined);
                        assert.equal(clipCasters, undefined);
                        assert.equal(useOverviews._, '1');
                        assert.equal(prescaleRasters._, 'true');

                        const layer2 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer2');
                        assert.ok(layer2);
                        assert.equal(layer2.Datasource.length, 1);
                        rasterField = layer2.Datasource[0].Parameter.find(param => param.$.name === 'raster_field');
                        type = layer2.Datasource[0].Parameter.find(param => param.$.name === 'type');
                        band = layer2.Datasource[0].Parameter.find(param => param.$.name === 'band');
                        clipCasters = layer2.Datasource[0].Parameter.find(param => param.$.name === 'clip_rasters');
                        useOverviews = layer2.Datasource[0].Parameter.find(param => param.$.name === 'use_overviews');
                        prescaleRasters = layer2.Datasource[0].Parameter.find(param => param.$.name === 'prescale_rasters');
                        assert.equal(rasterField._, 'r2');
                        assert.equal(type._, 'pgraster');
                        assert.equal(band._, '1');
                        assert.equal(clipCasters._, '1');
                        assert.equal(useOverviews, undefined);
                        assert.equal(prescaleRasters, undefined);

                        done();
                    });
                }
            );
        });

        it('gcol with objects fails when name is not provided', function (done) {
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: ['SELECT ST_MakePoint(0,0) g',
                            'SELECT ST_AsRaster(ST_MakePoint(0,0),1.0,1.0) r'],
                        style: [DEFAULT_POINT_STYLE, DEFAULT_POINT_STYLE],
                        gcols: [
                            { type: 'geometry' }
                        ],
                        style_version: '2.1.0'
                    }).toXML(this);
                },
                function getXML0 (err) {
                    assert.ok(!!err);
                    done();
                }
            );
        });

        it('datasource_extend option allows to have different datasources per layer', function (done) {
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.3.0' });

            var defaultUser = 'default_user';
            var defaultPass = 'default_pass';
            var wadusUser = 'wadus_user';
            var wadusPass = 'wadus_password';

            var datasourceExtend = {
                user: wadusUser,
                password: wadusPass
            };

            mmlStore.mml_builder({
                dbuser: defaultUser,
                dbpassword: defaultPass,
                dbname: 'my_database',
                sql: [queryMakeLine, queryMakePoint],
                datasource_extend: [null, datasourceExtend],
                style: [styleLine, stylePoint],
                style_version: '2.3.0'
            }).toXML((err, xml) => {
                if (err) { done(err); return; }

                xml2js.parseString(xml, (err, xmlDoc) => {
                    if (err) { done(err); return; }

                    const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                    assert.ok(layer0);
                    assert.equal(layer0.Datasource.length, 1);

                    const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                    assert.ok(layer1);
                    assert.equal(layer1.Datasource.length, 1);

                    let user = layer0.Datasource[0].Parameter.find(param => param.$.name === 'user');
                    let password = layer0.Datasource[0].Parameter.find(param => param.$.name === 'password');
                    assert.equal(user._, defaultUser);
                    assert.equal(password._, defaultPass);

                    user = layer1.Datasource[0].Parameter.find(param => param.$.name === 'user');
                    password = layer1.Datasource[0].Parameter.find(param => param.$.name === 'password');
                    assert.equal(user._, wadusUser);
                    assert.equal(password._, wadusPass);

                    return done();
                });
            });
        });

        it('error out on blank CartoCSS in a style array', function (done) {
            var style0 = '#layer0 { marker-width:3; }';
            var style1 = '';
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: ['SELECT ST_MakePoint(0,0)', 'SELECT ST_MakeLine(ST_MakePoint(-10,-5),ST_MakePoint(10,-5))'],
                        style: [style0, style1],
                        style_version: '2.1.0'
                    }).toXML(this);
                },
                function checkError (err) {
                    assert(err);
                    assert.equal(err.message, 'style1: CartoCSS is empty');
                    return null;
                },
                function finish (err) {
                    done(err);
                }
            );
        });

        it('accept sql with style and style_version array', function (done) {
            var style0 = '#layer0 { marker-width:3; }';
            var style1 = '#layer1 { marker-width:4; }';
            var sql0 = 'SELECT ST_MakePoint(0,0)';
            var sql1 = 'SELECT ST_MakeLine(ST_MakePoint(-10,-5),ST_MakePoint(10,-5))';
            var styleVersion0 = '2.0.2';
            var styleVersion1 = '2.1.0';
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: [sql0, sql1],
                        style: [style0, style1],
                        style_version: [styleVersion0, styleVersion1]
                    }).toXML(this);
                },
                function checkXML0 (err, xml) {
                    if (err) {
                        throw err;
                    }
                    xml2js.parseString(xml, (err, xmlDoc) => {
                        if (err) { done(err); return; }

                        const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                        assert.ok(layer0);
                        assert.equal(layer0.Datasource.length, 1);
                        const table0 = layer0.Datasource[0].Parameter.find(param => param.$.name === 'table');
                        assert.ok(
                            table0._.indexOf(sql0) !== -1,
                            'Cannot find sql [' + sql0 + '] in table datasource, got ' + table0._
                        );

                        const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                        assert.ok(layer1);
                        assert.equal(layer1.Datasource.length, 1);
                        const table1 = layer1.Datasource[0].Parameter.find(param => param.$.name === 'table');
                        assert.ok(
                            table1._.indexOf(sql1) !== -1,
                            'Cannot find sql [' + sql1 + '] in table datasource, got ' + table1._
                        );

                        const style0 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer0');
                        const symb0 = style0.Rule.find(r => Object.prototype.hasOwnProperty.call(r, 'MarkersSymbolizer')).MarkersSymbolizer[0];
                        assert.equal(symb0.$.width, 6);

                        const style1 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer1');
                        const symb1 = style1.Rule.find(r => Object.prototype.hasOwnProperty.call(r, 'MarkersSymbolizer')).MarkersSymbolizer[0];
                        assert.equal(symb1.$.width, 4);

                        return done();
                    });
                }
            );
        });

        it('layer name in style array is only a placeholder', function (done) {
            var style0 = '#layer { marker-width:3; }';
            var style1 = '#style { line-color:red; }';
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: ['SELECT ST_MakePoint(0,0)', 'SELECT ST_MakeLine(ST_MakePoint(-10,-5),ST_MakePoint(10,-5))'],
                        style: [style0, style1],
                        style_version: '2.1.0'
                    }).toXML(this);
                },
                function checkXML0 (err, xml) {
                    if (err) { done(err); return; }
                    xml2js.parseString(xml, (err, xmlDoc) => {
                        if (err) { done(err); return; }

                        const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                        assert.ok(layer0);

                        const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                        assert.ok(layer1);

                        const style0 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer0');
                        assert.ok(style0);

                        const style1 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer1');
                        assert.ok(style1);

                        done();
                    });
                }
            );
        });

        it('layer name in single style is only a placeholder', function (done) {
            var style0 = '#layer { marker-width:3; } #layer[a=1] { marker-fill:#ff0000 }';
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: ['SELECT ST_MakePoint(0,0)'],
                        style: [style0],
                        style_version: '2.1.0'
                    }).toXML(this);
                },
                function checkXML0 (err, xml) {
                    if (err) { done(err); return; }
                    xml2js.parseString(xml, (err, xmlDoc) => {
                        if (err) { done(err); return; }

                        const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                        assert.ok(layer0);

                        const style0 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer0');
                        assert.ok(style0);

                        const symb0 = style0.Rule.find(r => Object.prototype.hasOwnProperty.call(r, 'MarkersSymbolizer')).MarkersSymbolizer[0];
                        assert.equal(symb0.$.fill, '#ff0000');
                        assert.equal(symb0.$.width, 3);

                        done();
                    });
                }
            );
        });

        it('accept sql array with single style string', function (done) {
            var style0 = '#layer0 { marker-width:3; }';
            var style1 = '#layer1 { line-color:red; }';
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: ['SELECT ST_MakePoint(0,0)', 'SELECT ST_MakeLine(ST_MakePoint(-10,-5),ST_MakePoint(10,-5))'],
                        style: [style0, style1],
                        style_version: '2.1.0'
                    }).toXML(this);
                },
                function checkXML0 (err, xml) {
                    if (err) { done(err); return; }
                    xml2js.parseString(xml, (err, xmlDoc) => {
                        if (err) { done(err); return; }

                        const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                        assert.ok(layer0);

                        const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                        assert.ok(layer1);

                        const style0 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer0');
                        assert.ok(style0);

                        const style1 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer1');
                        assert.ok(style1);

                        done();
                    });
                }
            );
        });

        it('Error out on malformed interactivity', function (done) {
            var sql0 = 'SELECT 1 as a, 2 as b, ST_MakePoint(0,0)';
            var sql1 = 'SELECT 3 as a, 4 as b, ST_MakeLine(ST_MakePoint(-10,-5),ST_MakePoint(10,-5))';
            var style0 = '#layer0 { marker-width:3; }';
            var style1 = '#layer1 { line-color:red; }';
            var fullstyle = style0 + style1;
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });
            var iact0;
            var iact1 = ['a', 'b'];

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: [sql0, sql1],
                        interactivity: [iact0, iact1],
                        style: fullstyle,
                        style_version: '2.1.0'
                    }).toXML(this);
                },
                function checkError (err) {
                    assert.ok(err);
                    assert.equal(err.message, 'Invalid interactivity value type for layer 1: object');
                    done();
                }
            );
        });

        it('Error out on malformed layer', function (done) {
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: 'select 1',
                        style: DEFAULT_POINT_STYLE,
                        layer: 'cipz'
                    }).toXML(this);
                },
                function checkError (err) {
                    assert.ok(err);
                    assert.equal(err.message, 'Invalid (non-integer) layer value type: cipz');
                    done();
                }
            );
        });

        it('undefined layer id uses old `layer{index}` notation for layer name', function (done) {
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers });
            var mml = mmlStore.mml_builder({
                dbname: 'my_db',
                ids: ['layer-name-wadus', null, 'layer-name-top'],
                sql: ['select 1', 'select 2', 'select 3'],
                style: [DEFAULT_POINT_STYLE, DEFAULT_POINT_STYLE, DEFAULT_POINT_STYLE]
            });

            mml.toXML(function (err, data) {
                if (err) { done(err); return; }
                xml2js.parseString(data, (err, xmlDoc) => {
                    if (err) { done(err); return; }

                    const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer-name-wadus');
                    assert.ok(layer0);

                    const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                    assert.ok(layer1);

                    const layer2 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer-name-top');
                    assert.ok(layer2);

                    const style0 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer-name-wadus');
                    assert.ok(style0);

                    const style1 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer1');
                    assert.ok(style1);

                    const style2 = xpath.find(xmlDoc, '//Style').find(s => s.$.name === 'layer-name-top');
                    assert.ok(style2);

                    done();
                });
            });
        });

        it('Uses correct layer name for interactivity layer', function (done) {
            var sql0 = 'SELECT 1 as a, 2 as b, ST_MakePoint(0,0)';
            var sql1 = 'SELECT 3 as a, 4 as b, ST_MakeLine(ST_MakePoint(-10,-5),ST_MakePoint(10,-5))';
            var style0 = '#layer0 { marker-width:3; }';
            var style1 = '#layer1 { line-color:red; }';
            var fullstyle = style0 + style1;
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });
            var iact0 = 'a,b';
            var iact1 = 'c,d';

            var mml = mmlStore.mml_builder({
                dbname: 'my_database',
                ids: ['layer-wadus-0', 'layer-wadus-1'],
                layer: 1,
                sql: [sql0, sql1],
                interactivity: [iact0, iact1],
                style: fullstyle,
                style_version: '2.1.0'
            });

            mml.toXML(function (err, data) {
                if (err) { done(err); return; }
                xml2js.parseString(data, (err, xmlDoc) => {
                    if (err) { done(err); return; }
                    var x = xpath.find(xmlDoc, "//Parameter[@name='interactivity_layer']")[0];
                    assert.ok(x);
                    assert.equal(x._, 'layer-wadus-1');
                    done();
                });
            });
        });

        it('Allows specifying per-layer SRID', function (done) {
            var style0 = '#layer0 { marker-width:3; }';
            var style1 = '#layer1 { marker-width:4; }';
            var sql0 = 'SELECT ST_MakePoint(0,0)';
            var sql1 = 'SELECT ST_MakePoint(1,1)';
            var styleVersion0 = '2.0.2';
            var styleVersion1 = '2.1.0';
            var mmlStore = new grainstore.MMLStore({ use_workers: useWorkers, mapnik_version: '2.1.0' });

            step(
                function initBuilder () {
                    mmlStore.mml_builder({
                        dbname: 'my_database',
                        sql: [sql0, sql1],
                        style: [style0, style1],
                        style_version: [styleVersion0, styleVersion1],
                        datasource_extend: [{ srid: 1001 }, { srid: 1002 }]
                    }).toXML(this);
                },
                function checkXML0 (err, xml) {
                    if (err) {
                        throw err;
                    }
                    xml2js.parseString(xml, (err, xmlDoc) => {
                        if (err) { done(err); return; }

                        const layer0 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer0');
                        assert.ok(layer0);
                        assert.equal(layer0.Datasource.length, 1);
                        const srid0 = layer0.Datasource[0].Parameter.find(param => param.$.name === 'srid');
                        assert.equal(srid0._, '1001');

                        const layer1 = xpath.find(xmlDoc, '//Layer').find(l => l.$.name === 'layer1');
                        assert.ok(layer1);
                        assert.equal(layer1.Datasource.length, 1);
                        const srid1 = layer1.Datasource[0].Parameter.find(param => param.$.name === 'srid');
                        assert.equal(srid1._, '1002');

                        return done();
                    });
                }
            );
        });
    });
});


text:
PYENVS=2.7.15 3.4.8 3.5.5 3.6.5
REQUIREMENTS_DIR=requirements

.PHONY: clean clean_wheels

build:
	@python setup.py bdist_wheel

clean: clean_build clean_docs clean_requirements clean_wheels

clean_docs:
	cd docs && make clean

clean_build:
	python setup.py clean --all
	rm -rf dist/

clean_requirements:
	rm -rf requirements/*.txt

clean_wheels:
	rm -rf wheelhouse/

.PHONY: docs
docs:
	tox -e docs

serve_docs:
	tox -e docs,serve-docs

.PHONY: requirements
requirements:
	@pip install -r $(REQUIREMENTS_DIR)/build.txt

dev_requirements:
	@pip install -r $(REQUIREMENTS_DIR)/build.txt
	@pip install -r $(REQUIREMENTS_DIR)/dev.txt

.PHONY: test
test:
	@make install_envs
	@pyenv local ${PYENVS}
	@make dev_requirements
	@tox

install_envs:
	@for v in ${PYENVS} ; do \
		echo "Installing " $$v ; \
		pyenv install -s $$v ; \
	done


text:
* * *

title: How-to Guide for Organisations layout: wide nav: resources_nav

* * *

# الجوائز - الشروط والأحكام

## مساحة تخزينية على Dropbox أو رصيد Skype:

إن 10 غيغا بايت من المساحة التخزينية على Dropbox ، أو عشرة دولارات من رصيد Skype تقتصر على المراحل التعليميه الابتدائي ، الثانوي ، كادر المدرسين لنشاطات ما بعد المدرسة و الهيئات التعليمية. إن مساحة 10 جيغا بايت الخاليه لا بد أن تضاف إلى حساب Dropbox موجود مسبقاً. جائزة واحدة لكل منظمة.

على كل منظم للحدث أن يسجل في "ساعة من الكود البرمجي" حتى يحصل على جائزة المساحة التخزينية على Dropbox أو رصيد Skype. إذا شاركت مدرستك بشكل كامل في حدث "ساعة من الكود البرمجي", فلا بد لكل معلم في المدرسة من التسجيل بشكل منفصل كمنظم للحدث حتى يكون مؤهلاً للفوز بالجائزة.

سوف تتصل منظمة "Code.org" بالمنظمون بعد حدث "ساعة من الكود البرمجي" (8-14 كانون الأول/ديسمبر) لتوفير تعليمات الحصول على مساحة التخزين على Dropbox أو رصيد Skype.

<% if @country == 'us' %>

## محادثة مرئية مع ضيف متحدث:

Prize limited to K-12 classrooms in the U.S. and Canada only. To qualify, sign up your classroom by November 14, 2014. Code.org will select winning classrooms, provide a time slot for the web chat, and work with the appropriate teacher to set up the technology details. Your whole school does not need to apply to qualify for this prize. Both public and private schools are eligbile to win.

## مجموعة من الكمبيوترات المحمولة (أو قيمة عشرة آلاف دولار لأي تقنية أخرى):

هذه الجائزة مقتصرة على المدارس العامه غير الحكومية للمراحل الابتدائية والثانوية ما قبل الجامعة في الولايات المتحدة الأميركية. To qualify, your entire school must register for the Hour of Code by November 14, 2014. One school in every U.S. state will receive a class-set of computers. Code.org will select and notify winners via email by December 1, 2014.

To clarify, this is not a sweepstakes or a contest involving pure chance.

1) There is no financial stake or risk involved in applying - any school or classroom may participate, without any payment to Code.org or any other organization

2) Winners will only be selected among schools where the entire classroom (or school) participates in an Hour of Code, which involves a test of the students' and teachers' collective skill.

<% end %>


text:
from django.conf.urls import url
from .views import *
import LocalSettings
from django.core.urlresolvers import reverse_lazy
from django.views.generic.base import RedirectView

frontpage = LocalSettings.project_name + ':' + LocalSettings.mainpage_title

urlpatterns = [
    url(r'^$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^w/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^w/(?P<title>.*)/$', WikiView.as_view(), name='view'),
    url(r'^edit/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^edit/(?P<title>.*)/$', EditView.as_view(), name='edit'),
    url(r'^raw/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^raw/(?P<title>.*)/$', RawView.as_view(), name='raw'),
    url(r'^diff/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^diff/(?P<title>.*)/$', DiffView.as_view(), name='diff'),
    url(r'^history/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^history/(?P<title>.*)/$', HistoryView.as_view(), name='history'),
    url(r'^revert/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^revert/(?P<title>.*)/$', RevertView.as_view(), name='revert'),
    url(r'^random/$', random, name='random'),
    url(r'^rename/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^rename/(?P<title>.*)/$', RenameView.as_view(), name='rename'),
    url(r'^backlink/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^backlink/(?P<title>.*)/$', BacklinkView.as_view(), name='backlink'),
    url(r'^delete/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^delete/(?P<title>.*)/$', DeleteView.as_view(), name='delete'),
    url(r'^contribution/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^contribution/(?P<editor>.*)/$', ContributionView.as_view(), name='contribution'),
    url(r'^recentchanges/$', RecentChangesView.as_view(), name='recentchanges'),
    url(r'^acl/$', RedirectView.as_view(url=reverse_lazy('view', kwargs={'title': frontpage}))),
    url(r'^acl/(?P<title>.*)/$', ACLView.as_view(), name='acl'),
    url(r'^upload/$', UploadView.as_view(), name='upload'),
    url(r'^block/$', BlockView.as_view()),
    url(r'^block/(?P<editor>.*)/$', BlockView.as_view(), name='block'),
]


text:
@interface GJCFCoreTextDemoViewController : UIViewController

@end


text:
Let's start by creating a new Entity, **Phone** in **.Core** project:

```csharp
[Table("PbPhones")]
public class Phone : CreationAuditedEntity<long>
{
    public const int MaxNumberLength = 16;

    [ForeignKey("PersonId")]
    public virtual Person Person { get; set; }
    public virtual int PersonId { get; set; }

    [Required]
    public virtual PhoneType Type { get; set; }

    [Required]
    [MaxLength(MaxNumberLength)]
    public virtual string Number { get; set; }
}
```

Phone entities are stored in **PbPhones** table. Its primary key is
**long** and it inherits creation auditing properties. It has a reference
to **Person** entity which owns the phone number.

We added a **Phones** collection to the People:

```csharp
[Table("PbPersons")]
public class Person : FullAuditedEntity
{
    //...other properties

    public virtual ICollection<Phone> Phones { get; set; }
}
```

We have a **PhoneType** enum as shown below: (in **.Core**
project)

```csharp
public enum PhoneType : byte
{
    Mobile,
    Home,
    Business
}
```

Lastly, we're also adding a DbSet property for Phone to our DbContext:

```csharp
public virtual DbSet<Phone> Phones { get; set; }
```

## Next

- [Database Migration of Phone Entity](Developing-Step-By-Step-Angular-Migrations-Phone-Entity)


text:
package org.skyscreamer.yoga.util;

public class DefaultClassFinderStrategy implements ClassFinderStrategy
{
    @SuppressWarnings("unchecked")
    @Override
    public <T> Class<T> findClass( T instance )
    {
        return (Class<T>) (instance == null ? null : instance.getClass());
    }
}


text:
<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Manage account configuration
 *
 * @package CarbonCopy
 * @subpackage account
 * @author porquero
 */
class configuration extends MX_Controller {

    /**
     * Get item value from account config file.
     * If $item == NULL, return all config data.
     *
     * @param string $item item name
     * @return mixed array|string
     */
    public function load($item = NULL) {
        $this->load->module('file/read');

        $config = $this->read->json_content("_accounts/{$this->session->userdata('current_account')}/config.json");

        if ($item == NULL) {
            return $config;
        }

        return $config[$item];
    }

}


text:
/*
167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.

The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are not zero-based.

You may assume that each input would have exactly one solution and you may not use the same element twice.

Input: numbers={2, 7, 11, 15}, target=9
Output: index1=1, index2=2

*/
public class Solution {
    public int[] twoSum(int[] numbers, int target) {
        if(numbers == null || numbers.length == 0) {
            return new int[]{-1,-1};
        }
        int left = 0,right = numbers.length - 1;
        while(left < right) {
            if(numbers[left] + numbers[right] == target) {
                return new int[]{left+1,right+1};
            } else if(numbers[left] + numbers[right] > target) {
                right--;
            } else {
                left++;
            }
        }
        return new int[]{-1,-1};
    }
}


text:
from prob11 import getOneRandomByte
from prob1 import base64toRaw
from prob12 import constant_ecb_encrypt, padStr
from prob8 import chunks
from ssl import RAND_bytes

# Take your oracle function from #12.
# Now generate a random count of random bytes and
# prepend this string to every plaintext. You are now doing:
# AES-128-ECB(random-prefix || attacker-controlled || target-bytes, random-key)

prefixValue = RAND_bytes(getOneRandomByte());# += bytes(chr(getOneRandomByte()), 'UTF-8');
def prob14Encrypt(rawInput):
    unknownB64 = b'Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg' + \
    b'aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBq' + \
    b'dXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUg' + \
    b'YnkK'
    unknownRaw = base64toRaw(unknownB64);
    return constant_ecb_encrypt(prefixValue + rawInput + unknownRaw);

# Same goal: decrypt the target-bytes.
def recoverBytes():
    # first, determine number of bytes needed to push prefix up to a block boundry
    # and where the first block fully controlled by my input lies (effectively, determine prefix length)
    numBytesForPrefix, firstControlledBlock = determinePrefixLength();
    # deterine target plaintext length
    targetPlaintextLength = prob14DeterminePlaintextLength() + (numBytesForPrefix) - (firstControlledBlock * 16);
    # do the problem 12 process
    knownPlaintext = b'';
    blockSize = 16;
    for i in range(targetPlaintextLength):
        # Set first unknown byte to be last byte in block
        padLen = numBytesForPrefix + (blockSize - 1) - (len(knownPlaintext) % blockSize);
        pad = padStr * padLen;
        # Collect cipher, identify cipher blocks of interest
        cipherOutput = prob14Encrypt(pad);
        blockOfInterest = firstControlledBlock + (len(knownPlaintext) // 16);
        cipherChunks = chunks(cipherOutput, blockSize);
        cipherOfInterest = cipherChunks[blockOfInterest];
        ###knownPlainChunks.append(b'');
        # prefix is last 15 bytes of (pad|knownPlaintext)
        prefix = (pad + knownPlaintext)[-15:];
        knownPlaintext += prob14DetermineNextByte(prefix, cipherOfInterest, numBytesForPrefix, firstControlledBlock);
    return knownPlaintext;

def prob14DeterminePlaintextLength():
    plaintext = b'';
    emptyCipherLength = len(prob14Encrypt(plaintext));
    maxPlaintextLength = emptyCipherLength - 1; # cipher = plain + (at least) 1 byte PKCS7 padding
    while (True):
        plaintext += b'A';
        thisCipherLength = len(prob14Encrypt(plaintext));
        if (thisCipherLength == emptyCipherLength):
            maxPlaintextLength -= 1;
        else:
            return maxPlaintextLength;

def prob14DetermineNextByte(rawPrefix, observedCipher, numBytesForPrefix, firstControlledBlock):
    blockSize = 16;
    plain = (padStr) * (numBytesForPrefix + blockSize - 1 - len(rawPrefix));
    plain += rawPrefix;
    for i in range(256):
        thisPlain = plain + bytes(chr(i), 'UTF-8');
        thisCipher = prob14Encrypt(thisPlain);
        if (chunks(thisCipher, blockSize)[firstControlledBlock] == observedCipher):
            return bytes(chr(i), 'UTF-8');
    return b'***ERROR***';

def determinePrefixLength():
    plainLength = 32;
    while (True):
        plain = b'A' * plainLength;
        cipher = prob14Encrypt(plain);
        cipherBlocks = chunks(cipher, 16);
        for i in range(len(cipherBlocks)-1):
            if (cipherBlocks[i] == cipherBlocks[i+1]):
                return (len(plain)%16), i;
        plainLength += 1;

'''What's harder about doing this?

How would you overcome that obstacle? The hint is: you're using
all the tools you already have; no crazy math is required.

Think about the words "STIMULUS" and "RESPONSE".'''

if __name__ == "__main__":
    print(recoverBytes());


text:
package net.sf.txt2srt.reader;

import java.io.IOException;

public class InvalidFormatException extends IOException {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	public InvalidFormatException(String msg) {
		super(msg);
	}
}


text:
import { Bar, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins

export default {
  extends: Bar,
  props: ['options'],
  mixins: [reactiveProp],
  mounted () {
    this.renderChart(this.chartData, {responsive: true, maintainAspectRatio: true})
  }
}


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

Imports System
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.Diagnostics
Imports System.IO
Imports System.Linq
Imports System.Runtime.InteropServices
Imports System.Text
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Utilities
Imports TypeKind = Microsoft.CodeAnalysis.TypeKind

Namespace Microsoft.CodeAnalysis.VisualBasic
    ''' <summary>
    ''' The CommandLineArguments class provides members to Set and Get Visual Basic compilation and parse options.
    ''' </summary>
    Public NotInheritable Class VisualBasicCommandLineArguments
        Inherits CommandLineArguments
        ''' <summary>
        ''' Set and Get the Visual Basic compilation options.
        ''' </summary>
        ''' <returns>The currently set Visual Basic compilation options.</returns>
        Public Overloads Property CompilationOptions As VisualBasicCompilationOptions

        ''' <summary>
        ''' Set and Get the Visual Basic parse options.
        ''' </summary>
        ''' <returns>The currently set Visual Basic parse options.</returns>
        Public Overloads Property ParseOptions As VisualBasicParseOptions

        Friend OutputLevel As OutputLevel

        ''' <summary>
        ''' Gets the core Parse options.
        ''' </summary>
        ''' <returns>The currently set core parse options.</returns>
        Protected Overrides ReadOnly Property ParseOptionsCore As ParseOptions
            Get
                Return ParseOptions
            End Get
        End Property

        ''' <summary>
        ''' Gets the core compilation options.
        ''' </summary>
        ''' <returns>The currently set core compilation options.</returns>
        Protected Overrides ReadOnly Property CompilationOptionsCore As CompilationOptions
            Get
                Return CompilationOptions
            End Get
        End Property

        Friend Property DefaultCoreLibraryReference As CommandLineReference?

        Friend Sub New()
        End Sub

        Friend Overrides Function ResolveMetadataReferences(
            metadataResolver As MetadataReferenceResolver,
            diagnostics As List(Of DiagnosticInfo),
            messageProvider As CommonMessageProvider,
            resolved As List(Of MetadataReference)
            ) As Boolean

            Dim result = MyBase.ResolveMetadataReferences(metadataResolver, diagnostics, messageProvider, resolved)

            ' If there were no references, don't try to add default Cor library reference.
            If Me.DefaultCoreLibraryReference IsNot Nothing AndAlso resolved.Count > 0 Then
                ' All references from arguments were resolved successfully. Let's see if we have a reference that can be used as a Cor library.
                For Each reference In resolved
                    If reference.IsUnresolved Then
                        Continue For
                    End If

                    Dim refProps = reference.Properties

                    ' The logic about deciding what assembly is a candidate for being a Cor library here and in
                    ' CommonReferenceManager<TCompilation, TAssemblySymbol>.IndexOfCorLibrary
                    ' should be equivalent.
                    If Not refProps.EmbedInteropTypes AndAlso refProps.Kind = MetadataImageKind.Assembly Then
                        Try
                            Dim assemblyMetadata = TryCast(DirectCast(reference, PortableExecutableReference).GetMetadataNoCopy(), AssemblyMetadata)

                            If assemblyMetadata Is Nothing OrElse Not assemblyMetadata.IsValidAssembly() Then
                                ' There will be some errors reported later.
                                Return result
                            End If

                            Dim assembly As PEAssembly = assemblyMetadata.GetAssembly()

                            If assembly.AssemblyReferences.Length = 0 AndAlso Not assembly.ContainsNoPiaLocalTypes AndAlso assembly.DeclaresTheObjectClass Then
                                ' This reference looks like a valid Cor library candidate, bail out.
                                Return result
                            End If

                        Catch e As BadImageFormatException
                            ' error reported later
                            Return result
                        Catch e As IOException
                            ' error reported later
                            Return result
                        End Try
                    End If
                Next

                ' None of the supplied references could be used as a Cor library. Let's add a default one.
                Dim defaultCorLibrary = ResolveMetadataReference(Me.DefaultCoreLibraryReference.Value, metadataResolver, diagnostics, messageProvider).FirstOrDefault()

                If defaultCorLibrary Is Nothing OrElse defaultCorLibrary.IsUnresolved Then
                    Debug.Assert(diagnostics Is Nothing OrElse diagnostics.Any())
                    Return False
                Else
                    resolved.Insert(0, defaultCorLibrary)
                    Return result
                End If
            End If

            Return result
        End Function

    End Class

    Friend Enum OutputLevel
        Quiet
        Normal
        Verbose
    End Enum

End Namespace


text:
package org.cactoos.text;

import java.io.IOException;
import org.cactoos.Text;

/**
 * Normalize (replace sequences of whitespace characters by a single space)
 * a Text.
 *
 * @author Fabricio Cabral (fabriciofx@gmail.com)
 * @version $Id$
 * @since 0.9
 */
public final class NormalizedText implements Text {

    /**
     * The text.
     */
    private final Text origin;

    /**
     * Ctor.
     * @param text A Text
     */
    public NormalizedText(final String text) {
        this(new TextOf(text));
    }

    /**
     * Ctor.
     * @param text A Text
     */
    public NormalizedText(final Text text) {
        this.origin = text;
    }

    @Override
    public String asString() throws IOException {
        return new TrimmedText(this.origin).asString().replaceAll("\\s+", " ");
    }

}


text:
package org.conbere.irc

import Tokens.Message
import Messages._
import akka.actor._

import scala.concurrent.duration._
import com.typesafe.scalalogging.log4j.Logging
import scala.language.postfixOps
import akka.actor.ActorSystem

class ExampleBot(
  val serverName:String,
  val nickName:String,
  val userName:String,
  val password:String,
  val realName:String,
  val rooms:List[Room]
) extends ClassicBot with Logging {
  import Implicits._

  def before:Receive = {
    case PrivMsg(from, `nickName`, text) =>
      sender ! PrivMsg(from, text)
  }

  def after:Receive = {
    case Ping(from) =>
      sender ! PrivMsg(from, "hey")
  }

  def receive = onConnect orElse
                defaultHandler orElse
                before orElse after
}

object Main extends Logging {

  def main(args:Array[String]) = {
    val rooms = List(Room("#testroom", None))

    val serverName = "irc.server.com"
    val port = 6667

    val system = ActorSystem("Irc")

    val botProps =
      Props(classOf[ExampleBot], serverName, "testbot", "testbot", "password", "Test Bot", rooms)

    val bot = system.actorOf(botProps)

    val clientProps =
      Props(classOf[Client], serverName, port, bot)

    val client = system.actorOf(clientProps)
  }
}


text:
@implementation UIView (Debug)

- (NSString *)hay_detailedDebugDescription
{
    NSMutableString* debugDescription = [[self debugDescription] mutableCopy];

    if ([self isKindOfClass:[UIButton class]])
    {
        UIButton* button = (UIButton *)self;

        NSString* title = [button titleForState:button.state];

        if ([title length])
        {
            debugDescription = [[debugDescription substringToIndex:[debugDescription length] - 2] mutableCopy];
            [debugDescription appendString:@" title=\""];
            [debugDescription appendString:title];
            [debugDescription appendString:@"\">"];
        }
    }

    return [debugDescription copy];
}

@end


text:
var mongoose = require('mongoose');

    if (process.env.NODE_ENV === 'development') {
        console.log('development db is used ');
        mongoose.connect('mongodb://vttechnology:Abcd1234@ds051740.mongolab.com:51740/newidentity');
    }
    else{
        console.log('production db is used ');
        mongoose.connect('mongodb://vttechnology:Abcd1234@ds031741.mongolab.com:31741/newidentity_prod');
    }

module.exports = mongoose.connection;


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { OverlayModule } from '@angular/cdk/overlay';
import { ToastComponent } from './toast';
import { ToastItemComponent } from './toast.item';
import { ToastConfig } from './toast.config';

@NgModule({
    imports: [CommonModule, OverlayModule],
    declarations: [ToastComponent, ToastItemComponent],
    providers: [{
        provide: ToastConfig,
        useValue: {
            duration: 2000,
            animate: true
        }
    }],
    exports: [ToastComponent],
    entryComponents: [ToastComponent, ToastItemComponent]
})
export class ToastModule {
}


text:
<?php defined('SYSPATH') or die('No direct script access.');

class Pet extends Modulargaming_Pet { }


text:
package org.apache.pulsar.client.impl;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.sql.Time;
import java.sql.Timestamp;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;
import java.util.Map;
import java.util.function.Supplier;
import org.apache.pulsar.client.api.Authentication;
import org.apache.pulsar.client.api.BatcherBuilder;
import org.apache.pulsar.client.api.ClientBuilder;
import org.apache.pulsar.client.api.MessageId;
import org.apache.pulsar.client.api.MessagePayloadFactory;
import org.apache.pulsar.client.api.PulsarClientException;
import org.apache.pulsar.client.api.Schema;
import org.apache.pulsar.client.api.schema.GenericRecord;
import org.apache.pulsar.client.api.schema.GenericSchema;
import org.apache.pulsar.client.api.schema.RecordSchemaBuilder;
import org.apache.pulsar.client.api.schema.SchemaDefinition;
import org.apache.pulsar.client.api.schema.SchemaDefinitionBuilder;
import org.apache.pulsar.client.impl.auth.AuthenticationTls;
import org.apache.pulsar.client.impl.auth.AuthenticationToken;
import org.apache.pulsar.client.impl.schema.AutoConsumeSchema;
import org.apache.pulsar.client.impl.schema.AutoProduceBytesSchema;
import org.apache.pulsar.client.impl.schema.AvroSchema;
import org.apache.pulsar.client.impl.schema.BooleanSchema;
import org.apache.pulsar.client.impl.schema.ByteBufferSchema;
import org.apache.pulsar.client.impl.schema.ByteSchema;
import org.apache.pulsar.client.impl.schema.BytesSchema;
import org.apache.pulsar.client.impl.schema.DateSchema;
import org.apache.pulsar.client.impl.schema.DoubleSchema;
import org.apache.pulsar.client.impl.schema.FloatSchema;
import org.apache.pulsar.client.impl.schema.InstantSchema;
import org.apache.pulsar.client.impl.schema.IntSchema;
import org.apache.pulsar.client.impl.schema.JSONSchema;
import org.apache.pulsar.client.impl.schema.KeyValueSchemaImpl;
import org.apache.pulsar.client.impl.schema.KeyValueSchemaInfo;
import org.apache.pulsar.client.impl.schema.LocalDateSchema;
import org.apache.pulsar.client.impl.schema.LocalDateTimeSchema;
import org.apache.pulsar.client.impl.schema.LocalTimeSchema;
import org.apache.pulsar.client.impl.schema.LongSchema;
import org.apache.pulsar.client.impl.schema.NativeAvroBytesSchema;
import org.apache.pulsar.client.impl.schema.ProtobufNativeSchema;
import org.apache.pulsar.client.impl.schema.ProtobufSchema;
import org.apache.pulsar.client.impl.schema.RecordSchemaBuilderImpl;
import org.apache.pulsar.client.impl.schema.SchemaDefinitionBuilderImpl;
import org.apache.pulsar.client.impl.schema.SchemaInfoImpl;
import org.apache.pulsar.client.impl.schema.SchemaUtils;
import org.apache.pulsar.client.impl.schema.ShortSchema;
import org.apache.pulsar.client.impl.schema.StringSchema;
import org.apache.pulsar.client.impl.schema.TimeSchema;
import org.apache.pulsar.client.impl.schema.TimestampSchema;
import org.apache.pulsar.client.impl.schema.generic.GenericProtobufNativeSchema;
import org.apache.pulsar.client.impl.schema.generic.GenericSchemaImpl;
import org.apache.pulsar.client.internal.PulsarClientImplementationBinding;
import org.apache.pulsar.common.schema.KeyValue;
import org.apache.pulsar.common.schema.KeyValueEncodingType;
import org.apache.pulsar.common.schema.SchemaInfo;
import org.apache.pulsar.common.schema.SchemaInfoWithVersion;
import org.apache.pulsar.common.schema.SchemaType;

/**
 * Helper class for class instantiations and it also contains methods to work with schemas.
 */
@SuppressWarnings("unchecked")
public final class PulsarClientImplementationBindingImpl implements PulsarClientImplementationBinding {

    public <T> SchemaDefinitionBuilder<T> newSchemaDefinitionBuilder() {
        return new SchemaDefinitionBuilderImpl();
    }

    public ClientBuilder newClientBuilder() {
        return new ClientBuilderImpl();
    }

    public MessageId newMessageId(long ledgerId, long entryId, int partitionIndex) {
        return new MessageIdImpl(ledgerId, entryId, partitionIndex);
    }

    public MessageId newMessageIdFromByteArray(byte[] data) throws IOException {
        return MessageIdImpl.fromByteArray(data);
    }

    public MessageId newMessageIdFromByteArrayWithTopic(byte[] data, String topicName) throws IOException {
        return MessageIdImpl.fromByteArrayWithTopic(data, topicName);
    }

    public Authentication newAuthenticationToken(String token) {
        return new AuthenticationToken(token);
    }

    public Authentication newAuthenticationToken(Supplier<String> supplier) {
        return new AuthenticationToken(supplier);
    }

    public Authentication newAuthenticationTLS(String certFilePath, String keyFilePath) {
        return new AuthenticationTls(certFilePath, keyFilePath);
    }

    public Authentication createAuthentication(String authPluginClassName, String authParamsString)
            throws PulsarClientException.UnsupportedAuthenticationException {
        return AuthenticationUtil.create(authPluginClassName, authParamsString);
    }

    public Authentication createAuthentication(String authPluginClassName, Map<String, String> authParams)
            throws PulsarClientException.UnsupportedAuthenticationException {
        return AuthenticationUtil.create(authPluginClassName, authParams);
    }

    public Schema<byte[]> newBytesSchema() {
        return new BytesSchema();
    }

    public Schema<String> newStringSchema() {
        return new StringSchema();
    }

    public Schema<String> newStringSchema(Charset charset) {
        return new StringSchema(charset);
    }

    public Schema<Byte> newByteSchema() {
        return new ByteSchema();
    }

    public Schema<Short> newShortSchema() {
        return new ShortSchema();
    }

    public Schema<Integer> newIntSchema() {
        return new IntSchema();
    }

    public Schema<Long> newLongSchema() {
        return new LongSchema();
    }

    public Schema<Boolean> newBooleanSchema() {
        return new BooleanSchema();
    }

    public Schema<ByteBuffer> newByteBufferSchema() {
        return new ByteBufferSchema();
    }

    public Schema<Float> newFloatSchema() {
        return new FloatSchema();
    }

    public Schema<Double> newDoubleSchema() {
        return new DoubleSchema();
    }

    public Schema<Date> newDateSchema() {
        return DateSchema.of();
    }

    public Schema<Time> newTimeSchema() {
        return TimeSchema.of();
    }

    public Schema<Timestamp> newTimestampSchema() {
        return TimestampSchema.of();
    }

    public Schema<Instant> newInstantSchema() {
        return InstantSchema.of();
    }

    public Schema<LocalDate> newLocalDateSchema() {
        return LocalDateSchema.of();
    }

    public Schema<LocalTime> newLocalTimeSchema() {
        return LocalTimeSchema.of();
    }

    public Schema<LocalDateTime> newLocalDateTimeSchema() {
        return LocalDateTimeSchema.of();
    }

    public <T> Schema<T> newAvroSchema(SchemaDefinition schemaDefinition) {
        return AvroSchema.of(schemaDefinition);
    }

    public <T extends com.google.protobuf.GeneratedMessageV3> Schema<T> newProtobufSchema(
            SchemaDefinition schemaDefinition) {
        return ProtobufSchema.of(schemaDefinition);
    }

    public <T extends com.google.protobuf.GeneratedMessageV3> Schema<T> newProtobufNativeSchema(
            SchemaDefinition schemaDefinition) {
        return ProtobufNativeSchema.of(schemaDefinition);
    }

    public <T> Schema<T> newJSONSchema(SchemaDefinition schemaDefinition) {
        return JSONSchema.of(schemaDefinition);
    }

    public Schema<GenericRecord> newAutoConsumeSchema() {
        return new AutoConsumeSchema();
    }

    public Schema<byte[]> newAutoProduceSchema() {
        return new AutoProduceBytesSchema();
    }

    public Schema<byte[]> newAutoProduceSchema(Schema<?> schema) {
        return new AutoProduceBytesSchema(schema);
    }

    public Schema<byte[]> newAutoProduceValidatedAvroSchema(Object schema) {
        return new NativeAvroBytesSchema(schema);
    }

    public Schema<KeyValue<byte[], byte[]>> newKeyValueBytesSchema() {
        return KeyValueSchemaImpl.kvBytes();
    }

    public <K, V> Schema<KeyValue<K, V>> newKeyValueSchema(Schema<K> keySchema, Schema<V> valueSchema) {
        return KeyValueSchemaImpl.of(keySchema, valueSchema);
    }

    public <K, V> Schema<KeyValue<K, V>> newKeyValueSchema(Schema<K> keySchema, Schema<V> valueSchema,
                                                    KeyValueEncodingType keyValueEncodingType) {
        return KeyValueSchemaImpl.of(keySchema, valueSchema, keyValueEncodingType);
    }

    public <K, V> Schema<KeyValue<K, V>> newKeyValueSchema(Class<K> key, Class<V> value, SchemaType type) {
        return KeyValueSchemaImpl.of(key, value, type);
    }

    public Schema<?> getSchema(SchemaInfo schemaInfo) {
        return AutoConsumeSchema.getSchema(schemaInfo);
    }

    public GenericSchema<GenericRecord> getGenericSchema(SchemaInfo schemaInfo) {
        switch (schemaInfo.getType()) {
            case PROTOBUF_NATIVE:
                return GenericProtobufNativeSchema.of(schemaInfo);
            default:
                return GenericSchemaImpl.of(schemaInfo);
        }

    }

    public RecordSchemaBuilder newRecordSchemaBuilder(String name) {
        return new RecordSchemaBuilderImpl(name);
    }

    /**
     * Decode the kv encoding type from the schema info.
     *
     * @param schemaInfo the schema info
     * @return the kv encoding type
     */
    public KeyValueEncodingType decodeKeyValueEncodingType(SchemaInfo schemaInfo) {
        return KeyValueSchemaInfo.decodeKeyValueEncodingType(schemaInfo);
    }

    /**
     * Encode key & value into schema into a KeyValue schema.
     *
     * @param keySchema            the key schema
     * @param valueSchema          the value schema
     * @param keyValueEncodingType the encoding type to encode and decode key value pair
     * @return the final schema info
     */
    public <K, V> SchemaInfo encodeKeyValueSchemaInfo(Schema<K> keySchema,
                                               Schema<V> valueSchema,
                                               KeyValueEncodingType keyValueEncodingType) {
        return encodeKeyValueSchemaInfo("KeyValue", keySchema, valueSchema, keyValueEncodingType);
    }

    /**
     * Encode key & value into schema into a KeyValue schema.
     *
     * @param schemaName           the final schema name
     * @param keySchema            the key schema
     * @param valueSchema          the value schema
     * @param keyValueEncodingType the encoding type to encode and decode key value pair
     * @return the final schema info
     */
    public <K, V> SchemaInfo encodeKeyValueSchemaInfo(String schemaName,
                                               Schema<K> keySchema,
                                               Schema<V> valueSchema,
                                               KeyValueEncodingType keyValueEncodingType) {
        return KeyValueSchemaInfo.encodeKeyValueSchemaInfo(schemaName, keySchema, valueSchema, keyValueEncodingType);
    }

    /**
     * Decode the key/value schema info to get key schema info and value schema info.
     *
     * @param schemaInfo key/value schema info.
     * @return the pair of key schema info and value schema info
     */
    public KeyValue<SchemaInfo, SchemaInfo> decodeKeyValueSchemaInfo(SchemaInfo schemaInfo) {
        return KeyValueSchemaInfo.decodeKeyValueSchemaInfo(schemaInfo);
    }

    /**
     * Jsonify the schema info.
     *
     * @param schemaInfo the schema info
     * @return the jsonified schema info
     */
    public String jsonifySchemaInfo(SchemaInfo schemaInfo) {
        return SchemaUtils.jsonifySchemaInfo(schemaInfo);
    }

    /**
     * Jsonify the schema info with version.
     *
     * @param schemaInfoWithVersion the schema info with version
     * @return the jsonified schema info with version
     */
    public String jsonifySchemaInfoWithVersion(SchemaInfoWithVersion schemaInfoWithVersion) {
        return SchemaUtils.jsonifySchemaInfoWithVersion(schemaInfoWithVersion);
    }

    /**
     * Jsonify the key/value schema info.
     *
     * @param kvSchemaInfo the key/value schema info
     * @return the jsonified schema info
     */
    public String jsonifyKeyValueSchemaInfo(KeyValue<SchemaInfo, SchemaInfo> kvSchemaInfo) {
        return SchemaUtils.jsonifyKeyValueSchemaInfo(kvSchemaInfo);
    }

    /**
     * Convert the key/value schema data.
     *
     * @param kvSchemaInfo the key/value schema info
     * @return the convert key/value schema data string
     */
    public String convertKeyValueSchemaInfoDataToString(KeyValue<SchemaInfo, SchemaInfo> kvSchemaInfo)
            throws IOException {
        return SchemaUtils.convertKeyValueSchemaInfoDataToString(kvSchemaInfo);
    }

    /**
     * Convert the key/value schema info data json bytes to key/value schema info data bytes.
     *
     * @param keyValueSchemaInfoDataJsonBytes the key/value schema info data json bytes
     * @return the key/value schema info data bytes
     */
    public byte[] convertKeyValueDataStringToSchemaInfoSchema(byte[] keyValueSchemaInfoDataJsonBytes)
            throws IOException {
        return SchemaUtils.convertKeyValueDataStringToSchemaInfoSchema(keyValueSchemaInfoDataJsonBytes);
    }

    public BatcherBuilder newDefaultBatcherBuilder() {
        return new DefaultBatcherBuilder();
    }

    public BatcherBuilder newKeyBasedBatcherBuilder() {
        return new KeyBasedBatcherBuilder();
    }

    public MessagePayloadFactory newDefaultMessagePayloadFactory() {
        return new MessagePayloadFactoryImpl();
    }

    public SchemaInfo newSchemaInfoImpl(String name, byte[] schema, SchemaType type, long timestamp,
                                        Map<String, String> propertiesValue) {
        return new SchemaInfoImpl(name, schema, type, timestamp, propertiesValue);
    }
}


text:
import {IClone} from "../clone.interface";

export interface IClones {

    saveClone(clone: IClone);

    get(): IClone[];
}


text:
package rl.java.course.addressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import rl.java.course.addressbook.model.ContactData;
import rl.java.course.addressbook.model.Contacts;
import rl.java.course.addressbook.model.GroupData;

import java.util.List;

public class ContactHelper extends HelperBase {

  public ContactHelper(WebDriver wd) {
    super(wd);
  }

  public void initContactCreation() {
    click(By.xpath("//div[@id='nav']//a[.='add new']"));
  }

  public void fillContactForm(ContactData contactData, boolean creation) {
    type(By.name("firstname"), contactData.getName());
    type(By.name("lastname"), contactData.getLastName());
    type(By.name("address"), contactData.getAddress());
    type(By.name("home"), contactData.getHomePhone());
    type(By.name("email"), contactData.getEmail());
  }

  public void submitContact() {
    click(By.name("submit"));
  }

  public void updateCreationContact() {
    click(By.name("update"));
  }

  public void contactPage() {
    if (isElementPresent(By.id("maintable"))) {
      return;
    }
    click(By.linkText("home"));
  }

  private void selectContactById(int id) {
    wd.findElement(By.cssSelector("input[id='" + id + "']")).click();
  }

  public void deleteSelectedContact() {
    click(By.xpath("//*[@value='Delete']"));
  }

  public void initContactModification(int id) {
    click(By.xpath("//tr[@name='entry']//td[@class='center'][3]"));
  }

  public void initContactModificationById(int id) {
    wd.findElement(By.cssSelector(String.format("a[href='edit.php?id=%s']", id))).click();
  }

  public void submitContactModification() {
    click(By.name("update"));
  }

  public void acceptAlert() {
    wd.switchTo().alert().accept();
  }

  public void createContact(ContactData contact) {
    initContactCreation();
    fillContactForm(contact, true);
    submitContact();
    contactPage();
  }

  public int count() {
    return wd.findElements(By.name("selected[]")).size();
  }

  public boolean isThereAContact() {
    return isElementPresent(By.name("entry"));
  }

  public Contacts all() {
    Contacts contacts = new Contacts();
    List<WebElement> elements = wd.findElements(By.xpath("//tr[@name='entry']"));
    for (WebElement element : elements) {
      List<WebElement> cells = element.findElements(By.tagName("td"));
      String lastName = cells.get(1).getText();
      String name = cells.get(2).getText();
      String address = cells.get(3).getText();
      String allPhones = cells.get(5).getText();
      String allEmails = cells.get(4).getText();
      int id = Integer.parseInt(element.findElement(By.tagName("input")).getAttribute("value"));
      ContactData contact = new ContactData().withId(id).withLastName(lastName).withName(name)
              .withAddress(address).withAllPhones(allPhones).withAllEmails(allEmails);
      contacts.add(contact);
    }
    return contacts;
  }

  public void modify(ContactData contact) {
    contactPage();
    selectContactById(contact.getId());
    initContactModificationById(contact.getId());
    fillContactForm(contact, true);
    updateCreationContact();
    contactPage();
  }

  public void delete(ContactData contact) {
    contactPage();
    selectContactById(contact.getId());
    deleteSelectedContact();
    acceptAlert();
    contactPage();
  }

  public ContactData getInfoFromEditform(ContactData contact) {
    initContactModificationById(contact.getId());
    String name = wd.findElement(By.name("firstname")).getAttribute("value");
    String lastName = wd.findElement(By.name("lastname")).getAttribute("value");
    String address = wd.findElement(By.name("address")).getAttribute("value");
    String homePhone = wd.findElement(By.name("home")).getAttribute("value");
    String mobilePhone = wd.findElement(By.name("mobile")).getAttribute("value");
    String workPhone = wd.findElement(By.name("work")).getAttribute("value");
    String email = wd.findElement(By.name("email")).getAttribute("value");
    String email2 = wd.findElement(By.name("email2")).getAttribute("value");
    String email3 = wd.findElement(By.name("email3")).getAttribute("value");
    wd.navigate().back();
    return new ContactData().withId(contact.getId()).withName(name).withLastName(lastName)
            .withAddress(address).withHomePhone(homePhone).withMobilePhone(mobilePhone).withWorkPhone(workPhone)
            .withEmail(email).withEmail2(email2).withEmail3(email3);
  }

  public ContactData getInfoFromDeteilsForm(ContactData contact) {
    initContactDetailsById(contact.getId());
    String allDetails = wd.findElement(By.xpath("//div[@id='content']")).getText();
    wd.navigate().back();
    return new ContactData().withAllDetails(allDetails);
  }

  public void initContactDetailsById(int id) {
    wd.findElement(By.cssSelector(String.format("a[href='view.php?id=%s']", id))).click();
  }

  public void addContactToGroup(ContactData conact, GroupData associateGroup) {
    selectContactById(conact.getId());
    selectGroupToAdd(associateGroup);
    initAddContact();

  }

  public void deleteContactFromGroup(GroupData groupDate, ContactData contactDate) {
    selectGroupToDelete(groupDate);
    selectContactById(contactDate.getId());
    initDeleteContact();
  }

  public void initContactDeteilsById(int id) {

    wd.findElement(By.cssSelector(String.format("a[href='view.php?id=%s']", id))).click();

  }

  public void initAddContact() {
    wd.findElement(By.name("add")).click();
  }

  public void initDeleteContact() {
    wd.findElement(By.name("remove")).click();
  }

  public void selectGroupToAdd(GroupData group) {
    new Select(wd.findElement(By.cssSelector("select[name='to_group']"))).selectByVisibleText(group.getName());
  }

  public void selectGroupToDelete(GroupData group) {
    new Select(wd.findElement(By.name("group"))).selectByVisibleText(group.getName());
  }

}


text:
package com.simplaapliko.util.analytics;

import android.content.Context;

public class AnalyticsFactory {

    public static GoogleAnalyticsImpl getGoogleAnalytics(Context context) {
        return new GoogleAnalyticsImpl(context);
    }
}


text:
package com.cloudray.scalapress.plugin.listings

import com.cloudray.scalapress.plugin.listings.domain.ListingProcess
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import com.cloudray.scalapress.item.Item
import scala.collection.JavaConverters._
import com.cloudray.scalapress.plugin.listings.email.ListingAdminNotificationService
import com.cloudray.scalapress.account.Account
import com.cloudray.scalapress.framework.{Logging, ScalapressContext}

/** @author Stephen Samuel
  *
  *         This service will complete a listing process
  *
  **/
@Component
class ListingProcessService extends Logging {

  @Autowired var context: ScalapressContext = _
  @Autowired var listingProcessDao: ListingProcessDao = _
  @Autowired var listingAdminNotificationService: ListingAdminNotificationService = _

  def process(process: ListingProcess): Item = {
    logger.debug("Building listing for process [{}]", process)

    val account = context.accountDao.find(process.accountId.toLong)
    val listing = _listing(account, process)
    logger.debug("Created listing [{}]", listing.id)

    logger.debug("Sending email to admin")
    listingAdminNotificationService.notify(listing)

    listing
  }

  // delete the listing process
  def cleanup(process: ListingProcess) {
    process.attributeValues.asScala.foreach(_.listingProcess = null)
    process.attributeValues.clear()
    process.title = null
    process.content = null
    process.imageKeys = Array()
    process.email = null
    process.listing = null
    process.folders = Array()
    listingProcessDao.save(process)
    logger.debug("Process completed - removing from database")
    listingProcessDao.remove(process)
  }

  // build the listing object
  def _listing(account: Account, process: ListingProcess) = {
    val obj = new ListingProcessItemBuilder(context).build(process)
    obj.account = account
    context.itemDao.save(obj)
    obj
  }
}


text:
package org.spongepowered.mod.mixin.entity.living.monster;

import net.minecraft.entity.monster.EntityGuardian;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.world.World;

import org.spongepowered.api.entity.living.monster.Guardian;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.mod.mixin.Implements;
import org.spongepowered.mod.mixin.Interface;
import org.spongepowered.mod.mixin.Mixin;
import org.spongepowered.mod.mixin.Shadow;

@NonnullByDefault
@Mixin(EntityGuardian.class)
@Implements(@Interface(iface = Guardian.class, prefix = "guardian$"))
public abstract class MixinEntityGuardian extends EntityMob {

    @Shadow
    public abstract void func_175467_a(boolean elder); // setElder

    public MixinEntityGuardian(World worldIn) {
        super(worldIn);
    }

    public boolean guardian$isElder() {
        return (this.dataWatcher.getWatchableObjectInt(16) & 4) != 0;
    }

    public void guardian$setElder(boolean elder) {
        this.func_175467_a(elder);
    }
}


text:
package cercleSportif;

public class Inscription {

}