text:
RegisterWidgetClass("Tabpane")

--~    +----------+  +-------+       -     -
--~  d1|tab_active|d2|tab    |       h1    h2
--~ +--+          +--+-------+--+    -     |
--~ |                           |          -
--~ |  pane                     |
--~ +---------------------------+
--~
--~ d1=margin_first_tab
--~ d2=margin_between_tab
--~ h2-h1=height_tab_overlapped
--~
--~ tabsize h1 is the maximum of all tab content heights + margin (margin_tab)
--~ margin_tab is the margin between tab content and tab border

--~ params={gfxparam_pane			=?,
--~ params={gfxparam_tab			=?,
--~ params={gfxparam_tab_active		=?,
--~ params={margin_first_tab		=?,
--~ params={margin_between_tab		=?,
--~ params={margin_tab				=?,
--~ params={margin_pane				=?,
--~ params={height_tab_overlapped	=?,

-- EXAMPLE ================================================
--[[
	local test_image = MakeSpritePanelParam_SingleSprite(GetPlainTextureGUIMat("art_fallback.png"),
		32,32,0,0,0,0,32,32,32,32)

	local params = {
		gfxparam_pane			= MakeSpritePanelParam_BorderPartMatrix(GetPlainTextureGUIMat("tabbed.png"),128,128, 0,0, 2,2, 12,1,12, 12,1,12, 128,128, 1,1, false, false),
		gfxparam_tab			= MakeSpritePanelParam_BorderPartMatrix(GetPlainTextureGUIMat("tabbed.png"),128,128, 0,0, 31,2, 12,1,12, 12,1,1, 128,128, 1,1, false, false),
		gfxparam_tab_active		= MakeSpritePanelParam_BorderPartMatrix(GetPlainTextureGUIMat("tabbed.png"),128,128, 0,0, 31,20, 12,1,12, 12,1,1, 128,128, 1,1, false, false),
		margin_first_tab		= 10,
		margin_between_tab		= 10,
		margin_tab				= 6,
		margin_pane				= 6,
		height_tab_overlapped	= 2,
	}

	local tabpane = GetDesktopWidget():CreateChild("Tabpane",params)
	tabpane:SetSize(400,400)
	tabpane:SetLeftTop(10,10)

	tabpane:AddTab("test1")
	tabpane:GetTabContentTab("test1"):CreateChild("Text",{text="test1",textparam={r=0,g=0,b=0},font=CreateFont_UO(gUniFontLoaderList[0])})
	tabpane:GetTabContentPane("test1"):CreateChild("Text",{text="this is the first tab pane with\na lot of funny text!",textparam={r=0,g=0,b=0},font=CreateFont_UO(gUniFontLoaderList[0])})
	tabpane:AddTab("test2")
	tabpane:GetTabContentTab("test2"):CreateChild("Text",{text="test2",textparam={r=0,g=0,b=0},font=CreateFont_UO(gUniFontLoaderList[0])})
	tabpane:GetTabContentPane("test2"):CreateChild("Image",{gfxparam_init=test_image})
	tabpane:AddTab("test3")
	tabpane:GetTabContentTab("test3"):CreateChild("Text",{text="test3",textparam={r=0,g=0,b=0},font=CreateFont_UO(gUniFontLoaderList[0])})

	tabpane:UpdateAll()
]]
-- =======================================================

-- see SpritePanel for gfxparam format
function gWidgetPrototype.Tabpane:Init 	(parentwidget, params)
	local bVertexBufferDynamic,bVertexCol = false,true

	self.rendergroup2d = CreateRenderGroup2D(parentwidget:CastToRenderGroup2D())
	self:SetRenderGroup2D(self.rendergroup2d)
	self:AddToDestroyList(self.rendergroup2d)

	self:SetIgnoreBBoxHit(true)

	self.params = params

	self.panebackground = self:CreateChild("Border",{gfxparam_init=params.gfxparam_pane})
	self.tabs = {}	-- {pane=..., tab=...}
	self.taborder = {}	-- a list of names, order of the list is order of x position

	self.activetab = nil
	self.tabbar_height = 0
	self.tabbar_width = 0
end

function gWidgetPrototype.Tabpane:HasTab			(name)
	return self.tabs[name] ~= nil
end

function gWidgetPrototype.Tabpane:GetTab			(name)
	return self.tabs[name]
end

function gWidgetPrototype.Tabpane:RemoveTab			(name)
	if self:HasTab(name) then
		local t = self.tabs[name]
		self.tabs[name] = nil

		local order = 1

		-- remove the element with value name from order list
		for k,v in pairs(self.taborder) do
			if v == name then
				order = k
				table.remove(self.taborder, k)
				break
			end
		end

		self.taborder[name] = nil

		-- destroy widgets
		t.pane:Destroy()
		t.tab:Destroy()

		-- switch current active tab if the active gets removed
		if self.activetab == name and countarr(self.tabs) > 0 then
			order = math.max(1, order - 1)
			self:ActivateTab(self.taborder[order])
		end

		-- if there is no tab left, none is active
		if countarr(self.tabs) == 0 then self.activetab = nil end

		self:UpdateAll()
	end
end

function gWidgetPrototype.Tabpane:AddTab			(name)
	-- remove existing one if the name is already taken
	self:RemoveTab(name)

	local margin_tab = self.params.margin_tab or 0
	local height_tab_overlapped = self.params.height_tab_overlapped or 0

	local tab = self:CreateChild("Border",{gfxparam_init=self.params.gfxparam_tab, margin_left=margin_tab, margin_right=margin_tab, margin_top=margin_tab, margin_bottom=margin_tab+height_tab_overlapped})
	local pane = self:CreateChild("Group")
	-- initially hidden, ActivateTab shows the pane
	pane:SetVisible(false)

	local tabpane = self
	tab.on_button_click = function(self)
		tabpane:ActivateTab(name)
	end

	self.tabs[name] = {tab=tab, pane=pane}
	table.insert(self.taborder, name)

	-- if this is the first tab, make it the active one
	if self.activetab == nil then self:ActivateTab(name) end

	self:UpdateAll()
end

function gWidgetPrototype.Tabpane:ActivateTab		(name)
	if self.activetab == name then return end
	self.activetab = name

	for k,v in pairs(self.tabs) do
		if k == name then
			v.pane:SetVisible(true)
			v.tab.params.gfxparam_init = self.params.gfxparam_tab_active
		else
			v.pane:SetVisible(false)
			v.tab.params.gfxparam_init = self.params.gfxparam_tab
		end
	end

	self:UpdateAll()
end

function gWidgetPrototype.Tabpane:GetActiveTabName	(name)
	return self.activetab
end

function gWidgetPrototype.Tabpane:GetTabContentPane	(name)
	if not self:HasTab(name) then return nil end

	return self.tabs[name].pane
end

function gWidgetPrototype.Tabpane:GetTabContentTab	(name)
	if not self:HasTab(name) then return nil end

	return self.tabs[name].tab:GetContent()
end

-- adjusts the size and position of the tabs according to the current tab content
-- call this if the tab content size changes
function gWidgetPrototype.Tabpane:UpdateTabs	()
	self.tabbar_height = 0

	local margin_pane = self.params.margin_pane or 0
	local margin_tab = self.params.margin_tab or 0
	local margin_first_tab = self.params.margin_first_tab or 0
	local margin_between_tab = self.params.margin_between_tab or 0
	local height_tab_overlapped = self.params.height_tab_overlapped or 0

	-- calculate max size
	local minw,minh = 44,16
	for k,v in pairs(self.tabs) do
		local w,h = 0,0
		v.tab:UpdateContent() -- call here so it behaves correctly even if childs where added with AddChild
		if v.tab:GetContent() then
			w,h = v.tab:GetContent():GetSize()
			w = max(w,minw)
			h = max(h,minh)
		end

		self.tabbar_height = math.max(self.tabbar_height, h + 2 * margin_tab)
	end

	local x = margin_first_tab

	-- adjust size and position
	for k,v in pairs(self.taborder) do
		local t = self.tabs[v]

		local w,h = 0,0
		if t.tab:GetContent() then
			w,h = t.tab:GetContent():GetSize()
			w = max(w,minw)
			h = max(h,minh)
		end

		w = w + 2 * margin_tab
		h = self.tabbar_height + height_tab_overlapped

		t.tab:SetSize(w, h)
		t.tab:SetLeftTop(x, 0)

		t.pane:SetLeftTop(margin_pane, margin_pane + self.tabbar_height)

		-- switch position to next tab
		x = x + w + margin_between_tab
	end

	self.tabbar_width = x
end

function gWidgetPrototype.Tabpane:UpdateAll	()
	local w,h = self:GetSize()
	self:SetSize(w,h)
end

-- resize the complete tabpane, width is limited by tabbar width
function gWidgetPrototype.Tabpane:on_set_size	(w,h)
	self:UpdateTabs()

	w = math.max(self.tabbar_width, w)

	self.panebackground:SetLeftTop(0, self.tabbar_height)
	self.panebackground:SetSize(w, h - self.tabbar_height)
end


text:
set -o errexit
set -o nounset
set -o pipefail

die () {
    echo >&2 "$@"
    exit 1
}

while [[ $# > 1 ]]
do
key="$1"

case $key in
  --clustername)
  CLUSTER_NAME="$2"
  shift
  ;;
  --log-directory)
  LOG_DIRECTORY="$2"
  shift
  ;;
  *)
    # unknown option
  ;;
esac
shift # past argument or value
done

[[ -n "${CLUSTER_NAME-}" ]] || die "The --clustername parameter is required"
LOG_DIRECTORY=${LOG_DIRECTORY:-"$(pwd)/_artifacts"}

KRAKEN_ROOT=${KRAKEN_ROOT:-"$(pwd)"}
KRAKEN_CLUSTER_DIR="${KRAKEN_ROOT}/bin/clusters/${CLUSTER_NAME}"
KRAKEN_CLUSTER_SSH_CONFIG="${KRAKEN_CLUSTER_DIR}/ssh_config"
KRAKEN_CLUSTER_ANSIBLE_HOSTS="${KRAKEN_CLUSTER_DIR}/hosts"

SSH_CMD="ssh -F ${KRAKEN_CLUSTER_SSH_CONFIG}"
SCP_CMD="scp -F ${KRAKEN_CLUSTER_SSH_CONFIG}"

# Saves the output of running a given command ($2) on a given node ($1)
# into a given local file ($3). Does not fail if the ssh command fails for any
# reason, just prints an error to stderr.
function save_log() {
  local -r node_name="${1}"
  local -r cmd="${2}"
  local -r output_file="${3}"

  if ! ${SSH_CMD} "${node_name}" "${cmd}" > "${output_file}"; then
      echo "WARN: ${SSH_CMD} ${node_name} ${cmd} > ${output_file}" >&2
  fi
}

# Copies a remote directory ${2} from a given node ${1} and stores it in the
# destination directory ${3}. Does not fail if the ssh command fails for any
# reason, just prints an error to stderr.
function save_directory() {
  local -r node_name="${1}"
  local -r remote_directory="${2}"
  local -r destination_directory="${3}"

  if ! ${SCP_CMD} -r "${node_name}":"${remote_directory}" "${destination_directory}";
 then
    echo "WARN: ${SCP_CMD} -r ${node_name}:${remote_directory} ${destination_directory}" >&2
  fi
}

# Retrives logs from node ($1) and stores them in files under directory ($2).
function save_common_logs() {
    local -r node_name="${1}"
    local -r node_prefix="${2}"

    echo "Dumping common logs for ${node_name}"

    save_log "${node_name}" "journalctl --output=cat -k" "${node_prefix}/kern.log"
    save_log "${node_name}" "journalctl --output=cat -u docker" "${node_prefix}/docker.log"
    save_log "${node_name}" "journalctl --output=cat -u k8s-binary-kubelet.service" "${node_prefix}/kubelet.log"
    save_directory "${node_name}" "/var/log/k8s" "${node_prefix}"
}

function save_master_logs() {
  node_names=$(awk 'sub(/\[master\]/,""){f=1} /^\[[^\]\r\n]+/{f=0} {if (f) print $1}' ${KRAKEN_CLUSTER_ANSIBLE_HOSTS})

  for node_name in ${node_names}; do
    node_prefix="${LOG_DIRECTORY}/${node_name}"
    mkdir -p "${node_prefix}"

    echo "Dumping logs for master ${node_name}"

    save_log "${node_name}" "journalctl --output=cat -u k8s-binary-controller-manager.service" "${node_prefix}/kube-controller-manager.log"
    save_log "${node_name}" "journalctl --output=cat -u kube-scheduler.log" "${node_prefix}/kube-scheduler.log"
    save_common_logs "${node_name}" "${node_prefix}"
  done
}

function save_api_server_logs() {
  node_names=$(awk 'sub(/\[apiserver\]/,""){f=1} /^\[[^\]\r\n]+/{f=0} {if (f) print $1}' ${KRAKEN_CLUSTER_ANSIBLE_HOSTS})

  for node_name in ${node_names}; do
    node_prefix="${LOG_DIRECTORY}/${node_name}"
    mkdir -p "${node_prefix}"

    echo "Dumping logs for apiserver ${node_name}"

    save_log "${node_name}" "journalctl --output=cat -u k8s-binary-apiserver.service" "${node_prefix}/kube-apiserver.log"
    save_common_logs "${node_name}" "${node_prefix}"
  done
}

function save_etcd_logs() {
  node_names=$(awk 'sub(/\[etcd\]/,""){f=1} /^\[[^\]\r\n]+/{f=0} {if (f) print $1}' ${KRAKEN_CLUSTER_ANSIBLE_HOSTS})

  for node_name in ${node_names}; do
    node_prefix="${LOG_DIRECTORY}/${node_name}"
    mkdir -p "${node_prefix}"

    echo "Dumping logs for etcd ${node_name}"

    save_log "${node_name}" "journalctl --output=cat -u etcd2.service" "${node_prefix}/kube-etcd.log"
    save_common_logs "${node_name}" "${node_prefix}"
  done
}

function save_node_logs() {
  node_names=$(awk 'sub(/\[node\]/,""){f=1} /^\[[^\]\r\n]+/{f=0} {if (f) print $1}' ${KRAKEN_CLUSTER_ANSIBLE_HOSTS})

  for node_name in ${node_names}; do
    node_prefix="${LOG_DIRECTORY}/${node_name}"
    mkdir -p "${node_prefix}"

    echo "Dumping logs for node ${node_name}"

    save_common_logs "${node_name}" "${node_prefix}"
  done
}

function main() {
  echo "Dumping all node logs to ${LOG_DIRECTORY}"

  save_master_logs
  save_api_server_logs
  save_etcd_logs
  save_node_logs
}

main

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview 'cr-settings-languages-page' is the settings page
 * for language and input method settings.
 *
 * @group Chrome Settings Elements
 * @element cr-settings-languages-page
 */
Polymer({
  is: 'cr-settings-languages-page',

  properties: {
    /**
     * Preferences state.
     */
    prefs: {
      type: Object,
      notify: true,
    },

    dummyLanguages_: {
      type: Array,
      value: function() {
        return [{code: 'en', displayName: 'English', supportsSpellcheck: true},
                {code: 'es', displayName: 'Spanish', supportsSpellcheck: true},
                {code: 'ru', displayName: 'Russian', supportsSpellcheck: true},
                {code: 'ar', displayName: 'Arabic'}];
      },
    },

    dummyInputMethods_: {
      type: Array,
      value: function() {
        return [{id: 'us', name: 'US Keyboard'},
                {id: 'fr', name: 'French Keyboard'}];
      },
    },

    dummyAppLocale_: {
      type: String,
      value: 'en',
    },

    dummyCurrentInputMethod_: {
      type: String,
      value: 'us',
    },

    dummySpellcheckDictionaries_: {
      type: Array,
      value: function() {
        return ['en', 'es', 'ru'];
      },
    },

    route: String,

    /**
     * Whether the page is a subpage.
     */
    subpage: {
      type: Boolean,
      value: false,
      readOnly: true
    },

    /**
     * ID of the page.
     */
    PAGE_ID: {
      type: String,
      value: 'languages',
      readOnly: true
    },

    /**
     * Title for the page header and navigation menu.
     */
    pageTitle: {
      type: String,
      value: function() {
        return loadTimeData.getString('languagesPageTitle');
      },
    },

    /**
     * Name of the 'iron-icon' to be shown in the settings-page-header.
     */
    icon: {
      type: String,
      value: 'language',
      readOnly: true
    },
  },

  /**
   * @param {!Array<!Language>} languages
   * @return {!Array<!Language>} The languages from |languages| which support
   *     spell check.
   * @private
   */
  getSpellcheckLanguages_: function(languages) {
    return languages.filter(function(language) {
      return language.supportsSpellcheck;
    });
  },

  /**
   * @param {string} languageCode The language code identifying a language.
   * @param {string} dummyAppLocale A fake app locale.
   * @return {boolean} True if the given language matches the app locale pref
   *     (which may be different from the actual app locale if it was changed).
   * @private
   */
  isUILanguage_: function(languageCode, dummyAppLocale) {
    return languageCode == dummyAppLocale;
  },

  /**
   * @param {string} id The input method ID.
   * @param {string} currentId The ID of the currently enabled input method.
   * @return {boolean} True if the IDs match.
   * @private
   */
  isCurrentInputMethod_: function(id, currentId) {
    assert(cr.isChromeOS);
    return id == currentId;
  },

  /**
   * @param {string} languageCode The language code identifying a language.
   * @param {!Array<string>} spellcheckDictionaries The list of languages
   *     for which spell check is enabled.
   * @return {boolean} True if spell check is enabled for the language.
   * @private
   */
  isSpellcheckEnabled_: function(languageCode, spellcheckDictionaries) {
    return spellcheckDictionaries.indexOf(languageCode) != -1;
  },
});


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.Types = exports.Module = exports.DependencyResolver = undefined;

var _intravenousDependencyResolver = require('./intravenousDependencyResolver');

var _intravenousDependencyResolver2 = _interopRequireDefault(_intravenousDependencyResolver);

var _injectionModule = require('./injectionModule');

var _injectionModule2 = _interopRequireDefault(_injectionModule);

var _bindingTypes = require('./bindingTypes');

var _bindingTypes2 = _interopRequireDefault(_bindingTypes);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
                                                                                * Created by nhu on 16.08.15.
                                                                                */

var Nintra = (function (_IntravenousDependenc) {
    _inherits(Nintra, _IntravenousDependenc);

    function Nintra() {
        _classCallCheck(this, Nintra);

        return _possibleConstructorReturn(this, Object.getPrototypeOf(Nintra).call(this));
    }

    return Nintra;
})(_intravenousDependencyResolver2.default);

exports.default = Nintra;
var DependencyResolver = exports.DependencyResolver = new Nintra();
var Module = exports.Module = _injectionModule2.default;
var Types = exports.Types = _bindingTypes2.default;


text:
package wait

import (
	"errors"
	"math/rand"
	"time"
)

// Jitter returns a time.Duration between duration and duration + maxFactor * duration,
// to allow clients to avoid converging on periodic behavior.  If maxFactor is 0.0, a
// suggested default value will be chosen.
func Jitter(duration time.Duration, maxFactor float64) time.Duration {
	if maxFactor <= 0.0 {
		maxFactor = 1.0
	}
	wait := duration + time.Duration(rand.Float64()*maxFactor*float64(duration))
	return wait
}

// ErrWaitTimeout is returned when the condition exited without success
var ErrWaitTimeout = errors.New("timed out waiting for the condition")

// ConditionFunc returns true if the condition is satisfied, or an error
// if the loop should be aborted.
type ConditionFunc func() (done bool, err error)

// Poll tries a condition func until it returns true, an error, or the timeout
// is reached. condition will always be invoked at least once but some intervals
// may be missed if the condition takes too long or the time window is too short.
// If you pass maxTimes = 0, Poll will loop until condition returns true or an
// error.
// Poll always waits the interval before the first check of the condition.
// TODO: create a separate PollImmediate function that does not wait.
func Poll(interval, timeout time.Duration, condition ConditionFunc) error {
	return WaitFor(poller(interval, timeout), condition)
}

// WaitFunc creates a channel that receives an item every time a test
// should be executed and is closed when the last test should be invoked.
type WaitFunc func() <-chan struct{}

// WaitFor gets a channel from wait(), and then invokes c once for every value
// placed on the channel and once more when the channel is closed.  If c
// returns an error the loop ends and that error is returned, and if c returns
// true the loop ends and nil is returned. ErrWaitTimeout will be returned if
// the channel is closed without c ever returning true.
func WaitFor(wait WaitFunc, c ConditionFunc) error {
	w := wait()
	for {
		_, open := <-w
		ok, err := c()
		if err != nil {
			return err
		}
		if ok {
			return nil
		}
		if !open {
			break
		}
	}
	return ErrWaitTimeout
}

// poller returns a WaitFunc that will send to the channel every
// interval until timeout has elapsed and then close the channel.
// Over very short intervals you may receive no ticks before
// the channel is closed closed.  If maxTimes is 0, the channel
// will never be closed.
func poller(interval, timeout time.Duration) WaitFunc {
	return WaitFunc(func() <-chan struct{} {
		ch := make(chan struct{})
		go func() {
			tick := time.NewTicker(interval)
			defer tick.Stop()
			var after <-chan time.Time
			if timeout != 0 {
				// time.After is more convenient, but it
				// potentially leaves timers around much longer
				// than necessary if we exit early.
				timer := time.NewTimer(timeout)
				after = timer.C
				defer timer.Stop()
			}
			for {
				select {
				case <-tick.C:
					ch <- struct{}{}
				case <-after:
					close(ch)
					return
				}
			}
		}()
		return ch
	})
}


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<actes:RetourClassification xmlns:actes="http://www.interieur.gouv.fr/ACTES#v1.1-20040202" xmlns:insee="http://xml.insee.fr/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.interieur.gouv.fr/ACTES#v1.1-20040202
actesv1_1.xsd">
	<actes:DateClassification>2003-06-25</actes:DateClassification>
	<actes:NaturesActes >
		<actes:NatureActe actes:CodeNatureActe="1" actes:Libelle="Délibérations" actes:TypeAbrege="DE"/>
		<actes:NatureActe actes:CodeNatureActe="2" actes:Libelle="Arrêtés réglementaires" actes:TypeAbrege="AR"/>
		<actes:NatureActe actes:CodeNatureActe="3" actes:Libelle="Arrêtés Individuels" actes:TypeAbrege="AI"/>
		<actes:NatureActe actes:CodeNatureActe="4" actes:Libelle="Contrats et conventions" actes:TypeAbrege="CC"/>
		<actes:NatureActe actes:CodeNatureActe="5" actes:Libelle="Documents budgétaires et financiers" actes:TypeAbrege="BF"/>
		<actes:NatureActe actes:CodeNatureActe="6" actes:Libelle="Autres" actes:TypeAbrege="AU"/>
	</actes:NaturesActes>
	<actes:Matieres>
		<actes:Matiere1 actes:CodeMatiere="1" actes:Libelle="CommandePublique">
			<actes:Matiere2 actes:CodeMatiere="1" actes:Libelle="Marchés publics" />
			<actes:Matiere2 actes:CodeMatiere="2" actes:Libelle="Délégations de service public">
				<actes:Matiere3 actes:CodeMatiere="1" actes:Libelle="Par type de contrat"/>
				<actes:Matiere3 actes:CodeMatiere="2" actes:Libelle="Par catégorie de service public concerné">
					<actes:Matiere4 actes:CodeMatiere="1" actes:Libelle="Service public industriel et commercial"/>
					<actes:Matiere4 actes:CodeMatiere="2" actes:Libelle="Service public administratif">
						<actes:Matiere5 actes:CodeMatiere="1" actes:Libelle="Enseignement public"/>
						<actes:Matiere5 actes:CodeMatiere="2" actes:Libelle="Enseignement privé"/>
					</actes:Matiere4>
				</actes:Matiere3>
			</actes:Matiere2>
			<actes:Matiere2 actes:CodeMatiere="3" actes:Libelle="Autres types de contrats"/>
		</actes:Matiere1>
		<actes:Matiere1 actes:CodeMatiere="2" actes:Libelle="Urbanisme">
			<actes:Matiere2 actes:CodeMatiere="1" actes:Libelle="Documents d'urbanisme"/>
			<actes:Matiere2 actes:CodeMatiere="2" actes:Libelle="Autorisations ou actes relatifs à l'occupation ou à l'utilisation du sol"/>
		</actes:Matiere1>
		<actes:Matiere1 actes:CodeMatiere="8" actes:Libelle="Autres">
			<actes:Matiere2 actes:CodeMatiere="1" actes:Libelle="Ordre de réquisition du comptable"/>
			<actes:Matiere2 actes:CodeMatiere="2" actes:Libelle="Autres"/>
		</actes:Matiere1>
	</actes:Matieres>
</actes:RetourClassification>


text:
import React from "react";
import Parameter from "../../parameter.js";

export class IDParameter extends Parameter {
  name() { return "id"; }
  description() { return "User ID to get the notifications for."; }
}

export class SinceParameter extends Parameter {
  name() { return "since"; }
  optional() { return true; }
  description() {
    return (

        A minimum time for notifications to show. It must be given as an ISO8601
        string. If it is not, then all notifications will be shown.

    )
  }
  default() { return new Date().toISOString(); }
}

export class BeforeParameter extends Parameter {
  name() { return "before"; }
  optional() { return true; }
  description() {
    return (

        Results are, by default, truncated to 50 entries. If you need to view
        more you can set the "before" time so as to accomplish paging.

    );
  }
  default() { return "NOW()"; }
}


text:
//============================================================================
// Name        : Font.h
// Author      : Duarte Peixinho
// Version     :
// Copyright   : ;)
// Description : Font
//============================================================================

#ifndef FONT_H
#define FONT_H

#include <Pyros3D/Assets/Texture/Texture.h>
#include <Pyros3D/Core/Logs/Log.h>
#include <Pyros3D/Other/Export.h>
#define generic GenericFromFreeTypeLibrary
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#undef generic

#define MAP_SIZE 1024

namespace p3d {

	struct glyph_properties
	{
		Vec2 offset;
		Vec2 size;
		Vec2 startingPoint;
	};

	class PYROS3D_API Font {

	private:

		// Font Path
		std::string font;

		f32 fontSize;

		// Font Map
		Texture* glyphMap;

		// Glyph Map Data
		uchar glyphMapData[MAP_SIZE*MAP_SIZE];

		// Font Glyphs Properties
		std::map<char, glyph_properties> glyphs;

		// Last Glyph Pixel Position
		uint32 lastGlyphWidth, lastGlyphRow;

		// Free Type Specifics
		FT_Library ft;
		FT_Face face;

		// From Memory
		std::vector<uchar> memory;

	public:

		// Create Font
		Font(const std::string &font, const f32 size);

		// Create Text
		// It adds each char to the texture
		void CreateText(const std::string &text);

		virtual ~Font();

		Texture* GetTexture();

		f32 GetFontSize();

		std::map<char, glyph_properties> GetGlyphs();
	};

};

#endif /* FONT_H */


text:
package ei.ne.ke.cassandra.cql3.template;

import org.apache.commons.lang.builder.HashCodeBuilder;
import org.springframework.util.ObjectUtils;

import com.google.common.base.Preconditions;

/**
 * CQL3 relation.
 */
public class Relation {

    protected final Identifier identifier;
    private final Comparator comparator;
    private final Term term;

    /**
     * Creates a new relation with the given identifier and comparator, assuming
     * a variable term.
     * @param identifier the identifier.
     * @param comparator the comparator.
     */
    public Relation(Identifier identifier, Comparator comparator) {
        this.identifier = Preconditions.checkNotNull(identifier);
        this.comparator = Preconditions.checkNotNull(comparator);
        this.term = Term.VARIABLE;
    }

    /**
     * Creates a new relation with the given identifier, comparator, and term.
     * @param identifier the identifier.
     * @param comparator the comparator.
     * @param term the term.
     */
    public Relation(Identifier identifier, Comparator comparator, Term term) {
        this.identifier = Preconditions.checkNotNull(identifier);
        this.comparator = Preconditions.checkNotNull(comparator);
        this.term = Preconditions.checkNotNull(term);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(identifier);
        sb.append(" ");
        sb.append(comparator);
        sb.append(" ");
        sb.append(term);
        return sb.toString();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(Object rhs) {
        if (this == rhs) {
            return true;
        } else if (!(rhs instanceof Relation)) {
            return false;
        } else {
            Relation that = (Relation) rhs;
            return ObjectUtils.nullSafeEquals(this.identifier, that.identifier)
                && ObjectUtils.nullSafeEquals(this.comparator, that.comparator)
                && ObjectUtils.nullSafeEquals(this.term, that.term);
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    /**
     * @return the identifier
     */
    public Identifier getIdentifier() {
        return identifier;
    }

    /**
     * @return the comparator
     */
    public Comparator getComparator() {
        return comparator;
    }

    /**
     * @return the term
     */
    public Term getTerm() {
        return term;
    }

}


text:
<TITLE>Review for Faute à Voltaire, La (2000)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Faute à Voltaire, La (2000)

reviewed by
Louis Proyect

When we first saw "Lonely are the Brave" in 1962, my fellow Bard College
students and I found it possible to appreciate the film on two levels. It
was similar to Sam Peckinpah's "Ride the High Country" and other films
meditating on cowboy as beloved anachronism. This cowboy is a symbol
confronting all the new forces--the automobile, barbed-wire,
etc.--impinging on the last bastion of freedom, the old west.

In the opening scene of "Lonely are the Brave," we see Jack Burns (Kirk
Douglas) stretched out in front of a campfire with his horse by his side.
His restful contemplation of the awesome beauty of the New Mexico high
country is then interrupted by the raucous sound of a squadron of military
jets flying in formation overhead.

On another level the film seemed to evoke some of the beat generation
literature that many of us had read as high school students. In novels and
poems hearkening back to Thoreau's "Walden Pond," the beats rejected
civilization and embraced the simpler, freer and more rustic world of the
ranch hand, hobo or forest ranger. These were the sorts of characters who
cropped up in Kerouac's novels and found particular expression in the life
and work of Gary Snyder, the Buddhist poet who saw the Pacific Northwest
forests as a sanctuary from the corporate greed and mindlessness of the
Eisenhower era.

Now--nearly 40 years later--that I have learned the full story behind the
making of "Lonely are the Brave," the beat generation associations not only
become more meaningful, I also understand the importance of the film to the
radical movement since it brought together two disparate strands of the
American left: the screenplay was by Dalton Trumbo, one of the greatest
blacklisted writers in Hollywood, while the screenplay itself was based on
one of Edward Abbey's anarchist/deep ecology masterpieces, "The Brave Cowboy."

The driving force behind the movie came from Kirk Douglas, who was one of
the first to challenge the blacklist by insisting that Dalton Trumbo write
the screenplay for "Spartacus" only 3 years earlier in 1958. Douglas, who
often co-starred in mindless beefcake spectacles with Burt Lancaster, was
not at all like the characters he played in films. He was the son of a
Russian Jewish ragman from the Lower East Side and a product like so many
in the entertainment industry of the vast cultural and social forces
embodied in the New Deal radicalization. While never a Communist himself,
he believed that the blacklist was evil and put his reputation on the line
by standing up for Trumbo. (Lancaster was not what he appeared as well. In
real life, he was bisexual and something of a radical.)

After a couple of years tending sheep, Jack Burns has come to town to break
his old friend Paul out of jail. Paul is a scholar about to be transferred
to a penitentiary to begin serving a two year for running a modest
underground railroad for undocumented workers from Mexico.

Since the only way he can free Paul is by becoming a prisoner himself, he
goes to town to find a saloon where booze and trouble often go together. He
is not disappointed. As soon as he takes a seat in one such establishment
to begin enjoying a bottle of whiskey with a beer chaser, a one-armed man
hurls an empty bottle at his head. In keeping with a innate sense of fair
play, Burns uses one arm to fight the man in a lusty barroom brawl that
honors the best traditions of the Western film.

After he is arrested, he finds himself in the holding pen with Paul where
he lays out his escape plan. With the two hacksaws he has smuggled inside
his boots, the two should be able to break out before morning arrives. Paul
demurs. He has a wife and a young son. The sentence for jail break in New
Mexico is 5 years. He would prefer to serve out his term and return to a
normal life. While a jail break might deliver freedom in the short run, it
also would sentence him and his family to a life on the run.

Although Jack can not persuade him to break out, he himself has no qualms.
With the assistance of Paul and other prisoners, he cuts through the bars
to the street below. He then returns to Paul's house where he has left his
horse. From there, he heads toward the mountains, beyond which Mexico and
freedom await.

>From this point, the main action of the film takes place, pitting the lone
resourceful cowboy against a posse made up of local lawmen and a helicopter
deployed by the same airforce base whose jets disturbed his peace in the
opening scene of the movie. In charge of the whole operation is Sheriff
Monty Johnson (Walter Matthau) who seems to harbor a secret desire to see
the prisoner escape. This is understandable since Johnson, and most of the
audience watching the film, probably felt trapped by American civilization
in the early 1960s. This world was described by Gary Snyder in the
following terms in the poem "Front Lines":

A bulldozer grinding and slobbering
Sideslipping and belching
The skinned-up bodies of still-live bushes
In the pay of a man
>From town.

Behind is a forest that goes to the Arctic
And a desert that still belongs to the Piute
And here we must draw
Our line

Although we identify with Jack Burns's bid for freedom, there is a
foreboding sense that it will not be successful. As he climbs up the
mountain with his horse in tow, we feel that he will be captured at any
moment. This climb might have reminded many college students of the Myth of
Sisyphus that Albert Camus had interpreted as a symbol of the existential
fate of modern man. In this Greek myth the hero pushes a boulder up a hill
for all eternity. Just as he is about to reach the summit and freed of his
burden, the boulder comes tumbling down on him. For Camus, this represents
the failure of 20th century man to achieve deliverance from the oppressive
social and economic forces that control him. Even ideologies like Marxism
that promised freedom only served to erect new barriers.

Although the film resonates with such overarching philosophical concerns,
you have to turn to Abbey's novel to find their full expression, especially
the scene in which Jack explains his decision to break jail to Paul's wife
Jerry.

---
"You say you're going to hide for a few days-what does that mean? What
then? Where will you go?"

Burns ate heartily; a touch of egg adorned his beard. "I can go north, west
or south. Winters comin so I guess I'll go south: Chihuahua or maybe
Sonora, dependin on how things look."

"What will you do down there?"

"I dunno. Just live, I guess." He swabbed his plate with a piece of bread.
"I like Mexico-it's a good clean honest sorta country. I have friends there."

"But Jack-" Jerry hesitated. "You'll be back, won't you?"

"Sure. When I'm nothin but a face on the postoffice wall I'll come
a-sneakin back. You'll see me comin down across the mesa out there some
evening when things are peaceful."

"Don't talk to me like that. You know you can't go on like this-you're in
the Twentieth Century now."

"I don't tune my life to the numbers on a calendar."

"That's ridiculous, Jack. You're a social animal, whether you like it or
not. You've got to make some concessions-or they'll hunt you down like a...
like a... What do people hunt down nowadays?"

"Coyotes," Burns said. "With cyanide guns." He finished his coffee and
wiped his mouth. "I better get a move on."
---

Another important distinction between the novel and the film is that both
Paul and Jack are self-professed anarchists in the novel. Although Jack is
not prone to discuss politics, it is clear that his political beliefs
underpin his unquenchable desire for personal freedom. His friend Paul is
much more the ideologue, who is in jail not for harboring undocumented
workers but for refusing to register with the draft in 1948. Despite having
served in the military during WWII, both Paul and Jack feel that a
peacetime draft is the first step toward militarizing American society.
They were right, of course.

Abbey's anarchistic defense of personal freedom and pristine wilderness
made him a hero to the deep ecology movement, especially the wing that used
sabotage against the bulldozers and other mechanized instruments of
"development." His 1975 novel "The Monkey Wrench Gang" amounted to a
manifesto of Earth First activism. To defend the American West against a
Big Government/Big Business, a cabal of rugged individualists choose to
throw a monkey wrench into the machinery creating roads, dams, bridges and
other dubious symbols of civilization.

This movement continues to this day and makes up a substantial part of the
anti-WTO protests that reverberate out of Seattle. On reflection, the
anarchists appear to evoke certain themes found in Abbey's literature
beyond a hatred for out-of-control development. Namely, they seem to be in
love with the notion of the beautiful loser embodied in Jack Burns's
Sisyphean bid for freedom. Anarchism, unlike Marxism, seems less interested
in strategies for victory but more in dramatic gestures that evoke personal
refusal to go along with the status quo, no matter the price. For
anarchists, key historical events seem to be more about defeat than
victory. While Marxists commemorate October 1917, the anarchists are
fixated on the defeat of the Kronstadt rebellion or the Spanish Republic.
(This is something of a mystery to me since I believe that socialism must
be built on victories rather than defeat. In months to come I plan to
explore some of these questions as they relate more directly to anarchist
ideology.)

The other thing to keep in mind is that the deep ecology movement's pursuit
of aboriginal purity has led it to sometimes embrace dubious notions
bordering on xenophobia. While Abbey, who played a bit part as a cop in
"Lonely are the Brave", seemed to have no objection to Paul being
transformed from an anarchist draft resister into a comrade of undocumented
workers, he would eventually take an entirely different attitude toward
immigration issues. He wrote, "It would be wise for us as American citizens
to consider calling a halt to the mass influx of even more millions of
hungry, ignorant, unskilled, culturally, generally impoverished people."
This kind of anarchism seems to fit in neatly with the anti-immigration
agenda of such mainstream outfits as the Sierra Club and the Worldwatch
Institute.

Finally, it is worth considering how the logic of the lone rebel can be
driven to the extreme when detached from underlying questions of class.
After all, the plot of Sylvester Stallone's "First Blood" has many
similarities with "Lonely are the Brave." After Rambo breaks out of jail,
he manages not only to avoid capture by a posse, he shoots down a
helicopter in a scene that is practically stolen from the original. With
Alexander Cockburn's flirtation with the militias, these sorts of questions
take on a genuine immediacy.

Louis Proyect
Marxism mailing list: http://www.marxmail.org

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
'use strict';

/* jasmine specs for controllers */

/* http://docs.angularjs.org/api/angular.mock.inject */

function make_project(key, subsecond) {
  return {
      'description': 'The project description',
      'key': key,
      'name': 'New project name',
      'orderby': 'test@example.com-2013-01-03T01:05:32.' + subsecond,
      'run_url': 'http://localhost:9200/?_mimic_project=' + key,
  };
}

describe('AlertController', function() {

  var scope, ctrl, Alert;

  beforeEach(module('playgroundApp.services'));

  beforeEach(inject(function($rootScope, _Alert_, $controller) {
    scope = $rootScope.$new();
    ctrl = $controller(AlertController, {$scope: scope});
    Alert = _Alert_;
  }));

  it('should always show safety alert', function() {
    expect(scope.alerts().length).toBe(1);
    expect(scope.alerts()[0].msg)
      .toMatch(/Your private source code and data are not safe here./);
  });

  it('should be able to remove an alert', function() {
    scope.closeAlert(0);
    expect(scope.alerts().length).toBe(0);
  });

});

describe('HeaderController', function() {

  var scope, $httpBackend, $location;

  beforeEach(inject(function($rootScope, $injector) {
    scope = $rootScope.$new();
    //$httpBackend = $injector.get('$httpBackend');
  }));

  beforeEach(inject(function(_$location_) {
    doInit();
    $location = _$location_;
  }));

  function doInit() {
    inject(function($controller) {
      $controller(HeaderController, {$scope: scope});
      flushDoSerial();
      //$httpBackend.flush();
    });
  }

  it('alreadyhome function should only return true for /playground/',
     function() {
       expect(typeof scope.alreadyhome).toEqual('function');

       $location.path('/');
       expect(scope.alreadyhome()).toBe(false);
       $location.path('/playground');
       expect(scope.alreadyhome()).toBe(false);
       $location.path('/playground/');
       expect(scope.alreadyhome()).toBe(true);
       $location.path('/playground/p/42/');
       expect(scope.alreadyhome()).toBe(false);
     });

});

describe('ProjectController', function() {

  var scope, $httpBackend;

  function make_file(filename, mime_type, contents, dirty) {
    var file = {
        'path': filename,
        'mime_type': mime_type,
    };
    if (contents) {
      file.contents = contents;
    }
    if (dirty != undefined) {
      file.dirty = dirty;
    }
    return file;
  }

  function make_files_response() {
    return [
        make_file('app.yaml', 'text/x-yaml'),
        make_file('favicon.ico', 'image/x-icon'),
        make_file('main.py', 'text/x-python'),
    ];
  }

  function make_files_data() {
    return {
        // Contents of first file fetched during controller initialization
        'app.yaml': make_file('app.yaml', 'text/x-yaml', 'one: two', false),
        'favicon.ico': make_file('favicon.ico', 'image/x-icon'),
        'main.py': make_file('main.py', 'text/x-python'),
    };
  }

  beforeEach(module(function($provide) {
    // TODO: DETERMINE truth of 'there has to be a better way'
    $provide.factory('$window', function() {
      var $window = {
        document: {},
        navigator: {},
      };
      return $window;
    });
  }));

  beforeEach(module('playgroundApp.services'));

  beforeEach(module('mocks.dialog'));

  beforeEach(inject(function($browser) {
    $browser.url('http://localhost:8080/playground/p/76/');
  }));

  beforeEach(inject(function($rootScope, $injector, $window) {
    scope = $rootScope.$new();

    // TODO: extract config into service and inject into parent and
    // child controllers
    scope.config = {
        'PLAYGROUND_USER_CONTENT_HOST': 'localhost:9100',
    };
    scope.projects = [
        make_project(76),
    ];

    $httpBackend = $injector.get('$httpBackend');

    // TODO: DETERMINE if there's a better way to test JavaScript
    // functions which are expected to exist thanks to script tags
    $window.CodeMirror = jasmine.createSpy('CodeMirror').andReturn(
      jasmine.createSpyObj(
        'CodeMirror',
        ['getWrapperElement', 'setValue', 'setOption', 'focus', 'on'])
    );

    $httpBackend
    .whenGET('//localhost:9100/_ah/mimic/dir?_mimic_project=76')
    .respond(make_files_response());

    $httpBackend
    .whenGET('//localhost:9100/_ah/mimic/file?_mimic_project=42&path=app.yaml')
    .respond('one: two');

    $httpBackend
    .whenGET('//localhost:9100/_ah/mimic/file?_mimic_project=76&path=app.yaml')
    .respond('one: two');
  }));

  beforeEach(inject(function($routeParams) {
    $routeParams.project_id = '76';
  }));

  afterEach(function() {
    flushDoSerial();
    $httpBackend.verifyNoOutstandingExpectation();
    $httpBackend.verifyNoOutstandingRequest();
  });

  function doInit() {
    inject(function($controller) {
      $controller(ProjectController, {$scope: scope});
      flushDoSerial();
      $httpBackend.flush();
    });
  }

  describe('initialization', function() {

    // TODO: DETERMINE if there's a better way to ensure that
    // $routeParams is populated
    it('should set $scope.project to the project identified by ' +
       '$routeParams.project_id', inject(function($routeParams) {
      var project = make_project(76);
      scope.projects = [make_project(17), project, make_project(13)];
      expect(scope.projects[1]).toBe(project);
      expect(scope.project).toBeUndefined();
      doInit();
      expect(scope.project).toBe(project);
    }));

    it('should call $scope._list_files()',
       inject(function($controller, DoSerial) {
         spyOn(DoSerial, 'then').andCallThrough();
         expect(DoSerial.then).not.toHaveBeenCalled();
         doInit();
         expect(DoSerial.then).toHaveBeenCalledWith(scope._list_files);
       }));

    it('should call $scope._select_first_file()',
       inject(function($controller, DoSerial) {
         spyOn(DoSerial, 'then').andCallThrough();
         expect(DoSerial.then).not.toHaveBeenCalled();
         doInit();
         dump(scope);
         expect(DoSerial.then).toHaveBeenCalledWith(scope._select_first_file);
       }));

  });

  describe('runtime behavior', function() {

    beforeEach(function() {
      doInit();
    });

    describe('no_json_transform function', function() {

      it('should provide the identity transform', function() {
        var data = 'foo';
        expect(scope.no_json_transform(data)).toBe(data);
        expect(scope.no_json_transform(data)).toEqual('foo');
        data = '[1,2,3]';
        expect(scope.no_json_transform(data)).toBe(data);
        expect(scope.no_json_transform(data)).toEqual('[1,2,3]');
        data = undefined;
        expect(scope.no_json_transform(data)).toBe(undefined);
        data = null;
        expect(scope.no_json_transform(data)).toBe(null);
        data = Error('x');
        expect(scope.no_json_transform(data)).toEqual(Error('x'));
        expect(scope.no_json_transform(data)).toBe(data);
      });

    });

    describe('is_image_mime_type function', function() {

      it('should return true for "image/*" MIME types', function() {
        expect(scope.is_image_mime_type('image/png')).toBe(true);
        expect(scope.is_image_mime_type('image/gif')).toBe(true);
        expect(scope.is_image_mime_type('image')).toBe(false);
        expect(scope.is_image_mime_type('text/plain')).toBe(false);
        expect(scope.is_image_mime_type('text/png')).toBe(false);
        expect(scope.is_image_mime_type('application/octet-stream'))
          .toBe(false);
      });

    });

    describe('url_of function', function() {

      it('should return //localhost:9100/_ah/mimic/file?_mimic_project=' +
         ':project_id&path=:filename', inject(function($window) {
           var png = make_file('logo.png', 'image/png');
           // TODO: DETERMINE how to avoid localhost:9100
           expect(scope.url_of('file', {path: png.path}))
             .toEqual('//localhost:9100/_ah/mimic/file?_mimic_project=76' +
                      '&path=logo.png');
         }));

    });

    describe('image_url_of function', function() {

      it('should return emtpty string when no file is given', function() {
        expect(scope.image_url_of()).toEqual('');
        expect(scope.image_url_of(null)).toEqual('');
      });

      it('should return empty string for none "image/*" MIME types ',
         function() {
           expect(scope.image_url_of(make_file('filename', 'text/html')))
             .toEqual('');
         });

      it('should pass through to url_of() for "image/*" MIME types ',
         function() {
           var png = make_file('filename', 'image/png');
           var file_url = scope.url_of('file', {path: png.path});
           expect(scope.image_url_of(png)).toBe(file_url);
         });

    });

    describe('_get function', function() {

      it('should call success_cb when file has contents', function() {
        var success_cb = jasmine.createSpy();
        var file = make_file('app.yaml', 'text/x-yaml', 'version: 1');
        scope._get(file, success_cb);
        expect(success_cb).toHaveBeenCalledWith();
      });

      it('should call success_cb when file has no contents', function() {
        var success_cb = jasmine.createSpy();
        var file = make_file('app.yaml', 'text/x-yaml');
        expect(file.contents).toBeUndefined();
        expect(file.hasOwnProperty('contents')).toBe(false);
        $httpBackend.expectGET(scope.url_of('file', {path: file.path}))
          .respond('foo: bar');
        scope._get(file, success_cb);
        $httpBackend.flush();
        expect(file.contents).toEqual('foo: bar');
        expect(success_cb).toHaveBeenCalledWith();
      });

      it('should not overwrite file contents regardless of dirty flag',
         function() {
           var noop = function() {};
           var file = make_file('app.yaml', 'text/x-yaml', 'version: 1');
           scope._get(file, noop);
           expect(file.dirty).not.toBeDefined();
           expect(file.hasOwnProperty('dirty')).toBe(false);
           expect(file.contents).toEqual('version: 1');
           file.dirty = true;
           scope._get(file, noop);
           expect(file.contents).toEqual('version: 1');
           file.dirty = false;
           scope._get(file, noop);
           expect(file.contents).toEqual('version: 1');
         });

      it('should set file.dirty=false after fetching contents', function() {
        var success_cb = jasmine.createSpy();
        var file = make_file('app.yaml', 'text/x-yaml');
        expect(file.contents).toBeUndefined();
        expect(file.hasOwnProperty('contents')).toBe(false);
        expect(file.dirty).toBe(undefined);
        $httpBackend.expectGET(scope.url_of('file', {path: file.path}))
          .respond('version: bar');
        scope._get(file, success_cb);
        $httpBackend.flush();
        expect(file.contents).toEqual('version: bar');
        expect(file.dirty).toBe(false);
      });

      it('should HTTP GET missing file contents', function() {
        var success_cb = jasmine.createSpy();
        var file = make_file('app.yaml', 'text/x-yaml');
        $httpBackend.expectGET(scope.url_of('file', {path: file.path}))
          .respond('x: y');
        expect(file.contents).toBeUndefined();
        scope._get(file, success_cb);
        $httpBackend.flush();
        expect(file.contents).toEqual('x: y');
      });

    });

    describe('_list_files function', function() {

      function make_plain_file() {
        return make_file('foo.txt', 'text/plain');
      }

      it('should call //localhost:9100/_ah/mimic/dir?_mimic_project=' +
         ':project_id', function() {
           $httpBackend.verifyNoOutstandingRequest();
           $httpBackend.verifyNoOutstandingExpectation();
           expect(scope.files).toEqual(make_files_data());
           $httpBackend
             .expectGET('//localhost:9100/_ah/mimic/dir?_mimic_project=76')
             .respond([make_plain_file()]);
           scope.files = null;
           scope._list_files();
           $httpBackend.flush();
           expect(scope.files).toEqual({'foo.txt': make_plain_file()});
         });

    });

    describe('select_file function', function() {

      describe('with "image/*" MIME types', function() {

        function make_image_file() {
          return make_file('foo.png', 'image/png');
        }

        it('should set $scope.current_file', function() {
          scope.current_file = undefined;
          scope.select_file(make_image_file());
          expect(scope.current_file).toEqual(make_image_file());
        });

        it('should return undefined', function() {
          var result = scope.select_file(make_image_file());
          expect(result).toBeUndefined();
        });

      });

      describe('with MIME types other than "image/*"', function() {

        function make_text_file() {
          return make_file('app.yaml', 'text/x-yaml', 'version: 1');
        }

        it('should set $scope.current_file', function() {
          scope.current_file = undefined;
          scope.select_file(make_text_file());
          flushDoSerial();
          expect(scope.current_file).toEqual(make_text_file());
        });

      });

    });

    describe('_select_first_file function', function() {

      it('should call $scope.select_file(:first_file)', function() {
        doInit();
        scope.select_file = jasmine.createSpy();
        var expected_file = make_file('app.yaml', 'text/x-yaml', 'one: two',
                                      false);
        expect(scope.select_file).not.toHaveBeenCalled();
        scope._select_first_file();
        expect(scope.select_file).toHaveBeenCalledWith(expected_file);
      });

    });

    describe('dialog tests', function() {
      var dialogMock;

      beforeEach(inject(function($dialog) {
        doInit();
        dialogMock = $dialog;
      }));

      describe('prompt_new_file function', function() {
        it('should call $scope.insert_path(path)', function() {
          scope.insert_path = jasmine.createSpy();
          dialogMock.dialogShouldBeCalledWith({
            controller: 'NewFileController',
            templateUrl: '/playground/new_file_modal.html'
          });
          dialogMock.willCloseWith('test_file.py');
          scope.prompt_new_file();
          expect(scope.insert_path).toHaveBeenCalledWith('test_file.py');
        });
      });

    });

  });

});

describe('PageController', function() {

  var scope, $httpBackend;

  function doInit() {
    inject(function($controller) {
      $controller(PageController, {$scope: scope});
      flushDoSerial();
      $httpBackend.flush();
    });
  }

  beforeEach(module('mocks.dialog'));

  beforeEach(module('playgroundApp.services'));

  beforeEach(inject(function($rootScope, $injector) {
    scope = $rootScope.$new();
    $httpBackend = $injector.get('$httpBackend');

    $httpBackend
    .whenGET('/playground/getconfig')
    .respond({
        'PLAYGROUND_USER_CONTENT_HOST': 'localhost:9100',
        'email': 'user_q0inuf3vs5',
        'git_playground_url': 'http://code.google.com/p/cloud-playground/',
        'is_admin': false,
        'is_logged_in': false,
        'playground_namespace': '_playground',
    });

    $httpBackend
    .whenGET('/playground/getprojects')
    .respond([]);

    $httpBackend
    .whenGET('/playground/gettemplateprojects')
    .respond([make_project(89), make_project(91)]);
  }));

  describe('initialization', function() {

    afterEach(function() {
      flushDoSerial();
      $httpBackend.verifyNoOutstandingExpectation();
      $httpBackend.verifyNoOutstandingRequest();
    });

    it('should, when instantiated, get configuration, then project data',
       function() {
         expect(scope.config).toBeUndefined();
         expect(scope.projects).toBeUndefined();
         $httpBackend.expectGET('/playground/getconfig');
         $httpBackend.expectGET('/playground/getprojects');
         doInit();
         expect(scope.config).toBeDefined();
         expect(scope.config.email).toBeDefined();
         expect(scope.config.playground_namespace).toBe('_playground');
         expect(scope.projects).toBeDefined();
         expect(scope.projects.length).toBe(0);
       });

    it('should get template projects', function() {
      expect(scope.template_projects).toBeUndefined();
      $httpBackend.expectGET('/playground/gettemplateprojects');
      doInit();
      expect(scope.template_projects).toBeDefined();
      expect(scope.template_projects.length).toBe(2);
      expect(scope.template_projects[0]).toEqual(make_project(89))
      expect(scope.template_projects[1]).toEqual(make_project(91))
    });

  });

  describe('runtion behavior', function() {

    beforeEach(function() {
      doInit();
    });

    describe('namespace function', function() {

      var routeParams;

      beforeEach(inject(function($routeParams) {
        scope.config = {};
        routeParams = $routeParams;
        routeParams.project_id = undefined;
      }));

      it('should have no default', function() {
        expect(scope.namespace()).toBeUndefined();
      });

      it('should use $routeParams project_id', function() {
        expect(scope.namespace()).toBeUndefined();
        routeParams.project_id = 'route_param';
        expect(scope.namespace()).toBe('route_param');
      });

      it('should use $scope.config.playground_namespace', function() {
        expect(scope.namespace()).toBeUndefined();
        scope.config.playground_namespace = 'pg_namespace';
        expect(scope.namespace()).toBe('pg_namespace');
      });

      it('should prefer $routeParams to $scope.config', function() {
        expect(scope.namespace()).toBeUndefined();
        routeParams.project_id = 'route_param';
        scope.config.playground_namespace = 'pg_namespace';
        expect(scope.namespace()).toBe('route_param');
      });

    });

    describe('link functions', function() {

      var WindowService;

      beforeEach(inject(function($routeParams, _WindowService_) {
        $routeParams.project_id = 'some_namespace';
        WindowService = _WindowService_;
        spyOn(WindowService, 'open');
      }));

      describe('datastore_admin function', function() {

        it('should open new window to /playground/datastore/some_namespace',
           function() {
             expect(WindowService.open).not.toHaveBeenCalled();
             scope.datastore_admin();
             expect(WindowService.open).toHaveBeenCalledWith(
               '/playground/datastore/some_namespace', '_blank');
           });

      });

      describe('memcache_admin function', function() {

        it('should open new window to /playground/memcache/some_namespace',
           function() {
             expect(WindowService.open).not.toHaveBeenCalled();
             scope.memcache_admin();
             expect(WindowService.open).toHaveBeenCalledWith(
               '/playground/memcache/some_namespace', '_blank');
           });

      });

    });

  });

  describe('big_red_button function', function() {

    var $httpBackend, WindowService;

    beforeEach(inject(function(_$httpBackend_, _WindowService_) {
      $httpBackend = _$httpBackend_;
      WindowService = _WindowService_;
      spyOn(WindowService, 'reload');
      doInit();
      $httpBackend.expectPOST('/playground/nuke').respond();
    }));

    afterEach(function() {
      flushDoSerial();
    });

    it('should post /playground/nuke', function() {
      scope.big_red_button();
      $httpBackend.flush();
      expect(WindowService.reload).toHaveBeenCalled();
    });

  });

  describe('select_project function', function() {

    var $location;

    beforeEach(inject(function(_$location_) {
      $location = _$location_;
      doInit();
      $httpBackend
      .when('POST', '/playground/p/15/touch')
      .respond(make_project(15, 2));
    }));

    it('should call /playground/p/:project_id/touch', function() {
      var project = make_project(15, 1);
      scope.projects = [make_project(14, 1), project, make_project(16, 1),
                        make_project(17, 1)];
      expect(scope.projects[1]).toEqual(make_project(15, 1));
      expect($location.path()).toEqual('');
      scope.select_project(project);
      flushDoSerial();
      $httpBackend.flush();
      expect(scope.projects[1]).not.toEqual(make_project(15, 1));
      expect(scope.projects[1]).toEqual(make_project(15, 2));
      expect($location.path()).toEqual('/playground/p/15');
    });

  });

  describe('delete_project function', function() {

    var $httpBackend, $location;
    var project_to_delete = make_project(1, 12);

    beforeEach(inject(function(_$httpBackend_, _$location_) {
      $httpBackend = _$httpBackend_;
      $location = _$location_;
      doInit();
      scope.projects = [project_to_delete, make_project(2, 13)];
      scope.project = project_to_delete;
      $httpBackend
      .expectPOST('/playground/p/1/delete')
      .respond();
    }));

    it('should delete the project', function() {
      expect(scope.project).toBe(project_to_delete);
      scope.delete_project(project_to_delete);
      expect(scope.projects.length).toBe(2);
      $httpBackend.flush();
      expect(scope.project).toBe(undefined);
      expect(scope.projects.length).toBe(1);
      expect($location.path()).toBe('/playground/');
    });

  });

  describe('dialog tests', function() {

    var dialogMock;

    beforeEach(inject(function($dialog) {
      doInit();
      dialogMock = $dialog;
    }));

    describe('prompt_delete_project function', function() {

      var mockProject = {'name': 'test_project'};
      var title = 'Confirm project deletion';
      var msg = 'Are you sure you want to delete project "' +
        mockProject.name + '"?';
      var btns = [{result: false, label: 'Cancel'},
        {result: true, label: 'DELETE PROJECT',
          cssClass: 'btn btn-danger'}];

      it('should call $scope.delete_project()', function() {
        scope.delete_project = jasmine.createSpy();
        dialogMock.messageBoxShouldBeCalledWith(title, msg, btns);
        dialogMock.willCloseWith(true);

        scope.prompt_delete_project(mockProject);
        expect(scope.delete_project).toHaveBeenCalledWith(mockProject);
      });

      it('shouldn\'t call $scope.delete_project()', function() {
        scope.delete_project = jasmine.createSpy();
        dialogMock.messageBoxShouldBeCalledWith(title, msg, btns);
        dialogMock.willCloseWith(false);

        scope.prompt_delete_project(mockProject);
        expect(scope.delete_project).not.toHaveBeenCalled();
      });

    });

  });

});

describe('MainController', function() {

  var scope, $httpBackend;

  beforeEach(module('playgroundApp.services'));

  beforeEach(module(function($provide) {
    $provide.factory('$window', function() {
      return {
        location: { replace: jasmine.createSpy() },
        navigator: {},
      };
    });
  }));

  beforeEach(inject(function($rootScope, $injector) {
    scope = $rootScope.$new();
    scope.set_loaded = jasmine.createSpy('set_loaded');
    scope.projects = [];
    scope.template_projects = [make_project(12)];
    $httpBackend = $injector.get('$httpBackend');

    $httpBackend
    .whenGET('/playground/getprojects')
    .respond([]);
  }));

  afterEach(function() {
    flushDoSerial();
    $httpBackend.verifyNoOutstandingExpectation();
    $httpBackend.verifyNoOutstandingRequest();
  });

  function doInit() {
    inject(function($controller) {
      $controller(MainController, {$scope: scope});
      flushDoSerial();
      //$httpBackend.flush();
    });
  }

  describe('initialization', function() {

    it('should call $scope.set_loaded()', function() {
      doInit();
      expect(scope.set_loaded).toHaveBeenCalled();
    });

  });

  describe('runtime behavior', function() {

    var $location;

    beforeEach(inject(function(_$location_) {
      doInit();
      $location = _$location_;
    }));

    describe('login function', function() {

      it('should navigate to /playground/login', inject(function($window) {
        expect($window.location.replace).not.toHaveBeenCalled();
        scope.login();
        expect($window.location.replace)
          .toHaveBeenCalledWith('/playground/login');
        // TODO: expect(Browser.url()).toEqual(....)
      }));

    });

    describe('new_project function', function() {

      beforeEach(function() {
        $httpBackend
        .when('POST', '/playground/p/12/copy')
        .respond(make_project(42, 1));
      });

      it('should call /playground/p/12/copy', inject(function() {
        expect(scope.projects).toBeDefined();
        expect(scope.template_projects).toBeDefined();
        expect(scope.template_projects.length).toBeGreaterThan(0);
        $httpBackend.expectPOST('/playground/p/12/copy');
        scope.new_project(scope.template_projects[0]);
        flushDoSerial();
        $httpBackend.flush();
        expect(scope.projects.length).toBe(1);
        expect(scope.projects[0].key).toBe(42);
        expect(scope.projects[0].name).toBe('New project name');
      }));

    });

  });

});


text:
namespace chrome {

namespace {

const char kImageCaptureDeviceId[] = "ic:xyz";

}  // namespace

using content::BrowserThread;

class MediaStorageUtilTest : public testing::Test {
 public:
  MediaStorageUtilTest()
        : ui_thread_(BrowserThread::UI, &message_loop_),
          file_thread_(BrowserThread::FILE) {}
  virtual ~MediaStorageUtilTest() { }

  // Verify mounted device type.
  void CheckDeviceType(const base::FilePath& mount_point,
                       bool expected_val) {
    if (expected_val)
      EXPECT_TRUE(MediaStorageUtil::HasDcim(mount_point));
    else
      EXPECT_FALSE(MediaStorageUtil::HasDcim(mount_point));
  }

  void ProcessAttach(const std::string& id,
                     const string16& name,
                     const base::FilePath::StringType& location) {
    StorageInfo info(id, name, location, string16(), string16(), string16(), 0);
    monitor_.receiver()->ProcessAttach(info);
  }

 protected:
  // Create mount point for the test device.
  base::FilePath CreateMountPoint(bool create_dcim_dir) {
    base::FilePath path(scoped_temp_dir_.path());
    if (create_dcim_dir)
      path = path.Append(kDCIMDirectoryName);
    if (!file_util::CreateDirectory(path))
      return base::FilePath();
    return scoped_temp_dir_.path();
  }

  virtual void SetUp() OVERRIDE {
    ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir());
    file_thread_.Start();
  }

  virtual void TearDown() {
    WaitForFileThread();
  }

  static void PostQuitToUIThread() {
    BrowserThread::PostTask(BrowserThread::UI,
                            FROM_HERE,
                            base::MessageLoop::QuitClosure());
  }

  static void WaitForFileThread() {
    BrowserThread::PostTask(BrowserThread::FILE,
                            FROM_HERE,
                            base::Bind(&PostQuitToUIThread));
    base::MessageLoop::current()->Run();
  }

  base::MessageLoop message_loop_;

 private:
  chrome::test::TestStorageMonitor monitor_;
  content::TestBrowserThread ui_thread_;
  content::TestBrowserThread file_thread_;
  base::ScopedTempDir scoped_temp_dir_;
};

// Test to verify that HasDcim() function returns true for the given media
// device mount point.
TEST_F(MediaStorageUtilTest, MediaDeviceAttached) {
  // Create a dummy mount point with DCIM Directory.
  base::FilePath mount_point(CreateMountPoint(true));
  BrowserThread::PostTask(
      BrowserThread::FILE, FROM_HERE,
      base::Bind(&MediaStorageUtilTest::CheckDeviceType,
                 base::Unretained(this), mount_point, true));
  message_loop_.RunUntilIdle();
}

// Test to verify that HasDcim() function returns false for a given non-media
// device mount point.
TEST_F(MediaStorageUtilTest, NonMediaDeviceAttached) {
  // Create a dummy mount point without DCIM Directory.
  base::FilePath mount_point(CreateMountPoint(false));
  BrowserThread::PostTask(
      BrowserThread::FILE, FROM_HERE,
      base::Bind(&MediaStorageUtilTest::CheckDeviceType,
                 base::Unretained(this), mount_point, false));
  message_loop_.RunUntilIdle();
}

TEST_F(MediaStorageUtilTest, CanCreateFileSystemForImageCapture) {
  EXPECT_TRUE(MediaStorageUtil::CanCreateFileSystem(kImageCaptureDeviceId,
                                                    base::FilePath()));
  EXPECT_FALSE(MediaStorageUtil::CanCreateFileSystem(
      "dcim:xyz", base::FilePath(FILE_PATH_LITERAL("relative"))));
  EXPECT_FALSE(MediaStorageUtil::CanCreateFileSystem(
      "dcim:xyz", base::FilePath(FILE_PATH_LITERAL("../refparent"))));
}

TEST_F(MediaStorageUtilTest, DetectDeviceFiltered) {
  MediaStorageUtil::DeviceIdSet devices;
  devices.insert(kImageCaptureDeviceId);

  base::WaitableEvent event(true, false);
  base::Closure signal_event =
      base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event));

  // We need signal_event to be executed on the FILE thread, as the test thread
  // is blocked. Therefore, we invoke FilterAttachedDevices on the FILE thread.
  BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
                          base::Bind(&MediaStorageUtil::FilterAttachedDevices,
                                     base::Unretained(&devices), signal_event));
  event.Wait();
  EXPECT_FALSE(devices.find(kImageCaptureDeviceId) != devices.end());

  ProcessAttach(kImageCaptureDeviceId, ASCIIToUTF16("name"),
                FILE_PATH_LITERAL("/location"));
  devices.insert(kImageCaptureDeviceId);
  event.Reset();
  BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
                          base::Bind(&MediaStorageUtil::FilterAttachedDevices,
                                     base::Unretained(&devices), signal_event));
  event.Wait();

  EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end());
}

}  // namespace chrome


text:
//Linkedin Prototype0. In this below REST API's are created using Nodejs and database as RDS and
//DynamoBD on the AWS. Authentication has to be done using the secret key and region mentioned in the app.config and
//app.config1 files.
var express = require('express');
var passport = require('passport');
var session = require('express-session');
var flash = require('connect-flash');
var path = require('path');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var favicon = require('serve-favicon');
var logger = require('morgan');
var http = require('http');
var fs = require('fs');
var AWS = require('aws-sdk');

//INITIALIZE MYSQL DB
/*
var mySQL = require('./config/mySqlQuery');

mySQL.useDatabase(function(err, flag){

    if(err)
    {
        Console.log('App error ' + err);
    }
    if(flag)
    {
       Console.log('Db phase1');

    }

});

mySQL.createTable1(function(err, flag)
        {
           if(err)
           {
               Console.log('App error ' + err);
           }
            if(flag)
            {
                    Console.log('Db phase2');
            }

});

mySQL.createTable2(function(err, flag){

        if(err)
        {
            Console.log('App error ' + err);
        }
        if(flag)
        {
             Console.log('Db phase3');

        }
});
*/

var app = express();

//var routes = require('./routes');
//var user = require('./routes/userprofile');
//var company = require('./routes/companyprofile');
var authroutes = require('./routes/authroutes');

//import passport function
require('./config/passportAuth').passportAuth(passport);
require('./config/passportAuthCompany').passportAuthCompany(passport);

//app.set('port', process.env.PORT || 8082);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

// uncomment after placing your favicon in /public
//app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

//app.use(app.router);

app.use(session({ secret: 'ilovescotchscotchyscotchscotch' })); // session secret
app.use(flash()); // use connect-flash for flash messages stored in session

// required for passport
app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions

app.locals.theme = process.env.THEME; //Make the THEME environment variable available to the app.

//Create SNS(Simple notification Service) client and pass in region.
//var sns = new AWS.SNS({ region: config.AWS_REGION});

//mongodb connection
var mongoconn = require("./routes/mongoConnection");
mongoconn.createMongoConnection();

/*
//GET home page.
app.get('/', routes.index);

//POST signup form.
//app.post('/signup', user.signup);

//profile edit page.
app.get('/editProfile',user.viewProfile);

//UserProfile page
app.get('/userprofile',user.getProfile);

//Companyprofile page
//app.get('/companyprofile',company.getProfile);

//Job posting to store the data in DynamoDB and below are the fields chosen for the same.
app.post('/jobpost',user.jobposts);

//Company profile information and job posting details of the company
app.post('/companyProfile',company.postCompany);

//save profile info for users
app.post('/userProfile',user.postProfile);
*/

//register authentication routes
app.use('/', authroutes);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  var err = new Error('Not Found');
  err.status = 404;
  next(err);
});

// error handlers

// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
  app.use(function(err, req, res, next) {
    res.status(err.status || 500);
    res.send({
      message: err.message,
      error: err
    });
  });
}

// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
  res.status(err.status || 500);
  res.send({
    message: err.message,
    error: {}
  });
});

//process.on('uncaughtException', function(err){

   // console.log("ERROR LOGGED : " + err);

//})

module.exports = app;


text:
<?php

namespace Oro\Component\ChainProcessor;

/**
 * This applicable checker allows to use processor attributes to manage processors to be executed.
 * For example if you need to execute some processor only for specified entity type,
 * you can add 'class' attribute to this processor. As result it will be executed only if
 * a value of the 'class' attribute is equal of a value of 'class' attribute in the Context.
 * When several attributes are defined for a processor, it will be executed only if
 * values all of these attributes are equal to the corresponding attributes in the Context.
 */
class MatchApplicableChecker implements ApplicableCheckerInterface
{
    const OPERATOR_AND = '&';
    const OPERATOR_OR  = '|';
    const OPERATOR_NOT = '!';

    /** @var string[] */
    protected $ignoredAttributes;

    /**
     * @param string[] $ignoredAttributes
     */
    public function __construct(array $ignoredAttributes = ['group'])
    {
        $this->ignoredAttributes = $ignoredAttributes;
    }

    /**
     * @param string $attribute
     */
    public function addIgnoredAttribute($attribute)
    {
        $this->ignoredAttributes[] = $attribute;
    }

    /**
     * {@inheritdoc}
     */
    public function isApplicable(ContextInterface $context, array $processorAttributes)
    {
        $result = self::APPLICABLE;
        foreach ($processorAttributes as $name => $value) {
            if (in_array($name, $this->ignoredAttributes, true)
                || (!is_scalar($value) && !is_array($value))
            ) {
                continue;
            }
            if (!$context->has($name)) {
                $result = self::ABSTAIN;
            } elseif (!$this->isMatch($value, $context->get($name), $name)) {
                $result = self::NOT_APPLICABLE;
                break;
            }
        }

        return $result;
    }

    /**
     * Checks if a value of a processor attribute matches a corresponding value from the context
     *
     * @param mixed  $value        Array or Scalar
     * @param mixed  $contextValue Array or Scalar
     * @param string $name         The name of an attribute
     *
     * @return bool
     */
    protected function isMatch($value, $contextValue, $name)
    {
        if ($contextValue instanceof ToArrayInterface) {
            return $this->isMatchAnyInArray($value, $contextValue->toArray(), $name);
        }

        return is_array($contextValue)
            ? $this->isMatchAnyInArray($value, $contextValue, $name)
            : $this->isMatchAnyWithScalar($value, $contextValue, $name);
    }

    /**
     * @param mixed  $value        Array or Scalar
     * @param mixed  $contextValue Array
     * @param string $name         The name of an attribute
     *
     * @return bool
     */
    protected function isMatchAnyInArray($value, $contextValue, $name)
    {
        if (!is_array($value)) {
            return $this->isMatchScalarInArray($value, $contextValue, $name);
        }

        switch (key($value)) {
            case self::OPERATOR_NOT:
                return !$this->isMatchScalarInArray(current($value), $contextValue, $name);
            case self::OPERATOR_AND:
                $result = true;
                foreach (current($value) as $val) {
                    if (!$this->isMatchScalarWithArray($val, $contextValue, $name)) {
                        $result = false;
                        break;
                    }
                }

                return $result;
            case self::OPERATOR_OR:
                $result = false;
                foreach (current($value) as $val) {
                    if ($this->isMatchScalarWithArray($val, $contextValue, $name)) {
                        $result = true;
                        break;
                    }
                }

                return $result;
        }

        return false;
    }

    /**
     * @param mixed  $value        Scalar or ['!' => Scalar]
     * @param mixed  $contextValue Array
     * @param string $name         The name of an attribute
     *
     * @return bool
     */
    protected function isMatchScalarWithArray($value, $contextValue, $name)
    {
        if (!is_array($value)) {
            return $this->isMatchScalarInArray($value, $contextValue, $name);
        }

        return self::OPERATOR_NOT === key($value)
            ? !$this->isMatchScalarInArray(current($value), $contextValue, $name)
            : false;
    }

    /**
     * @param mixed  $value        Scalar
     * @param mixed  $contextValue Array
     * @param string $name         The name of an attribute
     *
     * @return bool
     */
    protected function isMatchScalarInArray($value, $contextValue, $name)
    {
        return in_array($value, $contextValue, true);
    }

    /**
     * @param mixed  $value        Array or Scalar
     * @param mixed  $contextValue Scalar
     * @param string $name         The name of an attribute
     *
     * @return bool
     */
    protected function isMatchAnyWithScalar($value, $contextValue, $name)
    {
        if (!is_array($value)) {
            return $this->isMatchScalars($value, $contextValue, $name);
        }

        switch (key($value)) {
            case self::OPERATOR_NOT:
                return !$this->isMatchScalars(current($value), $contextValue, $name);
            case self::OPERATOR_AND:
                $result = true;
                foreach (current($value) as $val) {
                    if (!$this->isMatchScalarWithScalar($val, $contextValue, $name)) {
                        $result = false;
                        break;
                    }
                }

                return $result;
            case self::OPERATOR_OR:
                $result = false;
                foreach (current($value) as $val) {
                    if ($this->isMatchScalarWithScalar($val, $contextValue, $name)) {
                        $result = true;
                        break;
                    }
                }

                return $result;
        }

        return false;
    }

    /**
     * @param mixed  $value        Scalar or ['!' => Scalar]
     * @param mixed  $contextValue Scalar
     * @param string $name         The name of an attribute
     *
     * @return bool
     */
    protected function isMatchScalarWithScalar($value, $contextValue, $name)
    {
        if (!is_array($value)) {
            return $this->isMatchScalars($value, $contextValue, $name);
        }

        return self::OPERATOR_NOT === key($value)
            ? !$this->isMatchScalars(current($value), $contextValue, $name)
            : false;
    }

    /**
     * @param mixed  $value        Scalar
     * @param mixed  $contextValue Scalar
     * @param string $name         The name of an attribute
     *
     * @return bool
     */
    protected function isMatchScalars($value, $contextValue, $name)
    {
        return $contextValue === $value;
    }
}


text:
package org.apache.sling.tooling.lc;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import org.apache.sling.maven.projectsupport.BundleListUtils;
import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
import org.apache.sling.provisioning.model.Artifact;
import org.apache.sling.provisioning.model.Model;
import org.apache.sling.provisioning.model.ModelUtility;
import org.apache.sling.provisioning.model.io.ModelReader;
import org.apache.sling.tooling.lc.aether.AetherSetup;
import org.apache.sling.tooling.lc.aether.ArtifactKey;
import org.apache.sling.tooling.lc.aether.Artifacts;
import org.apache.sling.tooling.lc.aether.VersionChange;
import org.apache.sling.tooling.lc.jira.IssueFinder;
import org.apache.sling.tooling.lc.svn.SvnChangeLogFinder;
import org.tmatesoft.svn.core.SVNException;

import com.google.common.collect.Sets;

public class LaunchpadComparer {

    private static final Pattern JIRA_KEY_PATTERN = Pattern.compile("^(SLING-\\d+).*");

    private final String firstVersion;
    private final String secondVersion;

    public LaunchpadComparer(String firstVersion, String secondVersion) {
        this.firstVersion = firstVersion;
        this.secondVersion = secondVersion;
    }

    public void run() throws Exception {

        System.out.format("Computing differences between Launchpad versions %s and %s...%n",
                firstVersion, secondVersion);

        // 1. download artifacts
        AetherSetup aether = new AetherSetup();

        File fromFile = aether.download(Artifacts.launchpadCoordinates(firstVersion));
        File toFile = aether.download(Artifacts.launchpadCoordinates(secondVersion));

        // 2. parse artifact definitions
        Model model;
        try (BufferedReader reader = Files.newBufferedReader(toFile.toPath())) {
            model = ModelUtility.getEffectiveModel(ModelReader.read(reader, null));
        }

        Map<ArtifactKey, Artifact> to = model.getFeatures().stream()
            .flatMap( f -> f.getRunModes().stream())
            .flatMap( r -> r.getArtifactGroups().stream())
            .flatMap( g -> StreamSupport.stream(g.spliterator(), false))
            .collect(Collectors.toMap( a -> new ArtifactKey(a), Function.identity()));

        BundleList readBundleList = BundleListUtils.readBundleList(fromFile);

        Map<ArtifactKey, Artifact> from = readBundleList.getStartLevels().stream()
            .flatMap( sl -> sl.getBundles().stream() )
            .collect(Collectors.toMap( b -> new ArtifactKey(b), LaunchpadComparer::newArtifact));

        // 3. generate added / removed / changed
        Set<Artifact> removed = Sets.difference(from.keySet(), to.keySet()).stream()
            .map( k -> from.get(k))
            .collect(Collectors.toSet());

        Set<Artifact> added = Sets.difference(to.keySet(), from.keySet()).stream()
                .map( k -> to.get(k))
                .collect(Collectors.toSet());

        Map<ArtifactKey, VersionChange> changed = to.values().stream()
                .filter( k -> !added.contains(k) && !removed.contains(k))
                .map( k -> new ArtifactKey(k))
                .filter( k -> !Objects.equals(to.get(k).getVersion(), from.get(k).getVersion()))
                .collect(Collectors.toMap( Function.identity(), k -> new VersionChange(from.get(k).getVersion(), to.get(k).getVersion())));

        // 4. output changes

        System.out.println("Added ");
        added.stream().sorted().forEach(LaunchpadComparer::outputFormatted);

        System.out.println("Removed ");
        removed.stream().sorted().forEach(LaunchpadComparer::outputFormatted);

        System.out.println("Changed");
        changed.entrySet().stream()
            .sorted( (a, b) -> a.getKey().compareTo(b.getKey()) )
            .forEach(LaunchpadComparer::outputFormatted);

    }

    private static Artifact newArtifact(Bundle bundle) {

        return new Artifact(bundle.getGroupId(), bundle.getArtifactId(), bundle.getVersion(), bundle.getClassifier(), bundle.getType());
    }

    private static void outputFormatted(Artifact a) {

        System.out.format("    %-30s : %-55s : %s%n", a.getGroupId(), a.getArtifactId(), a.getVersion());

    }

    private static void outputFormatted(Map.Entry<ArtifactKey, VersionChange> e) {

        ArtifactKey artifact = e.getKey();
        VersionChange versionChange = e.getValue();

        System.out.format("    %-30s : %-55s : %s -> %s%n", artifact.getGroupId(), artifact.getArtifactId(), versionChange.getFrom(), versionChange.getTo());

        if ( !artifact.getGroupId().equals("org.apache.sling"))  {
            return;
        }

        SvnChangeLogFinder svn = new SvnChangeLogFinder();

        String fromTag = artifact.getArtifactId()+"-"+versionChange.getFrom();
        String toTag = artifact.getArtifactId()+"-"+ versionChange.getTo();
        try {
            List<String> issues = svn.getChanges(fromTag, toTag)
                .stream()
                .map(LaunchpadComparer::toJiraKey)
                .filter( k -> k != null)
                .collect(Collectors.toList());

            IssueFinder issueFinder = new IssueFinder();
            issueFinder.findIssues(issues).
                forEach( i -> System.out.format("        %-10s - %s%n", i.getKey(), i.getSummary()));

        } catch (SVNException | IOException e1) {
            System.err.println("Failed retrieving changes : " + e1.getMessage());
        }
    }

    private static String toJiraKey(String message) {
        Matcher matcher = JIRA_KEY_PATTERN.matcher(message);
        if ( !matcher.matches() ) {
            return null;
        }

        return matcher.group(1);
    }
}


text:
1. Install Berkshelf (http://berkshelf.com/)

        gem install berkshelf
2. Run vagrant up (http://www.vagrantup.com/)

        vagrant up

### OS X ###
Using berkshelf and vagrant on OS X is exactly the same as on Ubuntu, however, there are can be some complications:
* the machine does not have a recent version of ruby installed (>1.9.1) you will have to take some additional steps.
* vagrant is installed via the installer and might not have installed berkshelf via the bundled ruby gem installer. To avoid this last problem, we'll install vagrant via ruby gems and not use the packaged vagrant installer.

Note: The next steps assume you have homebrew installed.

1. Install ruby:

        brew install ruby

2. Make sure the ruby you've just installed is being used. Try:

        ruby -v

	This should result in something like:
        	ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1]

	If not, your paths are probably not setup correctly. Run the follow for diagnostics:

        brew doctor

3. You might want to create a symbolic link to vagrant for easier use:

        cd /usr/local/bin
        ln -s ../Cellar/ruby/1.9.3-p374/bin/vagrant

After this you can follow the Ubuntu instructions. That's it!


text:
package android.view.menu;

/**
 * An activity (inherits from MenuLayout) that shows in landscape.
 */
public class MenuLayoutLandscape extends MenuLayout {

}