text:
package org.alien4cloud.tosca.model.definitions.constraints;

import javax.validation.constraints.NotNull;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import alien4cloud.json.deserializer.TextDeserializer;
import org.alien4cloud.tosca.normative.types.IPropertyType;
import org.alien4cloud.tosca.exceptions.ConstraintValueDoNotMatchPropertyTypeException;
import org.alien4cloud.tosca.exceptions.ConstraintViolationException;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

@Getter
@Setter
@EqualsAndHashCode(callSuper = false, of = { "lessOrEqual" })
@SuppressWarnings({ "unchecked" })
public class LessOrEqualConstraint extends AbstractComparablePropertyConstraint {

    @JsonDeserialize(using = TextDeserializer.class)
    @NotNull
    private String lessOrEqual;

    @Override
    public void initialize(IPropertyType<?> propertyType) throws ConstraintValueDoNotMatchPropertyTypeException {
        initialize(lessOrEqual, propertyType);
    }

    @Override
    protected void doValidate(Object propertyValue) throws ConstraintViolationException {
        if (getComparable().compareTo(propertyValue) < 0) {
            throw new ConstraintViolationException(propertyValue + " >= " + lessOrEqual);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.zhongyun.viewer.db;

import android.graphics.Bitmap;

public class CameraInfo {

	private long cid;
	private String cameraName;
	private String cameraUser;
	private String cameraPwd;
	private Bitmap cameraThumb;
	private boolean isOnline;
	private boolean pwdIsRight;
	private String os;

	public void setCid(long cid){
		this.cid = cid;
	}

	public long getCid(){
		return cid;
	}

	public void setCameraUser(String cameraUser){
		this.cameraUser = cameraUser;
	}

	public String getCameraUser(){
		return cameraUser;
	}

	public void setCameraName(String cameraName){
		this.cameraName = cameraName;
	}

	public String getCameraName(){
		return cameraName;
	}

	public void setCameraPwd(String cameraPwd){
		this.cameraPwd = cameraPwd;
	}

	public String getCameraPwd(){
		return cameraPwd;
	}

	public void setCameraThumb(Bitmap cameraThumb){
		this.cameraThumb = cameraThumb;
	}

	public Bitmap getCameraThumb(){
		return cameraThumb;
	}

	public void setIsOnline(boolean isOnline){
		this.isOnline = isOnline;
	}

	public boolean getIsOnline(){
		return isOnline;
	}

	public void setPwdIsRight(boolean pwdIsRight){
		this.pwdIsRight = pwdIsRight;
	}

	public boolean getPwdIsRight(){
		return pwdIsRight;
	}

	public void setOS(String os){
		this.os = os;
	}

	public String getOS(){
		return os;
	}
}


text:
/*
 * ManifestEditorKit.java
 *
 * Created on October 20, 2005, 5:14 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.netbeans.modules.manifestsupport;

import javax.swing.text.Document;

import org.netbeans.editor.Syntax;
import org.netbeans.modules.editor.NbEditorKit;
import org.openide.ErrorManager;

/**
 *
 * @author Administrator
 */
public class ManifestEditorKit extends NbEditorKit {

    private static final ErrorManager LOGGER = ErrorManager.getDefault().getInstance("org.netbeans.modules.manifestsupport.ManifestEditorKit");
    private static final boolean LOG = LOGGER.isLoggable(ErrorManager.INFORMATIONAL);

    public static final String MIME_TYPE = "text/x-java-jar-manifest"; // NOI18N

    /**
     * Creates a new instance of ManifestEditorKit
     */
    public ManifestEditorKit() {
    }

    /**
     * Create a syntax object suitable for highlighting Manifest file syntax
     */
    public Syntax createSyntax(Document doc) {
        if (LOG) {
            LOGGER.log(ErrorManager.INFORMATIONAL, "createSyntax"); // NOI18N
        }
        return new ManifestSyntax();
    }

    /**
     * Retrieves the content type for this editor kit
     */
    public String getContentType() {
        return MIME_TYPE;
    }
}


text:
puts "Started at #{Time.now}"

subscriber_ids = []

Policy.all.each do |policy|
	next if policy.subscriber.blank?
	subscriber_ids.push(policy.subscriber.m_id)
end

subscriber_ids.uniq!

subscribers = Person.where("members.hbx_member_id" => {"$in" => subscriber_ids})

puts "Subscribers collected at #{Time.now}"

def find_previous_home_addresses(person)
	return [] if person.versions.blank?
	addresses = person.versions.map(&:home_address).compact.uniq.map(&:full_address).uniq
	return addresses
end

CSV.open("people_missing_addresses_#{Time.now.strftime('%Y%m%d%H%M')}.csv", "w") do |csv|
	csv << ["HBX ID", "First Name", "Middle Name", "Last Name", "Previous Home Addresses"]
	subscribers.each do |subscriber|
		if subscriber.home_address.blank?
			hbx_id = subscriber.authority_member_id
			first_name = subscriber.name_first
			middle_name = subscriber.name_middle
			last_name = subscriber.name_last
			previous_addresses = find_previous_home_addresses(subscriber).join('; ')
			csv << [hbx_id,first_name,middle_name,last_name,previous_addresses]
		else
			next
		end
	end
end

puts "Finished at #{Time.now}"


text:
// ///////////////////////////////////////////////////////////////////////////////////////////
//  Description:     AssetHelper class.
//  Author:          Ben Moore
//  Created date:    22/05/2015
//  Copyright:       Donky Networks Ltd 2015
// ///////////////////////////////////////////////////////////////////////////////////////////

using System;
using Donky.Core.Configuration;
using System.Runtime.CompilerServices;

namespace Donky.Core.Assets
{
	internal class AssetHelper : IAssetHelper
	{
		private readonly IConfigurationManager _configurationManager;

		internal AssetHelper(IConfigurationManager configurationManager)
		{
			_configurationManager = configurationManager;
		}

    	public string CreateUriForAsset(string assetId)
		{
			var format = _configurationManager.GetValue<string>("AssetDownloadUrlFormat");
			return String.Format(format, assetId);
		}
	}
}


text:
namespace RiemannSphere {

    class GeodesicNode;
    class GeodesicTree;
    class GeodesicSphere;

	class GeodesicTree : public VirtualTree<GeodesicNode,4> {

        friend class GeodesicNode;
        friend class GeodesicTree;
        friend class GeodesicSphere;

        //ptr manager
        GeodesicSphere *sphere;

        //build function
        virtual GeodesicNode* buildNode(GeodesicNode* parent,
                                        Easy3D::uchar i);

        //delete function
        bool isDeletableChild(GeodesicNode* node);
        virtual bool isDeletable(GeodesicNode* node);

    public:

		GeodesicTree();

	};

};

#endif


text:
import json
import os
import re
import traceback
import unittest

import six

from rally import api
from rally.common import db
from rally.common import objects
from rally import plugins
from rally.plugins.openstack.context.keystone import users
from tests.functional import utils

class TestTaskSamples(unittest.TestCase):

    def _skip(self, validation_output):
        """Help to decide do we want to skip this result or not.

        :param validation_output: string representation of the
        error that we want to check
        :return: True if we want to skip this error
        of task sample validation, otherwise False.
        """

        skip_lst = ["[Ss]ervice is not available",
                    "is not installed. To install it run",
                    "extension.* is not configured"]
        for check_str in skip_lst:
            if re.search(check_str, validation_output) is not None:
                return True
        return False

    def test_task_samples_is_valid(self):
        rally = utils.Rally(force_new_db=True)
        # In TestTaskSamples, Rally API will be called directly (not via
        # subprocess), so we need to change database options to temp database.
        db.db_options.set_defaults(
            db.CONF, connection="sqlite:///%s/db" % rally.tmp_dir,
            sqlite_db="rally.sqlite")

        # let's use pre-created users to make TestTaskSamples quicker
        deployment = api.Deployment.get("MAIN")
        admin_cred = objects.Credential(**deployment["admin"])

        ctx = {"admin": {"credential": admin_cred},
               "task": {"uuid": self.__class__.__name__}}
        user_ctx = users.UserGenerator(ctx)
        user_ctx.setup()
        self.addCleanup(user_ctx.cleanup)

        config = deployment["config"]
        config["users"] = [{
            "username": ctx["users"][0]["credential"].username,
            "password": ctx["users"][0]["credential"].password,
            "tenant_name": ctx["users"][0]["credential"].tenant_name}]

        rally("deployment destroy MAIN", write_report=False)
        deployment_cfg = os.path.join(rally.tmp_dir, "new_deployment.json")
        with open(deployment_cfg, "w") as f:
            f.write(json.dumps(config))
        rally("deployment create --name MAIN --filename %s" % deployment_cfg,
              write_report=False)

        plugins.load()
        samples_path = os.path.join(
            os.path.dirname(__file__), os.pardir, os.pardir,
            "samples", "tasks")
        matcher = re.compile("\.json$")

        for dirname, dirnames, filenames in os.walk(samples_path):
            # NOTE(rvasilets): Skip by suggest of boris-42 because in
            # future we don't what to maintain this dir
            if dirname.find("tempest-do-not-run-against-production") != -1:
                continue
            for filename in filenames:
                full_path = os.path.join(dirname, filename)

                # NOTE(hughsaunders): Skip non config files
                # (bug https://bugs.launchpad.net/rally/+bug/1314369)
                if not matcher.search(filename):
                    continue
                with open(full_path) as task_file:
                    try:
                        input_task = task_file.read()
                        rendered_task = api.Task.render_template(input_task)
                        task_config = json.loads(rendered_task)
                        api.Task.validate("MAIN", task_config)
                    except Exception as e:
                        if not self._skip(six.text_type(e)):
                            print(traceback.format_exc())
                            print("Failed on task config %s with error." %
                                  full_path)
                            raise


text:
package me.lachlanap.heatmaprenderer;

import gnu.trove.iterator.TFloatIterator;
import gnu.trove.iterator.TIntIterator;
import gnu.trove.list.TFloatList;
import gnu.trove.list.TIntList;
import gnu.trove.list.array.TFloatArrayList;
import gnu.trove.list.array.TIntArrayList;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.List;
import java.util.Properties;

/**
 *
 * @author lachlan
 */
public class StatCalculator {

    private final TIntList apples;
    private final TIntList jellybeans;
    private final TIntList powerups;
    private final TFloatList time;

    public StatCalculator() {
        apples = new TIntArrayList();
        jellybeans = new TIntArrayList();
        powerups = new TIntArrayList();
        time = new TFloatArrayList();
    }

    public void loadAll(List<Path> maps) throws IOException {
        Properties props = new Properties();

        for (Path path : maps) {
            BufferedReader reader = Files.newBufferedReader(path, Charset.forName("UTF-8"));

            try {
                props.load(reader);
            } finally {
                reader.close();
            }

            try {
                apples.add(Integer.parseInt(props.getProperty("apples")));
                jellybeans.add(Integer.parseInt(props.getProperty("jellybeans")));
                powerups.add(Integer.parseInt(props.getProperty("powerups")));
                time.add(Float.parseFloat(props.getProperty("time")));
            } catch (NumberFormatException nfe) {
                System.err.println("Malformed stats file (" + path + "): " + nfe.toString());
            }

            props.clear();
        }
    }

    public void write(Path outputPath) throws IOException {
        apples.sort();
        jellybeans.sort();
        powerups.sort();
        time.sort();

        IntStatistics appleStats = new IntStatistics(apples);
        IntStatistics jellybeanStats = new IntStatistics(jellybeans);
        IntStatistics powerupsStats = new IntStatistics(powerups);
        FloatStatistics timeStats = new FloatStatistics(time);

        System.out.println("Apples: " + appleStats);
        System.out.println("Time: " + timeStats);

        Properties dataOut = new Properties();
        appleStats.put(dataOut, "apples");
        jellybeanStats.put(dataOut, "jellybeans");
        powerupsStats.put(dataOut, "powerups");
        timeStats.put(dataOut, "time");

        BufferedWriter writer = Files.newBufferedWriter(outputPath, Charset.forName("UTF-8"),
                                                        StandardOpenOption.CREATE);
        try {
            dataOut.store(writer, "PacAndroid Level Statistics");
        } finally {
            writer.close();
        }
    }

    private abstract class Statistics {

        private float min;
        private float max;
        private float avg;
        private float stddev;
        private float percentile10;
        private float percentile90;

        void init(int count, float min, float max, float total, float totalSq, float percentile10, float percentile90) {
            this.min = min;
            this.max = max;
            this.percentile10 = percentile10;
            this.percentile90 = percentile90;

            if (count > 1) {
                avg = total / count;
                stddev = (float) Math.sqrt(
                        (count * totalSq - total * total) / (count * (count - 1)));
            } else {
                avg = total;
                stddev = 0;
            }
        }

        @Override
        public String toString() {
            return "[" + min + " < " + avg + " < " + max
                    + " (+/-" + stddev + ": {" + (avg - stddev) + ", " + (avg + stddev) + "}"
                    + ", 10%: " + percentile10
                    + ", 90%: " + percentile90 + ")]";
        }

        public void put(Properties props, String base) {
            props.setProperty(base + ".min", String.valueOf(min));
            props.setProperty(base + ".max", String.valueOf(max));
            props.setProperty(base + ".avg", String.valueOf(avg));
            props.setProperty(base + ".stddev", String.valueOf(stddev));
            props.setProperty(base + ".per10", String.valueOf(percentile10));
            props.setProperty(base + ".per90", String.valueOf(percentile90));
        }
    }

    private class FloatStatistics extends Statistics {

        public FloatStatistics(TFloatList list) {
            int n = list.size();

            float min = Float.MAX_VALUE, max = Float.MIN_VALUE;
            float total = 0;
            float totalSq = 0;

            TFloatIterator itr = list.iterator();
            for (; itr.hasNext();) {
                float f = itr.next();

                min = Math.min(min, f);
                max = Math.max(max, f);

                total += f;
                totalSq += f * f;
            }

            float rank10 = 10f / 100f * (n - 1);
            int rI10 = (int) rank10;
            float rF10 = rank10 - rI10;
            float percentile10;

            float rank90 = 90f / 100f * (n - 1);
            int rI90 = (int) rank90;
            float rF90 = rank90 - rI90;
            float percentile90;

            if (n > 1) {
                percentile10 =
                        (1 - rF10) * list.get(rI10) + rF10 * list.get(rI10 + 1);
                percentile90 =
                        (1 - rF90) * list.get(rI90) + rF90 * list.get(rI90 + 1);
            } else {
                percentile10 = total;
                percentile90 = total;
            }

            init(n,
                 min, max,
                 total, totalSq,
                 percentile10,
                 percentile90);
        }
    }

    private class IntStatistics extends Statistics {

        public IntStatistics(TIntList list) {
            int n = list.size();

            int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
            float total = 0;
            float totalSq = 0;

            TIntIterator itr = list.iterator();
            for (; itr.hasNext();) {
                int i = itr.next();

                min = Math.min(min, i);
                max = Math.max(max, i);

                total += i;
                totalSq += i * i;
            }

            float rank10 = 10f / 100f * (n - 1);
            int rI10 = (int) rank10;
            float rF10 = rank10 - rI10;
            float percentile10;

            float rank90 = 90f / 100f * (n - 1);
            int rI90 = (int) rank90;
            float rF90 = rank90 - rI90;
            float percentile90;

            if (n > 1) {
                percentile10 =
                        (1 - rF10) * list.get(rI10) + rF10 * list.get(rI10 + 1);
                percentile90 =
                        (1 - rF90) * list.get(rI90) + rF90 * list.get(rI90 + 1);
            } else {
                percentile10 = total;
                percentile90 = total;
            }

            init(n,
                 min, max,
                 total, totalSq,
                 percentile10,
                 percentile90);
        }
    }
}


text:
static inline int
allow_same_session(const char *check, struct ucred *cred, struct proc *p) {
  struct shill_session *subject = shill_get_session(cred);

  if (subject == NULL) {
    // Don't enforce restrictions on un-sandboxed processes
    return 0;
  }

  // A process can interact with a process in the same session
  // or in a descendent session.
  struct shill_session *object = shill_get_session(p->p_ucred);
  while (object != NULL) {
    if (subject == object) { return 0; }
    object = shill_session_parent(object);
  }

  if (shill_session_debug(subject)) {
    shilld_log((uintptr_t)subject, "Permitting %s on %lx for debugging",
               check, (uintptr_t)p);
    return 0;
  } else {
    shilld_log((uintptr_t)subject, "Denied %s on %lx",
               check, (uintptr_t)p);
    return EACCES;
  }
}

int
shill_proc_check_debug(struct ucred *cred,
                       struct proc *proc) {
  return allow_same_session("process debug", cred, proc);
}

int
shill_proc_check_sched(struct ucred *cred,
                       struct proc *proc) {
  return allow_same_session("process sched", cred, proc);
}

int
shill_proc_check_signal(struct ucred *cred,
                        struct proc *proc, int signum) {
  return allow_same_session("process signal", cred, proc);
}

int
shill_proc_check_wait(struct ucred *cred,
                      struct proc *proc) {
  return allow_same_session("process wait", cred, proc);
}

void
shill_proc_destroy_label(struct label *label) {
  // Intentionally left blank. Shill relies on
  // the process's credential's label.
}

void
shill_proc_init_label(struct label *label) {
  // Intentionally left blank. Shill relies on
  // the process's credential's label.
}


text:
<?php

	class user
	{
		private $id;
		private $login;
		private $name;
		private $password;
		private $lastvisit;
		private $construct;

		public function __construct($anonymous = true)
		{
			if($anonymous == true)
			{
				$this -> id = 0;
				$this -> login = '';
				$this -> name = '';
				$this -> password = '';
				$this -> lastvisit = time();
			}
			$this -> construct = true;
		} // end __construct();

		public function isAnonymous()
		{
			return ($this -> id == 0 ? true : false);
		} // end isAnonymous();

		public function isUser()
		{
			return ($this -> id != 0 ? true : false);
		} // end isUser();

		public function getId()
		{
			return $this -> id;
		} // end getId();

		public function getLogin()
		{
			return $this -> login;
		} // end getLogin();

		public function getName()
		{
			return $this -> name;
		} // end getName();

		public function getPassword()
		{
			return $this -> password;
		} // end getPassword();

		public function getLastvisit()
		{
			return date('d.m.Y, H:i', $this -> lastvisit);
		} // end getLastvisit();

		public function __set($name, $value)
		{
			if(!$this -> construct)
			{
				$this -> $name = $value;
			}
		} // end __set();

		static public function checkPassword($login, $password)
		{
			global $pdo, $config;
			$stmt = $pdo -> prepare("SELECT user_id AS id,
				user_login AS login,
				user_name AS name,
				user_password AS password,
				user_lastvisit AS lastvisit
                                FROM {$config['db_users']} WHERE
				 user_login = :login AND user_password = :password");
			$stmt -> bindValue(':login', 	$login,		 		PDO::PARAM_STR);
			$stmt -> bindValue(':password', sha1($password), 	PDO::PARAM_STR);
			$stmt -> execute();
			$stmt -> setFetchMode(PDO::FETCH_CLASS, 'user', array(0 => false));
			if($user = $stmt -> fetch())
			{
				// Jezeli uzytkownik o takim loginie i hasle
				// istnieje, zwroc jego rekord w postaci obiektu
				$stmt -> closeCursor();
				return $user;
			}
			else
			{
				$stmt -> closeCursor();
				// Bledy w loginie/hasle zglaszamy zerem
				return 0;
			}
		} // end checkPassword();
	}
?>


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**model** | **str** | Access filter model name. | [optional]
**field** | **str** | Access filter field name. | [optional]
**value** | **str** | Access filter value | [optional]
**can** | **dict(str, bool)** | Operations the current user is able to perform on this object | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
/*
 * Setup the system to run on the current machine.
 *
 * Configure() is called at boot time and initializes the vba
 * device tables and the memory controller monitoring.  Available
 * devices are determined (from possibilities mentioned in ioconf.c),
 * and the drivers are initialized.
 */
#include "opt_bootp.h"
#include "opt_ffs.h"
#include "opt_cd9660.h"
#include "opt_nfs.h"
#include "opt_nfsroot.h"
#include "opt_bus.h"
#include "opt_rootdevname.h"

#include "isa.h"

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/disklabel.h>
#include <sys/diskslice.h>
#include <sys/reboot.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/cons.h>

#include <machine/bootinfo.h>
#include <machine/ipl.h>
#include <machine/md_var.h>
#ifdef APIC_IO
#include <machine/smp.h>
#else
#include <i386/isa/icu.h>
#endif /* APIC_IO */

#if NISA > 0
#include <isa/isavar.h>

device_t isa_bus_device = 0;
#endif

static void	configure_first __P((void *));
static void	configure __P((void *));
static void	configure_final __P((void *));

#if defined(FFS) && defined(FFS_ROOT)
static void	setroot __P((void));
#endif

SYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL);
/* SI_ORDER_SECOND is hookable */
SYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL);
/* SI_ORDER_MIDDLE is hookable */
SYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL);

dev_t	rootdev = NODEV;
dev_t	dumpdev = NODEV;

device_t nexus_dev;

/*
 * Determine i/o configuration for a machine.
 */
static void
configure_first(dummy)
	void *dummy;
{
}

static void
configure(dummy)
	void *dummy;
{

	/*
	 * Activate the ICU's.  Note that we are explicitly at splhigh()
	 * at present as we have no way to disable stray PCI level triggered
	 * interrupts until the devices have had a driver attached.  This
	 * is particularly a problem when the interrupts are shared.  For
	 * example, if IRQ 10 is shared between a disk and network device
	 * and the disk device generates an interrupt, if we "activate"
	 * IRQ 10 when the network driver is set up, then we will get
	 * recursive interrupt 10's as nothing will know how to turn off
	 * the disk device's interrupt.
	 *
	 * Having the ICU's active means we can probe interrupt routing to
	 * see if a device causes the corresponding pending bit to be set.
	 *
	 * This is all rather inconvenient.
	 */
#ifdef APIC_IO
	bsp_apic_configure();
	enable_intr();
#else
	enable_intr();
	INTREN(IRQ_SLAVE);
#endif /* APIC_IO */

	/* nexus0 is the top of the i386 device tree */
	device_add_child(root_bus, "nexus", 0);

	/* initialize new bus architecture */
	root_bus_configure();

#if NISA > 0
	/*
	 * Explicitly probe and attach ISA last.  The isa bus saves
	 * it's device node at attach time for us here.
	 */
	if (isa_bus_device)
		isa_probe_children(isa_bus_device);
#endif

	/*
	 * Now we're ready to handle (pending) interrupts.
	 * XXX this is slightly misplaced.
	 */
	spl0();

	/*
	 * Allow lowering of the ipl to the lowest kernel level if we
	 * panic (or call tsleep() before clearing `cold').  No level is
	 * completely safe (since a panic may occur in a critical region
	 * at splhigh()), but we want at least bio interrupts to work.
	 */
	safepri = cpl;
}

static void
configure_final(dummy)
	void *dummy;
{
	int i;

	cninit_finish();

	if (bootverbose) {

#ifdef APIC_IO
		imen_dump();
#endif /* APIC_IO */

		/*
		 * Print out the BIOS's idea of the disk geometries.
		 */
		printf("BIOS Geometries:\n");
		for (i = 0; i < N_BIOS_GEOM; i++) {
			unsigned long bios_geom;
			int max_cylinder, max_head, max_sector;

			bios_geom = bootinfo.bi_bios_geom[i];

			/*
			 * XXX the bootstrap punts a 1200K floppy geometry
			 * when the get-disk-geometry interrupt fails.  Skip
			 * drives that have this geometry.
			 */
			if (bios_geom == 0x4f010f)
				continue;

			printf(" %x:%08lx ", i, bios_geom);
			max_cylinder = bios_geom >> 16;
			max_head = (bios_geom >> 8) & 0xff;
			max_sector = bios_geom & 0xff;
			printf(
		"0..%d=%d cylinders, 0..%d=%d heads, 1..%d=%d sectors\n",
			       max_cylinder, max_cylinder + 1,
			       max_head, max_head + 1,
			       max_sector, max_sector);
		}
		printf(" %d accounted for\n", bootinfo.bi_n_bios_used);

		printf("Device configuration finished.\n");
	}
	cold = 0;
}

#ifdef BOOTP
extern void bootpc_init(void);
#endif
/*
 * Do legacy root filesystem discovery.
 */
void
cpu_rootconf()
{
#ifdef BOOTP
        bootpc_init();
#endif
#if defined(NFS) && defined(NFS_ROOT)
#if !defined(BOOTP_NFSROOT)
	if (nfs_diskless_valid)
#endif
		rootdevnames[0] = "nfs:";
#endif
#if defined(FFS) && defined(FFS_ROOT)
        if (!rootdevnames[0])
                setroot();
#endif
}
SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL)

u_long	bootdev = 0;		/* not a dev_t - encoding is different */

#if defined(FFS) && defined(FFS_ROOT)
#define FDMAJOR 	2
#define FDUNITSHIFT     6

/*
 * Attempt to find the device from which we were booted.
 * If we can do so, and not instructed not to do so,
 * set rootdevs[] and rootdevnames[] to correspond to the
 * boot device(s).
 *
 * This code survives in order to allow the system to be
 * booted from legacy environments that do not correctly
 * populate the kernel environment. There are significant
 * restrictions on the bootability of the system in this
 * situation; it can only be mounting root from a 'da'
 * 'wd' or 'fd' device, and the root filesystem must be ufs.
 */
static void
setroot()
{
	int majdev, mindev, unit, slice, part;
	dev_t newrootdev, dev;
	char partname[2];
	char *sname;

	if ((bootdev & B_MAGICMASK) != B_DEVMAGIC) {
		printf("no B_DEVMAGIC (bootdev=%#lx)\n", bootdev);
		return;
	}
	majdev = B_TYPE(bootdev);
	dev = makebdev(majdev, 0);
	if (devsw(dev) == NULL) {
		printf("no devsw (majdev=%d bootdev=%#lx)\n", majdev, bootdev);
		return;
	}
	unit = B_UNIT(bootdev);
	slice = B_SLICE(bootdev);
	if (slice == WHOLE_DISK_SLICE)
		slice = COMPATIBILITY_SLICE;
	if (slice < 0 || slice >= MAX_SLICES) {
		printf("bad slice\n");
		return;
	}

	/*
	 * XXX kludge for inconsistent unit numbering and lack of slice
	 * support for floppies.
	 */
	if (majdev == FDMAJOR) {
		slice = COMPATIBILITY_SLICE;
		part = RAW_PART;
		mindev = unit << FDUNITSHIFT;
	} else {
		part = B_PARTITION(bootdev);
		mindev = dkmakeminor(unit, slice, part);
	}

	newrootdev = makebdev(majdev, mindev);
	sname = dsname(newrootdev, unit, slice, part, partname);
	rootdevnames[0] = malloc(strlen(sname) + 6, M_DEVBUF, M_NOWAIT);
	sprintf(rootdevnames[0], "ufs:%s%s", sname, partname);

	/*
	 * For properly dangerously dedicated disks (ones with a historical
	 * bogus partition table), the boot blocks will give slice = 4, but
	 * the kernel will only provide the compatibility slice since it
	 * knows that slice 4 is not a real slice.  Arrange to try mounting
	 * the compatibility slice as root if mounting the slice passed by
	 * the boot blocks fails.  This handles the dangerously dedicated
	 * case and perhaps others.
	 */
	if (slice == COMPATIBILITY_SLICE)
		return;
	slice = COMPATIBILITY_SLICE;
	sname = dsname(newrootdev, unit, slice, part, partname);
	rootdevnames[1] = malloc(strlen(sname) + 6, M_DEVBUF, M_NOWAIT);
	sprintf(rootdevnames[1], "ufs:%s%s", sname, partname);
}
#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval" android:thickness="1dp" >
            <corners android:radius="2dp" />
            <solid android:color="@color/colorAll" />
            <stroke android:color="#000000" android:width="4dp" />
        </shape>
    </item>
</selector>


text:
const executeValidations = (item, c) => {
    const { validators, value } = item;

    if (!Array.isArray(validators)) {
        return true;
    }

    item.errors = [];

    let isValid = true;

    for (const fn of validators) {
        const r = fn(value, c);
        /**
         * if result is a string, then it is considered as error, otherwise it considered as valid
         */
        if (typeof r === 'string') {
            isValid = false;

            item.errors.push(r);
        }
    }

    return isValid;
}

/**
 * @param {Array} c
 * @param {Array} enforceValidationOn
 *
 * example of enforceValidationOn
 *  [[sectionId, itemId]] - will validate only item in specific section
 *  [[sectionId, undefined]] - will validate entire section, if item is not defined
 */
export const validationEngine = (c, enforceValidationOn) => {
    let isValid = true;

    if (Array.isArray(enforceValidationOn)) {
        for (const [sectionId, itemId] of enforceValidationOn) {
            if (undefined === itemId) {
                for (const item of c[sectionId].items) {
                    if (!executeValidations(item, c)) {
                        isValid = false;
                    }
                }

                continue;
            }

            if (!executeValidations(c[sectionId].items[itemId], c)) {
                isValid = false;
            }
        }

        return isValid;
    }

    for (const { items } of c) {
        for (const item of items) {
            if (!executeValidations(item, c)) {
                isValid = false;
            }
        }
    }

    return isValid;
}


text:
namespace gpu {
namespace gles2 {

class MemoryTracker;
class MemoryTypeTracker;

// This class keeps track of the renderbuffers and whether or not they have
// been cleared.
class GPU_EXPORT RenderbufferManager {
 public:
  // Info about Renderbuffers currently in the system.
  class GPU_EXPORT RenderbufferInfo
      : public base::RefCounted<RenderbufferInfo> {
   public:
    typedef scoped_refptr<RenderbufferInfo> Ref;

    RenderbufferInfo(RenderbufferManager* manager, GLuint service_id)
        : manager_(manager),
          deleted_(false),
          service_id_(service_id),
          cleared_(true),
          has_been_bound_(false),
          samples_(0),
          internal_format_(GL_RGBA4),
          width_(0),
          height_(0) {
      manager_->StartTracking(this);
    }

    GLuint service_id() const {
      return service_id_;
    }

    bool cleared() const {
      return cleared_;
    }

    GLenum internal_format() const {
      return internal_format_;
    }

    GLsizei samples() const {
      return samples_;
    }

    GLsizei width() const {
      return width_;
    }

    GLsizei height() const {
      return height_;
    }

    bool IsDeleted() const {
      return deleted_;
    }

    void MarkAsValid() {
      has_been_bound_ = true;
    }

    bool IsValid() const {
      return has_been_bound_ && !IsDeleted();
    }

    size_t EstimatedSize();

   private:
    friend class RenderbufferManager;
    friend class base::RefCounted<RenderbufferInfo>;

    ~RenderbufferInfo();

    void set_cleared() {
      cleared_ = true;
    }

    void SetInfo(
        GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) {
      samples_ = samples;
      internal_format_ = internalformat;
      width_ = width;
      height_ = height;
      cleared_ = false;
    }

    void MarkAsDeleted() {
      deleted_ = true;
    }

    // RenderbufferManager that owns this RenderbufferInfo.
    RenderbufferManager* manager_;

    bool deleted_;

    // Service side renderbuffer id.
    GLuint service_id_;

    // Whether this renderbuffer has been cleared
    bool cleared_;

    // Whether this renderbuffer has ever been bound.
    bool has_been_bound_;

    // Number of samples (for multi-sampled renderbuffers)
    GLsizei samples_;

    // Renderbuffer internalformat set through RenderbufferStorage().
    GLenum internal_format_;

    // Dimensions of renderbuffer.
    GLsizei width_;
    GLsizei height_;
  };

  RenderbufferManager(MemoryTracker* memory_tracker,
                      GLint max_renderbuffer_size,
                      GLint max_samples);
  ~RenderbufferManager();

  GLint max_renderbuffer_size() const {
    return max_renderbuffer_size_;
  }

  GLint max_samples() const {
    return max_samples_;
  }

  bool HaveUnclearedRenderbuffers() const {
    return num_uncleared_renderbuffers_ != 0;
  }

  void SetInfo(
      RenderbufferInfo* renderbuffer,
      GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);

  void SetCleared(RenderbufferInfo* renderbuffer);

  // Must call before destruction.
  void Destroy(bool have_context);

  // Creates a RenderbufferInfo for the given renderbuffer.
  void CreateRenderbufferInfo(GLuint client_id, GLuint service_id);

  // Gets the renderbuffer info for the given renderbuffer.
  RenderbufferInfo* GetRenderbufferInfo(GLuint client_id);

  // Removes a renderbuffer info for the given renderbuffer.
  void RemoveRenderbufferInfo(GLuint client_id);

  // Gets a client id for a given service id.
  bool GetClientId(GLuint service_id, GLuint* client_id) const;

  size_t mem_represented() const {
    return mem_represented_;
  }

 private:
  void UpdateMemRepresented();

  void StartTracking(RenderbufferInfo* renderbuffer);
  void StopTracking(RenderbufferInfo* renderbuffer);

  scoped_ptr<MemoryTypeTracker> renderbuffer_memory_tracker_;

  GLint max_renderbuffer_size_;
  GLint max_samples_;

  int num_uncleared_renderbuffers_;

  size_t mem_represented_;

  // Counts the number of RenderbufferInfo allocated with 'this' as its manager.
  // Allows to check no RenderbufferInfo will outlive this.
  unsigned renderbuffer_info_count_;

  bool have_context_;

  // Info for each renderbuffer in the system.
  typedef base::hash_map<GLuint, RenderbufferInfo::Ref> RenderbufferInfoMap;
  RenderbufferInfoMap renderbuffer_infos_;

  DISALLOW_COPY_AND_ASSIGN(RenderbufferManager);
};

}  // namespace gles2
}  // namespace gpu

#endif  // GPU_COMMAND_BUFFER_SERVICE_RENDERBUFFER_MANAGER_H_


text:
@interface BSGNetworkBreadcrumbTests : XCTestCase

@end

@implementation BSGNetworkBreadcrumbTests

- (void)testUrlParamsForQueryItems {
#define TEST(url, expected) \
XCTAssertEqualObjects(BSGURLParamsForQueryItems([NSURLComponents componentsWithString:url].queryItems), expected)

    TEST(@"http://example.com", nil);

    TEST(@"http://example.com?", @{});

    TEST(@"http://example.com?foo=bar", @{@"foo": @"bar"});

    TEST(@"http://example.com?foo=bar&bar=baz", (@{@"foo": @"bar", @"bar": @"baz"}));

    // Multiple query items with the same name should be represented as arrays.
    TEST(@"http://example.com?foo=bar&foo=baz", (@{@"foo": @[@"bar", @"baz"]}));

    // Query items with no value should be represented as empty string.
    TEST(@"http://example.com?foo=bar&foo=baz&foo=&sort=name", (@{@"foo": @[@"bar", @"baz", @""], @"sort": @"name"}));

    TEST(@"http://example.com?foo", @{@"foo": [NSNull null]});

    TEST(@"http://example.com?=bar", @{@"": @"bar"});

    TEST(@"http://example.com?foo=bar&", (@{@"foo": @"bar", @"": [NSNull null]}));

    TEST(@"http://example.com?foo=bar&baz", (@{@"foo": @"bar", @"baz": [NSNull null]}));

    TEST(@"http://example.com?foo=bar&baz&baz", (@{@"foo": @"bar", @"baz": @[[NSNull null], [NSNull null]]}));

#undef TEST
}

- (void)testURLStringWithoutQueryForComponents {
#define TEST(url, expected) \
XCTAssertEqualObjects(BSGURLStringForComponents([NSURLComponents componentsWithString:url]), expected)

    TEST(@"http://example.com",
         @"http://example.com");

    TEST(@"http://example.com/",
         @"http://example.com/");

    TEST(@"http://example.com?foo=bar",
         @"http://example.com");

    TEST(@"http://example.com/?foo=bar",
         @"http://example.com/");

    TEST(@"http://example.com/page.html?foo=bar",
         @"http://example.com/page.html");

    TEST(@"http://example.com/page.html?foo=bar#some-anchor",
         @"http://example.com/page.html#some-anchor");

    // In this example what look like query parameters are actually part of the fragment
    TEST(@"http://example.com/page.html#some-anchor?foo=bar",
         @"http://example.com/page.html#some-anchor?foo=bar");

#undef TEST
}

@end


text:
<?php

/* TodoClientBundle:Homepage:index.html.twig */
class __TwigTemplate_0c0d2acac3aac63e7a069118312582fe extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = $this->env->loadTemplate("TodoClientBundle::layout.html.twig");

        $this->blocks = array(
            'content' => array($this, 'block_content'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "TodoClientBundle::layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 3
        if ((!array_key_exists("last_username", $context))) {
            // line 4
            $context["last_username"] = "";
        }
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 7
    public function block_content($context, array $blocks = array())
    {
        // line 8
        echo "

            ";
        // line 10
        if ($this->getAttribute((isset($context["error"]) ? $context["error"] : null), "message", array(), "any", true, true)) {
            // line 11
            echo "

";
            // line 12
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["error"]) ? $context["error"] : null), "message"), "html", null, true);
            echo "

            ";
        } elseif (array_key_exists("error", $context)) {
            // line 15
            echo "

";
            // line 16
            echo twig_escape_filter($this->env, (isset($context["error"]) ? $context["error"] : null), "html", null, true);
            echo "

            ";
        } elseif (array_key_exists("success", $context)) {
            // line 19
            echo "

You have successfully registered

            ";
        }
        // line 23
        echo "

Login

                    <form action=\"";
        // line 26
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("todo_login_check"), "html", null, true);
        echo "\" method=\"post\">
                        Username:
                        <input type=\"text\" id=\"username\" name=\"_username\" value=\"";
        // line 28
        echo twig_escape_filter($this->env, (isset($context["last_username"]) ? $context["last_username"] : null), "html", null, true);
        echo "\" />

                        Password:
                        <input type=\"password\" id=\"password\" name=\"_password\" />

                        <input type=\"hidden\" name=\"_target_path\" value=\"account\" />

                        <input class=\"btn btn-info\" type=\"submit\" name=\"login\" />
                    </form>

Registration

                    <form action=\"";
        // line 41
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("todo_signup"), "html", null, true);
        echo "\" method=\"post\" ";
        echo $this->env->getExtension('form')->renderer->searchAndRenderBlock((isset($context["registration"]) ? $context["registration"] : null), 'enctype');
        echo " autocomplete=\"off\">
                        ";
        // line 42
        echo $this->env->getExtension('form')->renderer->searchAndRenderBlock((isset($context["registration"]) ? $context["registration"] : null), 'widget');
        echo "
                        <input type=\"submit\" class=\"btn btn-primary\" value=\"register\">
                    </form>

";
    }

    public function getTemplateName()
    {
        return "TodoClientBundle:Homepage:index.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  98 => 42,  92 => 41,  76 => 28,  71 => 26,  66 => 23,  60 => 19,  54 => 16,  51 => 15,  45 => 12,  42 => 11,  40 => 10,  36 => 8,  33 => 7,  27 => 4,  25 => 3,);
    }
}


text:
class EnemyGMonsterFire : public Enemy
{
public:
	EnemyGMonsterFire(Level *curLevel);
	virtual ~EnemyGMonsterFire();

	virtual void processAttack();
	virtual void processDamage();
	virtual void processDeath();
	virtual void stop();
	HPTRect &GetWeaponWorldLoc();
//	virtual HPTRect &GetWorldLoc();
	void processUpdate();
};

#endif // !defined(AFX_ENEMYGMONSTERFIRE_H__193381E0_F956_4CB3_9E5B_7CA6BE948706__INCLUDED_)


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
						http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
						http://www.springframework.org/schema/aop
						http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dateSource" ref="dateSource"></property><!-- 指定数据源 -->
		<!-- 指定映射定义 -->
		<property name="mappingResources">
			<list>
				<value>hibernate.application-hibernate.xml</value>
			</list>
		</property>
		<!-- 指定hibernate属性 -->
		<property name="hibernateProperties">
			<props>
				<!-- 指定数据库方言 -->
				<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
			</props>
		</property>
	</bean>
</beans>


text:
package edu.uprm.ece.icom4035.list.test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.Iterator;

import org.junit.Before;
import org.junit.Test;

import com.github.xtrot.contactmanager.SortedArrayList.SortedArrayList;

//import edu.uprm.ece.icom4035.list.ReverseIterator;
// import here your SortedArrayList

public class Test2 {
	private SortedArrayList<String> list;

	@Before
	public void setUp() throws Exception {
		this.list = new SortedArrayList<String>();
		this.list.add("Ron");
		this.list.add("Amy");
		this.list.add("Apu");
		this.list.add("Ned");
		this.list.add("Xi");
		this.list.add("Bob");
		this.list.add("Cal");

	}

	@Test
	public void testAdd() {
		this.list.add("Al");
		this.list.remove("Al");
		this.list.add("Al");
		assertTrue(this.list.get(0).equals("Al"));
		this.list.add("Zen");
		assertTrue(this.list.last().equals("Zen"));
	}

	@Test
	public void testSize() {
		assertTrue(this.list.size() == 7);
		this.list.add("Ned");
		this.list.add("Jil");
		this.list.remove("Xi");
		assertTrue(this.list.size() == 8);
	}

	@Test
	public void testRemoveE() {
		this.list.remove("Ron");
		this.list.add("Ron");
		this.list.remove("Ron");
		assertTrue(!this.list.contains("Ron"));
		this.list.remove("Xi");
		assertTrue(!this.list.contains("Xi"));
		assertFalse(this.list.remove("Gen"));
	}

	@Test
	public void testRemoveInt() {
		this.list.remove(2);
		assertTrue(!this.list.contains("Bob"));
		this.list.remove(0);
		this.list.add("Amy");
		this.list.add("Amy");
		this.list.add("Amy");
		this.list.remove(0);
		this.list.remove(0);
		this.list.remove(0);
		assertTrue(!this.list.contains("Amy"));
	}

	@Test
	public void testRemoveAll() {
		assertTrue(this.list.size() !=0);
		this.list.clear();
		assertTrue(this.list.size() == 0);
	}

	@Test
	public void testFirst() {
		assertTrue(this.list.first().equals("Amy"));
		this.list.add("Al");
		assertTrue(this.list.first().equals("Al"));

	}

	@Test
	public void testLast() {
		assertTrue(this.list.last().equals("Xi"));
		this.list.add("Zoe");
		assertTrue(this.list.last().equals("Zoe"));
	}

	@Test
	public void testGet() {
		assertTrue(this.list.get(1).equals("Apu"));
		assertTrue(this.list.get(0).equals("Amy"));

	}

	@Test
	public void testClear() {
		this.list.clear();
		assertTrue(this.list.size() ==0);
	}

	@Test
	public void testContains() {
		assertTrue(this.list.contains("Xi"));
		assertFalse(this.list.contains("Yu"));

	}

	@Test
	public void testIsEmpty() {
		assertFalse(this.list.isEmpty());
		this.list.clear();
		assertTrue(this.list.isEmpty());
	}

	@Test
	public void testIteratorInt() {
		Iterator<String> iter = this.list.iterator();
		assertTrue(iter.hasNext());
		assertTrue(iter.next().equals("Amy"));

		iter = this.list.iterator();
		iter.next();
		iter.next();
		iter.next();

		assertTrue(iter.hasNext());
		assertTrue(iter.next().equals("Bob"));

	}

	@Test
	public void testFirstIndex() {
		this.list.add("Bob");
		assertTrue(this.list.firstIndex("Bob") == 2);
		assertTrue(this.list.firstIndex("Jil") < 0);
		this.list.add("Bil");
		assertTrue(this.list.firstIndex("Bob") == 3);

	}

	@Test
	public void testLastIndex() {
		this.list.add("Bob");
		this.list.add("Bob");
		this.list.add("Bob");
		assertTrue(this.list.lastIndex("Bob") == 5);
		assertTrue(this.list.lastIndex("Jil") < 0);
	}

}


text:
package org.PrometheeIRanking.xmcda;

import javafx.util.Pair;
import org.PrometheeIRanking.PrometheeIRanking;
import org.xmcda.ProgramExecutionResult;
import org.xmcda.XMCDA;
import org.xmcda.converters.v2_v3.XMCDAConverter;
import org.xmcda.parsers.xml.xmcda_v2.XMCDAParser;
import org.xmcda.utils.ValueConverters;

import java.io.File;
import java.util.List;
import java.util.Map;

public class PrometheeIRankingCLI_XMCDAv2 {

    public static void main(String[] args) throws Utils.InvalidCommandLineException, ValueConverters.ConversionException {

        final Utils.Arguments params = Utils.parseCmdLineArguments(args);
        final String indir = params.inputDirectory;
        final String outdir = params.outputDirectory;
        final File prgExecResultsFile = new File(outdir, "messages.xml");
        final ProgramExecutionResult executionResult = new ProgramExecutionResult();

        final XMCDA xmcda;

        org.xmcda.v2.XMCDA xmcda_v2 = new org.xmcda.v2.XMCDA();
        Utils.loadXMCDAv2(xmcda_v2, new File(indir, "alternatives.xml"), false,
                executionResult, "alternatives");
        Utils.loadXMCDAv2(xmcda_v2, new File(indir, "positive_flow.xml"), false,
                executionResult, "alternativesValues");
        Utils.loadXMCDAv2(xmcda_v2, new File(indir, "negative_flow.xml"), false,
                executionResult, "alternativesValues");

        if ( ! (executionResult.isOk() || executionResult.isWarning() ) )
        {
            Utils.writeProgramExecutionResultsAndExit(prgExecResultsFile, executionResult, Utils.XMCDA_VERSION.v2);
        }

        try
        {
            xmcda = XMCDAConverter.convertTo_v3(xmcda_v2);
        }
        catch (Throwable t)
        {
            executionResult.addError(Utils.getMessage("Could not convert inputs to XMCDA v3, reason: ", t));
            Utils.writeProgramExecutionResultsAndExit(prgExecResultsFile, executionResult, Utils.XMCDA_VERSION.v2);
            return;
        }

        final InputsHandler.Inputs inputs = InputsHandler.checkAndExtractInputs(xmcda, executionResult);

        if ( ! ( executionResult.isOk() || executionResult.isWarning() ) || inputs == null )
        {
            Utils.writeProgramExecutionResultsAndExit(prgExecResultsFile, executionResult, Utils.XMCDA_VERSION.v2);
        }

        final Map<Pair<String, String>, Integer> results ;
        try
        {
            results = PrometheeIRanking.calculatePrometheeIRanking(inputs);
        }
        catch (Throwable t)
        {
            executionResult.addError(Utils.getMessage("The calculation could not be performed, reason: ", t));
            Utils.writeProgramExecutionResultsAndExit(prgExecResultsFile, executionResult, Utils.XMCDA_VERSION.v2);
            return;
        }

        final Map<String, XMCDA> x_results = OutputsHandler.convert(inputs.alternatives_ids, results, executionResult);

        org.xmcda.v2.XMCDA results_v2;
        for ( String outputName : x_results.keySet() )
        {
            File outputFile = new File(outdir, String.format("%s.xml", outputName));
            try
            {
                results_v2 = XMCDAConverter.convertTo_v2(x_results.get(outputName));
                if ( results_v2 == null )
                    throw new IllegalStateException("Conversion from v3 to v2 returned a null value");
            }
            catch (Throwable t)
            {
                final String err = String.format("Could not convert %s into XMCDA_v2, reason: ", outputName);
                executionResult.addError(Utils.getMessage(err, t));
                continue;
            }
            try
            {
                XMCDAParser.writeXMCDA(results_v2, outputFile, OutputsHandler.xmcdaV2Tag(outputName));
            }
            catch (Throwable t)
            {
                final String err = String.format("Error while writing %s.xml, reason: ", outputName);
                executionResult.addError(Utils.getMessage(err, t));
                outputFile.delete();
            }
        }

        if (!executionResult.isError()) {
            executionResult.addDebug("Success");
        }

        Utils.writeProgramExecutionResultsAndExit(prgExecResultsFile, executionResult, Utils.XMCDA_VERSION.v2);
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.bimaas</groupId>
		<artifactId>services-as</artifactId>
		<version>1.0.0</version>
	</parent>

	<groupId>com.bimaas.as.services.networkrail</groupId>
	<artifactId>services-networkrail-as</artifactId>

	<packaging>war</packaging>
	<name>services-networkrail-as</name>
	<description></description>
	<properties>
		<CApp.type>webapp/jaxws</CApp.type>
	</properties>

	<dependencies>
		<dependency>
			<groupId>javax.ws.rs</groupId>
			<artifactId>jsr311-api</artifactId>
			<version>1.1.1</version>
		</dependency>

		<dependency>
			<groupId>asm</groupId>
			<artifactId>asm</artifactId>
			<version>3.3.1</version>
		</dependency>

		<dependency>
			<groupId>com.bimaas.data</groupId>
			<artifactId>bimaas-data</artifactId>
			<version>1.0.0</version>
		</dependency>

		<!-- CORS Filter -->
		<dependency>
			<groupId>com.thetransactioncompany</groupId>
			<artifactId>cors-filter</artifactId>
			<version>2.4</version>
		</dependency>

	</dependencies>
	<repositories>
		<repository>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>daily</updatePolicy>
				<checksumPolicy>ignore</checksumPolicy>
			</releases>
			<id>wso2-nexus</id>
			<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>daily</updatePolicy>
				<checksumPolicy>ignore</checksumPolicy>
			</releases>
			<id>wso2-nexus</id>
			<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
		</pluginRepository>
	</pluginRepositories>
	<build>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<!-- plugin> <artifactId>maven-war-plugin</artifactId> <version>2.2</version>
				<configuration> <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
				<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> <warName>${project.artifactId}</warName>
				</configuration> </plugin -->
			<plugin>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.9</version>
				<configuration>
					<buildcommands>
						<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
					</buildcommands>
					<projectnatures>
						<projectnature>org.wso2.developerstudio.eclipse.jaxrs.project.nature</projectnature>
						<projectnature>org.eclipse.jdt.core.javanature</projectnature>
					</projectnatures>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


text:
class AmberException(Exception):
    """
    Base exception class
    """
    pass

class IdMissing(AmberException):
    """
    Raised when an id you provided does not exist in cache
    """
    pass

class EventMissing(AmberException):
    """
    Raised when you try to access an event type that does not exist
    """
    pass

class NotAllowed(AmberException):
    """
    General exception for things you're not allowed to do (when trying to enter a room, for example).
    """
    pass

class NoSuchBlueprint(AmberException):
    """
    Raised when player tries to combine two items that have to matching blueprint
    """
    pass


text:
package org.adbcj.mysql.codec.decoding;

import org.adbcj.DbCallback;
import org.adbcj.DbException;
import org.adbcj.mysql.codec.BoundedInputStream;
import org.adbcj.mysql.codec.IoUtils;
import org.adbcj.mysql.codec.ServerStatus;
import org.adbcj.mysql.codec.packets.EofResponse;
import org.adbcj.mysql.codec.packets.ErrorResponse;
import org.adbcj.mysql.codec.packets.ServerPacket;
import io.netty.channel.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Set;

public abstract class DecoderState {

    protected static final Logger logger = LoggerFactory.getLogger(DecoderState.class);

    public static final int RESPONSE_ERROR = 0xff;
    public static final int RESPONSE_EOF   = 0xfe;
    public static final int RESPONSE_OK    = 0x00;

    public abstract ResultAndState parse(int length,
                                         int packetNumber,
                                         BoundedInputStream in, Channel channel) throws IOException;

    public ResultAndState result( DecoderState newState,ServerPacket result){
        return new ResultAndState(newState,result);
    }

    protected EofResponse decodeEofResponse(InputStream in, int length, int packetNumber, EofResponse.Type type) throws IOException {
        int warnings = IoUtils.readUnsignedShort(in);
        Set<ServerStatus> serverStatus = IoUtils.readEnumSetShort(in, ServerStatus.class);

        return new EofResponse(length, packetNumber, warnings, serverStatus, type);
    }

    public static ErrorResponse decodeErrorResponse(BoundedInputStream in, int length, int packetNumber) throws IOException {
    	// The Payload of an ERR Packet
    	//Type	      Name	           Description
    	//-----------------------------------------------------------
    	//int<1>	  header	       0xFF ERR packet header
    	//int<2>	  error_code	   error-code
    	//if capabilities & CLIENT_PROTOCOL_41 {
    	//string[1]	  sql_state_marker # marker of the SQL state
    	//string[5]	  sql_state	       SQL state
    	//}
    	//string<EOF> error_message	   human readable error message
        final int errorNumber = IoUtils.readUnsignedShort(in);
        final boolean hasMarker;
        in.mark(Integer.MAX_VALUE);
        try {
        	hasMarker = ('#' == in.read());
        } finally {
        	in.reset();
        }
        final Charset CHARSET = StandardCharsets.UTF_8;
        final String sqlState, message;
        if (hasMarker) {
        	in.read(); // Throw away sqlstate marker
        	// fixbug: sql_state string[5] as null-terming-string.
            // @since 2017-08-27 little-pan
            //String sqlState = IoUtils.readNullTerminatedString(in, CHARSET);
        	sqlState = IoUtils.readFixedLengthString(in, 5, CHARSET);
        	message  = IoUtils.readNullTerminatedString(in, CHARSET);
        } else {
        	// Prev-4.1's message, still can be output
        	//in newer versions(e.g 'Too many connections')
        	// @since 2017-09-01 little-pan
        	sqlState = "HY000";
        	message  = IoUtils.readFixedLengthString(in, length - 3, CHARSET);
        }
        return new ErrorResponse(length, packetNumber, errorNumber, sqlState, message);
    }

    /**
     * Sand-boxing the DbCallback for protecting ADBCJ kernel from being destroyed when the exception
     * occurs in user DbCallback.onComplete() code.
     *
     * @param cb the database callback
     * @return the sand-boxed callback
     * @since 2017-09-02 little-pan
     */
    public static <T> DbCallback<T> sandboxCallback(final DbCallback<T> cb){
    	if(cb.getClass() == SandboxDbCallback.class) {
    		return cb;
    	}
    	return (new SandboxDbCallback<T>(cb));
    }

    static class SandboxDbCallback<T> implements DbCallback<T> {
        final DbCallback<T> callback;

        SandboxDbCallback(final DbCallback<T> callback) {
            this.callback = callback;
        }

        @Override
        public void onComplete(final T result, final DbException failure) {
            try {
                callback.onComplete(result, failure);
            } catch (final Throwable cause) {
                logger.warn("Uncaught exception in DbCallback", cause);
            }
        }

    }

}


text:
<?php

class SimplePie_First_Item_Permalink_Test_Atom_10_xmlbase_1 extends SimplePie_First_Item_Permalink_Test
{
    function data()
    {
        $this->data =
'<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://example.com/">
    <entry>
        <link rel="alternate" href="/alternate"/>
    </entry>
</feed>';
    }

    function expected()
    {
        $this->expected = 'http://example.com/alternate';
    }
}

?>


text:
import logging
from werkzeug.utils import cached_property

from base import db, Base, DB_STRING_TYPE

COL_ID = 0
COL_DESCRIPTION = 1

class Cluster(Base):
    __tablename__ = 'cluster'

    description = db.Column(DB_STRING_TYPE)
    nodes = db.relationship('RedisNode', backref='assignee')
    proxies = db.relationship('Proxy', backref='cluster')

    @cached_property
    def current_task(self):
        from task import TaskLock
        lock = db.session.query(TaskLock).filter(
            TaskLock.cluster_id == self.id).first()
        return None if lock is None else lock.task

    def get_tasks(self, skip=0, limit=5):
        from task import ClusterTask
        return db.session.query(ClusterTask).filter(
            ClusterTask.cluster_id == self.id).order_by(
                ClusterTask.id.desc()).offset(skip).limit(limit).all()

def get_by_id(cluster_id):
    return db.session.query(Cluster).filter(Cluster.id == cluster_id).first()

def list_all():
    return db.session.query(Cluster).all()

def create_cluster(description):
    c = Cluster(description=description)
    db.session.add(c)
    db.session.flush()
    return c

def remove_empty_cluster(cluster_id):
    c = get_by_id(cluster_id)
    if len(c.nodes) == 0:
        logging.info('Remove cluster %d', cluster_id)
        c.proxies = []
        db.session.add(c)
        db.session.flush()
        db.session.delete(c)


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>ACE Autocompletion demo</title>


text:
import { Explore20 } from "../../";

export = Explore20;


text:
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

 Overview
 Library
  Tag
 Help

 FRAMES   NO FRAMES
All Tags

------------------------------------------------------------------------

tiles
 Tag get
--------

------------------------------------------------------------------------

**Gets the content from request scope that was put there by a put tag.**

Retrieve content from tile context and include it.

Take into account the 'type' attribute.

------------------------------------------------------------------------

**Tag Information**

Tag Class

org.apache.strutsel.taglib.tiles.ELGetTag

TagExtraInfo Class

*None*

Body Content

empty

Display Name

*None*

**Attributes**

**Name**

**Required**

**Request-time**

**Type**

**Description**

name

true

true

`java.lang.String`

The name of the content to get from tile/component scope.

ignore

false

true

`java.lang.String`

If this attribute is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown.

flush

false

false

`java.lang.String`

True or false. If true, current page out stream is flushed before insertion.

role

false

true

`java.lang.String`

If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped).

|-------------------------|
| **Variables**           |
| *No Variables Defined.* |

<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

 Overview
 Library
  Tag
 Help

 FRAMES   NO FRAMES
All Tags

------------------------------------------------------------------------

*Output Generated by [Tag Library Documentation Generator](http://taglibrarydoc.dev.java.net/). Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.*


text:
module.exports = function() {
  throw new Error('something went horribly wrong');
};


text:
package retrotooth;

import com.fasterxml.jackson.databind.ObjectWriter;

import java.io.IOException;

import retrotooth.ok.MediaType;

final class JacksonRequestBodyConverter<T> implements Converter<T, RequestData> {
    private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");

    private final ObjectWriter adapter;

    JacksonRequestBodyConverter(ObjectWriter adapter) {
        this.adapter = adapter;
    }

    @Override
    public RequestData convert(T value) throws IOException {
        byte[] bytes = adapter.writeValueAsBytes(value);
        return RequestData.create(MEDIA_TYPE, bytes);
    }
}


text:
'use strict';

let EventEmitter = require('events').EventEmitter;

class IOComponent extends EventEmitter {

  constructor() {
    super();

    this._type = 'IOComponent';
  }

  get type() {
    return this._type;
  }

}

module.exports = IOComponent;


text:
/*This package implements a stack datastructure
and simple push and pop functions for stack manipulations*/
package stack

type Stack struct {
	I    int
	Data [10]int
}

/*We use a pointer here so that the function works
on the actual variable and not a copy of it*/

//Push pushes an int on the stack
func (s *Stack) Push(k int) {
	if s.I+1 > 9 {
		return
	}
	s.Data[s.I] = k
	s.I++
}

//Pop pops out an item from the stack
func (s *Stack) Pop() int {
	s.I--
	return s.Data[s.I]
}


text:
%%%%%%%%%%%%%%%%%%
%% CONTENTS
%%%%%%%%%%%%%%%%%%
% Packages
% Commands
% Environments
% More commands: Resizable delimiters
% More commands: Derivatives
% Useful templates
% Notes
%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%
%% PACKAGES
%%%%%%%%%%%%%%%%%%

% standard and structural packages
\usepackage{graphicx} % support the \includegraphics command and options
\usepackage[font=footnotesize,labelfont=bf,labelsep=space]{caption}
	% makes figure captions better, more configurable.
	% specific options make captions smaller and the label bold.
\usepackage{subcaption} % allows for subfigures and subcaptions
	% can add usual caption options to change format for subcaptions
\usepackage{epstopdf} % allows complier to convert eps files to pdf files for inclusion in document
\usepackage{amsmath} % for nice math commands and environments
\usepackage{mathtools} % extends amsmath with bug fixes and useful commands, e.g.
	% \shortintertext for short interjections in align environment,
	% \prescript{t}{b}{X} for simple, nicely aligned math pre-(super/sub)scripts
\usepackage{amsthm} % for theorem and proof environments
\usepackage[pdfencoding=auto,psdextra]{hyperref} % adds hyperlinks and outline to PDF documents
	% otpions enable enhanced unicode and math support in PDF outlines [causes conflict with \C command?]

% font packages
\usepackage{amssymb} % for \mathbb, \mathfrak fonts
\usepackage{mathrsfs} % for \mathscr font
\usepackage{dsfont} % best option for non-alphabetical doublestruck characters
\usepackage{bbm} % alternative option for non-alphabetical doublestruck characters
\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it} % defines \mathpzc for Zapf Chancery (standard postscript) font
	% basically another calligraphic font, alternative to mathcal

% other packages
\usepackage{datetime} % allows easy formatting of dates, e.g. \formatdate{dd}{mm}{yyyy}
\usepackage[inline]{enumitem} % allows for custom labels on enumerated lists
	% e.g. \begin{enumerate}[label=\textbf{(\alph*)}]
	% inline option creates '*' versions of enumerate, itemize, description
		% which can be inlined within the text of a paragraph.
\usepackage[squaren]{SIunits} % for nice units formatting e.g. \unit{50}{\kilo\gram}
\usepackage{cancel} % for crossing out terms with \cancel
\usepackage{verbatim} % for verbatim and comment environments
\usepackage{tensor} % for \indices e.g. M\indices{^a_b^{cd}_e}, and \tensor e.g. \tensor[^a_b^c_d]{M}{^a_b^c_d}
\usepackage{mhchem} % for writing chemical formulas with \ce, e.g. \ce{AgCl2-} or \ce{^{227}_{90}Th+}
\usepackage{feynmp-auto} % for Feynman diagrams.
\usepackage{pgfplots} % for plotting in tikzpicture environment
\usepackage{commath} % for some nice standardized syntax stuff.
	% \dif, \Dif, \od, \pd, \md, \(abs | envert), \(norm | enVert), \(set | cbr), \sbr, \eval, \int(o | c)(o | c), etc
\usepackage{slashed} % provides a command \slashed[1] for Feynman slash notation
\usepackage{listings} % for typesetting source code
\usepackage{algorithmicx} % for typesetting algorithms and pseudocode

\usepackage{rotating}
	% provides environments for rotating arbitrary objects, e.g. sideways, turn[ang], rotate[ang]
	% also provides macro \turnbox{ang}{stuff}
%\newcommand{\sideways}[1]{\begin{sideways} #1 \end{sideways}} % turn things 90 degrees CCW
%\newcommand{\turn}[2][]{\begin{turn}{#2} #1 \end{turn}} % \turn[ang]{stuff} turns things arbitrary +/- angle

%%%%%%%%%%%%%%%%%%
%% COMMANDS
%%%%%%%%%%%%%%%%%%

% functions and operators
\newcommand{\opname}[1]{\operatorname{#1}} % custom operator names
\newcommand{\tr}{\opname{tr}} % for trace
\newcommand{\Tr}{\opname{Tr}} % for Trace
\newcommand{\rank}{\opname{rank}} % for rank
\newcommand{\diag}{\opname{diag}} % i.e. \diag(\lambda_1, \dots, \lambda_n)
\let \fancyre = \Re
\let \fancyim = \Im
\renewcommand{\Re}{\opname{Re}}
\renewcommand{\Im}{\opname{Im}}
\newcommand{\Res}{\opname{Res}\limits} % for residue function -- change to put limits on bottom
\newcommand{\inv}{^{-1}}
\newcommand{\sech}{\opname{sech}}
\newcommand{\csch}{\opname{csch}}

% vector and other notational commands
\let \vaccent = \v % rename builtin command \v{} to \vaccent{}
\renewcommand{\v}[1]{\ensuremath{\boldsymbol{\mathbf{#1}}}} % for vectors
\newcommand{\uv}[1]{\ensuremath{\boldsymbol{\mathbf{\widehat{#1}}}}} % for unit vectors
\newcommand{\vd}[1]{\v{\dot{#1}}} % for dotted vectors
\newcommand{\vdd}[1]{\v{\ddot{#1}}} % for ddotted vectors
\newcommand{\vddd}[1]{\v{\dddot{#1}}} % for dddotted vectors
\newcommand{\vdddd}[1]{\v{\ddddot{#1}}} % for ddddotted vectors
\renewcommand{\bbar}[1]{\bar{\bar{#1}}} % for barring things twice -- use \cbar or \zbar instead of original \bbar
\newcommand{\bbbar}[1]{\bar{\bbar{#1}}}
\newcommand{\bbbbar}[1]{\bar{\bbbar{#1}}}

% deprecated by commath package
%\newcommand{\abs}[1]{\left| #1 \right|} % for absolute value ||x||
%\newcommand{\mag}{\abs} % magnitude, just another name for \abs
%\newcommand{\norm}[1]{\left\Vert #1 \right\Vert} % for norm ||v||

% more stuff
\newcommand{\grad}[1]{\v{\nabla} #1} % for gradient
\let \divsymb = \div % rename builtin command \div to \divsymb
\renewcommand{\div}[1]{\v{\nabla} \cdot #1} % for divergence
\newcommand{\curl}[1]{\v{\nabla} \times #1} % for curl
\let \baraccent = \= % rename builtin command \= to \baraccent
\renewcommand{\=}[1]{\stackrel{#1}{=}} % for putting numbers above =

% notational shortcuts
\newcommand{\bigO}{\mathcal{O}} % big O notation
\let \bigo = \bigO % deprecated version. keeping for now because need to update instances in older files
\newcommand{\Lag}{\mathcal{L}} % fancy Lagrangian
\newcommand{\Ham}{\mathcal{H}} % fancy Hamiltonian
% fields and spaces
\newcommand{\reals}{\mathbb{R}} % real numbers
\newcommand{\complexes}{\mathbb{C}} % complex numbers
\newcommand{\ints}{\mathbb{Z}} % integers
\newcommand{\nats}{\mathbb{N}} % natural numbers
\newcommand{\irrats}{\mathbb{Q}} % irrationals
\newcommand{\quats}{\mathbb{H}} % quaternions (a la Hamilton)
\newcommand{\euclids}{\mathbb{E}} % Euclidean space
\newcommand{\R}{\reals}
\renewcommand{\C}{\complexes}
\newcommand{\Z}{\ints}
\newcommand{\Q}{\irrats}
\newcommand{\N}{\nats}
\newcommand{\E}{\euclids}
\newcommand{\RP}{\mathbb{RP}} % real projective space
\newcommand{\CP}{\mathbb{CP}} % complex projective space
% Lie groups
\newcommand{\SO}{\mathrm{SO}}
\newcommand{\SU}{\mathrm{SU}}
% etc

% matrix shortcuts! only use for small vectors/matrices and such
\newcommand{\pmat}[1]{\begin{pmatrix} #1 \end{pmatrix}}
\newcommand{\bmat}[1]{\begin{bmatrix} #1 \end{bmatrix}}
\newcommand{\Bmat}[1]{\begin{Bmatrix} #1 \end{Bmatrix}}
\newcommand{\vmat}[1]{\begin{vmatrix} #1 \end{vmatrix}}
\newcommand{\Vmat}[1]{\begin{Vmatrix} #1 \end{Vmatrix}}

%%%%%%%%%%%%%%%%%%
%% ENVIRONMENTS
%%%%%%%%%%%%%%%%%%

\newcommand{\beg}{\begin} % a few letters less for beginning environments
\newenvironment{eqn}{\begin{equation}}{\end{equation}} % a lot fewer letter for equation environment

\newenvironment{enumproblem}{
	\begin{enumerate}[label=\textbf{(\alph*)},listparindent=\parindent]
	}{\end{enumerate}}
	% for easily enumerating letters in problems

% theorem-style environments. note amsthm builtin proof environment: \begin{proof}[title]
% appending [section] resets counter and prepends section number
% use \setcounter{counter}{0} to reset counter
% typical use cases:
% plain: Theorem, Lemma, Corollary, Proposition, Conjecture, Criterion, Algorithm
% definition: Definition, Condition, Problem, Example
% remark: Remark, Note, Notation, Claim, Summary, Acknowledgment, Case, Conclusion
\theoremstyle{plain} % default
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{conjecture}[theorem]{Conjecture}
% definition style
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\newtheorem{problem}{Problem}
\newtheorem{exercise}{Exercise}
\newtheorem{example}{Example}
% remark style
\theoremstyle{remark}
\newtheorem{remark}{Remark}
\newtheorem{note}{Note}
\newtheorem{claim}{Claim}
\newtheorem{conclusion}{Conclusion}
% to-do: add problem/subproblem/answer environments for homeworks

%%%%%%%%%%%%%%%%%%
% RESIZEABLE DELIMITERS
%%%%%%%%%%%%%%%%%%

% the value for the optional argument ranges from -1 to 4 with higher values resulting in larger delimiters
% default value for #1 is -1 which results in automatic size for the delimeters
\providecommand{\bra}[2][-1]{
\ensuremath{\mathinner{
\ifthenelse{\equal{#1}{-1}}{ % if
\left< #2 \right| }{}
\ifthenelse{\equal{#1}{0}}{ % if
\langle #2 | }{}
\ifthenelse{\equal{#1}{1}}{ % if
\bigl< #2 \bigr| }{}
\ifthenelse{\equal{#1}{2}}{ % if
\Bigl< #2 \Bigr| }{}
\ifthenelse{\equal{#1}{3}}{ % if
\biggl< #2 \biggr| }{}
\ifthenelse{\equal{#1}{4}}{ % if
\Biggl< #2 \Biggr| }{}
}} % \ensuremath{\mathinner{
}  % bra - Dirac bra <x|. the optional argument describes the size of the delimiters, no argument results in automatic size

% the value for the optional argument ranges from -1 to 4 with higher values resulting in larger delimiters
% default value for #1 is -1 which results in automatic size for the delimeters
\providecommand{\ket}[2][-1]{
\ensuremath{\mathinner{
\ifthenelse{\equal{#1}{-1}}{ % if
\left| #2 \right> }{}
\ifthenelse{\equal{#1}{0}}{ % if
| #2 \rangle }{}
\ifthenelse{\equal{#1}{1}}{ % if
\bigl| #2 \bigr> }{}
\ifthenelse{\equal{#1}{2}}{ % if
\Bigl| #2 \Bigr> }{}
\ifthenelse{\equal{#1}{3}}{ % if
\biggl| #2 \biggr> }{}
\ifthenelse{\equal{#1}{4}}{ % if
\Biggl| #2 \Biggr> }{}
}} % \ensuremath{\mathinner{
}  % bra - Dirac ket |x>. the optional argument describes the size of the delimiters, no argument results in automatic size

% the value for the optional argument ranges from -1 to 4 with higher values resulting in larger delimiters
% default value for #1 is -1 which results in automatic size for the delimeters
\providecommand{\braket}[3][-1]{
\ensuremath{\mathinner{
\ifthenelse{\equal{#1}{-1}}{ % if
\left< #2 \vphantom{#3} \right| \left. #3 \vphantom{#2} \right> }{}
\ifthenelse{\equal{#1}{0}}{ % if
\langle #2 | #3 \rangle }{}
\ifthenelse{\equal{#1}{1}}{ % if
\bigl< #2 \vphantom{#3} \bigr| \bigl. #3 \vphantom{#2} \bigr> }{}
\ifthenelse{\equal{#1}{2}}{ % if
\Bigl< #2 \vphantom{#3} \Bigr| \Bigl. #3 \vphantom{#2} \Bigr> }{}
\ifthenelse{\equal{#1}{3}}{ % if
\biggl< #2 \vphantom{#3} \biggr| \biggl. #3 \vphantom{#2} \biggr> }{}
\ifthenelse{\equal{#1}{4}}{ % if
\Biggl< #2 \vphantom{#3} \Biggr| \Biggl. #3 \vphantom{#2} \Biggr> }{}
}} % \ensuremath{\mathinner{
}  % braket - Dirac bra-ket <x|y>. the optional argument describes the size of the delimiters, no argument results in automatic size

% the value for the optional argument ranges from -1 to 4 with higher values resulting in larger delimiters
% default value for #1 is -1 which results in automatic size for the delimeters
\providecommand{\matrixel}[4][-1]{
\ensuremath{\mathinner{
\ifthenelse{\equal{#1}{-1}}{ % if
\left< #2 \vphantom{#3#4} \right| #3 \left| #4 \vphantom{#2#3} \right> }{}
\ifthenelse{\equal{#1}{0}}{ % if
\langle #2 \vphantom{#3#4} | #3 | #4 \vphantom{#2#3} \rangle }{}
\ifthenelse{\equal{#1}{1}}{ % if
\bigl< #2 \vphantom{#3#4} \bigr| #3 \bigl| #4 \vphantom{#2#3} \bigr> }{}
\ifthenelse{\equal{#1}{2}}{ % if
\Bigl< #2 \vphantom{#3#4} \Bigr| #3 \Bigl| #4 \vphantom{#2#3} \Bigr> }{}
\ifthenelse{\equal{#1}{3}}{ % if
\biggl< #2 \vphantom{#3#4} \biggr| #3 \biggl| #4 \vphantom{#2#3} \biggr> }{}
\ifthenelse{\equal{#1}{4}}{ % if
\Biggl< #2 \vphantom{#3#4} \Biggr| #3 \Biggl| #4 \vphantom{#2#3} \Biggr> }{}
}} % \ensuremath{\mathinner{
}  % matrixel - matrix element <x|A|y>. the optional argument describes the size of the delimiters, no argument results in automatic size

% the value for the optional argument ranges from -1 to 4 with higher values resulting in larger delimiters
% default value for #1 is -1 which results in automatic size for the delimeters
\providecommand{\avg}[2][-1]{
\ensuremath{\mathinner{
\ifthenelse{\equal{#1}{-1}}{ % if
\left< #2 \right> }{}
\ifthenelse{\equal{#1}{0}}{ % if
\langle #2 \rangle }{}
\ifthenelse{\equal{#1}{1}}{ % if
\bigl< #2 \bigr> }{}
\ifthenelse{\equal{#1}{2}}{ % if
\Bigl< #2 \Bigr> }{}
\ifthenelse{\equal{#1}{3}}{ % if
\biggl< #2 \biggr> }{}
\ifthenelse{\equal{#1}{4}}{ % if
\Biggl< #2 \Biggr> }{}
}} % \ensuremath{\mathinner{
}  % avg - average value <x>. the optional argument describes the size of the delimiters, no argument results in automatic size

% the value for the optional argument ranges from -1 to 4 with higher values resulting in larger delimiters
% default value for #1 is -1 which results in automatic size for the delimeters
\providecommand{\inner}[3][-1]{
\ensuremath{\mathinner{
\ifthenelse{\equal{#1}{-1}}{ % if
\left< #2 , #3 \right> }{}
\ifthenelse{\equal{#1}{0}}{ % if
\langle #2 , #3 \rangle }{}
\ifthenelse{\equal{#1}{1}}{ % if
\bigl< #2 , #3 \bigr> }{}
\ifthenelse{\equal{#1}{2}}{ % if
\Bigl< #2 , #3 \Bigr> }{}
\ifthenelse{\equal{#1}{3}}{ % if
\biggl< #2 , #3 \biggr> }{}
\ifthenelse{\equal{#1}{4}}{ % if
\Biggl< #2 , #3 \Biggr> }{}
}} % \ensuremath{\mathinner{
}  % inner - inner product <x,y>. the optional argument describes the size of the delimiters, no argument results in automatic size

%%%%%%%%%%%%%%%%%%
%% DERIVATIVES
%%%%%%%%%%%%%%%%%%

% BUG: derivatives revert to text mode often when in smaller environments in math mode?
% FIXED: below by setting defaults to display
% BUG: superscripts in bottom of derivative impose double superscript error
% -- requires embedding within brackets, i.e. \pd{x^\mu}{{y^\nu}}
% -- redefine \pd and other derivatives?

% Command for functional derivatives. The first argument denotes the function and the second argument denotes the variable with respect to which the derivative is taken. The optional argument denotes the order of differentiation. The style (text style/display style) is determined automatically
\providecommand{\fd}[3][]{\ensuremath{
\ifinner
\tfrac{\delta{^{#1}}#2}{\delta{#3^{#1}}}
\else
\dfrac{\delta{^{#1}}#2}{\delta{#3^{#1}}}
\fi
}}

% \tfd[2]{f}{k} denotes the second functional derivative of f with respect to k
% The first letter t means "text style"
\providecommand{\tfd}[3][]{\ensuremath{\mathinner{
\tfrac{\delta{^{#1}}#2}{\delta{#3^{#1}}}
}}}
% \dfd[2]{f}{k} denotes the second functional derivative of f with respect to k
% The first letter d means "display style"
\providecommand{\dfd}[3][]{\ensuremath{\mathinner{
\dfrac{\delta{^{#1}}#2}{\delta{#3^{#1}}}
}}}

% mixed functional derivative - analogous to the functional derivative command
% \mfd{F}{5}{x}{2}{y}{3}
\providecommand{\mfd}[6]{\ensuremath{
\ifinner
\tfrac{\delta{^{#2}}#1}{\delta{#3^{#4}}\delta{#5^{#6}}}
\else
\dfrac{\delta{^{#2}}#1}{\delta{#3^{#4}}\delta{#5^{#6}}}
\fi
}}

% Command for thermodynamic (chemistry?) partial derivatives. The first argument denotes the function and the second argument denotes the variable with respect to which the derivative is taken. The optional argument denotes the order of differentiation. The style (text style/display style) is determined automatically
\providecommand{\pdc}[4][]{\ensuremath{
\ifinner
\left( \tfrac{\partial{^{#1}}#2}{\partial{#3^{#1}}} \right)_{#4}
\else
\left( \dfrac{\partial{^{#1}}#2}{\partial{#3^{#1}}} \right)_{#4}
\fi
}}

% \tpd[2]{f}{k} denotes the second thermo partial derivative of f with respect to k
% The first letter t means "text style"
\providecommand{\tpdc}[4][]{\ensuremath{\mathinner{
\left( \tfrac{\partial{^{#1}}#2}{\partial{#3^{#1}}} \right)_{#4}
}}}
% \dpd[2]{f}{k} denotes the second thermo partial derivative of f with respect to k
% The first letter d means "display style"
\providecommand{\dpdc}[4][]{\ensuremath{\mathinner{
\left( \dfrac{\partial{^{#1}}#2}{\partial{#3^{#1}}} \right)_{#4}
}}}

% some shorter synonyms for commath
\let \underdot = \d % rename builtin command \d{} to \underdot{}
\let \d = \od % for derivatives
\let \pd = \dpd % redefine \pd as \dpd because the ambiguity is annoying
\let \fd = \dfd % likewise for these
\let \od = \dod
\let \pdc = \dpdc

% fixes for commath's differentials, which look bad for powers, e.g. $\dif^3 x$
\renewcommand{\dif}{\mathrm{d}} % \opname{d} better maybe?
\renewcommand{\Dif}{\mathrm{D}}

%%%%%%%%%%%%%%%%%%
%% USEFUL TEMPLATES
%%%%%%%%%%%%%%%%%%

\begin{comment}

% template for figures
\begin{figure}
\centering
\includegraphics[width=0.8\textwidth]{myfile.png}
\caption{This is a caption}
\label{fig:myfigure}
\end{figure}

% template for subfigures
\begin{figure}
	\centering
	\begin{subfigure}[b]{0.3\textwidth}
		\includegraphics[width=\textwidth]{gull}
		\caption{A gull}
		\label{fig:gull}
	\end{subfigure}%
	~ %add desired spacing between images, e. g. ~, \quad, \qquad, \hfill etc.
		%(or a blank line to force the subfigure onto a new line)
	\begin{subfigure}[b]{0.3\textwidth}
		\includegraphics[width=\textwidth]{tiger}
		\caption{A tiger}
		\label{fig:tiger}
	\end{subfigure}
	~ %add desired spacing between images, e. g. ~, \quad, \qquad, \hfill etc.
	%(or a blank line to force the subfigure onto a new line)
	\begin{subfigure}[b]{0.3\textwidth}
		\includegraphics[width=\textwidth]{mouse}
		\caption{A mouse}
		\label{fig:mouse}
	\end{subfigure}
	\caption{Pictures of animals}\label{fig:animals}
\end{figure}

% template for Feynman diagrams using feynmf/feynmp
\begin{fmfgraph*}(40,25)
\fmfleft{em,ep}
\fmf{fermion}{em,Zee,ep}
\fmf{photon,label=$Z$}{Zee,Zff}
\fmf{fermion}{fb,Zff,f}
\fmfright{fb,f}
\fmfdot{Zee,Zff}
\end{fmfgraph*}

% template for drawing plots with pgfplot
\pgfplotsset{compat=1.3,compat/path replacement=1.5.1}
\begin{tikzpicture}
\begin{axis}[
extra x ticks={-2,2},
extra y ticks={-2,2},
extra tick style={grid=major}]
\addplot {x};
\draw (axis cs:0,0) circle[radius=2];
\end{axis}
\end{tikzpicture}

%% find package for easily drawing mapping / algebraic / commutative diagrams..

\end{comment}
%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%
%% NOTES
%%%%%%%%%%%%%%%%%%

%% Note on math environments
% 'equation' and 'align' are basic standards
	% use '&' to for alignment in 'align'
	% multi-line environments all end lines with '\\' (except for last line)
	% generally all lines are tagged except in 'split' and '*' versions of environments
	% add \label{txt} after line to give LaTeX-label, \tag{txt} to change textual label
% use 'gather' to display multiple center-aligned lines (no manual alignment)
	% tags/labels every line
% use 'multline' to left-align first line, right-aline last line, and center-align all lines in between (no manual alignment)
	% only tags/labels last line
% use 'split' within 'equation' or 'align' to give single middle-aligned tag/label to the contained lines
	% use '&' for alignment within 'split'
	% no '*' version

%% Note on spacing
% 5) \qquad
% 4) \quad
% 3) \thickspace = \;
% 2) \medspace = \:
% 1) \thinspace = \,
% -1) \negthinspace = \!
% -2) \negmedspace
% -3) \negthickspace

%% Note on useful synonyms
% \rightarrow = \to
% \leftarrow = \gets
% \ni = \owns = backwards \in
% \cup = union, \cap = intersect
% \sqcup / \sqcap for disjoint varieties
% \gg = >>, \ll = <<
% \vert = | (pipe, e.g. absolute value delimiter),
% \Vert = || (double pipes, e.g. norm delimiter)


text:
from django.conf.urls import url
from . import views

urlpatterns = [
     url(r'^addpayment$', views.addPayment.as_view(), name='addpayment'),
     url(r'^paymentmethods$', views.paymentMethods.as_view(), name='paymentmethods'),
   ]


text:
#ifndef LayoutImageResourceStyleImage_h
#define LayoutImageResourceStyleImage_h

#include "core/layout/LayoutImageResource.h"
#include "core/style/StyleImage.h"
#include "wtf/RefPtr.h"

namespace blink {

class LayoutObject;

class LayoutImageResourceStyleImage final : public LayoutImageResource {
public:
    ~LayoutImageResourceStyleImage() override;

    static PassOwnPtrWillBeRawPtr<LayoutImageResource> create(StyleImage* styleImage)
    {
        return adoptPtrWillBeNoop(new LayoutImageResourceStyleImage(styleImage));
    }
    void initialize(LayoutObject*) override;
    void shutdown() override;

    bool hasImage() const override { return true; }
    PassRefPtr<Image> image(const IntSize&) const override;
    bool errorOccurred() const override { return m_styleImage->errorOccurred(); }

    void setContainerSizeForLayoutObject(const IntSize&) override;
    bool imageHasRelativeWidth() const override { return m_styleImage->imageHasRelativeWidth(); }
    bool imageHasRelativeHeight() const override { return m_styleImage->imageHasRelativeHeight(); }

    LayoutSize imageSize(float multiplier) const override { return m_styleImage->imageSize(m_layoutObject, multiplier); }
    LayoutSize intrinsicSize(float multiplier) const override { return m_styleImage->imageSize(m_layoutObject, multiplier); }

    WrappedImagePtr imagePtr() const override { return m_styleImage->data(); }

    DECLARE_VIRTUAL_TRACE();

private:
    explicit LayoutImageResourceStyleImage(StyleImage*);
    RefPtrWillBeMember<StyleImage> m_styleImage;
};

} // namespace blink

#endif // LayoutImageStyleImage_h


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xmldataset [
<!ELEMENT dataset (table+)>
<!ELEMENT table (column*, row*)>
<!ATTLIST table name CDATA #REQUIRED>
<!ELEMENT column (#PCDATA)>
<!ELEMENT row (value | null | none)*>
<!ELEMENT value (#PCDATA)>
<!ELEMENT null EMPTY>
<!ELEMENT none EMPTY>
]>
<dataset>
  <table name="MESSAGE">
    <column>ID</column>
    <column>TEXT</column>
    <row>
      <value>1</value>
      <value>Hello, world!</value>
    </row>
  </table>
</dataset>


text:
apply unified.patch containing unified context to the file specified therein

    patch <unified.patch

apply default.patch without unified context to a.txt

    patch a.txt <default.patch

use the whole file path in unified.patch to find the file to patch

    patch -p0 <unified.patch

# Basic Usage

Apply a patch file with unified context:

    patch <<patchfile>

Apply a patch file without unified context:

    patch file-to-patch.txt <<patchfile>

See `eg diff` for more discussion on unified context.

# Accounting for Patch File Location

By default, the file specified by a unified context is assumed to be in the
current directory. However, the file specified in unified context can include
more specific path information. This can be taken into account by `patch` by
using the `-p` command, which allows you to store the patch file at a different
location.

The `-p` command takes a numeric value. It modifies the search path of the file
by stripping a leading string by consuming as many slashes as possible from the
path in the patch file. A value of 0 will cause `patch` to take the entire path
rather than look in the current directory.

If the file name in the patch file is `/absolute/path/to/repo/file.txt`, this
command will cause `patch` to look for the file using the entire path by
stripping no prefix string (`-p0`):

    patch -p0 <unified.patch

If the patch file resided as a sibling of the `repo/` directory, 4 slashes
(`-p4`) would need to be stripped to point `patch` at the file located in
`repo/file.txt`:

    patch -p4 <unified.patch