text:
<?php

namespace Google\AdsApi\AdWords\v201702\cm;

/**
 * This file was generated from WSDL. DO NOT EDIT.
 */
class PriceFeedItem extends \Google\AdsApi\AdWords\v201702\cm\ExtensionFeedItem
{

    /**
     * @var string $priceExtensionType
     */
    protected $priceExtensionType = null;

    /**
     * @var string $priceQualifier
     */
    protected $priceQualifier = null;

    /**
     * @var string $trackingUrlTemplate
     */
    protected $trackingUrlTemplate = null;

    /**
     * @var string $language
     */
    protected $language = null;

    /**
     * @var \Google\AdsApi\AdWords\v201702\cm\PriceTableRow[] $tableRows
     */
    protected $tableRows = null;

    /**
     * @param int $feedId
     * @param int $feedItemId
     * @param string $status
     * @param string $feedType
     * @param string $startTime
     * @param string $endTime
     * @param \Google\AdsApi\AdWords\v201702\cm\FeedItemDevicePreference $devicePreference
     * @param \Google\AdsApi\AdWords\v201702\cm\FeedItemScheduling $scheduling
     * @param \Google\AdsApi\AdWords\v201702\cm\FeedItemCampaignTargeting $campaignTargeting
     * @param \Google\AdsApi\AdWords\v201702\cm\FeedItemAdGroupTargeting $adGroupTargeting
     * @param \Google\AdsApi\AdWords\v201702\cm\Keyword $keywordTargeting
     * @param \Google\AdsApi\AdWords\v201702\cm\Location $geoTargeting
     * @param \Google\AdsApi\AdWords\v201702\cm\FeedItemGeoRestriction $geoTargetingRestriction
     * @param \Google\AdsApi\AdWords\v201702\cm\FeedItemPolicyData[] $policyData
     * @param string $ExtensionFeedItemType
     * @param string $priceExtensionType
     * @param string $priceQualifier
     * @param string $trackingUrlTemplate
     * @param string $language
     * @param \Google\AdsApi\AdWords\v201702\cm\PriceTableRow[] $tableRows
     */
    public function __construct($feedId = null, $feedItemId = null, $status = null, $feedType = null, $startTime = null, $endTime = null, $devicePreference = null, $scheduling = null, $campaignTargeting = null, $adGroupTargeting = null, $keywordTargeting = null, $geoTargeting = null, $geoTargetingRestriction = null, array $policyData = null, $ExtensionFeedItemType = null, $priceExtensionType = null, $priceQualifier = null, $trackingUrlTemplate = null, $language = null, array $tableRows = null)
    {
      parent::__construct($feedId, $feedItemId, $status, $feedType, $startTime, $endTime, $devicePreference, $scheduling, $campaignTargeting, $adGroupTargeting, $keywordTargeting, $geoTargeting, $geoTargetingRestriction, $policyData, $ExtensionFeedItemType);
      $this->priceExtensionType = $priceExtensionType;
      $this->priceQualifier = $priceQualifier;
      $this->trackingUrlTemplate = $trackingUrlTemplate;
      $this->language = $language;
      $this->tableRows = $tableRows;
    }

    /**
     * @return string
     */
    public function getPriceExtensionType()
    {
      return $this->priceExtensionType;
    }

    /**
     * @param string $priceExtensionType
     * @return \Google\AdsApi\AdWords\v201702\cm\PriceFeedItem
     */
    public function setPriceExtensionType($priceExtensionType)
    {
      $this->priceExtensionType = $priceExtensionType;
      return $this;
    }

    /**
     * @return string
     */
    public function getPriceQualifier()
    {
      return $this->priceQualifier;
    }

    /**
     * @param string $priceQualifier
     * @return \Google\AdsApi\AdWords\v201702\cm\PriceFeedItem
     */
    public function setPriceQualifier($priceQualifier)
    {
      $this->priceQualifier = $priceQualifier;
      return $this;
    }

    /**
     * @return string
     */
    public function getTrackingUrlTemplate()
    {
      return $this->trackingUrlTemplate;
    }

    /**
     * @param string $trackingUrlTemplate
     * @return \Google\AdsApi\AdWords\v201702\cm\PriceFeedItem
     */
    public function setTrackingUrlTemplate($trackingUrlTemplate)
    {
      $this->trackingUrlTemplate = $trackingUrlTemplate;
      return $this;
    }

    /**
     * @return string
     */
    public function getLanguage()
    {
      return $this->language;
    }

    /**
     * @param string $language
     * @return \Google\AdsApi\AdWords\v201702\cm\PriceFeedItem
     */
    public function setLanguage($language)
    {
      $this->language = $language;
      return $this;
    }

    /**
     * @return \Google\AdsApi\AdWords\v201702\cm\PriceTableRow[]
     */
    public function getTableRows()
    {
      return $this->tableRows;
    }

    /**
     * @param \Google\AdsApi\AdWords\v201702\cm\PriceTableRow[] $tableRows
     * @return \Google\AdsApi\AdWords\v201702\cm\PriceFeedItem
     */
    public function setTableRows(array $tableRows)
    {
      $this->tableRows = $tableRows;
      return $this;
    }

}


text:
require "helper"

describe Google::Cloud::Bigtable::ColumnFamily, :create, :mock_bigtable do
  let(:instance_id) { "test-instance" }
  let(:table_id) { "test-table" }
  let(:column_families) { column_families_grpc }
  let(:table_grpc) do
    Google::Bigtable::Admin::V2::Table.new(
      name: table_path(instance_id, table_id),
      column_families: column_families,
      granularity: :MILLIS
    )
  end
  let(:table) do
    Google::Cloud::Bigtable::Table.from_grpc(table_grpc, bigtable.service)
  end
  let(:gc_rule) {
    Google::Cloud::Bigtable::GcRule.max_versions(3)
  }

  it "create column modification create instance" do
    modification = Google::Cloud::Bigtable::ColumnFamily.create_modification("cf1", gc_rule)
    modification.must_be_kind_of Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification
    modification.id.must_equal "cf1"
    modification.create.must_be_kind_of Google::Bigtable::Admin::V2::ColumnFamily
    modification.create.gc_rule.must_equal gc_rule.to_grpc
  end

  it "create column modification update instance" do
    modification = Google::Cloud::Bigtable::ColumnFamily.update_modification("cf1", gc_rule)
    modification.must_be_kind_of Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification
    modification.id.must_equal "cf1"
    modification.update.must_be_kind_of Google::Bigtable::Admin::V2::ColumnFamily
    modification.update.gc_rule.must_equal gc_rule.to_grpc
  end

  it "create column modification drop instance" do
    modification = Google::Cloud::Bigtable::ColumnFamily.drop_modification("cf1")
    modification.must_be_kind_of Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification
    modification.id.must_equal "cf1"
    modification.drop.must_equal true
  end

  it "create column family in given table" do
    new_cf_name = "new-cf"

    get_res = Google::Bigtable::Admin::V2::Table.new(
      name: table_path(instance_id, table_id),
      column_families: {
        new_cf_name => Google::Bigtable::Admin::V2::ColumnFamily.new(
          gc_rule: Google::Bigtable::Admin::V2::GcRule.new(max_num_versions: 3)
        )
      }
    )
    modifications = [
      Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification.new(
        id: new_cf_name,
        create: Google::Bigtable::Admin::V2::ColumnFamily.new(
          gc_rule: Google::Bigtable::Admin::V2::GcRule.new(max_num_versions: 3)
        )
      )
    ]

    mock = Minitest::Mock.new
    mock.expect :modify_column_families, get_res, [
      table_path(instance_id, table_id),
      modifications
    ]
    bigtable.service.mocked_tables = mock

    gc_rule = Google::Cloud::Bigtable::GcRule.max_versions(3)
    column_family = table.column_family(new_cf_name, gc_rule)
    column_family.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily

    created_column = column_family.create
    created_column.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily

    mock.verify
  end

  it "create column family with nil gc_rule" do
    new_cf_name = "new-cf"

    get_res = Google::Bigtable::Admin::V2::Table.new(
      name: table_path(instance_id, table_id),
      column_families: {
        new_cf_name => Google::Bigtable::Admin::V2::ColumnFamily.new
      }
    )
    modifications = [
      Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification.new(
        id: new_cf_name,
        create: Google::Bigtable::Admin::V2::ColumnFamily.new
      )
    ]

    mock = Minitest::Mock.new
    mock.expect :modify_column_families, get_res, [
                                         table_path(instance_id, table_id),
                                         modifications
                                       ]
    bigtable.service.mocked_tables = mock

    column_family = table.column_family(new_cf_name)
    column_family.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily

    created_column = column_family.create
    created_column.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily

    mock.verify
  end

  it "update column family" do
    cf_name = "cf"
    cf_grpc = Google::Bigtable::Admin::V2::ColumnFamily.new(
      gc_rule: Google::Bigtable::Admin::V2::GcRule.new(max_num_versions: 3)
    )
    column_family = Google::Cloud::Bigtable::ColumnFamily.from_grpc(
      cf_grpc,
      bigtable.service,
      name: cf_name,
      instance_id: instance_id,
      table_id: table_id
    )

    get_res = Google::Bigtable::Admin::V2::Table.new(
      name: table_path(instance_id, table_id),
      column_families: {
        cf_name => Google::Bigtable::Admin::V2::ColumnFamily.new(
          gc_rule: Google::Bigtable::Admin::V2::GcRule.new(max_num_versions: 1)
        )
      }
    )
    modifications = [
      Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification.new(
        id: cf_name,
        update: Google::Bigtable::Admin::V2::ColumnFamily.new(
          gc_rule: Google::Bigtable::Admin::V2::GcRule.new(max_num_versions: 1)
        )
      )
    ]

    mock = Minitest::Mock.new
    mock.expect :modify_column_families, get_res, [
      table_path(instance_id, table_id),
      modifications
    ]
    bigtable.service.mocked_tables = mock

    column_family.gc_rule = Google::Cloud::Bigtable::GcRule.max_versions(1)
    updated_cf = column_family.save
    updated_cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily

    mock.verify
  end

  it "update column family with nil gc_rule" do
    cf_name = "cf"
    cf_grpc = Google::Bigtable::Admin::V2::ColumnFamily.new(
      gc_rule: Google::Bigtable::Admin::V2::GcRule.new(max_num_versions: 3)
    )
    column_family = Google::Cloud::Bigtable::ColumnFamily.from_grpc(
      cf_grpc,
      bigtable.service,
      name: cf_name,
      instance_id: instance_id,
      table_id: table_id
    )

    get_res = Google::Bigtable::Admin::V2::Table.new(
      name: table_path(instance_id, table_id),
      column_families: {
        cf_name => Google::Bigtable::Admin::V2::ColumnFamily.new(
          gc_rule: nil
        )
      }
    )
    modifications = [
      Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification.new(
        id: cf_name,
        update: Google::Bigtable::Admin::V2::ColumnFamily.new(
          gc_rule: nil
        )
      )
    ]

    mock = Minitest::Mock.new
    mock.expect :modify_column_families, get_res, [
                                         table_path(instance_id, table_id),
                                         modifications
                                       ]
    bigtable.service.mocked_tables = mock

    column_family.gc_rule = nil
    updated_cf = column_family.save
    updated_cf.must_be_kind_of Google::Cloud::Bigtable::ColumnFamily

    mock.verify
  end

  it "delete column family" do
    cf_name = "cf"
    cf_grpc = Google::Bigtable::Admin::V2::ColumnFamily.new(
      gc_rule: Google::Bigtable::Admin::V2::GcRule.new(max_num_versions: 3)
    )
    column_family = Google::Cloud::Bigtable::ColumnFamily.from_grpc(
      cf_grpc,
      bigtable.service,
      name: cf_name,
      instance_id: instance_id,
      table_id: table_id
    )

    get_res = Google::Bigtable::Admin::V2::Table.new(
      name: table_path(instance_id, table_id)
    )
    modifications = [
      Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification.new(
        id: cf_name,
        drop: true
      )
    ]

    mock = Minitest::Mock.new
    mock.expect :modify_column_families, get_res, [
      table_path(instance_id, table_id),
      modifications
    ]
    bigtable.service.mocked_tables = mock

    column_family.gc_rule = Google::Cloud::Bigtable::GcRule.max_versions(1)
    result = column_family.delete
    result.must_equal true

    mock.verify
  end
end

redpajama_set_name: RedPajamaGithub


text:
import multiprocessing
import sys,time
from datetime import datetime

from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QColor
from PyQt5.QtCore import QThread

import numpy as np

from kuchinawa.Thread import Main
from kuchinawa import Graph

import Thread_ui

class MyThread(QThread):
    def __init__(self,call,lcd,progress,stop_signal,graph):
        super().__init__()
        self.call=call
        self.lcd=lcd
        self.progress=progress
        stop_signal.connect(self.stop)
        self.graph=graph
        self.run=True

    def run(self):
        timeOrigin=datetime.now() #get the origin of time
        self.run=True
        while self.run:
            time.sleep(0.01)
            t=(datetime.now()-timeOrigin).total_seconds()
            r=np.random.rand()
            self.call(self.lcd.display,(r,))
            self.graph.put({'x':t,'y':r})

    def stop(self):
        self.run=False
        print('stop')

T='Time'
V='Value'
COLORS=[QColor(255,0,0),QColor(255,255,0),QColor(0,255,0)] #the colors of points in graphs

class Sample(Main):
    def __init__(self):
        super().__init__()
        self.ui=Thread_ui.Ui_Form()
        self.setUI(self.ui)
        self.g1=self.addGraph(Graph.ScatterAll,(T,'sec',V,'V'),{'color':COLORS[0]},'Thread1')
        self.g2=self.addGraph(Graph.ScatterAll,(T,'sec',V,'V'),{'color':COLORS[1]},'Thread2')
        self.g3=self.addGraph(Graph.ScatterAll,(T,'sec',V,'V'),{'color':COLORS[2]},'Thread3')
        self.t1=MyThread(self.call,self.ui.lcd1,self.ui.bar1,self.ui.button1.pressed,self.g1)
        self.t2=MyThread(self.call,self.ui.lcd2,self.ui.bar2,self.ui.button2.pressed,self.g2)
        self.t3=MyThread(self.call,self.ui.lcd3,self.ui.bar3,self.ui.button3.pressed,self.g3)

    def run(self):
        self.t1.start()
        self.t2.start()
        self.t3.start()

        self.t1.wait()
        self.t2.wait()
        self.t3.wait()
        print('hoge')

if __name__ == '__main__':
    app = QApplication(sys.argv)
    s=Sample()
    sys.exit(app.exec_())


text:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

</body>
<script>
    var color = "blue";
    function changeColor() {
        var anotherColor = "red";

        function swapColors() {
            var tempColor = anotherColor;
            anotherColor = color;
            color = tempColor;

            //这里可以访问color,another,tempColor
        }
        //可以访问color,anotherColor
        swapColors();
    }
    //只能访问color
    changeColor();
</script>
</html>


text:
Released: 2015-06-09

### Contents ###

+ A. OVERVIEW
+ B. INSTALLATION
+ C. RESULTS

***************************************

### OVERVIEW ###
Bioinformatics benchmarking package, based on the original BioBench
developed by Albayraktaroglu et al, 2005 "BioBench: A benchmark suite of bioinformatics applications"

Scripts developed and packages assembled by John Johnston
Michigan State University

Last Modified: 2018-12-13

***************************************

### INSTALLATION ###

After cloning the repo, perform the following steps:

1.  cd <biobench2 sourcedir>
2. cd ./BLAST/input
3. Follow directions in README.1st
4. cd ../../
5. sh ./buildBench.sh
6. perl ./runBench.pl

***************************************

### RESULTS ###

Your primary results file will be located in the root installation
directory, and is entitled "bioBenchResults.csv"

Program specific output can be found in the "output" subdirectory
of each application directory.

Results are presented in the format:

host,test,replicate,runTime,cpuVendor,cpuFamily,cpuModel,procSpeed,cacheSize,numCores,totalMem,compiler

These are grouped by replicate number and can be imported into
a spreadsheet program, or parsed using a script language.

Tested on CentOS 6/7.


text:
var generalRequest = require('./util/generalRequest.js').func;

// Args
exports.required = ['group'];
exports.optional = ['message', 'jar'];

// Define
exports.func = function (args) {
  var jar = args.jar;
  var group = args.group;
  var message = args.message || '';
  var events = {
    ctl00$cphRoblox$GroupStatusPane$StatusTextBox: message,
    ctl00$cphRoblox$GroupStatusPane$StatusSubmitButton: 'Group Shout'
  };
  return generalRequest({jar: jar, url: '//www.roblox.com/My/Groups.aspx?gid=' + group, events: events})
  .then(function (result) {
    if (result.res.statusCode !== 200) {
      throw new Error('Shout failed, verify login, permissions, and message');
    }
  });
};


text:
registerManualTests('chrome.idle', function(rootEl, addButton) {
  addButton('Query state', function() {
    var detectionIntervalInSeconds = 10;
    var queryStateCallback = function(state) {
      logger('State: ' + state);
    };
    chrome.idle.queryState(detectionIntervalInSeconds, queryStateCallback);
  });

  // TODO(maxw): Allow the detection interval to be set in a textbox.
  addButton('Change detection interval to 10 seconds', function() {
    chrome.idle.setDetectionInterval(10);
    logger('Detection interval set to 10 seconds.');
  });

  addButton('Change detection interval to 60 seconds', function() {
    chrome.idle.setDetectionInterval(60);
    logger('Detection interval set to 60 seconds.');
  });

  // Add a status-change listener.
  var stateListener = function(state) {
    logger('State changed: ' + state);
  };
  chrome.idle.onStateChanged.addListener(stateListener);
});


text:
use crate::command_prelude::*;

use cargo::ops::{self, UpdateOptions};
use cargo::util::print_available_packages;

pub fn cli() -> App {
    subcommand("update")
        .about("Update dependencies as recorded in the local lock file")
        .arg(opt("quiet", "No output printed to stdout").short("q"))
        .arg(opt("workspace", "Only update the workspace packages").short("w"))
        .arg_package_spec_simple("Package to update")
        .arg(opt(
            "aggressive",
            "Force updating all dependencies of <name> as well",
        ))
        .arg_dry_run("Don't actually write the lockfile")
        .arg(opt("precise", "Update a single dependency to exactly PRECISE").value_name("PRECISE"))
        .arg_manifest_path()
        .after_help("Run `cargo help update` for more detailed information.\n")
}

pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
    let ws = args.workspace(config)?;

    if args.is_present_with_zero_values("package") {
        print_available_packages(&ws)?;
    }

    let update_opts = UpdateOptions {
        aggressive: args.is_present("aggressive"),
        precise: args.value_of("precise"),
        to_update: values(args, "package"),
        dry_run: args.is_present("dry-run"),
        workspace: args.is_present("workspace"),
        config,
    };
    ops::update_lockfile(&ws, &update_opts)?;
    Ok(())
}


text:
package org.apache.dubbo.rpc.cluster.router.file;

import org.apache.dubbo.common.Constants;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.utils.IOUtils;
import org.apache.dubbo.rpc.cluster.Router;
import org.apache.dubbo.rpc.cluster.RouterFactory;
import org.apache.dubbo.rpc.cluster.router.script.ScriptRouterFactory;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class FileRouterFactory implements RouterFactory {

    public static final String NAME = "file";

    private RouterFactory routerFactory;

    public void setRouterFactory(RouterFactory routerFactory) {
        this.routerFactory = routerFactory;
    }

    @Override
    public Router getRouter(URL url) {
        try {
            // Transform File URL into Script Route URL, and Load
            // file:///d:/path/to/route.js?router=script ==> script:///d:/path/to/route.js?type=js&rule=<file-content>
            String protocol = url.getParameter(Constants.ROUTER_KEY, ScriptRouterFactory.NAME); // Replace original protocol (maybe 'file') with 'script'
            String type = null; // Use file suffix to config script type, e.g., js, groovy ...
            String path = url.getPath();
            if (path != null) {
                int i = path.lastIndexOf('.');
                if (i > 0) {
                    type = path.substring(i + 1);
                }
            }
            String rule = IOUtils.read(new FileReader(new File(url.getAbsolutePath())));

            boolean runtime = url.getParameter(Constants.RUNTIME_KEY, false);
            URL script = url.setProtocol(protocol).addParameter(Constants.TYPE_KEY, type).addParameter(Constants.RUNTIME_KEY, runtime).addParameterAndEncoded(Constants.RULE_KEY, rule);

            return routerFactory.getRouter(script);
        } catch (IOException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }

}


text:
"""
sinecosine.py
Author: Billy B
Credit: Mr Dennison, Mathisfun.com, David

Assignment:

In this assignment you must use *list comprehensions* to generate sprites that show the behavior
of certain mathematical functions: sine and cosine.

The sine and cosine functions are provided in the Python math library. These functions are used
to relate *angles* to *rectangular* (x,y) coordinate systems and can be very useful in computer
game design.

Unlike the last assignment using ggame`, this one will not provide any "skeleton" code to fill
in. You should use your submission for the Picture assignment
(https://github.com/HHS-IntroProgramming/Picture) as a reference for starting this assignment.

See:
https://github.com/HHS-IntroProgramming/Sine-Cosine/blob/master/README.md
for a detailed list of requirements for this assignment.

https://github.com/HHS-IntroProgramming/Standards-and-Syllabus/wiki/Displaying-Graphics
for general information on how to use ggame.

https://github.com/HHS-IntroProgramming/Standards-and-Syllabus/wiki/Programmed-Graphics
for general information on using list comprehensions to generate graphics.

http://brythonserver.github.io/ggame/
for detailed information on ggame.
"""
from math import sin, cos, radians

from ggame import App, Color, LineStyle, Sprite
from ggame import CircleAsset

red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
purple = Color(0xFF00FF, 1.0)

thinline = LineStyle(1, black)
bluecircle = CircleAsset(5, thinline, blue)
xcoordinates = range(0, 360, 10)
redcircle = CircleAsset(5, thinline, red)
xcoordinatesred = range(0, 360, 10)
purplecircle = CircleAsset(5, thinline, purple)
xcoordinatespurple = range(0, 360, 10)

# Generate a list of sprites that form a line!
sprites = [Sprite(bluecircle, (x, 100+100*sin(radians(x)))) for x in xcoordinates]

spritesred= [Sprite(redcircle, (x, 100+100*cos(radians(x)))) for x in xcoordinatesred]

spritespurple = [Sprite(purplecircle, ((100+100*cos(radians(x))), (400+100*sin(radians(x))))) for x in xcoordinatespurple]

myapp = App()
myapp.run()


text:
$(function () {
  'use strict'

  QUnit.module('dropdowns plugin')

  QUnit.test('should be defined on jquery object', function (assert) {
    assert.expect(1)
    assert.ok($(document.body).dropdown, 'dropdown method is defined')
  })

  QUnit.module('dropdowns', {
    beforeEach: function () {
      // Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
      $.fn.bootstrapDropdown = $.fn.dropdown.noConflict()
    },
    afterEach: function () {
      $.fn.dropdown = $.fn.bootstrapDropdown
      delete $.fn.bootstrapDropdown
    }
  })

  QUnit.test('should provide no conflict', function (assert) {
    assert.expect(1)
    assert.strictEqual(typeof $.fn.dropdown, 'undefined', 'dropdown was set back to undefined (org value)')
  })

  QUnit.test('should throw explicit error on undefined method', function (assert) {
    assert.expect(1)
    var $el = $('
')
    $el.bootstrapDropdown()
    try {
      $el.bootstrapDropdown('noMethod')
    } catch (err) {
      assert.strictEqual(err.message, 'No method named "noMethod"')
    }
  })

  QUnit.test('should return jquery collection containing the element', function (assert) {
    assert.expect(2)
    var $el = $('
')
    var $dropdown = $el.bootstrapDropdown()
    assert.ok($dropdown instanceof $, 'returns jquery collection')
    assert.strictEqual($dropdown[0], $el[0], 'collection contains element')
  })

  QUnit.test('should not open dropdown if target is disabled via attribute', function (assert) {
    assert.expect(1)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        '<button disabled href="#" class="btn dropdown-toggle" data-toggle="dropdown">Dropdown</button>' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    $(dropdownHTML).appendTo('#qunit-fixture')
    var $dropdown = $('#qunit-fixture').find('[data-toggle="dropdown"]').bootstrapDropdown()
    $dropdown.on('click', function () {
      assert.ok(!$dropdown.parent('.dropdown').hasClass('show'))
      done()
    })
    $dropdown.trigger($.Event('click'))
  })

  QUnit.test('should not add class position-static to dropdown if boundary not set', function (assert) {
    assert.expect(1)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown()
    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok(!$dropdown.parent('.dropdown').hasClass('position-static'), '"position-static" class not added')
        done()
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should add class position-static to dropdown if boundary not scrollParent', function (assert) {
    assert.expect(1)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown()
    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok($dropdown.parent('.dropdown').hasClass('position-static'), '"position-static" class added')
        done()
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should set aria-expanded="true" on target when dropdown menu is shown', function (assert) {
    assert.expect(1)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()
    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.strictEqual($dropdown.attr('aria-expanded'), 'true', 'aria-expanded is set to string "true" on click')
        done()
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should set aria-expanded="false" on target when dropdown menu is hidden', function (assert) {
    assert.expect(1)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    $dropdown
      .parent('.dropdown')
      .on('hidden.bs.dropdown', function () {
        assert.strictEqual($dropdown.attr('aria-expanded'), 'false', 'aria-expanded is set to string "false" on hide')
        done()
      })

    $dropdown.trigger('click')
    $(document.body).trigger('click')
  })

  QUnit.test('should not open dropdown if target is disabled via class', function (assert) {
    assert.expect(1)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        '<button href="#" class="btn dropdown-toggle disabled" data-toggle="dropdown">Dropdown</button>' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'

    $(dropdownHTML).appendTo('#qunit-fixture')
    var $dropdown = $('#qunit-fixture').find('[data-toggle="dropdown"]').bootstrapDropdown()
    $dropdown.on('click', function () {
      assert.ok(!$dropdown.parent('.dropdown').hasClass('show'))
      done()
    })
    $dropdown.trigger($.Event('click'))
  })

  QUnit.test('should add class show to menu if clicked', function (assert) {
    assert.expect(1)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown()
    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok($dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click')
        done()
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should test if element has a # before assuming it\'s a selector', function (assert) {
    assert.expect(1)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown()
    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok($dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click')
        done()
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should remove "show" class if body is clicked', function (assert) {
    assert.expect(2)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok($dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click')
        $(document.body).trigger('click')
      }).on('hidden.bs.dropdown', function () {
        assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), '"show" class removed')
        done()
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should remove "show" class if tabbing outside of menu', function (assert) {
    assert.expect(2)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()
    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok($dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click')
        var e = $.Event('keyup')
        e.which = 9 // Tab
        $(document.body).trigger(e)
      }).on('hidden.bs.dropdown', function () {
        assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), '"show" class removed')
        done()
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should remove "show" class if body is clicked, with multiple dropdowns', function (assert) {
    assert.expect(7)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Test menu ' +
        '
' +
        'Submenu 1' +
        '
' +
        '
' +
        '
' +
        '
' +
        '<button class="btn">Actions</button>' +
        '<button class="btn dropdown-toggle" data-toggle="dropdown"></button>' +
        '
' +
        'Action 1' +
        '
' +
        '
'
    var $dropdowns = $(dropdownHTML).appendTo('#qunit-fixture').find('[data-toggle="dropdown"]')
    var $first = $dropdowns.first()
    var $last = $dropdowns.last()

    assert.strictEqual($dropdowns.length, 2, 'two dropdowns')

    $first.parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.strictEqual($first.parents('.show').length, 1, '"show" class added on click')
        assert.strictEqual($('#qunit-fixture .dropdown-menu.show').length, 1, 'only one dropdown is shown')
        $(document.body).trigger('click')
      }).on('hidden.bs.dropdown', function () {
        assert.strictEqual($('#qunit-fixture .dropdown-menu.show').length, 0, '"show" class removed')
        $last.trigger('click')
      })

    $last.parent('.btn-group')
      .on('shown.bs.dropdown', function () {
        assert.strictEqual($last.parent('.show').length, 1, '"show" class added on click')
        assert.strictEqual($('#qunit-fixture .dropdown-menu.show').length, 1, 'only one dropdown is shown')
        $(document.body).trigger('click')
      }).on('hidden.bs.dropdown', function () {
        assert.strictEqual($('#qunit-fixture .dropdown-menu.show').length, 0, '"show" class removed')
        done()
      })
    $first.trigger('click')
  })

  QUnit.test('should remove "show" class if body if tabbing outside of menu, with multiple dropdowns', function (assert) {
    assert.expect(7)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Test menu ' +
        '
' +
        'Submenu 1' +
        '
' +
        '
' +
        '
' +
        '
' +
        '<button class="btn">Actions</button>' +
        '<button class="btn dropdown-toggle" data-toggle="dropdown"></button>' +
        '
' +
        'Action 1' +
        '
' +
        '
'
    var $dropdowns = $(dropdownHTML).appendTo('#qunit-fixture').find('[data-toggle="dropdown"]')
    var $first = $dropdowns.first()
    var $last = $dropdowns.last()

    assert.strictEqual($dropdowns.length, 2, 'two dropdowns')

    $first.parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.strictEqual($first.parents('.show').length, 1, '"show" class added on click')
        assert.strictEqual($('#qunit-fixture .dropdown-menu.show').length, 1, 'only one dropdown is shown')
        var e = $.Event('keyup')
        e.which = 9 // Tab
        $(document.body).trigger(e)
      }).on('hidden.bs.dropdown', function () {
        assert.strictEqual($('#qunit-fixture .dropdown-menu.show').length, 0, '"show" class removed')
        $last.trigger('click')
      })

    $last.parent('.btn-group')
      .on('shown.bs.dropdown', function () {
        assert.strictEqual($last.parent('.show').length, 1, '"show" class added on click')
        assert.strictEqual($('#qunit-fixture .dropdown-menu.show').length, 1, 'only one dropdown is shown')
        var e = $.Event('keyup')
        e.which = 9 // Tab
        $(document.body).trigger(e)
      }).on('hidden.bs.dropdown', function () {
        assert.strictEqual($('#qunit-fixture .dropdown-menu.show').length, 0, '"show" class removed')
        done()
      })
    $first.trigger('click')
  })

  QUnit.test('should fire show and hide event', function (assert) {
    assert.expect(2)
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    var done = assert.async()

    $dropdown
      .parent('.dropdown')
      .on('show.bs.dropdown', function () {
        assert.ok(true, 'show was fired')
      })
      .on('hide.bs.dropdown', function () {
        assert.ok(true, 'hide was fired')
        done()
      })

    $dropdown.trigger('click')
    $(document.body).trigger('click')
  })

  QUnit.test('should fire shown and hidden event', function (assert) {
    assert.expect(2)
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    var done = assert.async()

    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok(true, 'shown was fired')
      })
      .on('hidden.bs.dropdown', function () {
        assert.ok(true, 'hidden was fired')
        done()
      })

    $dropdown.trigger('click')
    $(document.body).trigger('click')
  })

  QUnit.test('should fire shown and hidden event with a relatedTarget', function (assert) {
    assert.expect(2)
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()
    var done = assert.async()

    $dropdown.parent('.dropdown')
      .on('hidden.bs.dropdown', function (e) {
        assert.strictEqual(e.relatedTarget, $dropdown[0])
        done()
      })
      .on('shown.bs.dropdown', function (e) {
        assert.strictEqual(e.relatedTarget, $dropdown[0])
        $(document.body).trigger('click')
      })

    $dropdown.trigger('click')
  })

  QUnit.test('should ignore keyboard events within <input>s and <textarea>s', function (assert) {
    assert.expect(3)
    var done = assert.async()

    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '<input type="text" id="input">' +
        '<textarea id="textarea"/>' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    var $input = $('#input')
    var $textarea = $('#textarea')

    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok(true, 'shown was fired')

        $input.trigger('focus').trigger($.Event('keydown', {
          which: 38
        }))
        assert.ok($(document.activeElement).is($input), 'input still focused')

        $textarea.trigger('focus').trigger($.Event('keydown', {
          which: 38
        }))
        assert.ok($(document.activeElement).is($textarea), 'textarea still focused')

        done()
      })

    $dropdown.trigger('click')
  })

  QUnit.test('should skip disabled element when using keyboard navigation', function (assert) {
    assert.expect(2)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Disabled link' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok(true, 'shown was fired')
        $dropdown.trigger($.Event('keydown', {
          which: 40
        }))
        $dropdown.trigger($.Event('keydown', {
          which: 40
        }))
        assert.ok(!$(document.activeElement).is('.disabled'), '.disabled is not focused')
        done()
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should focus next/previous element when using keyboard navigation', function (assert) {
    assert.expect(4)
    var done = assert.async()
    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'A link' +
        'Another link' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok(true, 'shown was fired')
        $dropdown.trigger($.Event('keydown', {
          which: 40
        }))
        assert.ok($(document.activeElement).is($('#item1')), 'item1 is focused')

        $(document.activeElement).trigger($.Event('keydown', {
          which: 40
        }))
        assert.ok($(document.activeElement).is($('#item2')), 'item2 is focused')

        $(document.activeElement).trigger($.Event('keydown', {
          which: 38
        }))
        assert.ok($(document.activeElement).is($('#item1')), 'item1 is focused')
        done()
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should not close the dropdown if the user clicks on a text field', function (assert) {
    assert.expect(2)
    var done = assert.async()
    var dropdownHTML = '
' +
        '<button type="button" data-toggle="dropdown">Dropdown</button>' +
        '
' +
        '<input id="textField" type="text" />' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    var $textfield = $('#textField')
    $textfield.on('click', function () {
      assert.ok($dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is shown')
      done()
    })

    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok($dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is shown')
        $textfield.trigger($.Event('click'))
      })
    $dropdown.trigger('click')
  })

  QUnit.test('should not close the dropdown if the user clicks on a textarea', function (assert) {
    assert.expect(2)
    var done = assert.async()
    var dropdownHTML = '
' +
        '<button type="button" data-toggle="dropdown">Dropdown</button>' +
        '
' +
        '<textarea id="textArea"></textarea>' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    var $textarea = $('#textArea')
    $textarea.on('click', function () {
      assert.ok($dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is shown')
      done()
    })

    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok($dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is shown')
        $textarea.trigger($.Event('click'))
      })
    $dropdown.trigger('click')
  })

  QUnit.test('Dropdown should not use Popper.js in navbar', function (assert) {
    assert.expect(1)
    var done = assert.async()
    var html = '' +
        '
' +
        '  Dropdown' +
        '
' +
        '    Action' +
        '    Another action' +
        '    Something else here' +
        '
' +
        '
' +
        ''

    $(html).appendTo('#qunit-fixture')
    var $triggerDropdown = $('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()
    var $dropdownMenu = $triggerDropdown.next()

    $triggerDropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        assert.ok(typeof $dropdownMenu.attr('style') === 'undefined', 'No inline style applied by Popper.js')
        done()
      })
    $triggerDropdown.trigger($.Event('click'))
  })

  QUnit.test('should ignore keyboard events for <input>s and <textarea>s within dropdown-menu, except for escape key', function (assert) {
    assert.expect(7)
    var done = assert.async()

    var dropdownHTML = '
' +
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '<input type="text" id="input">' +
        '<textarea id="textarea"/>' +
        '
' +
        '
' +
        '
'
    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    var $input = $('#input')
    var $textarea = $('#textarea')

    $dropdown
      .parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        // Space key
        $input.trigger('focus').trigger($.Event('keydown', {
          which: 32
        }))
        assert.ok($(document.activeElement)[0] === $input[0], 'input still focused')
        $textarea.trigger('focus').trigger($.Event('keydown', {
          which: 32
        }))
        assert.ok($(document.activeElement)[0] === $textarea[0], 'textarea still focused')

        // Key up
        $input.trigger('focus').trigger($.Event('keydown', {
          which: 38
        }))
        assert.ok($(document.activeElement)[0] === $input[0], 'input still focused')
        $textarea.trigger('focus').trigger($.Event('keydown', {
          which: 38
        }))
        assert.ok($(document.activeElement)[0] === $textarea[0], 'textarea still focused')

        // Key down
        $input.trigger('focus').trigger($.Event('keydown', {
          which: 40
        }))
        assert.ok($(document.activeElement)[0] === $input[0], 'input still focused')
        $textarea.trigger('focus').trigger($.Event('keydown', {
          which: 40
        }))
        assert.ok($(document.activeElement)[0] === $textarea[0], 'textarea still focused')

        // Key escape
        $input.trigger('focus').trigger($.Event('keydown', {
          which: 27
        }))
        assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is not shown')
        done()
      })

    $dropdown.trigger('click')
  })

  QUnit.test('should ignore space key events for <input>s within dropdown, and accept up, down and escape', function (assert) {
    assert.expect(6)
    var done = assert.async()

    var dropdownHTML =
        '
' +
        '
' +
        '    <input type="text" id="input" data-toggle="dropdown">' +
        '
' +
        '      Secondary link' +
        '      Something else here' +
        '

' +
        '      Another link' +
        '
' +
        '
' +
        '
'

    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    var $input = $('#input')

    $dropdown
      .parent('.dropdown')
      .one('shown.bs.dropdown', function () {
        assert.ok(true, 'shown was fired')

        // Key space
        $input.trigger('focus').trigger($.Event('keydown', {
          which: 32
        }))
        assert.ok($dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is shown')
        assert.ok($(document.activeElement).is($input), 'input is still focused')

        // Key escape
        $input.trigger('focus').trigger($.Event('keydown', {
          which: 27
        }))
        assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is not shown')

        $dropdown
          .parent('.dropdown')
          .one('shown.bs.dropdown', function () {
            // Key down
            $input.trigger('focus').trigger($.Event('keydown', {
              which: 40
            }))
            assert.ok(document.activeElement === $('#item1')[0], 'item1 is focused')

            $dropdown
              .parent('.dropdown')
              .one('shown.bs.dropdown', function () {
                // Key up
                $input.trigger('focus').trigger($.Event('keydown', {
                  which: 38
                }))
                assert.ok(document.activeElement === $('#item1')[0], 'item1 is focused')
                done()
              }).bootstrapDropdown('toggle')
            $input.trigger('click')
          })
        $input.trigger('click')
      })
    $input.trigger('click')
  })

  QUnit.test('should ignore space key events for <textarea>s within dropdown, and accept up, down and escape', function (assert) {
    assert.expect(6)
    var done = assert.async()

    var dropdownHTML =
        '
' +
        '
' +
        '    <textarea id="textarea" data-toggle="dropdown"></textarea>' +
        '
' +
        '      Secondary link' +
        '      Something else here' +
        '

' +
        '      Another link' +
        '
' +
        '
' +
        '
'

    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()

    var $textarea = $('#textarea')

    $dropdown
      .parent('.dropdown')
      .one('shown.bs.dropdown', function () {
        assert.ok(true, 'shown was fired')

        // Key space
        $textarea.trigger('focus').trigger($.Event('keydown', {
          which: 32
        }))
        assert.ok($dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is shown')
        assert.ok($(document.activeElement).is($textarea), 'textarea is still focused')

        // Key escape
        $textarea.trigger('focus').trigger($.Event('keydown', {
          which: 27
        }))
        assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), 'dropdown menu is not shown')

        $dropdown
          .parent('.dropdown')
          .one('shown.bs.dropdown', function () {
            // Key down
            $textarea.trigger('focus').trigger($.Event('keydown', {
              which: 40
            }))
            assert.ok(document.activeElement === $('#item1')[0], 'item1 is focused')

            $dropdown
              .parent('.dropdown')
              .one('shown.bs.dropdown', function () {
                // Key up
                $textarea.trigger('focus').trigger($.Event('keydown', {
                  which: 38
                }))
                assert.ok(document.activeElement === $('#item1')[0], 'item1 is focused')
                done()
              }).bootstrapDropdown('toggle')
            $textarea.trigger('click')
          })
        $textarea.trigger('click')
      })
    $textarea.trigger('click')
  })

  QUnit.test('should not use Popper.js if display set to static', function (assert) {
    assert.expect(1)
    var dropdownHTML =
        '
' +
        'Dropdown' +
        '
' +
        'Secondary link' +
        'Something else here' +
        '
' +
        'Another link' +
        '
' +
        '
'

    var $dropdown = $(dropdownHTML)
      .appendTo('#qunit-fixture')
      .find('[data-toggle="dropdown"]')
      .bootstrapDropdown()
    var done = assert.async()
    var dropdownMenu = $dropdown.next()[0]

    $dropdown.parent('.dropdown')
      .on('shown.bs.dropdown', function () {
        // Popper.js add this attribute when we use it
        assert.strictEqual(dropdownMenu.getAttribute('x-placement'), null)
        done()
      })

    $dropdown.trigger('click')
  })
})


text:
namespace MassTransit.Distributor
{
    public class LeastBusyWorkerSelectorFactory :
        IWorkerSelectorFactory
    {
        public IWorkerSelector<TMessage> GetSelector<TMessage>()
            where TMessage : class
        {
            return new LeastBusyWorkerSelector<TMessage>();
        }
    }
}


text:
export class BaseDate {
  constructor(protected jdn: number) {}

  public getJdn(): number {
    return this.jdn;
  }
}


text:
CC4301 Arquitectura de Computadores  - Ejemplos de Assembly
===========================================================

Esta sección pretende materializar muchos de los conceptos estudiados hasta ahora y aplicarlos directamente en pequeños programas que puedan ser ejecutados en sistemas modernos.

1. Para los ejemplos de x86 se utilizará un procesador x86 de 64-bits. El sistema operativo utilizado es *Ubuntu 14.04 LTS*.
2. Para los ejemplos de ARM se utilizará una *Raspberry PI*. El sistema operativo utilizado es *Raspbian*.

Software utilizado:
  - `as`, the portable GNU Assembler
  - `gcc`, GNU Project C and C++ compiler
  - `ld`, The GNU linker

Tanto en Ubuntu como en Raspbian se puede instalar el paquete `build-essential` para tener la mayoría de las herramientas necesarias para compilar código.

  `sudo apt-get install build-essential`

También es necesario contar con un editor de texto. Editores como nano, gedit, vim, Sublime Text, Eclipse sirven, pues trabajan con el archivo en texto plano, sin agregarle metadatos (como Word o LibreOffice Writer).

Los ejemplos se dividen según la arquitectura:

  * *ejemplos_x86/* -- Ejemplos para ejecutar en arquitectura x86
  * *ejemplos_arm/* -- Ejemplos para ejecutar en arquitectura ARM

Cada ejemplo está comentado paso a paso y debería ser auto-explicativo, sin embargo, para no repetir las explicaciones, se han ordenado con números, donde el primer ejemplo es el más básico y al aumentar el número, se tratan temas más avanzados.

Por otro lado, esto no pretende ser un tutorial a fondo de Assembly. Sólo se pretende ilustrar algunos puntos y ofrecer una forma
rápida de abordar algunos problemas.

Instrucciones
=============

#### Generar código Assembly usando GCC y C

Cuando se compila un programa en C, el código atraviesa tres grandes etapas:

  1. Generación de código Assembler específico de la arquitectura.
  2. Ensamblar el código Assembler a código máquina (*texto a binario*).
  3. *Linkeo* del código máquina con librerías y más objetos.

El archivo resultante del proceso anterior es directamente ejecutable por el sistema.
El proceso anterior se realiza, típicamente, con estos comandos:

    `$ gcc programa.c -o programa // Compilar`
    `$ ./programa // Ejecutar`

Sin embargo, si a `gcc` se le pasa el parámetro `-S` detendrá la compilación en la etapa 1. Generando un archivo `.s`, el cual tendrá el código en Assembler. Este archivo no es directamente ejecutable, pues aún necesita atravesar las etapas de ensamblado y linkeo (*GCC* puede continuar la compilación a partir del archivo `.s` por lo que no hay de qué preocuparse).

Los pasos serían:

1. Utilizar gcc para generar el código assembler, esto generará el archivo `programa.s`:
  `$ gcc -S programa.c -o programa.s`
2. Ensamblar y linkear:
  `$ gcc programa.s -o programa`
3. Ejecutar:
  `$ ./programa`
  (normalmente hay que otorgar permisos de ejecución al archivo: `$ chmod +x programa`)

Con eso, se pueden generar programas y luego ver cómo C realiza sus operaciones.

###### NOTAS

1. Los archivos `.s` generados con este método suelen no ser directamente ensamblables y ejecutables, pues hacen referencias a librerías de C. Lo mejor en este caso es utilizar `gcc` como frontend para `as` y `ld`. En la sección siguiente se verá cómo utilizar `as` y `ld` para generar código máquina de manera independiente.
2. Por defecto, GCC insertará varias directivas en el archivo resultando, por ejemplo: `.cfi_startproc`, `.cfi_def_cfa_offset 16`, etc. Estas directivas asisten en el proceso de debug, en específico, permiten recorrer el stack y saber cuál ha sido el orden de las llamadas a funciones. Cuando el archivo es grande, puede ser molesto tener que leer estas directivas, por lo que se pueden desactivar utilizando el siguiente parámetro:
  `$ gcc -fno-asynchronous-unwind-tables -S prueba.c -o prueba.s`

#### Ensamblar y ejecutar código Assembly directamente

Para esto es necesario escribir a mano el archivo `.s`. Luego, se utiliza `as` para ensamablarlo (pasar de texto a binario) y luego `ld` para generar el archivo ejecutable.

1. Ensamblar:
  `$ as -o programa.o programa.s`
2. Linkear:
  `$ ld -o programa programa.o`
3. Ejecutar:
  `$ ./programa`

#### Usar GCC para ensamblar y linkear

Si el archivo `.s` ya existe, se puede realizar el ensamblado y linkeo en un solo paso, obteniendo el ejecutable de inmediato:

1. `$ gcc -nostdlib programa.s -o programa`

#### Ensamblar los ejemplos

Para ensamblar todos los ejemplos, se puede utilizar un archivo `Makefile`, provisto en cada carpeta:

  1. `cd ejemplos_x86`
  2. `make`
  3. `./001_inicio`

#### TIPS

1. Cada programa ejecutado en Linux tiene un código de retorno, o de salida. Este es un número utilizado para indicar el resultado de la ejecución. Típicamente, si el programa termina con código `0` (cero), significa que se ejecutó satisfactoriamente. Para saber cuál fue el código de salida del último programa ejecutado, se puede escribir en la consola el siguiente comando:
  `$ echo $?`
  Esto resulta bastante útil al momento de querer imprimir números desde Assembler, pues es mucho más fácil que imprimir una cadena de texto.

###### LINKS ÚTILES

  - http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html
  - http://blog.rchapman.org/post/36801038863/linux-system-call-table-for-x86-64
  - http://syscalls.kernelgrok.com/
  - http://en.wikipedia.org/wiki/Function_prologue
  - http://www.cs.virginia.edu/~evans/cs216/guides/x86.html
  - http://www.asciitable.com/
  - http://web.mit.edu/gnu/doc/html/as_7.html


text:
[![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-haskell-master)](https://ci.tensorflow.org/job/tensorflow-haskell-master)

The tensorflow-haskell package provides Haskell bindings to
[TensorFlow](https://www.tensorflow.org/).

This is not an official Google product.

# Documentation

https://tensorflow.github.io/haskell/haddock/

[TensorFlow.Core](https://tensorflow.github.io/haskell/haddock/tensorflow-0.1.0.0/TensorFlow-Core.html)
is a good place to start.

# Examples

Neural network model for the MNIST dataset: [code](tensorflow-mnist/app/Main.hs)

Toy example of a linear regression model
([full code](tensorflow-ops/tests/RegressionTest.hs)):

```haskell
import Control.Monad (replicateM, replicateM_, zipWithM)
import System.Random (randomIO)
import Test.HUnit (assertBool)

import qualified TensorFlow.Core as TF
import qualified TensorFlow.GenOps.Core as TF
import qualified TensorFlow.Gradient as TF
import qualified TensorFlow.Ops as TF

main :: IO ()
main = do
    -- Generate data where `y = x*3 + 8`.
    xData <- replicateM 100 randomIO
    let yData = [x*3 + 8 | x <- xData]
    -- Fit linear regression model.
    (w, b) <- fit xData yData
    assertBool "w == 3" (abs (3 - w) < 0.001)
    assertBool "b == 8" (abs (8 - b) < 0.001)

fit :: [Float] -> [Float] -> IO (Float, Float)
fit xData yData = TF.runSession $ do
    -- Create tensorflow constants for x and y.
    let x = TF.vector xData
        y = TF.vector yData
    -- Create scalar variables for slope and intercept.
    w <- TF.initializedVariable 0
    b <- TF.initializedVariable 0
    -- Define the loss function.
    let yHat = (x `TF.mul` w) `TF.add` b
        loss = TF.square (yHat `TF.sub` y)
    -- Optimize with gradient descent.
    trainStep <- gradientDescent 0.001 loss [w, b]
    replicateM_ 1000 (TF.run trainStep)
    -- Return the learned parameters.
    (TF.Scalar w', TF.Scalar b') <- TF.run (w, b)
    return (w', b')

gradientDescent :: Float
                -> TF.Tensor TF.Build Float
                -> [TF.Tensor TF.Ref Float]
                -> TF.Session TF.ControlNode
gradientDescent alpha loss params = do
    let applyGrad param grad =
            TF.assign param (param `TF.sub` (TF.scalar alpha `TF.mul` grad))
    TF.group =<< zipWithM applyGrad params =<< TF.gradients loss params
```

# Installation Instructions

## Build with Docker on Linux

As an expedient we use [docker](https://www.docker.com/) for building. Once you have docker
working, the following commands will compile and run the tests.

    git clone --recursive https://github.com/tensorflow/haskell.git tensorflow-haskell
    cd tensorflow-haskell
    IMAGE_NAME=tensorflow/haskell:v0
    docker build -t $IMAGE_NAME docker
    # TODO: move the setup step to the docker script.
    stack --docker --docker-image=$IMAGE_NAME setup
    stack --docker --docker-image=$IMAGE_NAME test

There is also a demo application:

    cd tensorflow-mnist
    stack --docker --docker-image=$IMAGE_NAME build --exec Main

## Build on Mac OS X

Run the [install_osx_dependencies.sh](./tools/install_osx_dependencies.sh)
script in the `tools/` directory. The script installs dependencies
via [Homebrew](http://brew.sh) and then downloads and installs the TensorFlow
library on your machine under `/usr/local`.

After running the script to install system dependencies, build the project with stack:

    stack test


text:
/************************************************************************
*
* Corbin Hart © (2008-201x)
* All rights reserved.
*
************************************************************************/

#pragma once

#include "API.h"

namespace dit {

    //-----------------------------------//
    // Forward decls

    class ProfilerInternal;

    //-----------------------------------//
    // Publicly exposed profiler interface

    class Profiler
    {
    public:
        //-----------------------------------//

        struct SampleNode
        {
            // null index value
            static const size_t NullIdx;

            SampleNode() = default;
            SampleNode(uint64 _key, size_t _nextIdx)
                : key(_key)
                , nextIdx(_nextIdx)
            {}

            size_t nextIdx = NullIdx;
            uint64 key = 0;
        };

        //-----------------------------------//

        struct Sample
        {
            Sample() = default;
            Sample(void* framePtr, uint64 invocationCount, double time)
                : addr(framePtr)
                , callCount(invocationCount)
                , totalTime(time)
            {}

            // data / stats
            void* addr = nullptr;
            uint64 callCount = 0;
            uint64 instructionCount = 0;
            double totalTime = 0.f;

            // dependency graph links
            size_t childsIdx = SampleNode::NullIdx;
        };

    public:
        //-----------------------------------//

        Profiler(const char* logFileName = "profile-stats.log");
        ~Profiler();

        void Start();
        void Stop();

        void Enter(int64 rdtsc, void* addr);
        void Exit(int64 rdtsc, void* addr);

    private:
        ProfilerInternal*   _prfl = nullptr;
        bool                _isActive = false;

    private:
        static Profiler* _instance;
        friend Profiler* profiler();
    };

    //-----------------------------------//

    Profiler* profiler();
}


text:
class EmailValidator < ActiveModel::EachValidator
  EMAIL_REGEX = /([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})/i.freeze

  def validate_each(record, attribute, value)
    return if value =~ /\A#{EMAIL_REGEX}\z/i

    record.errors[attribute] << (options[:message] || 'is not an email')
  end
end


text:
package com.netpet.spools.javadp.createtype.builder;

/**
 * Created with IntelliJ IDEA.
 * User: David
 * Date: 2015/1/21
 * Time: 15:08
 */
public abstract class AbstractBuilder {
    public abstract void buildDay();

    public abstract void addHotel();

    public abstract void addReservation();

    public abstract void addSpecialEvent();

    public abstract void addTickets();

    public abstract VocationPlanner getVocationPlanner();

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<bean type="com.opengamma.financial.analytics.curve.InterpolatedCurveDefinition">
 <name>USD-OIS-FFS-NCS</name>
 <nodes>
  <item type="com.opengamma.financial.analytics.ircurve.strips.CashNode">
   <curveNodeIdMapperName>USD-Depo-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>OVERNIGHT</maturityTenor>
   <convention>CONVENTION~USDDepoON</convention>
  </item>
  <item type="com.opengamma.financial.analytics.ircurve.strips.SwapNode">
   <curveNodeIdMapperName>USD-OIS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P1M</maturityTenor>
   <payLegConvention>CONVENTION~USDFixed1Y_PayLag</payLegConvention>
   <receiveLegConvention>CONVENTION~USDFEDFUNDSCmp1Y</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-OIS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P2M</maturityTenor>
   <payLegConvention>CONVENTION~USDFixed1Y_PayLag</payLegConvention>
   <receiveLegConvention>CONVENTION~USDFEDFUNDSCmp1Y</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-OIS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P3M</maturityTenor>
   <payLegConvention>CONVENTION~USDFixed1Y_PayLag</payLegConvention>
   <receiveLegConvention>CONVENTION~USDFEDFUNDSCmp1Y</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-OIS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P6M</maturityTenor>
   <payLegConvention>CONVENTION~USDFixed1Y_PayLag</payLegConvention>
   <receiveLegConvention>CONVENTION~USDFEDFUNDSCmp1Y</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-OIS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P9M</maturityTenor>
   <payLegConvention>CONVENTION~USDFixed1Y_PayLag</payLegConvention>
   <receiveLegConvention>CONVENTION~USDFEDFUNDSCmp1Y</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-OIS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P1Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFixed1Y_PayLag</payLegConvention>
   <receiveLegConvention>CONVENTION~USDFEDFUNDSCmp1Y</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P2Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P3Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P4Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P5Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P6Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P7Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P8Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P9Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P10Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P12Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P15Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P20Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P25Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
  <item type="SwapNode">
   <curveNodeIdMapperName>USD-FFF-FFS-BBG</curveNodeIdMapperName>
   <startTenor>P0D</startTenor>
   <maturityTenor>P30Y</maturityTenor>
   <payLegConvention>CONVENTION~USDFEDFUNDSAA3M</payLegConvention>
   <receiveLegConvention>CONVENTION~USDLIBOR3M</receiveLegConvention>
   <useFixings>true</useFixings>
  </item>
 </nodes>
 <interpolatorName>NaturalCubicSpline</interpolatorName>
 <rightExtrapolatorName>FlatExtrapolator</rightExtrapolatorName>
 <leftExtrapolatorName>FlatExtrapolator</leftExtrapolatorName>
</bean>


text:
package com.noelchew.ncutils.ui;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.StateListDrawable;
import androidx.core.content.ContextCompat;
import android.view.View;

/**
 * Created by noelchew on 09/12/2016.
 */

public class ButtonUtil {

    public static void setSideBoarder(Context context, View view, int color, int stroke, int left, int top, int right, int bottom) {
        GradientDrawable border = new GradientDrawable();
        border.setStroke(stroke, ContextCompat.getColor(context, color));
        Drawable[] layers = {border};
        LayerDrawable layerDrawable = new LayerDrawable(layers);
        layerDrawable.setLayerInset(0, left, top, right, bottom);
        view.setBackground(layerDrawable);
    }

    public static void setRadiusColor(Context context, View view, int radiusDp, int colorNormal, int colorPressed, int colorDisabled) {
        int radiusPx = PixelUtil.dpToPx(context, radiusDp);

        GradientDrawable drawableNormal = new GradientDrawable();
        drawableNormal.setCornerRadius(radiusPx);
        drawableNormal.setColor(ContextCompat.getColor(context, colorNormal));

        GradientDrawable drawablePressed = new GradientDrawable();
        drawablePressed.setCornerRadius(radiusPx);
        drawablePressed.setColor(ContextCompat.getColor(context, colorPressed));

        GradientDrawable drawableDisabled = new GradientDrawable();
        drawableDisabled.setCornerRadius(radiusPx);
        drawableDisabled.setColor(ContextCompat.getColor(context, colorDisabled));

        StateListDrawable sld = new StateListDrawable();
        sld.addState(new int[] { -android.R.attr.state_enabled }, drawableDisabled);
        sld.addState(new int[] { android.R.attr.state_pressed, android.R.attr.state_enabled }, drawablePressed);
        sld.addState(new int[] { -android.R.attr.state_pressed, android.R.attr.state_enabled }, drawableNormal);
        view.setBackground(sld);
    }
}


text:
layout: kanji-remain
v4: 2892
kanji: 匡
keyword: set straight
strokes: 6
on-yomi: キョウ
permalink: /rtk/匡/
---

## Koohii stories:

1) [Megaqwerty] 29-9-2007(36): After the revolution, the king was put into a box so that the government could be set straight.

2) [Katsuo] 16-7-2007(10): Walking through the park, I see many large boxes where homeless people live. But there's one guy dressed as a king, who seems to be arranging them all, i.e. he's setting the boxes straight. "Surely you're not a real king?" I ask. He replies, "Let me set you straight, I'm king of the boxes".

3) [taikura] 2-12-2008(4): A country needs to be set straight - if its borders are breached and its jewels missing.

4) [kapalama] 27-11-2010(1): 匡正する , 匡救する set straight (#2892 匡) キョウ, 名乗り : ただし, まさ, まさし ... Parts: 匚, 王 ... Story: If you don't Set it Straight, it won't just be your dick in a box; it will be your Balls in a Box. Which is not nearly as much fun as the original.

5) [enryu] 4-9-2009(): Because the king was gay, they brainwashed him torturing him by suffocation in a cardboard box to he could be set straight.


text:
import { PureComponent, Children } from 'react';
import cx from 'classnames';

const buildInDotsColors = ['black', 'blue', 'red', 'green'];

export type IDotsType = 'line' | 'round';

export type IDotsTheme = 'light' | 'dark';

export interface ISwiperDotsProps {
  dotsColor: string;
  dotsSize?: 'normal' | 'small' | 'large';
  dotsType?: 'line' | 'round';
  items: React.ReactNode;
  currentIndex: number;
  onDotsClick(index: number): void;
  dotsTheme: IDotsTheme;
}

export default class SwiperDots extends PureComponent<ISwiperDotsProps> {
  isDotActive = (index: number, currentIndex: number, length: number) => {
    return (
      index === currentIndex ||
      (index === 0 && currentIndex > length - 1) ||
      (index === length - 1 && currentIndex < 0)
    );
  };

  isBuildInColor = (dotsColor: string) => {
    return buildInDotsColors.indexOf(dotsColor) !== -1;
  };

  render() {
    const {
      dotsColor,
      dotsSize,
      items,
      currentIndex,
      dotsType,
      onDotsClick,
      dotsTheme,
    } = this.props;
    const classString = cx(
      'zent-swiper__dots',
      `zent-swiper__dots-${dotsSize}`,
      `zent-swiper__dots--${dotsType}`,
      `zent-swiper__dots--${dotsTheme}`,
      {
        [`zent-swiper__dots-${dotsColor}`]: this.isBuildInColor(dotsColor),
      }
    );

    return (
      <ul className={classString}>
        {Children.map(items, (item, index) => {
          const isActive = this.isDotActive(
            index,
            currentIndex,
            (items as any).length
          );
          if (isActive && !this.isBuildInColor(dotsColor)) {
            return (
              <li
                key={index}
                style={{ background: dotsColor }}
                className="zent-swiper__dots-item zent-swiper__dots-item-active"
              />
            );
          }
          return (
            <li
              key={index}
              className={cx('zent-swiper__dots-item', {
                'zent-swiper__dots-item-active': isActive,
              })}
              onClick={() => onDotsClick(index)}
            />
          );
        })}
      </ul>
    );
  }
}


text:
import { parseRtpPacket, parseRtpPayloadType, payloadTypesHash } from 'rtp-parser';

const result = parseRtpPacket(new Buffer('fakeRTP'));
result.csrc; // $ExpectType number[]
result.payload; // $ExpectType Buffer

const parsed3 = parseRtpPayloadType(3);
parsed3.name; // $ExpectType "GSM"
parsed3.mediaType; // $ExpectType "A"
parsed3.channels; // $ExpectType 1
parsed3.clockRate; // $ExpectType 8000

const parsed35 = parseRtpPayloadType(35);
parsed35.name; // $ExpectType "unassigned"

for (let i = 0; i < 200; i++) {
  const parsed = parseRtpPayloadType(i);
  if (parsed.name) {}
  if (parsed.clockRate) {}
}

payloadTypesHash[0].mediaType; // $ExpectType "A"

parseRtpPayloadType(0);
parseRtpPayloadType(1);
parseRtpPayloadType(2);
parseRtpPayloadType(3);
parseRtpPayloadType(4);
parseRtpPayloadType(5);
parseRtpPayloadType(6);
parseRtpPayloadType(7);
parseRtpPayloadType(8);
parseRtpPayloadType(9);
parseRtpPayloadType(10);
parseRtpPayloadType(11);
parseRtpPayloadType(12);
parseRtpPayloadType(13);
parseRtpPayloadType(14);
parseRtpPayloadType(15);
parseRtpPayloadType(16);
parseRtpPayloadType(17);
parseRtpPayloadType(18);
parseRtpPayloadType(19);
parseRtpPayloadType(20);
parseRtpPayloadType(21);
parseRtpPayloadType(22);
parseRtpPayloadType(23);
parseRtpPayloadType(24);
parseRtpPayloadType(25);
parseRtpPayloadType(26);
parseRtpPayloadType(27);
parseRtpPayloadType(28);
parseRtpPayloadType(29);
parseRtpPayloadType(30);
parseRtpPayloadType(31);
parseRtpPayloadType(32);
parseRtpPayloadType(33);
parseRtpPayloadType(34);
parseRtpPayloadType(35);
parseRtpPayloadType(36);
parseRtpPayloadType(37);
parseRtpPayloadType(38);
parseRtpPayloadType(39);
parseRtpPayloadType(40);
parseRtpPayloadType(41);
parseRtpPayloadType(42);
parseRtpPayloadType(43);
parseRtpPayloadType(44);
parseRtpPayloadType(45);
parseRtpPayloadType(46);
parseRtpPayloadType(47);
parseRtpPayloadType(48);
parseRtpPayloadType(49);
parseRtpPayloadType(50);
parseRtpPayloadType(51);
parseRtpPayloadType(52);
parseRtpPayloadType(53);
parseRtpPayloadType(54);
parseRtpPayloadType(55);
parseRtpPayloadType(56);
parseRtpPayloadType(57);
parseRtpPayloadType(58);
parseRtpPayloadType(59);
parseRtpPayloadType(60);
parseRtpPayloadType(61);
parseRtpPayloadType(62);
parseRtpPayloadType(63);
parseRtpPayloadType(64);
parseRtpPayloadType(65);
parseRtpPayloadType(66);
parseRtpPayloadType(67);
parseRtpPayloadType(68);
parseRtpPayloadType(69);
parseRtpPayloadType(70);
parseRtpPayloadType(71);
parseRtpPayloadType(72);
parseRtpPayloadType(73);
parseRtpPayloadType(74);
parseRtpPayloadType(75);
parseRtpPayloadType(76);
parseRtpPayloadType(77);
parseRtpPayloadType(78);
parseRtpPayloadType(79);
parseRtpPayloadType(80);
parseRtpPayloadType(81);
parseRtpPayloadType(82);
parseRtpPayloadType(83);
parseRtpPayloadType(84);
parseRtpPayloadType(85);
parseRtpPayloadType(86);
parseRtpPayloadType(87);
parseRtpPayloadType(88);
parseRtpPayloadType(89);
parseRtpPayloadType(90);
parseRtpPayloadType(91);
parseRtpPayloadType(92);
parseRtpPayloadType(93);
parseRtpPayloadType(94);
parseRtpPayloadType(95);
parseRtpPayloadType(96);
parseRtpPayloadType(97);
parseRtpPayloadType(98);
parseRtpPayloadType(99);
parseRtpPayloadType(100);
parseRtpPayloadType(101);
parseRtpPayloadType(102);
parseRtpPayloadType(103);
parseRtpPayloadType(104);
parseRtpPayloadType(105);
parseRtpPayloadType(106);
parseRtpPayloadType(107);
parseRtpPayloadType(108);
parseRtpPayloadType(109);
parseRtpPayloadType(110);
parseRtpPayloadType(111);
parseRtpPayloadType(112);
parseRtpPayloadType(113);
parseRtpPayloadType(114);
parseRtpPayloadType(115);
parseRtpPayloadType(116);
parseRtpPayloadType(117);
parseRtpPayloadType(118);
parseRtpPayloadType(119);
parseRtpPayloadType(120);
parseRtpPayloadType(121);
parseRtpPayloadType(122);
parseRtpPayloadType(123);
parseRtpPayloadType(124);
parseRtpPayloadType(125);
parseRtpPayloadType(126);
parseRtpPayloadType(127);


text:
package org.onosproject.provider.bgp.cfg.impl;

import com.fasterxml.jackson.databind.JsonNode;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.osgi.DefaultServiceDirectory;
import org.onlab.packet.IpAddress;
import org.onosproject.bgp.controller.BgpCfg;
import org.onosproject.bgp.controller.BgpController;
import org.onosproject.core.ApplicationId;
import org.onosproject.net.config.Config;

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

import static org.onosproject.net.config.Config.FieldPresence.MANDATORY;
import static org.onosproject.net.config.Config.FieldPresence.OPTIONAL;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Configuration object for BGP.
 */
public class BgpAppConfig extends Config<ApplicationId> {
    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
    BgpController bgpController;

    BgpCfg bgpConfig = null;

    public static final String ROUTER_ID = "routerId";
    public static final String LOCAL_AS = "localAs";
    public static final String MAX_SESSION = "maxSession";
    public static final String LS_CAPABILITY = "lsCapability";
    public static final String HOLD_TIME = "holdTime";
    public static final String LARGE_AS_CAPABILITY = "largeAsCapability";
    public static final String FLOW_SPEC_CAPABILITY = "flowSpecCapability";
    public static final String FLOW_SPEC_RPD_CAPABILITY = "flowSpecRpdCapability";

    public static final String BGP_PEER = "bgpPeer";
    public static final String PEER_IP = "peerIp";
    public static final String REMOTE_AS = "remoteAs";
    public static final String PEER_HOLD_TIME = "peerHoldTime";
    public static final String PEER_CONNECT_MODE = "connectMode";
    public static final String PEER_CONNECT_PASSIVE = "passive";
    public static final String PEER_CONNECT_ACTIVE = "active";

    static final int MAX_SHORT_AS_NUMBER = 65535;
    static final long MAX_LONG_AS_NUMBER = 4294967295L;

    static final int MIN_SESSION_NUMBER = 1;
    static final long MAX_SESSION_NUMBER = 21;

    static final int MIN_HOLDTIME = 0;
    static final long MAX_HOLDTIME = 65535;

    @Override
    public boolean isValid() {
        boolean fields = false;

        this.bgpController = DefaultServiceDirectory.getService(BgpController.class);
        bgpConfig = bgpController.getConfig();

        fields = hasOnlyFields(ROUTER_ID, LOCAL_AS, MAX_SESSION, LS_CAPABILITY,
                HOLD_TIME, LARGE_AS_CAPABILITY, FLOW_SPEC_CAPABILITY, FLOW_SPEC_RPD_CAPABILITY, BGP_PEER) &&
                isIpAddress(ROUTER_ID, MANDATORY) && isNumber(LOCAL_AS, MANDATORY) &&
                isNumber(MAX_SESSION, OPTIONAL, MIN_SESSION_NUMBER, MAX_SESSION_NUMBER)
                && isNumber(HOLD_TIME, OPTIONAL, MIN_HOLDTIME, MAX_HOLDTIME) &&
                isBoolean(LS_CAPABILITY, OPTIONAL) && isBoolean(LARGE_AS_CAPABILITY, OPTIONAL) &&
                isString(FLOW_SPEC_CAPABILITY, OPTIONAL) && isBoolean(FLOW_SPEC_RPD_CAPABILITY, OPTIONAL);

        if (!fields) {
            return fields;
        }

        return validateBgpConfiguration();
    }

    /**
     * Returns routerId from the configuration.
     *
     * @return routerId
     */
    public String routerId() {
        return get(ROUTER_ID, null);
    }

    /**
     * Returns localAs number from the configuration.
     *
     * @return local As number
     */
    public int localAs() {
        return Integer.parseInt(get(LOCAL_AS, null));
    }

    /**
     * Returns max session from the configuration.
     *
     * @return max session
     */
    public int maxSession() {
        return Integer.parseInt(get(MAX_SESSION, null));
    }

    /**
     * Returns BGP-LS capability support from the configuration.
     *
     * @return true if BGP-LS capability is set else false
     */
    public boolean lsCapability() {
        return Boolean.parseBoolean(get(LS_CAPABILITY, null));
    }

    /**
     * Returns flow spec route policy distribution capability support from the configuration.
     *
     * @return true if flow spec route policy distribution capability is set otherwise false
     */
    public boolean rpdCapability() {
        return Boolean.parseBoolean(get(FLOW_SPEC_RPD_CAPABILITY, null));
    }

    /**
     * Returns largeAs capability support from the configuration.
     *
     * @return largeAs capability
     */
    public boolean largeAsCapability() {
        return Boolean.parseBoolean(get(LARGE_AS_CAPABILITY, null));
    }

    /**
     * Returns flow specification capability support from the configuration.
     *
     * @return flow specification capability
     */
    public String flowSpecCapability() {
        return get(FLOW_SPEC_CAPABILITY, null);
    }

    /**
     * Returns holdTime of the local node from the configuration.
     *
     * @return holdTime
     */
    public short holdTime() {
        return Short.parseShort(get(HOLD_TIME, null));
    }

    /**
     * Validates the flow specification capability.
     *
     * @return true if valid else false
     */
    public boolean validateFlowSpec() {
        if (flowSpecCapability() != null) {
            String flowSpec = flowSpecCapability();
            if ((!flowSpec.equals("IPV4")) && (!flowSpec.equals("VPNV4")) && (!flowSpec.equals("IPV4_VPNV4"))) {
                return false;
            }
        }

        return true;
    }

    /**
     * Validates the hold time value.
     *
     * @return true if valid else false
     */
    public boolean validateHoldTime() {
        if (holdTime() != 0) {
            short holdTime = holdTime();
            if ((holdTime == 1) || (holdTime == 2)) {
                return false;
            }
        }
        return true;
    }

    /**
     * Validates the Bgp local and peer configuration.
     *
     * @return true if valid else false
     */
    public boolean validateBgpConfiguration() {

        if (!validateLocalAs()) {
            return false;
        }

        if (!validateRouterId()) {
            return false;
        }

        if (!validateBgpPeers()) {
            return false;
        }

        if (!validateFlowSpec()) {
            return false;
        }

        if (!validateHoldTime()) {
            return false;
        }
        return true;
    }

    /**
     * Validates the Bgp As number.
     *
     * @return true if valid else false
     */
    public boolean validateLocalAs() {

        long localAs = 0;
        localAs = localAs();

        if (largeAsCapability()) {

            if (localAs == 0 || localAs >= MAX_LONG_AS_NUMBER) {
                return false;
            }
        } else {
            if (localAs == 0 || localAs >= MAX_SHORT_AS_NUMBER) {
                return false;
            }
        }

        return true;
    }

    /**
     * Validates the Bgp peer As number.
     *
     * @param remoteAs remote As number
     * @return true if valid else false
     */
    public boolean validateRemoteAs(long remoteAs) {
        if (largeAsCapability()) {

            if (remoteAs == 0 || remoteAs >= MAX_LONG_AS_NUMBER) {
                return false;
            }
        } else {
            if (remoteAs == 0 || remoteAs >= MAX_SHORT_AS_NUMBER) {
                return false;
            }
        }
        return true;
    }

    /**
     * Validates the Bgp Router ID configuration.
     *
     * @return true if valid else false
     */
    public boolean validateRouterId() {
        String routerId = routerId();
        // TODO: router ID validation
        return true;
    }

    /**
     * Validates the Bgp peer holdTime.
     *
     * @param remoteAs remote As number
     * @return true if valid else false
     */
    public boolean validatePeerHoldTime(long remoteAs) {
        //TODO:Validate it later..
        return true;
    }

    /**
     * Validates the Bgp peer configuration.
     *
     * @return true if valid else false
     */
    public boolean validateBgpPeers() {
        List<BgpPeerConfig> nodes;
        String connectMode;

        nodes = bgpPeer();
        for (int i = 0; i < nodes.size(); i++) {
            connectMode = nodes.get(i).connectMode();
            if ((IpAddress.valueOf(nodes.get(i).hostname()) == null) ||
                    !validateRemoteAs(nodes.get(i).asNumber()) ||
                    !validatePeerHoldTime(nodes.get(i).holdTime()) ||
                    !(connectMode.equals(PEER_CONNECT_ACTIVE) || connectMode.equals(PEER_CONNECT_PASSIVE))) {
                return false;
            }
        }

        return true;
    }

    /**
     * Returns the set of nodes read from network config.
     *
     * @return list of BgpPeerConfig or null
     */
    public List<BgpPeerConfig> bgpPeer() {
        List<BgpPeerConfig> nodes = new ArrayList<BgpPeerConfig>();

        JsonNode jsonNodes = object.get(BGP_PEER);
        if (jsonNodes == null) {
            return null;
        }

        jsonNodes.forEach(jsonNode -> nodes.add(new BgpPeerConfig(
                jsonNode.path(PEER_IP).asText(),
                jsonNode.path(REMOTE_AS).asInt(),
                jsonNode.path(PEER_HOLD_TIME).asInt(),
                jsonNode.path(PEER_CONNECT_MODE).asText())));

        return nodes;
    }

    /**
     * Configuration for Bgp peer nodes.
     */
    public static class BgpPeerConfig {

        private final String hostname;
        private final int asNumber;
        private final short holdTime;
        private final String connectMode;

        public BgpPeerConfig(String hostname, int asNumber, int holdTime, String connectMode) {
            this.hostname = checkNotNull(hostname);
            this.asNumber = asNumber;
            this.holdTime = (short) holdTime;
            this.connectMode = connectMode;
        }

        /**
         * Returns hostname of the peer node.
         *
         * @return hostname
         */
        public String hostname() {
            return this.hostname;
        }

        /**
         * Returns asNumber if peer.
         *
         * @return asNumber
         */
        public int asNumber() {
            return this.asNumber;
        }

        /**
         * Returns holdTime of the peer node.
         *
         * @return holdTime
         */
        public short holdTime() {
            return this.holdTime;
        }

        /**
         * Returns connection mode for the peer node.
         *
         * @return active or passive connection
         */
        public String connectMode() {
            return this.connectMode;
        }
    }
}


text:
export const view = {

  SearchInput: (payload) => ({
    type: 'view-SearchInput',
    payload,
  }),

}


text:
function g = rbfOutputGradX(model, X)

% RBFOUTPUTGRADX Evaluate derivatives of a RBF model's output with respect to inputs.
%
%	Description:
%
%	G = RBFOUTPUTGRADX(MODEL, X) returns the derivatives of the outputs
%	of an periodic radial basis function model with respect to the
%	inputs to the model. Currently a wrapper for rbfjacob.
%	 Returns:
%	  G - the gradient of the output with respect to the inputs.
%	 Arguments:
%	  MODEL - the model for which the derivatives will be computed.
%	  X - the locations at which the derivatives will be computed.
%
%
%	See also
%	RBFOUTPUTGRAD, MODELOUTPUTGRADX, RBFJACOB

%	Copyright (c) 2008 Neil D. Lawrence

g = rbfjacob(model, X);


text:
package org.unitime.timetable.model;

import org.unitime.timetable.model.base.BaseStudentAreaClassificationMajor;

public class StudentAreaClassificationMajor extends BaseStudentAreaClassificationMajor implements Comparable<StudentAreaClassificationMajor> {
	private static final long serialVersionUID = 1L;

	public StudentAreaClassificationMajor() {
		super();
	}

	@Override
	public int compareTo(StudentAreaClassificationMajor m) {
		int cmp = Double.compare(getWeight() == null ? 1.0 : getWeight().doubleValue(), m.getWeight() == null ? 1.0 : m.getWeight().doubleValue());
		if (cmp != 0) return - cmp;
		cmp = getAcademicArea().getAcademicAreaAbbreviation().compareTo(m.getAcademicArea().getAcademicAreaAbbreviation());
		if (cmp != 0) return cmp;
		cmp = getAcademicClassification().getCode().compareTo(m.getAcademicClassification().getCode());
		if (cmp != 0) return cmp;
		cmp = (getDegree() == null ? "" : getDegree().getReference()).compareTo(m.getDegree() == null ? "" : m.getDegree().getReference());
		if (cmp != 0) return cmp;
		cmp = (getProgram() == null ? "" : getProgram().getReference()).compareTo(m.getProgram() == null ? "" : m.getProgram().getReference());
		if (cmp != 0) return cmp;
		cmp = getMajor().getCode().compareTo(m.getMajor().getCode());
		if (cmp != 0) return cmp;
		cmp = (getConcentration() == null ? "" : getConcentration().getCode()).compareTo(m.getConcentration() == null ? "" : m.getConcentration().getCode());
		if (cmp != 0) return cmp;
		return (getUniqueId() == null ? Long.valueOf(-1) : getUniqueId()).compareTo(m.getUniqueId() == null ? -1 : m.getUniqueId());
	}

}


text:
package camelinaction;

import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Test;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * A Spring XML based version of the {@link camelinaction.LoadBalancerTest}.
 * <p/>
 * See the other class for more comments.
 *
 * @version $Revision$
 */
public class SpringLoadBalancerTest extends CamelSpringTestSupport {

    @Test
    public void testLoadBalancer() throws Exception {
        MockEndpoint a = getMockEndpoint("mock:a");
        a.expectedBodiesReceived("Hello", "Cool");

        MockEndpoint b = getMockEndpoint("mock:b");
        b.expectedBodiesReceived("Camel rocks", "Bye");

        template.sendBody("direct:start", "Hello");
        template.sendBody("direct:start", "Camel rocks");
        template.sendBody("direct:start", "Cool");
        template.sendBody("direct:start", "Bye");

        assertMockEndpointsSatisfied();
    }

    @Override
    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("META-INF/spring/loadbalancer.xml");
    }
}