text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Azure.Core.TestFramework;
using NUnit.Framework;

namespace Azure.ResourceManager.Advisor.Tests
{
    public class SuppressionTests : AdvisorManagementTestBase
    {
        public SuppressionTests(bool isAsync)
                    : base(isAsync)//, RecordedTestMode.Record)
        {
        }

        private const string TimeToLive = "01:00:00";

        [Test]
        public async Task SuppressionsTest()
        {
            // get recommendations, we should get a non-empty list
            var collection = Client.GetResourceRecommendationBases(DefaultSubscription.Id);
            var recs = await collection.GetAllAsync().ToEnumerableAsync();
            Assert.GreaterOrEqual(recs.Count, 1);

            ResourceRecommendationBaseResource recommendation = null;

            // standard properties must all be populated
            foreach (var rec in recs)
            {
                Assert.IsFalse(string.IsNullOrWhiteSpace(rec.Data.Id));
                Assert.IsFalse(string.IsNullOrWhiteSpace(rec.Data.Name));
                Assert.IsFalse(string.IsNullOrWhiteSpace(rec.Data.RecommendationTypeId));
                Assert.NotNull(rec.Data.Category);
                Assert.NotNull(rec.Data.Impact);
                Assert.NotNull(rec.Data.ShortDescription);
                Assert.IsFalse(string.IsNullOrWhiteSpace(rec.Data.ShortDescription.Problem));
                Assert.IsFalse(string.IsNullOrWhiteSpace(rec.Data.ShortDescription.Solution));
                if (!string.IsNullOrWhiteSpace(rec.Data.ImpactedValue))
                {
                    recommendation = rec;
                }
            }

            // at least one recommendation must have ImpactedValue
            Assert.NotNull(recommendation);

            // we should be able to fetch the recommendation by name
            var output = (await collection.GetAsync(recommendation.Data.Name)).Value;
            Assert.AreEqual(recommendation.Id, output.Id);
            Assert.AreEqual(recommendation.Data.Name, output.Data.Name);

            // we should be able to create a suppression with a specific TTL
            var suppressionCollection = recommendation.GetSuppressionContracts();
            var suppressionName = Recording.GenerateAssetName("NetSdkTest");
            var suppression = (await suppressionCollection.CreateOrUpdateAsync(
                WaitUntil.Completed,
                suppressionName,
                new SuppressionContractData() { Ttl = TimeToLive })).Value;
            Assert.AreEqual(TimeToLive, suppression.Data.Ttl);

            // we should be able to fetch the suppression by name
            var sup = (await suppressionCollection.GetAsync(suppressionName)).Value;
            Assert.AreEqual(sup.Data.Name, suppressionName);

            // we should be able to delete the suppression by name
            await sup.DeleteAsync(WaitUntil.Completed);
            var sups = (await suppressionCollection.ExistsAsync(suppressionName)).Value;
            Assert.IsFalse(sups);
        }
    }
}


text:
"""Control tasks execution order"""
import fnmatch
from collections import deque

from .exceptions import InvalidTask, InvalidCommand, InvalidDodoFile
from .task import Task

class TaskControl(object):
    """Manages tasks inter-relationship

    There are 3 phases
      1) the constructor gets a list of tasks and do initialization
      2) 'process' the command line options for tasks are processed
      3) 'task_dispatcher' dispatch tasks to runner

    Process dependencies and targets to find out the order tasks
    should be executed. Also apply filter to exclude tasks from
    execution. And parse task cmd line options.

    @ivar tasks: (dict) Key: task name ([taskgen.]name)
                               Value: L{Task} instance
    @ivar targets: (dict) Key: fileName
                          Value: task_name
    """

    def __init__(self, task_list):
        self.tasks = {}
        self.targets = {}

        # name of task in order to be executed
        # this the order as in the dodo file. the real execution
        # order might be different if the dependecies require so.
        self._def_order = []
        # list of tasks selected to be executed
        self.selected_tasks = None

        # sanity check and create tasks dict
        for task in task_list:
            # task must be a Task
            if not isinstance(task, Task):
                msg = "Task must an instance of Task class. %s"
                raise InvalidTask(msg % (task.__class__))
            # task name must be unique
            if task.name in self.tasks:
                msg = "Task names must be unique. %s"
                raise InvalidDodoFile(msg % task.name)

            self.tasks[task.name] = task
            self._def_order.append(task.name)

        # expand wild-card task-dependencies
        for task in self.tasks.itervalues():
            for pattern in task.wild_dep:
                task.task_dep.extend(self._get_wild_tasks(pattern))

        self._check_dep_names()
        self._init_implicit_deps()

    def _check_dep_names(self):
        """check if user input task_dep or setup_task that doesnt exist"""
        # check task-dependencies exist.
        for task in self.tasks.itervalues():
            for dep in task.task_dep:
                if dep not in self.tasks:
                    msg = "%s. Task dependency '%s' does not exist."
                    raise InvalidTask(msg% (task.name, dep))

            for setup_task in task.setup_tasks:
                if setup_task not in self.tasks:
                    msg = "Task '%s': invalid setup task '%s'."
                    raise InvalidTask(msg % (task.name, setup_task))

    def _init_implicit_deps(self):
        """get task_dep based on file_dep on a target from another task"""
        # 1) create a dictionary associating every target->task. where the task
        # builds that target.
        for task in self.tasks.itervalues():
            for target in task.targets:
                if target in self.targets:
                    msg = ("Two different tasks can't have a common target." +
                           "'%s' is a target for %s and %s.")
                    raise InvalidTask(msg % (target, task.name,
                                             self.targets[target]))
                self.targets[target] = task.name
        # 2) now go through all dependencies and check if they are target from
        # another task.
        for task in self.tasks.itervalues():
            self.add_implicit_task_dep(self.targets, task, task.file_dep)

    @staticmethod
    def add_implicit_task_dep(targets, task, deps_list):
        """add tasks which created targets are file_dep for this task"""
        for dep in deps_list:
            if (dep in targets and targets[dep] not in task.task_dep):
                task.task_dep.append(targets[dep])

    def _get_wild_tasks(self, pattern):
        """get list of tasks that match pattern"""
        wild_list = []
        for t_name in self._def_order:
            if fnmatch.fnmatch(t_name, pattern):
                wild_list.append(t_name)
        return wild_list

    def _process_filter(self, task_selection):
        """process cmd line task options
        [task_name [-task_opt [opt_value]] ...] ...
        """
        filter_list = []
        def add_filtered_task(seq, f_name):
            """can be filter by target or task name """
            filter_list.append(f_name)
            if f_name in self.tasks:
                # parse task_selection
                the_task = self.tasks[f_name]
                # remaining items are other tasks not positional options
                the_task.options, seq = the_task.taskcmd.parse(seq)
            return seq

        # process...
        seq = task_selection[:]
        # process cmd_opts until nothing left
        while seq:
            f_name = seq.pop(0) # always start with a task/target name
            # select tasks by task-name pattern
            if '*' in f_name:
                for task_name in self._get_wild_tasks(f_name):
                    add_filtered_task((), task_name)
            else:
                seq = add_filtered_task(seq, f_name)
        return filter_list

    def _filter_tasks(self, task_selection):
        """Select tasks specified by filter.

        filter can specify tasks to be execute by task name or target.
        @return (list) of string. where elements are task name.
        """
        selected_task = []

        filter_list = self._process_filter(task_selection)
        for filter_ in filter_list:
            # by task name
            if filter_ in self.tasks:
                selected_task.append(filter_)
            # by target
            elif filter_ in self.targets:
                selected_task.append(self.targets[filter_])
            else:
                msg = ('cmd `run` invalid parameter: "%s".' +
                       'Must be a task, or a target.\n' +
                       'Type "doit list" to see available tasks')
                raise InvalidCommand(msg % filter_)
        return selected_task

    def process(self, task_selection):
        """@return (list - string) each element is the name of a task"""
        # execute only tasks in the filter in the order specified by filter
        if task_selection is not None:
            self.selected_tasks = self._filter_tasks(task_selection)
        else:
            # if no filter is defined execute all tasks
            # in the order they were defined.
            self.selected_tasks = self._def_order

    def task_dispatcher(self, include_setup=False):
        """return a TaskDispatcher generator
        """
        assert self.selected_tasks is not None, \
            "must call 'process' before this"

        return TaskDispatcher(self.tasks, self.targets, self.selected_tasks,
                              include_setup)

class ExecNode(object):
    """Each task will have an instace of this
    This used to keep track of waiting events and the generator for dep nodes

    @ivar run_status (str): contains the result of Dependency.get_status
            modified by runner, value can be:
           - None: not processed yet
           - run: task is selected to be executed (it might be running or
                   waiting for setup)
           - ignore: task wont be executed (user forced deselect)
           - up-to-date: task wont be executed (no need)
           - done: task finished its execution
    """
    def __init__(self, task, parent):
        self.task = task
        # list of dependencies not processed by _add_task yet
        self.task_dep = task.task_dep[:]
        self.calc_dep = task.calc_dep.copy()

        # ancestors are used to detect cyclic references.
        # it does not contain a list of tasks that depends on this node
        # for that check the attribute waiting_me
        self.ancestors = []
        if parent:
            self.ancestors.extend(parent.ancestors)
        self.ancestors.append(task.name)

        # Wait for a task to be selected to its execution
        # checking if it is up-to-date
        self.wait_select = False

        # Wait for a task to finish its execution
        self.wait_run = set() # task names
        self.wait_run_calc = set() # task names

        self.waiting_me = set() # ExecNode

        self.run_status = None
        # all ancestors that failed
        self.bad_deps = []
        self.ignored_deps = []

        # generator from TaskDispatcher._add_task
        self.generator = None

    def parent_status(self, parent_node):
        if parent_node.run_status == 'failure':
            self.bad_deps.append(parent_node)
        elif parent_node.run_status == 'ignore':
            self.ignored_deps.append(parent_node)

    def __repr__(self):
        return "%s(%s)" % (self.__class__.__name__, self.task.name)

    def step(self):
        """get node's next step"""
        try:
            return next(self.generator)
        except StopIteration:
            return None

def no_none(decorated):
    """decorator for a generator to discard/filter-out None values"""
    def _func(*args, **kwargs):
        """wrap generator"""
        for value in decorated(*args, **kwargs):
            if value is not None:
                yield value
    return _func

class TaskDispatcher(object):
    """Dispatch another task to be selected/executed, mostly handle with MP

    Note that a dispatched task might not be ready to be executed.

    @ivar include_setup: (bool) when True tasks wont be execute so
                         do not wait for task deps.
    """
    def __init__(self, tasks, targets, selected_tasks, include_setup=False):
        self.tasks = tasks
        self.targets = targets
        self.include_setup = include_setup

        self.nodes = {} # key task-name, value: ExecNode
        # queues
        self.waiting = set() # of ExecNode
        self.ready = deque() # of ExecNode

        self.generator = self._dispatcher_generator(selected_tasks)

    def _gen_node(self, parent, task_name):
        """return ExecNode for task_name if not created yet"""
        node = self.nodes.get(task_name, None)

        # first time, create node
        if node is None:
            node = ExecNode(self.tasks[task_name], parent)
            node.generator = self._add_task(node)
            self.nodes[task_name] = node
            return node

        # detect cyclic/recursive dependencies
        if parent and task_name in parent.ancestors:
            msg = "Cyclic/recursive dependencies for task %s: [%s]"
            cycle = " -> ".join(parent.ancestors + [task_name])
            raise InvalidDodoFile(msg % (task_name, cycle))

    def _node_add_wait_run(self, node, task_list, calc=False):
        """updates node.wait_run
        @param node (ExecNode)
        @param task_list (list - str) tasks that node should wait for
        @param calc (bool) task_list is for calc_dep
        """
        # remove tasks that were already executed from task_list
        wait_for = set()
        for name in task_list:
            dep_node = self.nodes[name]
            if (not dep_node) or dep_node.run_status in (None, 'run'):
                wait_for.add(name)
            else:
                node.parent_status(dep_node)

        # update ExecNode setting parent/dependent relationship
        for name in wait_for:
            self.nodes[name].waiting_me.add(node)
        if calc:
            node.wait_run_calc.update(wait_for)
        else:
            node.wait_run.update(wait_for)

    @no_none
    def _add_task(self, node):
        """@return a generator that produces:
             - ExecNode for task dependencies
             - 'wait' to wait for an event (i.e. a dep task run)
             - Task when ready to be dispatched to runner (run or be selected)
             - None values are of no interest and are filtered out
               by the decorator no_none

        note that after a 'wait' is sent it is the reponsability of the
        caller to ensure the current ExecNode cleared all its waiting
        before calling `next()` again on this generator
        """
        this_task = node.task

        # add calc_dep & task_dep until all processed
        # calc_dep may add more deps so need to loop until nothing left
        while True:
            for calc_dep in node.calc_dep:
                yield self._gen_node(node, calc_dep)
            self._node_add_wait_run(node, node.calc_dep, calc=True)
            node.calc_dep.clear()

            # add task_dep
            for task_dep in node.task_dep:
                yield self._gen_node(node, task_dep)
            self._node_add_wait_run(node, node.task_dep)
            node.task_dep = []

            if (node.wait_run or node.wait_run_calc) and not self.include_setup:
                yield 'wait'
            else:
                break

        # add itself
        yield this_task

        # tasks that contain setup-tasks need to be yielded twice
        if this_task.setup_tasks:
            # run_status None means task is waiting for other tasks
            # in order to check if up-to-date. so it needs to wait
            # before scheduling its setup-tasks.
            if node.run_status is None:
                node.wait_select = True
                yield "wait"

            # if this task should run, so schedule setup-tasks before itself
            if node.run_status == 'run' or self.include_setup:
                for setup_task in this_task.setup_tasks:
                    yield self._gen_node(node, setup_task)
                self._node_add_wait_run(node, this_task.setup_tasks)
                if node.wait_run:
                    yield 'wait'

                # re-send this task after setup_tasks are sent
                yield this_task

    def _get_next_node(self, ready, tasks_to_run):
        """get ExecNode from (in order):
            .1 ready
            .2 tasks_to_run (list in reverse order)
         """
        if ready:
            return ready.popleft()
        # get task group from tasks_to_run
        while tasks_to_run:
            task_name = tasks_to_run.pop()
            node = self._gen_node(None, task_name)
            if node:
                return node

    def _update_waiting(self, processed):
        """updates 'ready' and 'waiting' queues after processed
        @param processed (ExecNode) or None
        """
        # no task processed, just ignore
        if processed is None:
            return

        node = processed

        # if node was waiting select must only receive select event
        if node.wait_select:
            self.ready.append(node)
            self.waiting.remove(node)
            node.wait_select = False

        # status == run means this was not just select completed
        if node.run_status == 'run':
            return

        for waiting_node in node.waiting_me:
            waiting_node.parent_status(node)

            # is_ready indicates if node.generator can be invoked again
            task_name = node.task.name

            # node wait_run will be ready if there are nothing left to wait
            if task_name in waiting_node.wait_run:
                waiting_node.wait_run.remove(task_name)
                is_ready = not (waiting_node.wait_run or
                                waiting_node.wait_run_calc)
            # node wait_run_calc
            else:
                assert task_name in waiting_node.wait_run_calc
                waiting_node.wait_run_calc.remove(task_name)
                # calc_dep might add new deps that can be run without
                # waiting for the completion of the remaining deps
                is_ready = True

                # refresh this task dependencies with values got from calc_dep
                values = node.task.values
                len_task_deps = len(node.task.task_dep)
                old_calc_dep = node.task.calc_dep.copy()
                waiting_node.task.update_deps(values)
                TaskControl.add_implicit_task_dep(
                    self.targets, waiting_node.task,
                    values.get('file_dep', []))

                # update node's list of non-processed dependencies
                new_task_dep = waiting_node.task.task_dep[len_task_deps:]
                waiting_node.task_dep.extend(new_task_dep)
                new_calc_dep = waiting_node.task.calc_dep - old_calc_dep
                waiting_node.calc_dep.update(new_calc_dep)

            # this node can be further processed
            if is_ready and (waiting_node in self.waiting):
                self.ready.append(waiting_node)
                self.waiting.remove(waiting_node)

    def _dispatcher_generator(self, selected_tasks):
        """return generator dispatching tasks"""
        # each selected task will create a tree (from dependencies) of
        # tasks to be processed
        tasks_to_run = list(reversed(selected_tasks))
        node = None  # current active ExecNode

        while True:
            # get current node
            if not node:
                node = self._get_next_node(self.ready, tasks_to_run)
                if not node:
                    if self.waiting:
                        # all tasks are waiting, hold on
                        processed = (yield "hold on")
                        self._update_waiting(processed)
                        continue
                    # we are done!
                    return

            # get next step from current node
            next_step = node.step()

            # got None, nothing left for this generator
            if next_step is None:
                node = None
                continue

            # got a task, send ExecNode to runner
            if isinstance(next_step, Task):
                processed = (yield self.nodes[next_step.name])
                self._update_waiting(processed)

            # got new ExecNode, add to ready_queue
            elif isinstance(next_step, ExecNode):
                self.ready.append(next_step)

            # got 'wait', add ExecNode to waiting queue
            else:
                assert next_step == "wait"
                # skip all waiting tasks, just getting a list of tasks...
                if not self.include_setup:
                    self.waiting.add(node)
                    node = None

redpajama_set_name: RedPajamaGithub


text:
/*
 Application controllers
 Main controllers for the app
 */

angular.module("app.controllers", []).controller("AdminAppCtrl", ["$scope", "$location",
  function ($scope, $location) {
    $scope.checkIfOwnPage = function () {

      return _.contains(["/front","/404", "/pages/500", "/pages/login", "/pages/signin", "/pages/signin1", "/pages/signin2", "/pages/signup", "/pages/signup1", "/pages/signup2", "/pages/forgot", "/pages/lock-screen"], $location.path());

    };

    $scope.checkIfFixedPage = function () {

      return _.contains(["/dashboard"], $location.path());

    };

    $scope.info = {
      theme_name: "Kimono",
      user_name: "Jane Doe"
    };

  }
]).controller("NavCtrl", ['navigationMenuService',
  function (navigationMenuService) {

    this.navigationState = navigationMenuService;

    this.SwitchToMenu = function () {
      navigationMenuService.menu = true;
      navigationMenuService.playlist = false;
    };

    this.SwitchToPlaylist = function () {
      navigationMenuService.menu = false;
      navigationMenuService.playlist = true;
    };

  }
]).controller("ActionsCtrl", ['$scope',function ($scope) {

    this.toggleChat = function () {
      $('.chat-bar').toggleClass("visible");
    };

  }
]);

/*
 App Form validations
 Validator functions for form elements (signIn,signUp and custom forms)
 */

angular.module("app.form.validation", []).controller("wizardFormCtrl", ["$scope",
  function ($scope) {
    return $scope.wizard = {
      firstName: "some name",
      lastName: "",
      email: "",
      password: "",
      age: "",
      address: ""
    }, $scope.isValidateStep1 = function () {
      return void 0;
    }, $scope.finishedWizard = function () {
      return void 0;
    };
  }
]).controller("formConstraintsCtrl", ["$scope",
  function ($scope) {
    var original;
    return $scope.form = {
      required: "",
      minlength: "",
      maxlength: "",
      length_rage: "",
      type_something: "",
      confirm_type: "",
      foo: "",
      email: "",
      url: "",
      num: "",
      minVal: "",
      maxVal: "",
      valRange: "",
      pattern: ""
    }, original = angular.copy($scope.form), $scope.revert = function () {
      return $scope.form = angular.copy(original), $scope.form_constraints.$setPristine();
    }, $scope.canRevert = function () {
      return !angular.equals($scope.form, original) || !$scope.form_constraints.$pristine;
    }, $scope.canSubmit = function () {
      return $scope.form_constraints.$valid && !angular.equals($scope.form, original);
    };
  }
]).controller("signinCtrl", ["$scope",
  function ($scope) {
    var original;
    return $scope.user = {
      email: "",
      password: ""
    }, $scope.showInfoOnSubmit = !1, original = angular.copy($scope.user), $scope.revert = function () {
      return $scope.user = angular.copy(original), $scope.form_signin.$setPristine();
    }, $scope.canRevert = function () {
      return !angular.equals($scope.user, original) || !$scope.form_signin.$pristine;
    }, $scope.canSubmit = function () {
      return $scope.form_signin.$valid && !angular.equals($scope.user, original);
    }, $scope.submitForm = function () {
      return $scope.showInfoOnSubmit = !0, $scope.revert();
    };
  }
]).controller("signupCtrl", ["$scope",
  function ($scope) {
    var original;
    return $scope.user = {
      name: "",
      email: "",
      password: "",
      confirmPassword: "",
      age: ""
    }, $scope.showInfoOnSubmit = !1, original = angular.copy($scope.user), $scope.revert = function () {
      return $scope.user = angular.copy(original), $scope.form_signup.$setPristine(), $scope.form_signup.confirmPassword.$setPristine();
    }, $scope.canRevert = function () {
      return !angular.equals($scope.user, original) || !$scope.form_signup.$pristine;
    }, $scope.canSubmit = function () {
      return $scope.form_signup.$valid && !angular.equals($scope.user, original);
    }, $scope.submitForm = function () {
      return $scope.showInfoOnSubmit = !0, $scope.revert();
    };
  }
]).directive("validateEquals", [
  function () {
    return {
      require: "ngModel",
      link: function (scope, ele, attrs, ngModelCtrl) {
        var validateEqual;
        return validateEqual = function (value) {
          var valid;
          return valid = value === scope.$eval(attrs.validateEquals), ngModelCtrl.$setValidity("equal", valid), "function" == typeof valid ? valid({
            value: void 0
          }) : void 0;
        }, ngModelCtrl.$parsers.push(validateEqual), ngModelCtrl.$formatters.push(validateEqual), scope.$watch(attrs.validateEquals, function (newValue, oldValue) {
          return newValue !== oldValue ? ngModelCtrl.$setViewValue(ngModelCtrl.$ViewValue) : void 0;
        });
      }
    };
  }
]);

/*
 App Form Ui Controls
 Controllers for form Ui components
 */

angular.module("app.ui.form.ctrls", []).controller("TagsDemoCtrl", ["$scope",
  function ($scope) {
    $scope.tags = ["foo", "bar"];
  }
]).controller("DatepickerDemoCtrl", ["$scope",
  function ($scope) {
    return $scope.today = function () {
      $scope.dt = new Date();
    }, $scope.today(), $scope.showWeeks = !0, $scope.toggleWeeks = function () {
      $scope.showWeeks = !$scope.showWeeks;
    }, $scope.clear = function () {
      $scope.dt = null;
    }, $scope.disabled = function (date, mode) {
      return "day" === mode && (0 === date.getDay() || 6 === date.getDay());
    }, $scope.toggleMin = function () {
      var _ref;
      $scope.minDate = null !== (_ref = $scope.minDate) ? _ref : {
        "null": new Date()
      };
    }, $scope.toggleMin(), $scope.open = function ($event) {
      return $event.preventDefault(), $event.stopPropagation(), $scope.opened = !0;
    }, $scope.dateOptions = {
      "year-format": "'yy'",
      "starting-day": 1
    }, $scope.formats = ["dd-MMMM-yyyy", "yyyy/MM/dd", "shortDate"], $scope.format = $scope.formats[0];
  }
]).controller("TimepickerDemoCtrl", ["$scope",
  function ($scope) {
    return $scope.mytime = new Date(), $scope.hstep = 1, $scope.mstep = 15, $scope.options = {
      hstep: [1, 2, 3],
      mstep: [1, 5, 10, 15, 25, 30]
    }, $scope.ismeridian = !0, $scope.toggleMode = function () {
      $scope.ismeridian = !$scope.ismeridian;
    }, $scope.update = function () {
      var d;
      return d = new Date(), d.setHours(14), d.setMinutes(0), $scope.mytime = d;
    }, $scope.changed = function () {
      return void 0;
    }, $scope.clear = function () {
      $scope.mytime = null;
    };
  }
]).controller("TypeaheadCtrl", ["$scope",
  function ($scope) {
    return $scope.selected = void 0, $scope.states = ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Dakota", "North Carolina", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"];
  }
]).controller("RatingDemoCtrl", ["$scope",
  function ($scope) {
    return $scope.rate = 7, $scope.max = 10, $scope.isReadonly = !1, $scope.hoveringOver = function (value) {
      return $scope.overStar = value, $scope.percent = 100 * (value / $scope.max);
    }, $scope.ratingStates = [{
      stateOn: "glyphicon-ok-sign",
      stateOff: "glyphicon-ok-circle"
    }, {
      stateOn: "glyphicon-star",
      stateOff: "glyphicon-star-empty"
    }, {
      stateOn: "glyphicon-heart",
      stateOff: "glyphicon-ban-circle"
    }, {
      stateOn: "glyphicon-heart"
    }, {
      stateOff: "glyphicon-off"
    }];
  }
]);

/*
 App Tables
 Controller for dynamic and other tables
 */

angular.module("app.tables", []).controller("tableCtrl", ["$scope", "$filter",
  function ($scope, $filter) {
    var init;
    return $scope.stores = [{
      name: "Nijiya Market",
      price: "$$",
      sales: 292,
      rating: 4
    }, {
      name: "Eat On Monday Truck",
      price: "$",
      sales: 119,
      rating: 4.3
    }, {
      name: "Tea Era",
      price: "$",
      sales: 874,
      rating: 4
    }, {
      name: "Rogers Deli",
      price: "$",
      sales: 347,
      rating: 4.2
    }, {
      name: "MoBowl",
      price: "$$$",
      sales: 24,
      rating: 4.6
    }, {
      name: "The Milk Pail Market",
      price: "$",
      sales: 543,
      rating: 4.5
    }, {
      name: "Nob Hill Foods",
      price: "$$",
      sales: 874,
      rating: 4
    }, {
      name: "Scratch",
      price: "$$$",
      sales: 643,
      rating: 3.6
    }, {
      name: "Gochi Japanese Fusion Tapas",
      price: "$$$",
      sales: 56,
      rating: 4.1
    }, {
      name: "Cost Plus World Market",
      price: "$$",
      sales: 79,
      rating: 4
    }, {
      name: "Bumble Bee Health Foods",
      price: "$$",
      sales: 43,
      rating: 4.3
    }, {
      name: "Costco",
      price: "$$",
      sales: 219,
      rating: 3.6
    }, {
      name: "Red Rock Coffee Co",
      price: "$",
      sales: 765,
      rating: 4.1
    }, {
      name: "99 Ranch Market",
      price: "$",
      sales: 181,
      rating: 3.4
    }, {
      name: "Mi Pueblo Food Center",
      price: "$",
      sales: 78,
      rating: 4
    }, {
      name: "Cucina Venti",
      price: "$$",
      sales: 163,
      rating: 3.3
    }, {
      name: "Sufi Coffee Shop",
      price: "$",
      sales: 113,
      rating: 3.3
    }, {
      name: "Dana Street Roasting",
      price: "$",
      sales: 316,
      rating: 4.1
    }, {
      name: "Pearl Cafe",
      price: "$",
      sales: 173,
      rating: 3.4
    }, {
      name: "Posh Bagel",
      price: "$",
      sales: 140,
      rating: 4
    }, {
      name: "Artisan Wine Depot",
      price: "$$",
      sales: 26,
      rating: 4.1
    }, {
      name: "Hong Kong Chinese Bakery",
      price: "$",
      sales: 182,
      rating: 3.4
    }, {
      name: "Starbucks",
      price: "$$",
      sales: 97,
      rating: 3.7
    }, {
      name: "Tapioca Express",
      price: "$",
      sales: 301,
      rating: 3
    }, {
      name: "House of Bagels",
      price: "$",
      sales: 82,
      rating: 4.4
    }], $scope.searchKeywords = "", $scope.filteredStores = [], $scope.row = "", $scope.select = function (page) {
      var end, start;
      return start = (page - 1) * $scope.numPerPage, end = start + $scope.numPerPage, $scope.currentPageStores = $scope.filteredStores.slice(start, end);
    }, $scope.onFilterChange = function () {
      return $scope.select(1), $scope.currentPage = 1, $scope.row = "";
    }, $scope.onNumPerPageChange = function () {
      return $scope.select(1), $scope.currentPage = 1;
    }, $scope.onOrderChange = function () {
      return $scope.select(1), $scope.currentPage = 1;
    }, $scope.search = function () {
      return $scope.filteredStores = $filter("filter")($scope.stores, $scope.searchKeywords), $scope.onFilterChange();
    }, $scope.order = function (rowName) {
      return $scope.row !== rowName ? ($scope.row = rowName, $scope.filteredStores = $filter("orderBy")($scope.stores, rowName), $scope.onOrderChange()) : void 0;
    }, $scope.numPerPageOpt = [3, 5, 10, 20], $scope.numPerPage = $scope.numPerPageOpt[2], $scope.currentPage = 1, $scope.currentPageStores = [], (init = function () {
      return $scope.search(), $scope.select($scope.currentPage);
    }), $scope.search();
  }
]);

/*
 App Ui Controllers
 Provides general controllers for the app
 */

angular.module("app.ui.ctrls", []).controller("NotifyCtrl", ["$scope", "loggit",
  function ($scope, loggit) {
    $scope.notify = function (type) {
      switch (type) {
        case "info":
          return loggit.log("Hello! This is an alert of the info importance level.");
        case "success":
          return loggit.logSuccess("Great! You did something successfully.");
        case "warning":
          return loggit.logWarning("Warning! Something that happened that is not critical but important.");
        case "error":
          return loggit.logError("Error! Something went terribly wrong and needs your attention.");
      }
    };
  }
]).controller("AlertDemoCtrl", ["$scope",
  function ($scope) {
    $scope.alerts = [{
      type: "success",
      msg: "Great! You did something successfully."
    }, {
      type: "info",
      msg: "Hello! This is an alert of the info importance level."
    }, {
      type: "warning",
      msg: "Warning! Something that happened that is not critical but important."
    }, {
      type: "danger",
      msg: "Error! Something went terribly wrong and needs your attention."
    }];

    $scope.addAlert = function () {
      $scope.alerts.push({msg: 'Another alert!'});
    };

    $scope.closeAlert = function (index) {
      $scope.alerts.splice(index, 1);
    };
  }
]).controller("ProgressDemoCtrl", ["$scope",
  function ($scope) {
    $scope.max = 200;

    $scope.random = function () {
      var value = Math.floor((Math.random() * 100) + 1);
      var type;

      if (value < 25) {
        type = 'success';
      } else if (value < 50) {
        type = 'info';
      } else if (value < 75) {
        type = 'warning';
      } else {
        type = 'danger';
      }

      $scope.showWarning = (type === 'danger' || type === 'warning');

      $scope.dynamic = value;
      $scope.type = type;
    };
    $scope.random();

    $scope.randomStacked = function () {
      $scope.stacked = [];
      var types = ['success', 'info', 'warning', 'danger'];

      for (var i = 0, n = Math.floor((Math.random() * 4) + 1); i < n; i++) {
        var index = Math.floor((Math.random() * 4));
        $scope.stacked.push({
          value: Math.floor((Math.random() * 30) + 1),
          type: types[index]
        });
      }
    };
    $scope.randomStacked();
  }
]).controller("AccordionDemoCtrl", ["$scope",
  function ($scope) {
    return $scope.oneAtATime = !0, $scope.groups = [{
      title: "First Group Header",
      content: "First Group Body"
    }, {
      title: "Second Group Header",
      content: "Second Group Body"
    }, {
      title: "Third Group Header",
      content: "Third Group Body"
    }], $scope.items = ["Item 1", "Item 2", "Item 3"], $scope.status = {
      isFirstOpen: !0,
      isFirstOpen1: !0,
      isFirstOpen2: !0,
      isFirstOpen3: !0,
      isFirstOpen4: !0,
      isFirstOpen5: !0,
      isFirstOpen6: !0
    }, $scope.addItem = function () {
      var newItemNo;
      newItemNo = $scope.items.length + 1;
      $scope.items.push("Item " + newItemNo);
    };
  }
]).controller("CollapseDemoCtrl", ["$scope",
  function ($scope) {
    $scope.isCollapsed = !1;
  }
]).controller("ModalDemoCtrl", ["$scope", "$modal", "$log",
  function ($scope, $modal, $log) {
    $scope.items = ['item1', 'item2', 'item3'];

    $scope.open = function (size) {

      var modalInstance = $modal.open({
        templateUrl: 'myModalContent.html',
        controller: 'ModalInstanceCtrl',
        size: size,
        resolve: {
          items: function () {
            return $scope.items;
          }
        }
      });

      modalInstance.result.then(function (selectedItem) {
        $scope.selected = selectedItem;
      }, function () {
        $log.info('Modal dismissed at: ' + new Date());
      });
    };
  }
]).controller("ModalInstanceCtrl", ["$scope", "$modalInstance", "items",
  function ($scope, $modalInstance, items) {
    $scope.items = items;
    $scope.selected = {
      item: $scope.items[0]
    };

    $scope.ok = function () {
      $modalInstance.close($scope.selected.item);
    };

    $scope.cancel = function () {
      $modalInstance.dismiss('cancel');
    };
  }
]).controller("PaginationDemoCtrl", ["$scope",
  function ($scope) {
    $scope.totalItems = 64;
    $scope.currentPage = 4;

    $scope.setPage = function (pageNo) {
      $scope.currentPage = pageNo;
    };

    $scope.pageChanged = function () {
      console.log('Page changed to: ' + $scope.currentPage);
    };

    $scope.maxSize = 5;
    $scope.bigTotalItems = 175;
    $scope.bigCurrentPage = 1;
  }
]).controller("MapDemoCtrl", ["$scope", "$http", "$interval",
  function ($scope, $http, $interval) {
    var i, markers;
    for (markers = [], i = 0; 8 > i;) {
      markers[i] = new google.maps.Marker({
        title: "Marker: " + i
      });
      i++;
    }
    $scope.GenerateMapMarkers = function () {
      var d, lat, lng, loc, numMarkers;
      for (d = new Date(), $scope.date = d.toLocaleString(), numMarkers = Math.floor(4 * Math.random()) + 4, i = 0; numMarkers > i;) {
        lat = 38.73 + Math.random() / 100;
        lng = -9.14 + Math.random() / 100;
        loc = new google.maps.LatLng(lat, lng);
        markers[i].setPosition(loc);
        markers[i].setMap($scope.map);
        i++;
      }
    };
    $interval($scope.GenerateMapMarkers, 2e3);
  }
]).controller("TreeDemoCtrl", ["$scope",
  function ($scope) {
    // Parameters

    $scope.list = [{
      "id": 1,
      "title": "1. dragon-breath",
      "items": []
    }, {
      "id": 2,
      "title": "2. moiré-vision",
      "items": [{
        "id": 21,
        "title": "2.1. tofu-animation",
        "items": [{
          "id": 211,
          "title": "2.1.1. spooky-giraffe",
          "items": []
        }, {
          "id": 212,
          "title": "2.1.2. bubble-burst",
          "items": []
        }]
      }, {
        "id": 22,
        "title": "2.2. barehand-atomsplitting",
        "items": []
      }]
    }, {
      "id": 3,
      "title": "3. unicorn-zapper",
      "items": []
    }, {
      "id": 4,
      "title": "4. romantic-transclusion",
      "items": []
    }];

    $scope.callbacks = {};

    $scope.remove = function (scope) {
      scope.remove();
    };

    $scope.toggle = function (scope) {
      scope.toggle();
    };

    $scope.newSubItem = function (scope) {
      var nodeData = scope.$modelValue;
      nodeData.items.push({
        id: nodeData.id * 10 + nodeData.items.length,
        title: nodeData.title + '.' + (nodeData.items.length + 1),
        items: []
      });
    };
  }
]);

/*
 App Ui Controllers
 Provides general controllers for the app
 */

angular.module('app.music', ['mediaPlayer','ngDragDrop'])
  .controller('PlayListCtrl', ['$scope','PlayListSrv', 'CreatePlaylistSrv',
    function ($scope,PlayListSrv, CreatePlaylistSrv) {
      this.audioPlaylist = [];
      var CreateNewPlaylistSrv = CreatePlaylistSrv;

      this.userPlaylists = PlayListSrv.playlists;

      this.addSong = function (audioElement) {
        this.audioPlaylist.push(angular.copy(audioElement));
      };

      this.removeSong = function (index) {
        this.audioPlaylist.splice(index, 1);
      };

      this.dropSong = function (audioElement, index) {
        this.audioPlaylist.splice(index, 0, angular.copy(audioElement));
      };

      this.getSongImage = function (currentTrack) {
        if (typeof this.audioPlaylist[currentTrack - 1] != "undefined") {
          return this.audioPlaylist[currentTrack - 1].image;
        }
      };

      this.getSongArtist = function (currentTrack) {
        if (typeof this.audioPlaylist[currentTrack - 1] != "undefined") {
          return this.audioPlaylist[currentTrack - 1].artist;
        }
      };

      this.getSongName = function (currentTrack) {
        if (typeof this.audioPlaylist[currentTrack - 1] != "undefined") {
          return this.audioPlaylist[currentTrack - 1].title;
        }
      };

      this.seekPercentage = function ($event) {
        var percentage = ($event.offsetX / $event.target.offsetWidth);
        if (percentage <= 1) {
          return percentage;
        } else {
          return 0;
        }
      };

      this.createNewPlaylist = function(song){

        CreateNewPlaylistSrv.openCreateModal(song);

      };

    }]).controller('ArtistListingCtrl',['$scope','ArtistListingSrv',
    function($scope,ArtistListingSrv){

      $scope.ArtistsSrv = ArtistListingSrv;

      ArtistListingSrv.getArtists(function(data){
        // no need to read data because its binded to $scope.AlbumsSrv
        // You can however process something only after the data comes back
      });

    }]).controller('AlbumsCtrl',['$scope','AlbumsListingSrv',
    function($scope,AlbumsListingSrv){

      $scope.AlbumsSrv = AlbumsListingSrv;

      AlbumsListingSrv.getAlbums(function(data){
        // no need to read data because its binded to $scope.AlbumsSrv
        // You can however process something only after the data comes back
      });

    }]).controller('GenresCtrl',['$scope','GenresListingSrv',
    function($scope,GenresListingSrv){

      $scope.GenresSrv = GenresListingSrv;

      GenresListingSrv.getGenres(function(data){
        // no need to read data because its binded to $scope.GenresSrv
        // You can however process something only after the data comes back
      });

    }]).controller('ArtistCtrl', ['$scope','$routeParams', 'ArtistSrv','PlayListSrv', 'navigationMenuService','loggit',
    function ($scope,$routeParams, ArtistSrv,PlayListSrv, navigationMenuService,loggit) {

      this.ArtistSrv = ArtistSrv;
      var artistPlaylistVar = [],
        artistPlaylistAlbums = [];

      this.AlbumList = true;
      this.FullList = false;
      this.following = "Follow artist";
      this.following_class = "btn-default";

      this.follow = function(){

        this.following = "Following";
        this.following_class = "btn-primary";

        loggit.logSuccess('Yaay!! You are now following this artist');

      };

      ArtistSrv.getArtist($routeParams.title, function (response) {

        if(typeof response.albums != "undefined"){

          _.map(response.albums, function (album) {

            artistPlaylistAlbums.push({
              album_name: album.album_name,
              album_image: album.album_image,
              album_release: album.album_release,
              songs:[]
            });

            _.map(album.songs, function (song) {

              /*Put them all together in one single list (for adding to new playlists for example)*/

              var parseTitle = song.displayName.match(/(.*?)\s?-\s?(.*)?$/);

              artistPlaylistVar.push({
                image: song.image,
                src: song.url,
                url: song.url,
                type: song.type,
                artist: parseTitle[1],
                title: parseTitle[2],
                displayName:song.displayName
              });

              /*Put songs also in this artist ordered by album*/

              artistPlaylistAlbums[artistPlaylistAlbums.length - 1].songs.push({
                image: song.image,
                src: song.url,
                url: song.url,
                type: song.type,
                artist: parseTitle[1],
                title: parseTitle[2],
                displayName:song.displayName
              });
            });

          });

          $scope.artistName = response.name;
          $scope.artistImage = response.image;
          $scope.artistBanner = response.banner;
          $scope.artistGenre = response.genre;
          $scope.artistAbout = response.about;

        }

      });

      $scope.artistPlaylist = artistPlaylistVar;
      $scope.artistPlaylistAlbums = artistPlaylistAlbums;

      this.addSongs = function (playlist, callback) {

        _.each(artistPlaylistVar, function (audioElement) {
          playlist.push(angular.copy(audioElement));

          if ((artistPlaylistVar.indexOf(audioElement) + 1) == artistPlaylistVar.length) {
            // Callback goes here
            if (callback) {
              callback();
            }
          }

        });

        navigationMenuService.menu = false;
        navigationMenuService.playlist = true;

      };

      this.addSongsAndPlay = function (playlist, mediaPlayer) {

        this.addSongs(playlist, function () {

          setTimeout(function () {
            mediaPlayer.play();
          }, 1000);

        });

      };

      this.addSongToPlaylist = function(song,playlist){

        PlayListSrv.addSongToPlaylist(song,playlist);
      };

      this.toggleAlbumsList = function(){
        this.AlbumList = true;
        this.FullList = false;
      };

      this.toggleFullList = function(){
        this.AlbumList = false;
        this.FullList = true;
      };

    }]).controller('UserPlayListCtrl', ['$routeParams', 'PlayListSrv', 'navigationMenuService',
    function ($routeParams, PlayListSrv, navigationMenuService) {

      this.PlayListSrv = PlayListSrv;
      var UserPlaylistVar = [],
        playlistTitle, playlistImage, playlistBanner, playlistGenre,playlistUrlName;

      PlayListSrv.getPlaylist($routeParams.title, function (response) {

        if (typeof response.songs != "undefined") {

          _.map(response.songs, function (song) {
            var parseTitle = song.displayName.match(/(.*?)\s?-\s?(.*)?$/);
            UserPlaylistVar.push({
              image: song.image,
              src: song.url,
              url: song.url,
              type: song.type,
              artist: parseTitle[1],
              title: parseTitle[2],
              displayName:song.displayName
            });
          });

          playlistTitle = response.name;
          playlistImage = response.image;
          playlistBanner = response.banner;
          playlistGenre = response.genre;
          playlistUrlName = response.url_name;
        }

      });

      this.userPlaylist = UserPlaylistVar;
      this.playlistName = playlistTitle;
      this.playlistImage = playlistImage;
      this.playlistBanner = playlistBanner;
      this.playlistGenre = playlistGenre;
      this.playlistUrlName = playlistUrlName;

      this.addSongs = function (playlist, callback) {

        _.each(UserPlaylistVar, function (audioElement) {
          playlist.push(angular.copy(audioElement));

          if ((UserPlaylistVar.indexOf(audioElement) + 1) == UserPlaylistVar.length) {
            // Callback goes here
            if (callback) {
              callback();
            }
          }

        });

        navigationMenuService.menu = false;
        navigationMenuService.playlist = true;

      };

      this.addSongsAndPlay = function (playlist, mediaPlayer) {

        this.addSongs(playlist, function () {

          setTimeout(function () {
            mediaPlayer.play();
          }, 1000);

        });

      };

      this.addSongToPlaylist = function(song,playlist){

        PlayListSrv.addSongToPlaylist(song,playlist);
      };

      this.removeSongFromPlaylist = function(song,playlist){

        PlayListSrv.removeSongFromPlaylist(song,playlist);

        //Remove from client so he notices immediately
        this.userPlaylist = _.without(this.userPlaylist,song);
      };

    }]).controller("CreatePlaylistInstanceCtrl", ["$scope", "$modalInstance",'playlistName', 'song','loggit',
    function ($scope, $modalInstance, playlistName, song,loggit) {

      $scope.playlistName = playlistName;
      $scope.song = song;

      $scope.ok = function () {

        if($scope.playlistName !== ""){
          $modalInstance.close($scope);
        }
        else {
          $modalInstance.dismiss('cancel');
          loggit.logError("Error! Could not create a playlist with no name..");
        }
      };

      $scope.cancel = function () {
        $modalInstance.dismiss('cancel');
      };
    }
  ]);


text:
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cats.Models.Mapping
{
   public class LocalPurchaseMap:EntityTypeConfiguration<LocalPurchase>
    {
       public LocalPurchaseMap()
       {
           // Primary Key
           this.HasKey(t => t.LocalPurchaseID);

           // Properties
           // Table & Column Mappings
           this.ToTable("LocalPurchase");
           this.Property(t => t.LocalPurchaseID).HasColumnName("LocalPurchaseID");
           this.Property(t => t.GiftCertificateID).HasColumnName("GiftCertificateID");
           this.Property(t => t.ShippingInstructionID).HasColumnName("ShippingInstructionID");
           this.Property(t => t.ProjectCode).HasColumnName("ProjectCode");
           this.Property(t => t.CommodityID).HasColumnName("CommodityID");
           this.Property(t => t.DonorID).HasColumnName("DonorID");
           this.Property(t => t.ProgramID).HasColumnName("ProgramID");
           this.Property(t => t.Quantity).HasColumnName("Quantity");
           this.Property(t => t.DateCreated).HasColumnName("DateCreated");
           this.Property(t => t.PurchaseOrder).HasColumnName("PurchaseOrder");
           this.Property(t => t.SupplierName).HasColumnName("SupplierName");
           this.Property(t => t.ReferenceNumber).HasColumnName("ReferenceNumber");
           this.Property(t => t.StatusID).HasColumnName("StatusID");
           this.Property(t => t.Remark).HasColumnName("Remark");
           // Relationships
           this.HasRequired(t => t.GiftCertificate)
               .WithMany(t => t.LocalPurchases)
               .HasForeignKey(d => d.GiftCertificateID);
           this.HasRequired(t => t.Commodity)
               .WithMany(t => t.LocalPurchases)
               .HasForeignKey(t => t.CommodityID);
           this.HasRequired(t => t.Donor)
             .WithMany(t => t.LocalPurchases)
             .HasForeignKey(t => t.DonorID);
           this.HasRequired(t => t.Program)
             .WithMany(t => t.LocalPurchases)
             .HasForeignKey(t => t.ProgramID);
       }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Perf Meter</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="perf-webapp">
    <meta name="author" content="henri.gomez@gmail.com">

    <link href="css/bootstrap.css" rel="stylesheet">

    <link href="css/bootstrap-responsive.css" rel="stylesheet">

    <link rel="shortcut icon" href="ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">

Performance Tests

Default Performance Test, no wait, ok as reply

Run

      </row>

Large Content Text

Performance Test, waiting 100ns and 100kb response size

Run

No Content

Performance Test, waiting 10ms without response content

Run

No Wait

Performance Test, no wait, 4kb of response containing PerfMe

Run

© MyCorp 2013


text:
package org.apache.derbyTesting.functionTests.tests.replicationTests;

import java.sql.SQLException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.derbyTesting.junit.BaseJDBCTestCase;
import org.apache.derbyTesting.junit.SecurityManagerSetup;

/**
 * Run a replication test on localhost
 * by using default values for master and slave hosts,
 * and master and slave ports.
 *
 */

public class ReplicationRun_Local extends ReplicationRun
{

    /**
     * Creates a new instance of ReplicationRun_Local
     * @param testcaseName Identifying the test.
     */
    public ReplicationRun_Local(String testcaseName)
    {
        super(testcaseName);
    }

    /**
     * Creates a new instance of ReplicationRun_Local running with authentication.
     */
    public ReplicationRun_Local(String testcaseName, String user, String password )
    {
        super( testcaseName, user, password );
    }

    public static Test suite()
    {
        TestSuite suite = new TestSuite("ReplicationRun_Local Suite");

        suite.addTestSuite( ReplicationRun_Local.class );

        return SecurityManagerSetup.noSecurityManager(suite);

    }

    public static Test localAuthenticationSuite()
    {
        String      user = "KIWI";
        String      password = "KIWI_password";
        TestSuite suite = new TestSuite("ReplicationRun_Local Suite Local Authentication Suite");

        suite.addTest( new ReplicationRun_Local( "testReplication_Local_TestStraightReplication", user, password ) );
        suite.addTest( new ReplicationRun_Local( "testReplication_Local_LogFilesSynched", user, password ) );

        return SecurityManagerSetup.noSecurityManager( suite );
    }

    //////////////////////////////////////////////////////////////
    ////
    //// The replication test framework (testReplication()):
    //// a) "clean" replication run starting master and slave servers,
    ////     preparing master and slave databases,
    ////     starting and stopping replication and doing
    ////     failover for a "normal"/"failure free" replication
    ////     test run.
    ////
    //////////////////////////////////////////////////////////////

    /**
     * Test the "normal" replication scenario:
     * Load on the master db while replicating to slave db,
     * then verify that slave db is correct after failover.
     * @throws java.lang.Exception
     */
    public void testReplication_Local_TestStraightReplication()
    throws Exception
    {
        cleanAllTestHosts();

        initEnvironment();

        initMaster(masterServerHost,
                replicatedDb);

        startServer(masterJvmVersion, derbyMasterVersion,
                masterServerHost,
                ALL_INTERFACES, // masterServerHost, // "0.0.0.0", // All. or use masterServerHost for interfacesToListenOn,
                masterServerPort,
                masterDbSubPath); // Distinguishing master/slave

        startServer(slaveJvmVersion, derbySlaveVersion,
                slaveServerHost,
                ALL_INTERFACES, // slaveServerHost, // "0.0.0.0", // All. or use slaveServerHost for interfacesToListenOn,
                slaveServerPort,
                slaveDbSubPath); // Distinguishing master/slave

        startServerMonitor(slaveServerHost);

        bootMasterDatabase(jvmVersion,
                masterDatabasePath +FS+ masterDbSubPath,
                replicatedDb,
                masterServerHost, // Where the startreplication command must be given
                masterServerPort, // master server interface accepting client requests
                null // bootLoad, // The "test" to start when booting db.
                );

        initSlave(slaveServerHost,
                jvmVersion,
                replicatedDb); // Trunk and Prototype V2: copy master db to db_slave.

        startSlave(jvmVersion, replicatedDb,
                slaveServerHost, // slaveClientInterface // where the slave db runs
                slaveServerPort,
                slaveServerHost, // for slaveReplInterface
                slaveReplPort,
                testClientHost);

        startMaster(jvmVersion, replicatedDb,
                masterServerHost, // Where the startMaster command must be given
                masterServerPort, // master server interface accepting client requests
                masterServerHost, // An interface on the master: masterClientInterface (==masterServerHost),
                slaveServerPort, // Not used since slave don't allow clients.
                slaveServerHost, // for slaveReplInterface
                slaveReplPort);

        // Used to run positive tests.
        // Handle negative testing in State.testPostStartedMasterAndSlave().
        // Observe that it will not be meaningful to do runTest if State.XXXX()
        // has led to incorrect replication state wrt. replicationTest.

        replicationTest = "org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationTestRun";
        util.DEBUG("replicationTest: " + replicationTest);
        replicationVerify = "org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationTestRun_Verify";
        util.DEBUG("replicationVerify: " + replicationVerify);

        runTest(replicationTest, // Returns immediatly if replicationTest is null.
                jvmVersion,
                testClientHost,
                masterServerHost, masterServerPort,
                replicatedDb);

        failOver(jvmVersion,
                masterDatabasePath, masterDbSubPath, replicatedDb,
                masterServerHost,  // Where the master db is run.
                masterServerPort,
                testClientHost);

        connectPing(slaveDatabasePath+FS+slaveDbSubPath+FS+replicatedDb,
                slaveServerHost,slaveServerPort,
                testClientHost);

        verifySlave();

        // We should verify the master as well, at least to see that we still can connect.
        verifyMaster();

        stopServer(jvmVersion, derbyVersion,
                slaveServerHost, slaveServerPort);

        stopServer(jvmVersion, derbyVersion,
                masterServerHost, masterServerPort);
        // As of 2008-02-06 master does not accept shutdown after replication, so:
        // do a 'kill pid' after ending the test run

    }

    /**
     * DERBY-3382: Test that start replication fails if master db is updated
     * after copying the db to the slave location
     * @throws java.lang.Exception on test errors.
     */
    public void testReplication_Local_LogFilesSynched() throws Exception {

        cleanAllTestHosts();
        initEnvironment();
        initMaster(masterServerHost, replicatedDb);

        startServer(masterJvmVersion,
                                   derbyMasterVersion,
                                   masterServerHost,
                                   ALL_INTERFACES,
                                   masterServerPort,
                                   masterDbSubPath);
        startServer(slaveJvmVersion,
                                  derbySlaveVersion,
                                  slaveServerHost,
                                  ALL_INTERFACES,
                                  slaveServerPort,
                                  slaveDbSubPath);

        startServerMonitor(slaveServerHost);

        bootMasterDatabase(jvmVersion,
                           masterDatabasePath + FS + masterDbSubPath,
                           replicatedDb,
                           masterServerHost,
                           masterServerPort,
                           null);

        // copy db to slave
        initSlave(slaveServerHost,
                  jvmVersion,
                  replicatedDb);

        // database has now been copied to slave. Updating the master
        // database at this point will cause unsynced log files
        executeOnMaster("call syscs_util.syscs_unfreeze_database()");
        executeOnMaster("create table breakLogSynch (v varchar(20))");
        executeOnMaster("drop table breakLogSynch");

        // startSlave is supposed do fail. We check the sql state in
        // assertSqlStateSlaveConn below
        startSlave(jvmVersion, replicatedDb,
                   slaveServerHost,
                   slaveServerPort,
                   slaveServerHost,
                   slaveReplPort,
                   testClientHost);

        SQLException sqlexception = null;
        try {
            startMaster(jvmVersion, replicatedDb,
                        masterServerHost,
                        masterServerPort,
                        masterServerHost,
                        slaveServerPort,
                        slaveServerHost,
                        slaveReplPort);
        } catch (SQLException sqle) {
            sqlexception = sqle;
        }
        // the startMaster connection attempt should fail with exception XRE05
        if (sqlexception == null) {
            fail("Start master did not get the expected SQL Exception XRE05");
        } else {
            BaseJDBCTestCase.assertSQLState("Unexpected SQL state.",
                                            "XRE05",
                                            sqlexception);
        }

        // The startSlave connection attempt should fail with exception XJ040
        assertSqlStateSlaveConn("XJ040");

        stopServer(jvmVersion, derbyVersion,
                   masterServerHost, masterServerPort);
        stopServer(jvmVersion, derbyVersion,
                   slaveServerHost, slaveServerPort);

    }

}


text:
package com.graphhopper.routing;

import com.graphhopper.routing.util.*;
import com.graphhopper.storage.Graph;
import com.graphhopper.storage.GraphBuilder;
import com.graphhopper.storage.GraphStorage;
import com.graphhopper.storage.TurnCostExtension;
import com.graphhopper.util.EdgeIteratorState;
import com.graphhopper.util.Helper;
import static org.junit.Assert.*;
import static com.graphhopper.util.GHUtility.*;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

/**
 * @author Peter Karich
 */
@RunWith(Parameterized.class)
public class EdgeBasedRoutingAlgorithmTest
{
    private FlagEncoder carEncoder;

    EncodingManager createEncodingManager( boolean restrictedOnly )
    {
        if (restrictedOnly)
            carEncoder = new CarFlagEncoder(5, 5, 1);
        else
            // allow for basic costs too
            carEncoder = new CarFlagEncoder(5, 5, 3);
        return new EncodingManager(carEncoder);
    }

    @Parameters(name = "{0}")
    public static Collection<Object[]> configs()
    {
        return Arrays.asList(new Object[][]
        {
            { AlgorithmOptions.DIJKSTRA },
            { AlgorithmOptions.DIJKSTRA_BI },
            { AlgorithmOptions.ASTAR },
            { AlgorithmOptions.ASTAR_BI }
        // TODO { AlgorithmOptions.DIJKSTRA_ONE_TO_MANY }
        });
    }

    private final String algoStr;

    public EdgeBasedRoutingAlgorithmTest( String algo )
    {
        this.algoStr = algo;
    }

    public RoutingAlgorithm createAlgo( Graph g, AlgorithmOptions opts )
    {
        opts = AlgorithmOptions.start(opts).algorithm(algoStr).build();
        return new RoutingAlgorithmFactorySimple().createAlgo(g, opts);
    }

    protected GraphStorage createGraph( EncodingManager em )
    {
        return new GraphBuilder(em).create();
    }

    // 0---1
    // |   /
    // 2--3--4
    // |  |  |
    // 5--6--7
    public static void initGraph( Graph g )
    {
        g.edge(0, 1, 3, true);
        g.edge(0, 2, 1, true);
        g.edge(1, 3, 1, true);
        g.edge(2, 3, 1, true);
        g.edge(3, 4, 1, true);
        g.edge(2, 5, .5, true);
        g.edge(3, 6, 1, true);
        g.edge(4, 7, 1, true);
        g.edge(5, 6, 1, true);
        g.edge(6, 7, 1, true);
    }

    private void initTurnRestrictions( Graph g, TurnCostExtension tcs, TurnCostEncoder tEncoder )
    {
        long tflags = tEncoder.getTurnFlags(true, 0);

        // only forward from 2-3 to 3-4 => limit 2,3->3,6 and 2,3->3,1
        tcs.addTurnInfo(getEdge(g, 2, 3).getEdge(), 3, getEdge(g, 3, 6).getEdge(), tflags);
        tcs.addTurnInfo(getEdge(g, 2, 3).getEdge(), 3, getEdge(g, 3, 1).getEdge(), tflags);

        // only right   from 5-2 to 2-3 => limit 5,2->2,0
        tcs.addTurnInfo(getEdge(g, 5, 2).getEdge(), 2, getEdge(g, 2, 0).getEdge(), tflags);

        // only right   from 7-6 to 6-3 => limit 7,6->6,5
        tcs.addTurnInfo(getEdge(g, 7, 6).getEdge(), 6, getEdge(g, 6, 5).getEdge(), tflags);

        // no 5-6 to 6-3
        tcs.addTurnInfo(getEdge(g, 5, 6).getEdge(), 6, getEdge(g, 6, 3).getEdge(), tflags);
        // no 4-3 to 3-1
        tcs.addTurnInfo(getEdge(g, 4, 3).getEdge(), 3, getEdge(g, 3, 1).getEdge(), tflags);
        // no 4-3 to 3-2
        tcs.addTurnInfo(getEdge(g, 4, 3).getEdge(), 3, getEdge(g, 3, 2).getEdge(), tflags);

        // no u-turn at 6-7
        tcs.addTurnInfo(getEdge(g, 6, 7).getEdge(), 7, getEdge(g, 7, 6).getEdge(), tflags);

        // no u-turn at 3-6
        tcs.addTurnInfo(getEdge(g, 3, 6).getEdge(), 6, getEdge(g, 6, 3).getEdge(), tflags);
    }

    Weighting createWeighting( FlagEncoder encoder, TurnCostExtension tcs )
    {
        return new TurnWeighting(new FastestWeighting(encoder), encoder, tcs);
    }

    @Test
    public void testBasicTurnRestriction()
    {
        GraphStorage g = createGraph(createEncodingManager(true));
        initGraph(g);
        TurnCostExtension tcs = (TurnCostExtension) g.getExtension();
        initTurnRestrictions(g, tcs, carEncoder);
        Path p = createAlgo(g, AlgorithmOptions.start().flagEncoder(carEncoder).weighting(createWeighting(carEncoder, tcs)).traversalMode(TraversalMode.EDGE_BASED_2DIR).build()).
                calcPath(5, 1);
        assertEquals(Helper.createTList(5, 2, 3, 4, 7, 6, 3, 1), p.calcNodes());

        // test 7-6-5 and reverse
        p = createAlgo(g, AlgorithmOptions.start().flagEncoder(carEncoder).weighting(createWeighting(carEncoder, tcs)).traversalMode(TraversalMode.EDGE_BASED_1DIR).build()).
                calcPath(5, 7);
        assertEquals(Helper.createTList(5, 6, 7), p.calcNodes());

        p = createAlgo(g, AlgorithmOptions.start().flagEncoder(carEncoder).weighting(createWeighting(carEncoder, tcs)).traversalMode(TraversalMode.EDGE_BASED_1DIR).build()).
                calcPath(7, 5);
        assertEquals(Helper.createTList(7, 6, 3, 2, 5), p.calcNodes());
    }

    @Test
    public void testUTurns()
    {
        GraphStorage g = createGraph(createEncodingManager(true));
        initGraph(g);
        TurnCostExtension tcs = (TurnCostExtension) g.getExtension();

        long tflags = carEncoder.getTurnFlags(true, 0);

        // force u-turn via lowering the cost for it
        EdgeIteratorState e3_6 = getEdge(g, 3, 6);
        e3_6.setDistance(0.1);
        getEdge(g, 3, 2).setDistance(8642);
        getEdge(g, 1, 0).setDistance(8642);

        tcs.addTurnInfo(getEdge(g, 7, 6).getEdge(), 6, getEdge(g, 6, 5).getEdge(), tflags);
        tcs.addTurnInfo(getEdge(g, 4, 3).getEdge(), 3, e3_6.getEdge(), tflags);
        Path p = createAlgo(g,
                AlgorithmOptions.start().flagEncoder(carEncoder).weighting(createWeighting(carEncoder, tcs)).traversalMode(TraversalMode.EDGE_BASED_2DIR_UTURN).build()).
                calcPath(7, 5);

        assertEquals(Helper.createTList(7, 6, 3, 6, 5), p.calcNodes());

        // no u-turn    from 6-3
        tcs.addTurnInfo(getEdge(g, 6, 3).getEdge(), 3, getEdge(g, 3, 6).getEdge(), tflags);
        p = createAlgo(g, AlgorithmOptions.start().flagEncoder(carEncoder).weighting(createWeighting(carEncoder, tcs)).traversalMode(TraversalMode.EDGE_BASED_2DIR_UTURN).build()).
                calcPath(7, 5);

        assertEquals(Helper.createTList(7, 6, 3, 2, 5), p.calcNodes());
    }

    @Test
    public void testBasicTurnCosts()
    {
        GraphStorage g = createGraph(createEncodingManager(false));
        initGraph(g);
        TurnCostExtension tcs = (TurnCostExtension) g.getExtension();
        Path p = createAlgo(g, AlgorithmOptions.start().flagEncoder(carEncoder).weighting(createWeighting(carEncoder, tcs)).traversalMode(TraversalMode.EDGE_BASED_1DIR).build()).
                calcPath(5, 1);

        // no restriction and costs
        EdgeIteratorState e3_6 = getEdge(g, 5, 6);
        e3_6.setDistance(2);
        assertEquals(Helper.createTList(5, 2, 3, 1), p.calcNodes());

        // now introduce some turn costs
        long tflags = carEncoder.getTurnFlags(false, 2);
        tcs.addTurnInfo(getEdge(g, 5, 2).getEdge(), 2, getEdge(g, 2, 3).getEdge(), tflags);

        p = createAlgo(g, AlgorithmOptions.start().flagEncoder(carEncoder).weighting(createWeighting(carEncoder, tcs)).traversalMode(TraversalMode.EDGE_BASED_1DIR).build()).
                calcPath(5, 1);
        assertEquals(Helper.createTList(5, 6, 3, 1), p.calcNodes());
    }
}


text:
var expect = require("chai").expect;

module.exports = function (helpers) {
  var component = helpers.mount(require.resolve("./index"), {});
  var rootEl = component.el;
  var spanEl = rootEl.querySelector("span");

  component.state.count = 1;
  component.update();

  expect(component.el).to.equal(rootEl);
  expect(rootEl.querySelector("span").innerHTML).to.equal("1");
  expect(rootEl.querySelector("span")).to.equal(spanEl);
};


text:
package org.apache.geode.redis.internal.executor.list;

import org.apache.geode.redis.internal.RedisConstants.ArityDef;

public class RPopExecutor extends PopExecutor {

  @Override
  protected ListDirection popType() {
    return ListDirection.RIGHT;
  }

  @Override
  public String getArgsError() {
    return ArityDef.RPOP;
  }

}


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.androiddev101.control.copy.MainFragment" >

    <!-- an uneditable edit text, cause we're raw like that -->
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/helpTextButton"
        android:scrollbars="vertical"
        style="@android:style/TextAppearance.DeviceDefault.Large"
        android:text="@string/welcome_text"
        android:scrollbarStyle="outsideOverlay"
        android:textIsSelectable="true"
        android:editable="false"
        />
    <Button
        android:id="@+id/helpTextButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/launchNotificationButton"
        android:text="@string/button_help_text"
        android:onClick="helpClicked"
        />

    <Button
        android:id="@+id/launchNotificationButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/toggleCopyPastaService"
        android:text="@string/button_launch_notification_text"
        android:onClick="showNotification"
        />

     <Button
        android:id="@+id/toggleCopyPastaService"
        android:layout_width="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_height="wrap_content"
        android:text="@string/button_toggle_on"
        android:onClick="toggleClicked"
        />

</RelativeLayout>


text:
all: enter_env

enter_env: enter_env.cpp
	g++ -Wall -Wextra -Werror -std=c++11 enter_env.cpp -static -o enter_env

clean:
	rm -f ./enter_env