text:
#ifndef PEGR_CAMERA_HPP
#define PEGR_CAMERA_HPP

#include "pegr/video/GraphicsApiLibrary.hpp"

namespace pegr {
class Camera {
public:
    Camera(float fov, float aspect, float nearDepth, float farDepth);
    Camera();
    virtual ~Camera();

private:
    float mFOV;
    float mAspect;
    float mNearDepth;
    float mFarDepth;

    glm::mat4 mViewMatr;
    glm::mat4 mProjMatr;

public:
    void setProjMatrix(glm::mat4 projMatrix);
    void setProjMatrix(float fov, float aspect, float nearDepth, float farDepth);
    void setViewMatrix(glm::mat4 viewMatrix);
    void setViewMatrix(glm::vec3 location, glm::vec3 lookAt, glm::vec3 up);

    glm::mat4 getProjMatrix() const;
    glm::mat4 getViewMatrix() const;

    float getFOV() const;
    float getFarDepth() const;
    float getNearDepth() const;

    glm::vec3 calcLocation() const;
    glm::vec3 calcDirection() const;
};
}

#endif // PEGR_CAMERA_HPP


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Net;
using WebDAVSharp.Server.Exceptions;

namespace WebDAVTests
{
    /// <summary>
    /// Tests if the exceptions have the right statuscodes
    /// </summary>
    [TestClass]
    public class UnitTestExceptions
    {
        /// <summary>
        /// Checks if the <see cref="WebDavConflictException" /> has the statuscode 409 Conflict.
        /// </summary>
        [TestMethod]
        public void Exception_Conflict_Test()
        {
            var exception = new WebDavConflictException();
            Assert.AreEqual((int)HttpStatusCode.Conflict, exception.StatusCode);
        }

        /// <summary>
        /// Checks if the <see cref="WebDavForbiddenException" /> has the statuscode 403 Forbidden.
        /// </summary>
        [TestMethod]
        public void Exception_Forbidden_Test()
        {
            var exception = new WebDavForbiddenException();
            Assert.AreEqual((int)HttpStatusCode.Forbidden, exception.StatusCode);
        }

        /// <summary>
        /// Checks if the <see cref="WebDavInternalServerException" /> has the statuscode 500 Internal Server Error.
        /// </summary>
        [TestMethod]
        public void Exception_InternalServer_Test()
        {
            var exception = new WebDavInternalServerException();
            Assert.AreEqual((int)HttpStatusCode.InternalServerError, exception.StatusCode);
        }

        /// <summary>
        /// Checks if the <see cref="WebDavLengthRequiredException" /> has the statuscode 411 Length Required.
        /// </summary>
        [TestMethod]
        public void Exception_LengthRequired_Test()
        {
            var exception = new WebDavLengthRequiredException();
            Assert.AreEqual((int)HttpStatusCode.LengthRequired, exception.StatusCode);
        }

        /// <summary>
        /// Checks if the <see cref="WebDavMethodNotAllowedException" /> has the statuscode 405 Method Not Allowed.
        /// </summary>
        [TestMethod]
        public void Exception_MethodNotAllowed_Test()
        {
            var exception = new WebDavMethodNotAllowedException();
            Assert.AreEqual((int)HttpStatusCode.MethodNotAllowed, exception.StatusCode);
        }

        /// <summary>
        /// Checks if the <see cref="WebDavNotFoundException" /> has the statuscode 404 Not Found.
        /// </summary>
        [TestMethod]
        public void Exception_NotFound_Test()
        {
            var exception = new WebDavNotFoundException();
            Assert.AreEqual((int)HttpStatusCode.NotFound, exception.StatusCode);
        }

        /// <summary>
        /// Checks if the <see cref="WebDavNotImplementedException" /> has the statuscode 501 Not Implemented.
        /// </summary>
        [TestMethod]
        public void Exception_NotImplemented_Test()
        {
            var exception = new WebDavNotImplementedException();
            Assert.AreEqual((int)HttpStatusCode.NotImplemented, exception.StatusCode);
        }

        /// <summary>
        /// Checks if the <see cref="WebDavPreconditionFailedException" /> has the statuscode 412 Precondition Failed.
        /// </summary>
        [TestMethod]
        public void Exception_PreconditionFailed_Test()
        {
            var exception = new WebDavPreconditionFailedException();
            Assert.AreEqual((int)HttpStatusCode.PreconditionFailed, exception.StatusCode);
        }

        /// <summary>
        /// Checks if the <see cref="WebDavUnauthorizedException" /> has the statuscode 401 Unauthorized.
        /// </summary>
        [TestMethod]
        public void Exception_Unauthorized_Test()
        {
            var exception = new WebDavUnauthorizedException();
            Assert.AreEqual((int)HttpStatusCode.Unauthorized, exception.StatusCode);
        }

        /// <summary>
        /// Checks if the <see cref="WebDavUnsupportedMediaTypeException" /> has the statuscode 415 Unsupported Media Type.
        /// </summary>
        [TestMethod]
        public void Exception_UnsupportedMediaType_Test()
        {
            var exception = new WebDavUnsupportedMediaTypeException();
            Assert.AreEqual((int)HttpStatusCode.UnsupportedMediaType, exception.StatusCode);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
 Django-Config
###################
An architecture for maintaining multiple settings files in Django

Overview
========
django-config is an easy way to maintain multiple configurations for django. It relies on the concept of having a shared configuration file (base)
and a per user/ server custom configuration file (dev1/ dev2/ local/ staging). settings.py combines the base & custom configuration and loads it up.

Installation
============
1. Include the djangoconfig application in your django application set.
2. Create a directory named 'config' at the root directory of your project. 'config' directory will contain your global settings file: 'base.py' & all custom configuration file e.g. 'local.py'.
3. Overwrite 'manage.py' & 'settings.py' with the files supplied with django-config

Usage
=====
1. Add new settings to your custom settings file.
2. Override base settings in custom settings file.
3. Whenever you run manage.py, select your configuration identifier

More
====

The primary repository for Django-Config is located at:

`http://github.com/tarequeh/django-config/ <http://github.com/tarequeh/django-config/>`_

Django-Config was created by Nowell Strite. Extended and maintained by Tareque Hossain


text:
from django.forms import ModelForm
from django.core.exceptions import ValidationError
from django import forms
from apps.validez_nacional.models import Solicitud, EstadoSolicitud
from django.core.validators import RegexValidator

class SolicitudControlForm(forms.ModelForm):
    nro_expediente = forms.CharField(max_length=200, label='Nro. Expediente', required=False, validators=[
        RegexValidator(
            '^.*\/[0-9]{2}$',
            message='El Nro de Expediente debe incluir dos dígitos indicando el año (ej: abcde/14)',
            code='expediente_invalido'
        ),
    ])
    # EX-XXXX-XXXXXXXX- -APN-DVNTYE#ME
    nro_expediente_gedo = forms.CharField(max_length=200, label='Nro. Expediente GEDO', required=False, validators=[
        RegexValidator(
            '^[0-9]{,4}\-[0-9]{,10}$',
            message='El Nro de Expediente debe tener el formato XXXX-XXXXXXXX (números)',
            code='expediente_invalido'
        ),
    ])
    dictamen_cofev = forms.CharField(max_length=200, label='Dictamen Cofev', required=False)
    normativas_nacionales = forms.CharField(max_length=99, label='Normativas Nacionales', required=False)
    estado = forms.ModelChoiceField(queryset=EstadoSolicitud.objects.order_by('nombre'), label='Estado', required=True, empty_label=None)

    class Meta:
       model = Solicitud
       fields = ('dictamen_cofev', 'normativas_nacionales', 'estado', 'nro_expediente', 'nro_expediente_gedo')

    def __init__(self, *args, **kwargs):
        super(SolicitudControlForm, self).__init__(*args, **kwargs)
        # No se puede pasar a estado numerado por esta vía
        self.fields['estado'].queryset = EstadoSolicitud.objects.exclude(nombre=EstadoSolicitud.NUMERADO)

    def clean(self):
        data = self.cleaned_data

        '''
        REGLAS:
        -------
        PENDIENTE: sin requerimientos
        CONTROLADO: Nro Exp
        RETENIDO: Nro Exp
        EVALUADO: Dictamen COFEV
        NUMERADO: (se pasa en la numeración)
        '''
        try:
            estado = data['estado'].nombre
        except KeyError:
            estado = None

        try:
            normativas_nacionales = data['normativas_nacionales']
        except KeyError:
            normativas_nacionales = None

        try:
            dictamen_cofev = data['dictamen_cofev']
        except KeyError:
            dictamen_cofev = None

        try:
            nro_expediente = data['nro_expediente']
        except KeyError:
            nro_expediente = None

        try:
            nro_expediente_gedo = data['nro_expediente_gedo']
        except KeyError:
            nro_expediente_gedo = None

        if nro_expediente and nro_expediente_gedo:
            raise forms.ValidationError(u'Sólo se puede cargar un tipo de expediente')

        if estado == EstadoSolicitud.CONTROLADO and (nro_expediente == '' and nro_expediente_gedo == ''):
            raise forms.ValidationError(u'Para pasar a estado "controlado", es necesario cargar el número de expediente')
        if estado == EstadoSolicitud.RETENIDO and (nro_expediente == '' and nro_expediente_gedo == ''):
            raise forms.ValidationError(u'Para pasar a estado "retenido", es necesario cargar el número de expediente')
        if estado == EstadoSolicitud.EVALUADO and dictamen_cofev == '':
            raise forms.ValidationError(u'Para pasar a estado "evaluado", es necesario cargar el dictámen COFEV')
        #if estado == EstadoSolicitud.NUMERADO and normativas_nacionales == '':
        #    raise forms.ValidationError(u'Para pasar a estado "numerado", es necesario cargar las normativas nacionales')
        return self.cleaned_data


text:
using Elders.Cronus.MessageProcessing;
using Microsoft.Extensions.Logging;
using RabbitMQ.Client;

namespace Elders.Cronus.Transport.RabbitMQ
{
    /// <summary>
    /// Transient secured consumer with some extra connection management.
    /// </summary>
    /// <typeparam name="TSubscriber"></typeparam>
    public class AsyncConsumer<TSubscriber> : AsyncConsumerBase<TSubscriber>
    {
        public AsyncConsumer(string queue, IModel model, ISubscriberCollection<TSubscriber> subscriberCollection, ISerializer serializer, ILogger logger)
            : base(model, subscriberCollection, serializer, logger)
        {
            model.BasicQos(0, 1, false); // prefetch allow to avoid buffer of messages on the flight
            model.BasicConsume(queue, false, string.Empty, this); // we should use autoAck: false to avoid messages loosing

            logger.Debug(() => $"Consumer for {typeof(TSubscriber).Name} started.");
        }
    }
}


text:
package org.hypothesis.servlet.jnlp;

import javax.servlet.ServletContext;
import java.io.*;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

/*
 * A class that generates and caches information about JarDiff files
 *
 */
public class JarDiffHandler {
	static private class JarDiffEntry {
		private final File _jardiffFile; // Location of JARDiff file

		public JarDiffEntry(File jarDiffFile) {
			_jardiffFile = jarDiffFile;
		}

		public File getJarDiffFile() {
			return _jardiffFile;
		}
	}

	/* Contains information about a particular JARDiff entry */
	private static class JarDiffKey implements Comparable<JarDiffKey> {
		private final String _name; // Name of file
		private final String _fromVersionId; // From version
		private final String _toVersionId; // To version
		private final boolean _minimal; // True if this is a minimal jardiff

		/** Constructor used to generate a query object */
		public JarDiffKey(String name, String fromVersionId, String toVersionId, boolean minimal) {
			_name = name;
			_fromVersionId = fromVersionId;
			_toVersionId = toVersionId;
			_minimal = minimal;
		}

		public int compareTo(JarDiffKey other) {
			// All nullable entries are less
			if (other == null)
				return -1;

			int n = _name.compareTo(other.getName());
			if (n != 0)
				return n;

			n = _fromVersionId.compareTo(other.getFromVersionId());
			if (n != 0)
				return n;

			if (_minimal != other.isMinimal())
				return -1;

			return _toVersionId.compareTo(other.getToVersionId());
		}

		@Override
		public boolean equals(Object o) {
			if (!(o instanceof JarDiffKey))
				return false;

			return compareTo((JarDiffKey) o) == 0;
		}

		public String getFromVersionId() {
			return _fromVersionId;
		}

		// Query methods
		public String getName() {
			return _name;
		}

		// Collection framework interface methods

		public String getToVersionId() {
			return _toVersionId;
		}

		@Override
		public int hashCode() {
			return _name.hashCode() + _fromVersionId.hashCode() + _toVersionId.hashCode();
		}

		public boolean isMinimal() {
			return _minimal;
		}
	}

	// Default size of download buffer
	private static final int BUF_SIZE = 32 * 1024;

	// Default JARDiff mime type
	private static final String JARDIFF_MIMETYPE = "application/x-java-archive-diff";

	public static boolean isJavawsVersion(DownloadRequest dreq, String version) {
		String javawsAgent = "javaws";
		String jwsVer = dreq.getHttpRequest().getHeader("User-Agent");

		// check the request is coming from javaws
		if (!jwsVer.startsWith("javaws-")) {
			// this is the new style User-Agent string
			// User-Agent: JNLP/1.0.1 javaws/1.4.2 (b28) J2SE/1.4.2
			StringTokenizer st = new StringTokenizer(jwsVer);
			while (st.hasMoreTokens()) {
				String verString = st.nextToken();
				int index = verString.indexOf(javawsAgent);
				if (index != -1) {
					verString = verString.substring(index + javawsAgent.length() + 1);
					return VersionString.contains(version, verString);
				}
			}
			return false;
		}

		// extract the version id from the download request
		int startIndex = jwsVer.indexOf("-");

		if (startIndex == -1) {
			return false;
		}

		int endIndex = jwsVer.indexOf("/");

		if (endIndex == -1 || endIndex < startIndex) {
			return false;
		}

		String verId = jwsVer.substring(startIndex + 1, endIndex);

		// check whether the versionString contains the versionId
		return VersionString.contains(version, verId);

	}

	/** List of all generated JARDiffs */
	private Map<JarDiffKey, JarDiffEntry> _jarDiffEntries = null;

	/** Reference to ServletContext and logger object */
	private ServletContext _servletContext = null;

	private String _jarDiffMimeType = null;

	/** Initialize JarDiff handler */
	public JarDiffHandler(ServletContext servletContext) {
		_jarDiffEntries = new HashMap<>();
		_servletContext = servletContext;

		_jarDiffMimeType = _servletContext.getMimeType("xyz.jardiff");
		if (_jarDiffMimeType == null)
			_jarDiffMimeType = JARDIFF_MIMETYPE;
	}

	/** Download resource to the given file */
	private boolean download(URL target, File file) {
		boolean ret = true;
		boolean delete = false;
		// use bufferedstream for better performance
		BufferedInputStream in = null;
		BufferedOutputStream out = null;
		try {
			in = new BufferedInputStream(target.openStream());
			out = new BufferedOutputStream(new FileOutputStream(file));
			int read = 0;
			// int totalRead = 0;
			byte[] buf = new byte[BUF_SIZE];
			while ((read = in.read(buf)) != -1) {
				out.write(buf, 0, read);
				// totalRead += read;
			}

		} catch (IOException ioe) {
			System.err.println("Got exception while downloading resource: " + ioe);
			ret = false;

			if (file != null)
				delete = true;
		} finally {
			try {
				in.close();
				in = null;
			} catch (IOException ioe) {
				System.err.println("Got exception while downloading resource: " + ioe);
			}
			try {
				out.close();
				out = null;
			} catch (IOException ioe) {
				System.err.println("Got exception while downloading resource: " + ioe);
			}

			if (delete) {
				file.delete();
			}
		}
		return ret;
	}

	private File generateJarDiff(/* ResourceCatalog catalog, */DownloadRequest dreq, JnlpResource res,
			boolean doJarDiffWorkAround) {
		boolean del_old = false;
		boolean del_new = false;

		// Lookup up file for request version
		@SuppressWarnings("unused")
		DownloadRequest fromDreq = dreq.getFromDownloadRequest();
		try {
			// JnlpResource fromRes = catalog.lookupResource(fromDreq);

			/* Get file locations */
			String newFilePath = _servletContext.getRealPath(res.getPath());
			// String oldFilePath =
			// _servletContext.getRealPath(fromRes.getPath());
			String oldFilePath = _servletContext.getRealPath(res.getPath());

			// fix for 4720897
			if (newFilePath == null) {
				newFilePath = getRealPath(res.getPath());
				if (newFilePath != null)
					del_new = true;
			}

			if (oldFilePath == null) {
				// oldFilePath = getRealPath(fromRes.getPath());
				oldFilePath = getRealPath(res.getPath());
				if (oldFilePath != null)
					del_old = true;
			}

			if (newFilePath == null || oldFilePath == null) {
				return null;
			}

			// Create temp. file to store JarDiff file in
			File tempDir = (File) _servletContext.getAttribute("javax.servlet.context.tempdir");

			// fix for 4653036: JarDiffHandler() should use
			// javax.servlet.context.tempdir to store the jardiff
			File outputFile = File.createTempFile("jnlp", ".jardiff", tempDir);

			System.out.println(
					"Generating Jardiff between " + oldFilePath + " and " + newFilePath + " Store in " + outputFile);

			// Generate JarDiff
			OutputStream os = new FileOutputStream(outputFile);

			JarDiff.createPatch(oldFilePath, newFilePath, os, !doJarDiffWorkAround);
			os.close();

			try {

				// Check that Jardiff is smaller, or return null
				if (outputFile.length() >= (new File(newFilePath).length())) {
					return null;
				}

				// Check that Jardiff is smaller than the packed version of
				// the new file, if the file exists at all
				File newFilePacked = new File(newFilePath + ".pack.gz");
				if (newFilePacked.exists()) {
					if (outputFile.length() >= newFilePacked.length()) {
						return null;
					}
				}

				return outputFile;

			} finally {
				// delete the temporarily downloaded file
				if (del_new) {
					new File(newFilePath).delete();
				}

				if (del_old) {
					new File(oldFilePath).delete();
				}
			}
		} catch (IOException ioe) {
			System.err.println("Failed to genereate jardiff " + ioe);
			return null;
		} /*
			 * catch (ErrorResponseException ere) { System.err.println(
			 * "Failed to genereate jardiff " + ere); return null; }
			 */
	}

	/** Returns a JarDiff for the given request */
	public synchronized DownloadResponse getJarDiffEntry(
			/* ResourceCatalog catalog, */DownloadRequest dreq, JnlpResource res) {
		if (dreq.getCurrentVersionId() == null)
			return null;

		// check whether the request is from javaws 1.0/1.0.1
		// do not generate minimal jardiff if it is from 1.0/1.0.1
		boolean doJarDiffWorkAround = isJavawsVersion(dreq, "1.0*");

		// First do a lookup to find a match
		JarDiffKey key = new JarDiffKey(res.getName(), dreq.getCurrentVersionId(), res.getReturnVersionId(),
				!doJarDiffWorkAround);

		JarDiffEntry entry = _jarDiffEntries.get(key);
		// If entry is not found, then the querty has not been made.
		if (entry == null) {
			File f = generateJarDiff(/* catalog, */dreq, res, doJarDiffWorkAround);
			if (f == null) {
				System.err.println("servlet.log.warning.jardiff.failed " + res.getName() + " "
						+ dreq.getCurrentVersionId() + " " + res.getReturnVersionId());
			}
			// Store entry in table
			entry = new JarDiffEntry(f);
			_jarDiffEntries.put(key, entry);
		}

		// Check for no JarDiff to return
		if (entry.getJarDiffFile() == null) {
			return null;
		} else {
			return DownloadResponse.getFileDownloadResponse(entry.getJarDiffFile(), _jarDiffMimeType,
					entry.getJarDiffFile().lastModified(), res.getReturnVersionId());
		}
	}

	// fix for 4720897
	// if the jar file resides in a war file, download it to a temp dir
	// so it can be used to generate jardiff
	private String getRealPath(String path) throws IOException {
		URL fileURL = _servletContext.getResource(path);

		File tempDir = (File) _servletContext.getAttribute("javax.servlet.context.tempdir");

		// download file into temp dir
		if (fileURL != null) {
			File newFile = File.createTempFile("temp", ".jar", tempDir);
			if (download(fileURL, newFile)) {
				return newFile.getPath();
			}
		}
		return null;
	}
}


text:
/*
#######################################################################
#		SYMBIOT
#
#		Real-time Network Threat Modeling
#		(C) 2002-2008 Symbiot, Inc.	---	ALL RIGHTS RESERVED
#
#		Symbiot Master Library
#
#		http://www.symbiot.com
#
#######################################################################
#		Author: Borrowed Time, Inc.
#		e-mail: libsymbiot@bti.net
#
#		Created:					01 Nov 2003
#		Last Modified:				16 Mar 2004
#
#######################################################################
*/

#if !defined(SYMLIB_TASK_QUEUE)
#define SYMLIB_TASK_QUEUE

//---------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------
#include "symlib-config.h"

#include "symlib-tasks.h"
#include "symlib-threads.h"

#include <string>

//---------------------------------------------------------------------
// Begin Environment
//---------------------------------------------------------------------
namespace symbiot {

//---------------------------------------------------------------------
// Forward Class Declarations
//---------------------------------------------------------------------
class TQueueRunner;
class TQueue;

//---------------------------------------------------------------------
// Definitions
//---------------------------------------------------------------------

//---------------------------------------------------------------------
// Class TQueueRunner
//---------------------------------------------------------------------
class TQueueRunner
{
	public:

		TQueueRunner ();
			// Constructor

		virtual ~TQueueRunner ();
			// Destructor

		virtual void ThreadMain (void* argPtr = NULL);
			// Main loop.  Calls TQueue::ManageTasks() at a set interval.
};

//---------------------------------------------------------------------
// Class TQueue
//---------------------------------------------------------------------
class TQueue
{
	protected:

		struct WaitQueueEntry
			{
				TTaskBase*						taskObjPtr;
				time_t							nextExecTime;
				WaitQueueEntry() : taskObjPtr(NULL),nextExecTime(0) {}
			};

		typedef std::vector<WaitQueueEntry>		WaitQueue;
		typedef WaitQueue::iterator				WaitQueue_iter;
		typedef WaitQueue::const_iterator		WaitQueue_const_iter;

		typedef TContextPthreadObj<TTaskBase>	TaskContext;

		typedef std::vector<TaskContext*>		RunQueue;
		typedef RunQueue::iterator				RunQueue_iter;
		typedef RunQueue::const_iterator		RunQueue_const_iter;

		typedef std::vector<TTaskBase*>			TaskObjPtrList;
		typedef TaskObjPtrList::iterator		TaskObjPtrList_iter;
		typedef TaskObjPtrList::const_iterator	TaskObjPtrList_const_iter;

	public:

		TQueue ();
			// Constructor

		virtual ~TQueue ();
			// Destructor

		virtual void ClearQueues (bool gracefully = true, bool leaveActive = true);
			// Clears both waiting and running queues.  If the argument is true
			// the running tasks are allowed to quit gracefully; if the
			// argument is false then they are summarily terminated.

		virtual void InsertTask (TTaskBase* taskObjPtr);
			// Inserts the given task into the waiting queue without
			// running it first.  Note that taskObjPtr is now owned
			// by the queue and will be deleted by the queue when
			// appropriate.

		virtual void InsertTask (TTaskBase* taskObjPtr, time_t delayInSeconds);
			// Inserts the given task into the waiting queue without
			// running it first, set to execute in delayInSeconds seconds.
			// Note that taskObjPtr is now owned by the queue and will be
			// deleted by the queue when appropriate.

		virtual void RunTask (TTaskBase* taskObjPtr);
			// Inserts the given task as the first task in the waiting
			// queue, so it will run during the next execution round.
			// Note that taskObjPtr is now owned by the queue and will
			// be deleted by the queue when appropriate.

		virtual bool DeleteTask (const TTaskBase* taskObjPtr);
			// Deletes the given task, cancelling it if it is currently running.
			// Returns a boolean indicating whether the task was actually found
			// and deleted or not.

		virtual void ManageTasks ();
			// Executes waiting tasks that have execution time less than
			// or equal to the current time, checks for finished tasks
			// running tasks and either moves them back to the waiting
			// queue (if they reexecute) or deletes them (if not).

		virtual bool IsTaskInQueue (const TTaskBase* taskObjPtr);
			// Returns true if the given task object resides in either the run
			// or wait queue, false otherwise.

		//---------------------------
		// Accessors
		//---------------------------

		inline bool IsActive () const
			{ return fIsActive; }

		inline unsigned long WaitingTaskCount () const
			{ return fWaitQueue.size(); }

		inline unsigned long RunningTaskCount () const
			{ return fRunQueue.size(); }

		inline bool TaskRunnerAvailability () const
			{ return fTaskRunnerAvail; }

		inline void SetTaskRunnerAvailability (bool avail)
			{ fTaskRunnerAvail = avail; }

	protected:

		virtual void _InsertTask (TTaskBase* taskObjPtr, time_t delayInSeconds);
			// Inserts the given task into the waiting queue without
			// running it first.

		virtual bool _DeleteTask (const TTaskBase* taskObjPtr);
			// Deletes the given task, cancelling it if it is currently running.
			// Returns a boolean indicating whether the task was actually found
			// and deleted or not.

		virtual void _DeleteChildTasks (const TaskContext* contextObjPtr);
			// Recursively deletes child tasks of the parent argument.

		virtual void _ManageTasks ();
			// Executes waiting tasks that have execution time less than
			// or equal to the current time, checks for finished tasks
			// running tasks and either moves them back to the waiting
			// queue (if they reexecute) or deletes them (if not).

	protected:

		TPthreadMutexObj						fQueueMutex;
		WaitQueue								fWaitQueue;
		RunQueue								fRunQueue;
		bool									fIsActive;
		bool									fTaskRunnerAvail;
};

//---------------------------------------------------------------------
// Global Function Declarations
//---------------------------------------------------------------------
void InitTaskQueue ();
	// Initializes the task queue.  Must be called before any other
	// task-oriented methods and functions.

void DeleteTaskQueue ();
	// Destroys the task queue and all entries, killing any currently-
	// running tasks in the process.

bool IsTaskQueueAccepting ();
	// Returns true if the task queue will accept new tasks, false otherwise.

bool IsTaskQueueExecuting ();
	// Returns true if the tasks queue is running, false otherwise.

void _AddTaskToQueue (TTaskBase* taskObjPtr, bool runFirst);
	// Adds the given task to the task queue.  If runFirst is true
	// then the task is executed at the next opportunity; otherwise,
	// its execution will be delayed by the tasks execution interval.
	// Note that the taskObjPtr is now owned by the queue -- callers
	// should not mess around with it (especially delete it).

void _AddDelayedTaskToQueue (TTaskBase* taskObjPtr, time_t delayInSeconds);
	// Like _AddTaskToQueue(), except that the task is never immediately
	// executed and it will be set to execute in delayInSeconds seconds.

bool _DeleteTaskFromQueue (TTaskBase* taskObjPtr);
	// Deletes the given task, cancelling it if it is currently running.
	// Returns a boolean indicating whether the task was actually found
	// and deleted or not.

void _ClearTaskQueues (bool gracefully = true, bool leaveActive = true);
	// Clears the task queue of all queued tasks, running or waiting.
	// If the argument is true then running tasks are allowed to
	// terminate normally; otherwise, they are terminated with extreme
	// prejudice.

bool _IsTaskInQueue (const TTaskBase* taskObjPtr);
	// Returns true if the given task object resides in either the run
	// or wait queue, false otherwise.

//---------------------------------------------------------------------
// End Environment
//---------------------------------------------------------------------
} // namespace symbiot

#endif // SYMLIB_TASK_QUEUE


text:
import java.util.List;
import java.util.ArrayList;

public class ConditionalBranchBuilder extends InstructionBuilder {
	private ConditionalBranchBuilder elseifChain;
	private Expression condition;
	private List<Instruction> thenInstructionList;
	private List<Instruction> elseInstructionList;
	private boolean elseMode;

	public ConditionalBranchBuilder(Expression condition) {
		this(condition, null);
	}

	public ConditionalBranchBuilder(Expression condition, ConditionalBranchBuilder elseifChain) {
		this.elseifChain = elseifChain;
		this.condition = condition;
		this.thenInstructionList = new ArrayList<Instruction>();
		this.elseMode = false;
	}

	public String getInstructionName() {
		return "conditional branch";
	}

	public ConditionalBranchBuilder getElseifChain() {
		return elseifChain;
	}

	public boolean isElseMode() {
		return elseMode;
	}

	public void enterElseMode() {
		if (elseMode) {
			throw new IllegalStateException("already in else mode");
		}
		elseMode = true;
		elseInstructionList = new ArrayList<Instruction>();
	}

	public void addInstruction(Instruction inst) {
		if (elseMode) {
			elseInstructionList.add(inst);
		} else {
			thenInstructionList.add(inst);
		}
	}

	public ConditionalBranch toConditionalBranch() {
		ConditionalBranch cb;
		ConditionalBranchBuilder nextBuilder = elseifChain;
		if (elseMode) {
			cb = new ConditionalBranch(condition, thenInstructionList, elseInstructionList);
		} else {
			cb = new ConditionalBranch(condition, thenInstructionList);
		}
		while (nextBuilder != null) {
			nextBuilder.addInstruction(cb);
			cb = nextBuilder.toConditionalBranch();
			nextBuilder = nextBuilder.getElseifChain();
		}
		return cb;
	}
}


text:
package modularmachines.api.modules.components;

import javax.annotation.Nullable;

import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

/**
 * This component is used to provide the data about the model of the module.
 */
@SideOnly(Side.CLIENT)
public interface IModelComponent extends IModuleComponent {
	void setModelNeedReload(boolean modelNeedReload);

	/**
	 * @return If the model of the module needs a reload.
	 */
	boolean isModelNeedReload();

	void setModelKey(String key);

	@Nullable
	String getModelKey();
}


text:
package org.ms123.common.datamapper;

import org.milyn.xml.*;
import org.milyn.cdr.SmooksConfigurationException;
import org.milyn.container.ExecutionContext;
import org.milyn.delivery.VisitorAppender;
import org.milyn.delivery.VisitorConfigMap;
import org.milyn.delivery.annotation.Initialize;
import org.milyn.delivery.java.JavaXMLReader;
import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
import java.util.Map;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import net.sf.sojo.common.ObjectGraphWalker;
import flexjson.*;

public class BeanReader implements JavaXMLReader, VisitorAppender {

	private ExecutionContext m_executionContext;
	private JSONSerializer m_js = new JSONSerializer();

	private List<Object> m_sourceObjects;

	private Boolean m_withNullValues;
	private String m_rootTag;

	private ContentHandler m_contentHandler;

	public void setContentHandler(ContentHandler contentHandler) {
		this.m_contentHandler = contentHandler;
	}

	public ContentHandler getContentHandler() {
		return m_contentHandler;
	}

	public void setSourceObjects(List<Object> sourceObjects) throws SmooksConfigurationException {
		m_sourceObjects = sourceObjects;
	}

	public void parse(InputSource src) throws IOException, SAXException {
		m_js.prettyPrint(true);
		m_contentHandler.startDocument();
		ObjectGraphWalker walker = new ObjectGraphWalker();
		walker.setIgnoreNullValues(!m_withNullValues);
		BeanWalker interceptor = new BeanWalker();
		interceptor.setContentHandler(m_contentHandler);
		walker.addInterceptor(interceptor);
		interceptor.setRootTag(m_rootTag);
		walker.walk(m_sourceObjects.get(0));
		m_contentHandler.endDocument();
	}

	public void setExecutionContext(ExecutionContext request) {
		this.m_executionContext = request;
		m_rootTag = (String) m_executionContext.getAttribute("rootTag");
		m_withNullValues = true;
	}

	@Initialize
	public void initialize() {
	}

	public void addVisitors(VisitorConfigMap visitorMap) {
	}

	/****************************************************************************
	 *
	 * The following methods are currently unimplemnted...
	 *
	 ****************************************************************************/
	public void parse(String systemId) throws IOException, SAXException {
		throw new UnsupportedOperationException("Operation not supports by this reader.");
	}

	public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
		return false;
	}

	public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
	}

	public DTDHandler getDTDHandler() {
		return null;
	}

	public void setDTDHandler(DTDHandler arg0) {
	}

	public EntityResolver getEntityResolver() {
		return null;
	}

	public void setEntityResolver(EntityResolver arg0) {
	}

	public ErrorHandler getErrorHandler() {
		return null;
	}

	public void setErrorHandler(ErrorHandler arg0) {
	}

	public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
		return null;
	}

	public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
	}
}


text:
#pragma checksum "..\..\..\Controls\ChatPlayer.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "841FE28ACF0E7633C3F40A7631D1E192"
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18408
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms.Integration;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;

namespace LegendaryClient.Controls {

    /// <summary>
    /// ChatPlayer
    /// </summary>
    public partial class ChatPlayer : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {

        #line 11 "..\..\..\Controls\ChatPlayer.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Image ProfileImage;

        #line default
        #line hidden

        #line 13 "..\..\..\Controls\ChatPlayer.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Label LevelLabel;

        #line default
        #line hidden

        #line 20 "..\..\..\Controls\ChatPlayer.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Label PlayerName;

        #line default
        #line hidden

        #line 22 "..\..\..\Controls\ChatPlayer.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Label PlayerStatus;

        #line default
        #line hidden

        #line 24 "..\..\..\Controls\ChatPlayer.xaml"
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
        internal System.Windows.Controls.Label PlayerId;

        #line default
        #line hidden

        private bool _contentLoaded;

        /// <summary>
        /// InitializeComponent
        /// </summary>
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
        public void InitializeComponent() {
            if (_contentLoaded) {
                return;
            }
            _contentLoaded = true;
            System.Uri resourceLocater = new System.Uri("/LegendaryClient;component/controls/chatplayer.xaml", System.UriKind.Relative);

            #line 1 "..\..\..\Controls\ChatPlayer.xaml"
            System.Windows.Application.LoadComponent(this, resourceLocater);

            #line default
            #line hidden
        }

        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
            switch (connectionId)
            {
            case 1:
            this.ProfileImage = ((System.Windows.Controls.Image)(target));
            return;
            case 2:
            this.LevelLabel = ((System.Windows.Controls.Label)(target));
            return;
            case 3:
            this.PlayerName = ((System.Windows.Controls.Label)(target));
            return;
            case 4:
            this.PlayerStatus = ((System.Windows.Controls.Label)(target));
            return;
            case 5:
            this.PlayerId = ((System.Windows.Controls.Label)(target));
            return;
            }
            this._contentLoaded = true;
        }
    }
}


text:
'use strict';

const LocalStrategy = require('passport-local');

module.exports = function (passport, app, config, data) {

    const authStrategy = new LocalStrategy(
        {
          username: 'username',
          password: 'password'
        },
        (username, password, done) => {
            data.getUserByName(username)
                .then(user => {
                    if (user && user.authenticatePassword(password)) {
                        done(null, user);
                    } else {

                        done(null, false);
                    }
                })
                .catch(error => done(error, false));
        });

    passport.use(authStrategy);
};


text:
<?php

namespace Oro\Bundle\ApiBundle\Processor\Create;

use Doctrine\Common\Util\ClassUtils;

use Oro\Component\ChainProcessor\ContextInterface;
use Oro\Component\ChainProcessor\ProcessorInterface;
use Oro\Bundle\ApiBundle\Processor\SingleItemContext;
use Oro\Bundle\ApiBundle\Util\DoctrineHelper;

/**
 * Saves new ORM entity to the database and save its identifier into the Context.
 */
class SaveEntity implements ProcessorInterface
{
    /** @var DoctrineHelper */
    protected $doctrineHelper;

    /**
     * @param DoctrineHelper $doctrineHelper
     */
    public function __construct(DoctrineHelper $doctrineHelper)
    {
        $this->doctrineHelper = $doctrineHelper;
    }

    /**
     * {@inheritdoc}
     */
    public function process(ContextInterface $context)
    {
        /** @var SingleItemContext $context */

        $entity = $context->getResult();
        if (!is_object($entity)) {
            // entity does not exist
            return;
        }

        $em = $this->doctrineHelper->getEntityManager($entity, false);
        if (!$em) {
            // only manageable entities are supported
            return;
        }

        $em->persist($entity);
        $em->flush($entity);

        // save entity id into the Context
        $metadata = $em->getClassMetadata(ClassUtils::getClass($entity));
        $id = $metadata->getIdentifierValues($entity);
        if (!empty($id)) {
            if (1 === count($id)) {
                $id = reset($id);
            }
            $context->setId($id);
        }
    }
}


text:
#ifndef __TOTALS_H__
#define __TOTALS_H__

#include "condor_common.h"
#include "condor_classad.h"
#include "HashTable.h"
#include "MyString.h"
#include "status_types.h"

// object keeps track of totals within a single class (same key)
// (i.e., "OpSys/Arch" for a startd, "Name" for schedd, etc.)
class ClassTotal
{
  	public:
		ClassTotal ();
		virtual ~ClassTotal ();

		static ClassTotal *makeTotalObject(ppOption);
		static int makeKey( MyString &, ClassAd *, ppOption);

		virtual int update(ClassAd*, int options) 	= 0;
		virtual void displayHeader(FILE*)= 0;

		// param is zero for non-final totals
		virtual void displayInfo(FILE*, int=0)	= 0;

  	protected:
		ppOption ppo;
};

#define TOTALS_OPTION_IGNORE_PARTITIONABLE 0x0001
#define TOTALS_OPTION_ROLLUP_PARTITIONABLE 0x0002
#define TOTALS_OPTION_IGNORE_DYNAMIC       0x0004

// object manages totals for different classes within the same ppo
// (e.g., different "Arch/OpSys" in startd normal mode)
class TrackTotals
{
	public:
		TrackTotals (ppOption);
		~TrackTotals();

		int  update(ClassAd *, int options = 0, const char * key=NULL);
		void displayTotals(FILE *, int keyLength);
		bool haveTotals();

	private:
		ppOption ppo;
		int malformed;
		HashTable<MyString,ClassTotal*> allTotals;
		ClassTotal*	topLevelTotal;
};

// startd totals
class StartdNormalTotal : public ClassTotal
{
	public:
		StartdNormalTotal();
		virtual int update (ClassAd *, int options);
		virtual void displayHeader(FILE *);
		virtual void displayInfo(FILE *, int);

  	protected:
		int machines;
		int owner;
		int unclaimed;
		int claimed;
		int matched;
		int preempting;
#if HAVE_BACKFILL
		int backfill;
#endif
		int drained;

		int update(const char * state);
};

class StartdRunTotal : public ClassTotal
{
	public:
		StartdRunTotal();
		virtual int update (ClassAd *, int options);
		virtual void displayHeader(FILE *);
		virtual void displayInfo(FILE *,int);

	protected:
		int machines;
		uint64_t condor_mips;
		uint64_t kflops;
		float loadavg;
};

class StartdServerTotal : public ClassTotal
{
	public:
		StartdServerTotal();
		virtual int update (ClassAd *, int options);
		virtual void displayHeader(FILE*);
		virtual void displayInfo(FILE*,int);

  	protected:
		int machines;
		int avail;
		uint64_t memory;
		uint64_t disk;
		long condor_mips;
		uint64_t kflops;
};

class StartdStateTotal : public ClassTotal
{
	public:
		StartdStateTotal();
		virtual int update (ClassAd *, int options);
		virtual void displayHeader(FILE*);
		virtual void displayInfo(FILE*,int);

  	protected:
		int machines;
		int owner;
		int unclaimed;
		int claimed;
		int preempt;
		int matched;
#if HAVE_BACKFILL
		int backfill;
#endif
		int drained;

		int update(const char * state);
};

class StartdCODTotal : public ClassTotal
{
public:
	StartdCODTotal();
	virtual int update (ClassAd *, int options);
	virtual void displayHeader(FILE*);
	virtual void displayInfo(FILE*,int);
protected:
	void updateTotals( ClassAd*, const char* );

	int total;
	int idle;
	int running;
	int suspended;
	int vacating;
	int killing;
};

// schedd totals
class ScheddNormalTotal : public ClassTotal
{
	public:
		ScheddNormalTotal();
		virtual int update (ClassAd *, int options);
		virtual void displayHeader(FILE*);
		virtual void displayInfo(FILE*,int);

	protected:
		int runningJobs;
		int idleJobs;
		int heldJobs;
};

class ScheddSubmittorTotal : public ClassTotal
{
	public:
		ScheddSubmittorTotal();
		virtual int update (ClassAd *, int options);
		virtual void displayHeader(FILE*);
		virtual void displayInfo(FILE*,int);

	protected:
		int runningJobs;
		int idleJobs;
		int heldJobs;
};

// ckptserver totals
class CkptSrvrNormalTotal : public ClassTotal
{
	public:
		CkptSrvrNormalTotal();
		virtual int update (ClassAd *, int options);
		virtual void displayHeader(FILE*);
		virtual void displayInfo(FILE*,int);

	protected:
		int numServers;
		uint64_t disk;
};

int getCODInt( ClassAd* ad, const char* id, const char* attr,
			   int alt_val );

char* getCODStr( ClassAd* ad, const char* id, const char* attr,
				 const char* alt );

#endif//__TOTALS_H__


text:
=head1 LICENSE

Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

=head1 CONTACT

  Please email comments or questions to the public Ensembl
  developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.

  Questions may also be sent to the Ensembl help desk at
  <http://www.ensembl.org/Help/Contact>.

=head1 NAME

Bio::EnsEMBL::Compara::RunnableDB::PairAligner::PairAligner

=cut

=head1 SYNOPSIS

=cut

=head1 DESCRIPTION

This object is an abstract superclass which must be inherited from.
It uses a runnable which takes sequence as input and returns
FeaturePair objects as output (like Bio::EnsEMBL::Analysis::Runnable::Blastz)

It adds functionality to read and write to a compara databases.
It takes as input (via input_id or analysis->parameters) DnaFragChunk or DnaFragChunkSet
objects (via dbID reference) and stores GenomicAlignBlock entries.

The appropriate Bio::EnsEMBL::Analysis object must be passed for
extraction of appropriate parameters.

=cut

=head1 APPENDIX

The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _

=cut

package Bio::EnsEMBL::Compara::RunnableDB::PairAligner::PairAligner;

use strict;
use Time::HiRes qw(time gettimeofday tv_interval);
use File::Basename;
use Bio::EnsEMBL::Utils::Exception;
use Bio::EnsEMBL::Utils::SqlHelper;
use Bio::EnsEMBL::Analysis::RunnableDB;
use Bio::EnsEMBL::Compara::GenomicAlign;
use Bio::EnsEMBL::Compara::MethodLinkSpeciesSet;
use Bio::EnsEMBL::Compara::GenomicAlignBlock;
use Bio::EnsEMBL::Compara::Production::DnaFragChunkSet;

use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable');

##########################################
#
# subclass override methods
#
##########################################

sub configure_defaults {
  my $self = shift;
  return 0;
}

sub configure_runnable {
  my $self = shift;
  throw("subclass must implement configure_runnable method\n");
}

##########################################
#
# internal RunnableDB methods that should
# not be subclassed
#
##########################################

=head2 fetch_input

    Title   :   fetch_input
    Usage   :   $self->fetch_input
    Function:   Fetches input data for repeatmasker from the database
    Returns :   none
    Args    :   none

=cut

sub fetch_input {
  my( $self) = @_;

  #
  # run subclass configure_defaults method
  #
  $self->configure_defaults();

  my $query_DnaFragChunkSet = new Bio::EnsEMBL::Compara::Production::DnaFragChunkSet;

  if(defined($self->param('qyChunkSetID'))) {
      my $chunkset = $self->compara_dba->get_DnaFragChunkSetAdaptor->fetch_by_dbID($self->param('qyChunkSetID'));
      $query_DnaFragChunkSet = $chunkset;
  } else {
      throw("Missing qyChunkSetID");
  }
  $self->param('query_DnaFragChunkSet',$query_DnaFragChunkSet);

  my $db_DnaFragChunkSet = new Bio::EnsEMBL::Compara::Production::DnaFragChunkSet;

  if(defined($self->param('dbChunkSetID'))) {
      my $chunkset = $self->compara_dba->get_DnaFragChunkSetAdaptor->fetch_by_dbID($self->param('dbChunkSetID'));
      $db_DnaFragChunkSet = $chunkset;
  } else {
      throw("Missing dbChunkSetID");
  }
  $self->param('db_DnaFragChunkSet',$db_DnaFragChunkSet);

  #create a Compara::DBAdaptor which shares the same DBI handle
  #with $self->db (Hive DBAdaptor)
  $self->compara_dba->dbc->disconnect_when_inactive(0);

  throw("Missing qyChunkSet") unless($query_DnaFragChunkSet);
  throw("Missing dbChunkSet") unless($db_DnaFragChunkSet);
  throw("Missing method_link_type") unless($self->param('method_link_type'));

  my ($first_qy_chunk) = @{$query_DnaFragChunkSet->get_all_DnaFragChunks};
  my ($first_db_chunk) = @{$db_DnaFragChunkSet->get_all_DnaFragChunks};

  #
  # create method_link_species_set
  #
  my $method = Bio::EnsEMBL::Compara::Method->new( -type => $self->param('method_link_type'),
                                                   -class => "GenomicAlignBlock.pairwise_alignment");

  my $species_set_obj = Bio::EnsEMBL::Compara::SpeciesSet->new(
        -genome_dbs => ($first_qy_chunk->dnafrag->genome_db->dbID == $first_db_chunk->dnafrag->genome_db->dbID)
                            ? [$first_qy_chunk->dnafrag->genome_db]
                            : [$first_qy_chunk->dnafrag->genome_db, $first_db_chunk->dnafrag->genome_db]
  );

  my $mlss = Bio::EnsEMBL::Compara::MethodLinkSpeciesSet->new(
        -method             => $method,
        -species_set_obj    => $species_set_obj,
  );

  $self->compara_dba->get_MethodLinkSpeciesSetAdaptor->store($mlss);
  $self->param('method_link_species_set', $mlss);

  if (defined $self->param('max_alignments')) {
      my $sth = $self->compara_dba->dbc->prepare("SELECT count(*) FROM genomic_align_block".
						 " WHERE method_link_species_set_id = ".$mlss->dbID);
      $sth->execute();
      my ($num_alignments) = $sth->fetchrow_array();
      $sth->finish();
      if ($num_alignments >= $self->max_alignments) {
	  throw("Too many alignments ($num_alignments) have been stored already for MLSS ".$mlss->dbID."\n".
		"  Try changing the parameters or increase the max_alignments option if you think\n".
		"  your system can cope with so many alignments.");
      }
  }

  #
  # execute subclass configure_runnable method
  #
  $self->configure_runnable();

  return 1;
}

sub run
{
  my $self = shift;

  $self->compara_dba->dbc->disconnect_when_inactive(1);

  my $starttime = time();
  my $work_dir = $self->worker_temp_directory;
  foreach my $runnable (@{$self->param('runnable')}) {
      throw("Runnable module not set") unless($runnable);
      $runnable->run($work_dir);
  }

  if($self->debug){printf("%1.3f secs to run %s pairwise\n", (time()-$starttime), $self->param('method_link_type'));}

  $self->compara_dba->dbc->disconnect_when_inactive(0);
  return 1;
}

sub delete_fasta_dumps_but_these {
  my $self = shift;
  my $fasta_files_not_to_delete = shift;

  my $work_dir = $self->worker_temp_directory;

  open F, "ls $work_dir|";
  while (my $file = <F>) {
    chomp $file;
    next unless ($file =~ /\.fasta$/);
    my $delete = 1;
    foreach my $fasta_file (@{$fasta_files_not_to_delete}) {
      if ($file eq basename($fasta_file)) {
        $delete = 0;
        last;
      }
    }
    unlink "$work_dir/$file" if ($delete);
  }
  close F;
}

sub write_output {
  my( $self) = @_;
  my $starttime = time();

  #since the Blast runnable takes in analysis parameters rather than an
  #analysis object, it creates new Analysis objects internally
  #(a new one for EACH FeaturePair generated)
  #which are a shadow of the real analysis object ($self->analysis)
  #The returned FeaturePair objects thus need to be reset to the real analysis object

  #
  #Start transaction
  #
  if ($self->param('do_transactions'))  {
      my $compara_conn = $self->compara_dba->dbc;
      my $compara_helper = Bio::EnsEMBL::Utils::SqlHelper->new(-DB_CONNECTION => $compara_conn);
      $compara_helper->transaction(-CALLBACK => sub {
	  $self->_write_output;
      });
  } else {
      $self->_write_output;
  }

  return 1;
}

sub _write_output {
    my ($self) = @_;
    my $fake_analysis     = Bio::EnsEMBL::Analysis->new;

  #Set use_autoincrement to 1 otherwise the GenomicAlignBlockAdaptor will use
  #LOCK TABLES which does an implicit commit and prevent any rollback
  $self->compara_dba->get_GenomicAlignBlockAdaptor->use_autoincrement(1);
  foreach my $runnable (@{$self->param('runnable')}) {
      foreach my $fp ( @{ $runnable->output() } ) {
          if($fp->isa('Bio::EnsEMBL::FeaturePair')) {
              $fp->analysis($fake_analysis);

              $self->store_featurePair_as_genomicAlignBlock($fp);
          }
      }
      if($self->debug){printf("%d FeaturePairs found\n", scalar(@{$runnable->output}));}
  }

  #print STDERR (time()-$starttime), " secs to write_output\n";
}

##########################################
#
# internal methods
#
##########################################

sub dumpChunkSetToWorkdir
{
  my $self      = shift;
  my $chunkSet   = shift;

  my $starttime = time();

  my $fastafile = $self->worker_temp_directory. "chunk_set_". $chunkSet->dbID .".fasta";

  $fastafile =~ s/\/\//\//g;  # converts any // in path to /
  return $fastafile if(-e $fastafile);

  open(OUTSEQ, ">$fastafile")
    or $self->throw("Error opening $fastafile for write");
  my $output_seq = Bio::SeqIO->new( -fh =>\*OUTSEQ, -format => 'Fasta');

  #Masking options are stored in the dna_collection
  my $dna_collection = $chunkSet->dna_collection;

  my $chunk_array = $chunkSet->get_all_DnaFragChunks;
  if($self->debug){printf("dumpChunkSetToWorkdir : %s : %d chunks\n", $fastafile, $chunkSet->count());}

  #Load all sequences in a dnafrag_chunk_set and set masking options
  my $sequence_ids;
  foreach my $chunk (@$chunk_array) {
    $chunk->masking_options($dna_collection->masking_options);
  }

  my $sequences = $self->compara_dba->get_SequenceAdaptor->fetch_all_by_chunk_set_id($chunkSet->dbID);

  foreach my $chunk (@$chunk_array) {
    #only have sequences for chunks with sequence_id > 0 - but this resets the sequence_id to 0. Why?

    my $this_seq_id = $chunk->sequence_id; #save seq_id

    $chunk->sequence($sequences->{$this_seq_id}) if ($chunk->sequence_id > 0); #this sets $chunk->sequence_id=0
    $chunk->sequence_id($this_seq_id); #reset seq_id

    #Retrieve sequences with sequence_id=0 (ie too big to store in the sequence table)
    my $bioseq = $chunk->bioseq;

    # This may not be necessary now as already have all the sequences in the sequence table
    if($chunk->sequence_id==0) {
      my $this_seq_id = $self->compara_dba->get_DnaFragChunkAdaptor->update_sequence($chunk);
    }

    $output_seq->write_seq($bioseq);
  }

  close OUTSEQ;
  if($self->debug){printf("  %1.3f secs to dump\n", (time()-$starttime));}
  return $fastafile
}

sub dumpChunkToWorkdir
{
  my $self = shift;
  my $chunk = shift;

  my $starttime = time();

  my $fastafile = $self->worker_temp_directory .
                  "chunk_" . $chunk->dbID . ".fasta";
  $fastafile =~ s/\/\//\//g;  # converts any // in path to /
  return $fastafile if(-e $fastafile);

  if($self->debug){print("dumpChunkToWorkdir : $fastafile\n");}

  $chunk->cache_sequence;
  $chunk->dump_to_fasta_file($fastafile);

  if($self->debug){printf("  %1.3f secs to dump\n", (time()-$starttime));}

  return $fastafile
}

sub store_featurePair_as_genomicAlignBlock
{
  my $self = shift;
  my $fp   = shift;

  my $qyChunk = undef;
  my $dbChunk = undef;

  if($fp->seqname =~ /chunkID(\d*):/) {
    my $chunk_id = $1;
    #printf("%s => %d\n", $fp->seqname, $chunk_id);
    $qyChunk = $self->compara_dba->get_DnaFragChunkAdaptor->
                     fetch_by_dbID($chunk_id);
  }
  if($fp->hseqname =~ /chunkID(\d*):/) {
    my $chunk_id = $1;
    #printf("%s => %d\n", $fp->hseqname, $chunk_id);
    $dbChunk = $self->compara_dba->get_DnaFragChunkAdaptor->
                     fetch_by_dbID($chunk_id);
  }
  unless($qyChunk and $dbChunk) {
    warn("unable to determine DnaFragChunk objects from FeaturePair");
    return undef;
  }

  if($self->debug > 1) {
    print("qyChunk : ",$qyChunk->display_id,"\n");
    print("dbChunk : ",$dbChunk->display_id,"\n");
    print STDOUT $fp->seqname."\t".
                 $fp->start."\t".
                 $fp->end."\t".
                 $fp->strand."\t".
                 $fp->hseqname."\t".
                 $fp->hstart."\t".
                 $fp->hend."\t".
                 $fp->hstrand."\t".
                 $fp->score."\t".
                 $fp->percent_id."\t".
                 $fp->cigar_string."\n";
  }

  $fp->slice($qyChunk->slice);
  $fp->hslice($dbChunk->slice);

  #
  # test if I'm getting the indexes right
  #
  if($self->debug > 2) {
    print_simple_align($fp->get_SimpleAlign, 80);

    my $testChunk = new Bio::EnsEMBL::Compara::Production::DnaFragChunk();
    $testChunk->dnafrag($qyChunk->dnafrag);
    $testChunk->seq_start($qyChunk->seq_start+$fp->start-1);
    $testChunk->seq_end($qyChunk->seq_start+$fp->end-1);
    my $bioseq = $testChunk->bioseq;
    print($bioseq->seq, "\n");
  }

  my $genomic_align1 = new Bio::EnsEMBL::Compara::GenomicAlign;
  $genomic_align1->method_link_species_set($self->param('method_link_species_set'));
  $genomic_align1->dnafrag($qyChunk->dnafrag);
  $genomic_align1->dnafrag_start($qyChunk->seq_start + $fp->start -1);
  $genomic_align1->dnafrag_end($qyChunk->seq_start + $fp->end -1);
  $genomic_align1->dnafrag_strand($fp->strand);
  $genomic_align1->visible(1);

  my $cigar1 = $fp->cigar_string;
  $cigar1 =~ s/I/M/g;
  $cigar1 = compact_cigar_line($cigar1);
  $cigar1 =~ s/D/G/g;
  $genomic_align1->cigar_line($cigar1);

  my $genomic_align2 = new Bio::EnsEMBL::Compara::GenomicAlign;
  $genomic_align2->method_link_species_set($self->param('method_link_species_set'));
  $genomic_align2->dnafrag($dbChunk->dnafrag);
  $genomic_align2->dnafrag_start($dbChunk->seq_start + $fp->hstart -1);
  $genomic_align2->dnafrag_end($dbChunk->seq_start + $fp->hend -1);
  $genomic_align2->dnafrag_strand($fp->hstrand);
  $genomic_align2->visible(1);

  my $cigar2 = $fp->cigar_string;
  $cigar2 =~ s/D/M/g;
  $cigar2 =~ s/I/D/g;
  $cigar2 = compact_cigar_line($cigar2);
  $cigar2 =~ s/D/G/g;
  $genomic_align2->cigar_line($cigar2);

  if($self->debug > 1) {
    print("original cigar_line ",$fp->cigar_string,"\n");
    print("   $cigar1\n");
    print("   $cigar2\n");
  }

  my $GAB = new Bio::EnsEMBL::Compara::GenomicAlignBlock;
  $GAB->method_link_species_set($self->param('method_link_species_set'));
  $GAB->genomic_align_array([$genomic_align1, $genomic_align2]);
  $GAB->score($fp->score);
  $GAB->perc_id($fp->percent_id);
  $GAB->length($fp->alignment_length);
  $GAB->level_id(1);

  $self->compara_dba->get_GenomicAlignBlockAdaptor->store($GAB);

  if($self->debug > 2) { print_simple_align($GAB->get_SimpleAlign, 80);}

  return $GAB;
}

sub compact_cigar_line
{
  my $cigar_line = shift;

  #print("cigar_line '$cigar_line' => ");
  my @pieces = ( $cigar_line =~ /(\d*[MDI])/g );
  my @new_pieces = ();
  foreach my $piece (@pieces) {
    $piece =~ s/I/M/;
    if (! scalar @new_pieces || $piece =~ /D/) {
      push @new_pieces, $piece;
      next;
    }
    if ($piece =~ /\d*M/ && $new_pieces[-1] =~ /\d*M/) {
      my ($matches1) = ($piece =~ /(\d*)M/);
      my ($matches2) = ($new_pieces[-1] =~ /(\d*)M/);
      if (! defined $matches1 || $matches1 eq "") {
        $matches1 = 1;
      }
      if (! defined $matches2 || $matches2 eq "") {
        $matches2 = 1;
      }
      $new_pieces[-1] = $matches1 + $matches2 . "M";
    } else {
      push @new_pieces, $piece;
    }
  }
  my $new_cigar_line = join("", @new_pieces);
  #print(" '$new_cigar_line'\n");
  return $new_cigar_line;
}

sub print_simple_align
{
  my $alignment = shift;
  my $aaPerLine = shift;
  $aaPerLine=40 unless($aaPerLine and $aaPerLine > 0);

  my ($seq1, $seq2)  = $alignment->each_seq;
  my $seqStr1 = "|".$seq1->seq().'|';
  my $seqStr2 = "|".$seq2->seq().'|';

  my $enddiff = length($seqStr1) - length($seqStr2);
  while($enddiff>0) { $seqStr2 .= " "; $enddiff--; }
  while($enddiff<0) { $seqStr1 .= " "; $enddiff++; }

  my $label1 = sprintf("%40s : ", $seq1->id);
  my $label2 = sprintf("%40s : ", "");
  my $label3 = sprintf("%40s : ", $seq2->id);

  my $line2 = "";
  for(my $x=0; $x<length($seqStr1); $x++) {
    if(substr($seqStr1,$x,1) eq substr($seqStr2, $x,1)) { $line2.='|'; } else { $line2.=' '; }
  }

  my $offset=0;
  my $numLines = (length($seqStr1) / $aaPerLine);
  while($numLines>0) {
    printf("$label1 %s\n", substr($seqStr1,$offset,$aaPerLine));
    printf("$label2 %s\n", substr($line2,$offset,$aaPerLine));
    printf("$label3 %s\n", substr($seqStr2,$offset,$aaPerLine));
    print("\n\n");
    $offset+=$aaPerLine;
    $numLines--;
  }
}

1;


text:
package com.example.pengyuanfan.fablix.util;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.widget.ImageView;

import java.io.InputStream;

/**
 * Created by pengyuanfan on 5/12/2016.
 */
public class ImageDowloader extends AsyncTask<String, Void, Bitmap> {

    protected ImageView show;
    protected BitmapCache img=null;
    public ImageDowloader(ImageView show, BitmapCache img) {this.show=show; this.img=img;}
    public ImageDowloader(ImageView show) {
        this.show = show;
    }

    @Override
    protected Bitmap doInBackground(String... url) {
        String imageUrl = url[0];
        Bitmap img = null;
        try {
            InputStream in = new java.net.URL(imageUrl).openStream();
            img = BitmapFactory.decodeStream(in);
        }catch (Exception e){
            e.printStackTrace();
        }
        return img;
    }

    @Override
    protected void onPostExecute(Bitmap bitmap) {
        if(bitmap!=null)
            show.setImageBitmap(bitmap);
        if(img!=null)
            img.setImg(bitmap);
    }
}


text:
require 'rubygems'
require 'bundler'

require 'redis'
require 'json'

class SetupConfig
    def self.run(options)
        $pwd = File.expand_path(File.dirname(__FILE__)) + '/../../'
        defaults = JSON.parse(File.read("#{$pwd}1/config/defaults.json"))
        redis = nil
        begin
            redis = Redis.new
        rescue Exception => e
            puts "Unable to connect to local redis instance!"
            return false
        end

        defaults.keys.each do |scope|
            defaults[scope].each do |setting|
                key = "#{scope}_#{setting['key']}"
                current_value = redis.get(key)
                if current_value == nil
                    current_value = setting["value"].to_json
                    redis.set(key, current_value)
                end
            end
        end
    end
end


text:
/**
 * All of the CSS for your admin-specific functionality should be
 * included in this file.
 */
.form-table.wta hr {
  display: block;
}

.form-field._billing_sub_city_field,
.form-field._shipping_sub_city_field {
  float: right !important;
  clear: right !important;
}

.debug--link {
  display: block;
  width: 100px;
  margin-bottom: 1em;
}

.wta--debug {
  overflow: auto;
  min-height: 200px;
  min-width: 500px;
}


text:
extern zend_class_entry *stub_issue887_ce;

ZEPHIR_INIT_CLASS(Stub_Issue887);

PHP_METHOD(Stub_Issue887, __construct);
PHP_METHOD(Stub_Issue887, add);
PHP_METHOD(Stub_Issue887, fetch_array);
PHP_METHOD(Stub_Issue887, fetch_object);

ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887___construct, 0, 0, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887_add, 0, 0, 2)
	ZEND_ARG_INFO(0, key)
	ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887_fetch_array, 0, 0, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887_fetch_object, 0, 0, 0)
ZEND_END_ARG_INFO()

ZEPHIR_INIT_FUNCS(stub_issue887_method_entry) {
#if PHP_VERSION_ID >= 80000
	PHP_ME(Stub_Issue887, __construct, arginfo_stub_issue887___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
#else
	PHP_ME(Stub_Issue887, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
#endif
	PHP_ME(Stub_Issue887, add, arginfo_stub_issue887_add, ZEND_ACC_PUBLIC)
#if PHP_VERSION_ID >= 80000
	PHP_ME(Stub_Issue887, fetch_array, arginfo_stub_issue887_fetch_array, ZEND_ACC_PUBLIC)
#else
	PHP_ME(Stub_Issue887, fetch_array, NULL, ZEND_ACC_PUBLIC)
#endif
#if PHP_VERSION_ID >= 80000
	PHP_ME(Stub_Issue887, fetch_object, arginfo_stub_issue887_fetch_object, ZEND_ACC_PUBLIC)
#else
	PHP_ME(Stub_Issue887, fetch_object, NULL, ZEND_ACC_PUBLIC)
#endif
	PHP_FE_END
};


text:
package scala.compat.java8.collectionImpl

import scala.language.higherKinds

/** A `DoubleAccumulator` is a low-level collection specialized for gathering
  * elements in parallel and then joining them in order by merging them.
  * This is a manually specialized variant of `Accumulator` with no actual
  * subclassing relationship with `Accumulator`.
  */
final class DoubleAccumulator extends AccumulatorLike[Double, DoubleAccumulator] { self =>
  private[java8] var current: Array[Double] = DoubleAccumulator.emptyDoubleArray
  private[java8] var history: Array[Array[Double]] = DoubleAccumulator.emptyDoubleArrayArray

  private[java8] def cumulative(i: Int) = { val x = history(i); x(x.length-1).toLong }

  private def expand(): Unit = {
    if (index > 0) {
      current(current.length-1) = (if (hIndex > 0) { val x = history(hIndex-1); x(x.length-1) } else 0) + index
      if (hIndex >= history.length) hExpand()
      history(hIndex) = current
      hIndex += 1
    }
    current = new Array[Double](nextBlockSize+1)
    index = 0
  }

  private def hExpand(): Unit = {
    if (hIndex == 0) history = new Array[Array[Double]](4)
    else history = java.util.Arrays.copyOf(history, history.length << 1)
  }

  /** Appends an element to this `DoubleAccumulator`. */
  final def +=(a: Double): Unit = {
    totalSize += 1
    if (index+1 >= current.length) expand()
    current(index) = a
    index += 1
  }

  /** Removes all elements from `that` and appends them to this `DoubleAccumulator`. */
  final def drain(that: DoubleAccumulator): Unit = {
    var h = 0
    var prev = 0L
    var more = true
    while (more && h < that.hIndex) {
      val cuml = that.cumulative(h)
      val n = (cuml - prev).toInt
      if (current.length - index - 1 >= n) {
        System.arraycopy(that.history(h), 0, current, index, n)
        prev = cuml
        index += n
        h += 1
      }
      else more = false
    }
    if (h >= that.hIndex && current.length - index - 1>= that.index) {
      if (that.index > 0) System.arraycopy(that.current, 0, current, index, that.index)
      index += that.index
    }
    else {
      val slots = (if (index > 0) 1 else 0) + that.hIndex - h
      if (hIndex + slots > history.length) {
        val n = math.max(4, 1 << (32 - java.lang.Integer.numberOfLeadingZeros(1 + hIndex + slots)))
        history = java.util.Arrays.copyOf(history, n)
      }
      var pv = (if (hIndex > 0) cumulative(hIndex-1) else 0L)
      if (index > 0) {
        val x =
          if (index < (current.length >>> 3) && current.length - 1 > 32) {
            val ans = java.util.Arrays.copyOf(current, index + 1)
            ans(ans.length - 1) = current(current.length - 1)
            ans
          }
          else current
        pv = pv + index
        x(x.length - 1) = pv
        history(hIndex) = x
        hIndex += 1
      }
      while (h < that.hIndex) {
        val cuml = that.cumulative(h)
        pv = pv + cuml - prev
        prev = cuml
        val x = that.history(h)
        x(x.length - 1) = pv
        history(hIndex) = x
        h += 1
        hIndex += 1
      }
      index = that.index
      current = that.current
    }
    totalSize += that.totalSize
    that.clear
  }

  override def clear(): Unit = {
    super.clear()
    current = DoubleAccumulator.emptyDoubleArray
    history = DoubleAccumulator.emptyDoubleArrayArray
  }

  /** Retrieves the `ix`th element. */
  final def apply(ix: Long): Double = {
    if (totalSize - ix <= index || hIndex == 0) current((ix - (totalSize - index)).toInt)
    else {
      val w = seekSlot(ix)
      history((w >>> 32).toInt)((w & 0xFFFFFFFFL).toInt)
    }
  }

  /** Retrieves the `ix`th element, using an `Int` index. */
  final def apply(i: Int): Double = apply(i.toLong)

  /** Returns a `DoubleStepper` over the contents of this `DoubleAccumulator`. */
  final def stepper: DoubleStepper = new DoubleAccumulatorStepper(this)

  /** Returns an `Iterator` over the contents of this `DoubleAccumulator`. The `Iterator` is not specialized. */
  final def iterator = stepper.iterator

  /** Returns a `java.util.Spliterator.OfDouble` over the contents of this `DoubleAccumulator`*/
  final def spliterator: java.util.Spliterator.OfDouble = stepper

  /** Produces a sequential Java 8 `DoubleStream` over the elements of this `DoubleAccumulator`*/
  final def seqStream: java.util.stream.DoubleStream = java.util.stream.StreamSupport.doubleStream(spliterator, false)

  /** Produces a parallel Java 8 `DoubleStream` over the elements of this `DoubleAccumulator`*/
  final def parStream: java.util.stream.DoubleStream = java.util.stream.StreamSupport.doubleStream(spliterator, true)

  /** Copies the elements in this `DoubleAccumulator` into an `Array[Double]` */
  final def toArray = {
    if (totalSize > Int.MaxValue) throw new IllegalArgumentException("Too many elements accumulated for an array: "+totalSize.toString)
    val a = new Array[Double](totalSize.toInt)
    var j = 0
    var h = 0
    var pv = 0L
    while (h < hIndex) {
      val x = history(h)
      val cuml = x(x.length-1).toLong
      val n = (cuml - pv).toInt
      pv = cuml
      System.arraycopy(x, 0, a, j, n)
      j += n
      h += 1
    }
    System.arraycopy(current, 0, a, j, index)
    j += index
    a
  }

  /** Copies the elements in this `DoubleAccumulator` to a `List` */
  final def toList: List[Double] = {
    var ans: List[Double] = Nil
    var i = index - 1
    while (i >= 0) {
      ans = current(i) :: ans
      i -= 1
    }
    var h = hIndex - 1
    while (h >= 0) {
      val a = history(h)
      i = (cumulative(h) - (if (h == 0) 0L else cumulative(h-1))).toInt - 1
      while (i >= 0) {
        ans = a(i) :: ans
        i -= 1
      }
      h -= 1
    }
    ans
  }

  /** Copies the elements in this `DoubleAccumulator` to a specified collection.
    * Note that the target collection is not specialized.
    * Usage example: `acc.to[Vector]`
    */
  final def to[Coll[_]](implicit cbf: collection.generic.CanBuildFrom[Nothing, Double, Coll[Double]]): Coll[Double] = {
    if (totalSize > Int.MaxValue) throw new IllegalArgumentException("Too many elements accumulated for a Scala collection: "+totalSize.toString)
    val b = cbf()
    b.sizeHint(totalSize.toInt)
    var h = 0
    var pv = 0L
    while (h < hIndex) {
      val x = history(h)
      val n = cumulative(h) - pv
      pv = cumulative(h)
      var i = 0
      while (i < n) {
        b += x(i)
        i += 1
      }
      h += 1
    }
    var i = 0
    while (i < index) {
      b += current(i)
      i += 1
    }
    b.result
  }
}
object DoubleAccumulator {
  private val emptyDoubleArray = new Array[Double](0)
  private val emptyDoubleArrayArray = new Array[Array[Double]](0)

  /** A `Supplier` of `DoubleAccumulator`s, suitable for use with `java.util.stream.DoubleStream`'s `collect` method.  Suitable for `Stream[Double]` also. */
  def supplier = new java.util.function.Supplier[DoubleAccumulator]{ def get: DoubleAccumulator = new DoubleAccumulator }

  /** A `BiConsumer` that adds an element to an `Accumulator`, suitable for use with `java.util.stream.DoubleStream`'s `collect` method. */
  def adder = new java.util.function.ObjDoubleConsumer[DoubleAccumulator]{ def accept(ac: DoubleAccumulator, a: Double): Unit = { ac += a } }

  /** A `BiConsumer` that adds a boxed `Double` to an `DoubleAccumulator`, suitable for use with `java.util.stream.Stream`'s `collect` method. */
  def boxedAdder = new java.util.function.BiConsumer[DoubleAccumulator, Double]{ def accept(ac: DoubleAccumulator, a: Double): Unit = { ac += a } }

  /** A `BiConsumer` that merges `DoubleAccumulator`s, suitable for use with `java.util.stream.DoubleStream`'s `collect` method.  Suitable for `Stream[Double]` also. */
  def merger = new java.util.function.BiConsumer[DoubleAccumulator, DoubleAccumulator]{ def accept(a1: DoubleAccumulator, a2: DoubleAccumulator): Unit = { a1 drain a2 } }

  /** Builds a `DoubleAccumulator` from any `Double`-valued `TraversableOnce` */
  def from[A](source: TraversableOnce[Double]) = {
    val a = new DoubleAccumulator
    source.foreach(a += _)
    a
  }
}

private[java8] class DoubleAccumulatorStepper(private val acc: DoubleAccumulator) extends DoubleStepper {
  import java.util.Spliterator._

  private var h = 0
  private var i = 0
  private var a = if (acc.hIndex > 0) acc.history(0) else acc.current
  private var n = if (acc.hIndex > 0) acc.cumulative(0) else acc.index
  private var N = acc.totalSize

  private def duplicateSelf(limit: Long): DoubleAccumulatorStepper = {
    val ans = new DoubleAccumulatorStepper(acc)
    ans.h = h
    ans.i = i
    ans.a = a
    ans.n = n
    ans.N = limit
    ans
  }

  private def loadMore(): Unit = {
    h += 1
    if (h < acc.hIndex) { a = acc.history(h); n = acc.cumulative(h) - acc.cumulative(h-1) }
    else { a = acc.current; n = acc.index }
    i = 0
  }

  def characteristics() = ORDERED | SIZED | SUBSIZED | NONNULL

  def estimateSize = N

  def hasNext = N > 0

  def nextDouble: Double =
    if (n <= 0) throw new NoSuchElementException("next on empty Stepper")
    else {
      if (i >= n) loadMore()
      val ans = a(i)
      i += 1
      N -= 1
      ans
    }

  // Overridden for efficiency
  override def tryStep(f: Double => Unit): Boolean =
    if (N <= 0) false
    else {
      if (i >= n) loadMore()
      f(a(i))
      i += 1
      N -= 1
      true
    }

  // Overridden for efficiency
  override def tryAdvance(f: java.util.function.DoubleConsumer): Boolean =
    if (N <= 0) false
    else {
      if (i >= n) loadMore()
      f.accept(a(i))
      i += 1
      N -= 1
      true
    }

  // Overridden for efficiency
  override def foreach(f: Double => Unit): Unit = {
    while (N > 0) {
      if (i >= n) loadMore()
      val i0 = i
      if ((n-i) > N) n = i + N.toInt
      while (i < n) {
        f(a(i))
        i += 1
      }
      N -= (n - i0)
    }
  }

  // Overridden for efficiency
  override def forEachRemaining(f: java.util.function.DoubleConsumer): Unit = {
    while (N > 0) {
      if (i >= n) loadMore()
      val i0 = i
      if ((n-i) > N) n = i + N.toInt
      while (i < n) {
        f.accept(a(i))
        i += 1
      }
      N -= (n - i0)
    }
  }

  def substep(): DoubleStepper =
    if (N <= 1) null
    else {
      val half = (N >> 1)
      val M = (if (h <= 0) 0L else acc.cumulative(h-1)) + i
      val R = M + half
      val ans = duplicateSelf(half)
      if (h < acc.hIndex) {
        val w = acc.seekSlot(R)
        h = (w >>> 32).toInt
        if (h < acc.hIndex) {
          a = acc.history(h)
          n = acc.cumulative(h) - (if (h > 0) acc.cumulative(h-1) else 0)
        }
        else {
          a = acc.current
          n = acc.index
        }
        i = (w & 0xFFFFFFFFL).toInt
      }
      else i += half.toInt
      N -= half
      ans
    }
}


text:
import React, { Component } from 'react';

export default class NavigationButton extends Component {
    render() {
        const { config, utilities } = this.props;
        const { navigationOpened } = config;
        const { navigationToggler } = utilities;

        return (
            <button className={`${navigationOpened ? 'opened' : null}`} onClick={() => navigationToggler()} data-component="Page_NavigationButton" />
        );
    }
}


text:
Ansible script to deploy Apache Airavata and PGA.
There are ansible roles to install Airavata pre-requisites (RabbitMQ, Zookeeper, MariaDB).

## Supported OS with versions.

- Centos 7

## Roles

- **env_setup** :- Create user and group, install oracle java 8, open firewall ports.
- **zookeeper** :- Download and install zookeeper.
- **rabbitmq** :- Download and install rabbitmq as service.
- **database** :- Download and install mysql(mariadb) as a service.
- **common** :- Checkout Airavata source from git and run maven build. Move keystore files.
- **gfac** :- Setup and deploy Gfac component.
- **registry** Setup and deploy registry component.
- **api-orch** :- Setup and deploy Api-Orch components.
- **pga** :- Setup and deploy Airavata PHP Gateway.

## Useful commands

- `ansible-playbook -i hosts site.yml`
- `ansible-playbook -i hosts site.yml -t "tags"`
- `ansible-playbook -i hosts site.yml --start-at-task="name of the ansible task"`

To deploy pga run following. see site.yml (playbook) file for other available tags.

- `ansible-playbook -i hosts site.yml -t "pga"`

## Configurations

- Set correct private key file to `ansible_ssh_private_key_file` property in group_vars/all


text:
All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](http://semver.org/) and tries to follow the [Keep a CHANGELOG](http://keepachangelog.com) convention.

## vNext - Unreleased

- Animate twinkling stars
- Animate drifting clouds
- Implement JS animation for weather effects to save on bandwidth
- Add Windows Pinned Site functionality
- An API would be kinda cute to have

## v0.1.0 - 2016-08-10

- Initial release.


text:
body{
    font-family:arial;
}

td, th {
    color:#000000!important;
}

.os-animation{
  opacity: 0;
}

.os-animation.animated{
    opacity: 1;
}
.page-header {
    border-bottom: 1px solid #eee;
    color: #333333;

    font-size: 30px;
    font-weight: 100;
    margin: 20px 0;
    padding-bottom: 9px;
    text-transform: capitalize;
}
.numbers {

    font-size: 18px;
    font-weight: 100;
}
.email{

    font-size: 18px;
    font-weight: 100;
}
.content-section.text-center {
    margin-bottom: 50px;
}
.navbar-nav > li {
    float: left;
    margin-left: 20px;
    margin-right: 20px;
}
a.page-scroll {

}

.contact_no ,.email_address{
    color: #333333;
     margin-top: 15px;
     margin-bottom: 15px;
}
.btn.btn-lg.btn-warning.text-center {
    margin-bottom: 10px;
    margin-top: 5px;
}
.contact_no span,.email_address span{
    color: #b2bec4;
    font-size: 12px;
}
.contact_no i,.email_address i{
    background: #0f6eb4;
    padding: 10px;
    border-radius: 3px;
    color: #ffffff;
    font-size: 20px;
    margin-right: 10px;
    float: left;
}
.heading {
    margin: 40px 0;
    text-align: center;
}
.heading h1 {
    font-family: impact;
    font-size: 50px;
    text-shadow: 2px 2px 6px #434343;
}
.heading p {

    font-size: 24px;
    margin: 0;
    padding: 0;
    text-align: center;
}
.btn-warning {
    background-color: #F26620;
    border-color: #eea236;
    color: #fff;
}
.btn-group-lg > .btn, .btn-lg {
    font-size: 18px;
    line-height: 1.33333;

    font-weight: normal;
    padding: 15px 25px;
}

/*Section first header css style*/
.card .card-heading {
    padding: 0 20px;
    margin: 0;
}

.card .card-heading.simple {
    font-size: 20px;
    font-weight: 300;
    color: #777;
    border-bottom: 1px solid #e5e5e5;
}

.card .card-heading.image img {
    display: inline-block;
    width: 46px;
    height: 46px;
    margin-right: 15px;
    vertical-align: top;
    border: 0;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    border-radius: 50%;
}

.card .card-heading.image .card-heading-header {
    display: inline-block;
    vertical-align: top;
}

.card .card-heading.image .card-heading-header h3 {
    margin: 0;
    font-size: 14px;
    line-height: 16px;
    color: #262626;
}

.card .card-heading.image .card-heading-header span {
    font-size: 12px;
    color: #999999;
}

.card .card-body {
    padding: 0 20px;
    margin-top: 20px;
}

.card .card-media {
    padding: 0 20px;
    margin: 0 -14px;
}

.card .card-media img {
    max-width: 100%;
    max-height: 100%;
}

.card .card-actions {
    min-height: 30px;
    padding: 0 20px 20px 20px;
    margin: 20px 0 0 0;
}

.card .card-comments {
    padding: 20px;
    margin: 0;
    background-color: #f8f8f8;
}

.card .card-comments .comments-collapse-toggle {
    padding: 0;
    margin: 0 20px 12px 20px;
}

.card .card-comments .comments-collapse-toggle a,
.card .card-comments .comments-collapse-toggle span {
    padding-right: 5px;
    overflow: hidden;
    font-size: 12px;
    color: #999;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-comments .media-heading {
    font-size: 13px;
    font-weight: bold;
}

.card.people {
    position: relative;
    display: inline-block;
    width: 170px;
    height: 300px;
    padding-top: 0;
    margin-left: 20px;
    overflow: hidden;
    vertical-align: top;
}

.card.people:first-child {
    margin-left: 0;
}

.card.people .card-top {
    position: absolute;
    top: 0;
    left: 0;
    display: inline-block;
    width: 170px;
    height: 150px;
    background-color: #ffffff;
}

.card.people .card-top.green {
    background-color: #53a93f;
}

.card.people .card-top.blue {
    background-color: #427fed;
}

.card.people .card-info {
    position: absolute;
    top: 150px;
    display: inline-block;
    width: 100%;
    height: 101px;
    overflow: hidden;
    background: #ffffff;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.card.people .card-info .title {
    display: block;
    margin: 8px 14px 0 14px;
    overflow: hidden;
    font-size: 16px;
    font-weight: bold;
    line-height: 18px;
    color: #404040;
}

.card.people .card-info .desc {
    display: block;
    margin: 8px 14px 0 14px;
    overflow: hidden;
    font-size: 12px;
    line-height: 16px;
    color: #737373;
    text-overflow: ellipsis;
}

.card.people .card-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    display: inline-block;
    width: 100%;
    padding: 10px 20px;
    line-height: 29px;
    text-align: center;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.card.hovercard {
    background-color: #ffffff;
    border-top: 5px solid #0085c8;
    margin-bottom: 50px;
    margin-top: -50px;
    overflow: hidden;
    padding-top: 0;
    text-align: center;
    width: 100%;
}
#payment-form input {
    background: #ffffff none repeat scroll 0 0;
}
#payment-form select{
    background: #ffffff none repeat scroll 0 0;
}
#payment-form textarea{
    background: #ffffff none repeat scroll 0 0;
}
.card.hovercard .cardheader {
    height: 60px;
}

.avatar img{
    margin: 0 auto;

}
.card.hovercard .info {
    padding: 20px;
}
.card.hovercard .info .title {
    margin-bottom: 4px;
    font-size: 24px;
    line-height: 1;
    vertical-align: middle;
}
.title > a{
    font-weight: 700;
    font-size: 10pt;
    color: #403f3f!important;
}
.card.hovercard .info .desc {
    overflow: hidden;
    font-size: 12px;
    line-height: 20px;
    color: #737373;
    text-overflow: ellipsis;
}

.card.hovercard .bottom {
    padding: 0 20px;
    margin-bottom: 17px;
}
.arrow_readmore {
    background: #F04D15 none repeat scroll 0 0;
    color: #ffffff;
    float: left;
    margin-left: 6px;
    margin-top: 60px;
    padding: 5px 11px;
}
/*Section first header css style*/

/*services section css*/

.our_services h3 {
    color: #000000;
    float: left;

    font-size: 14pt;
    text-align: left;
    text-transform: capitalize;
    margin: 0;
}
.form_header h3 {
    color: #000000;
    float: left;

    font-size: 18px;
    margin: 0;
    text-align: inherit;
    text-transform: capitalize;
}
.divider {
    background: #F2F2F2 none repeat scroll 0 0;
    padding: 12px;
}
.box {
    background: #f2f2f2 none repeat scroll 0 0;
    margin: 30px 0 0;
    padding: 10px;

    text-align: left;
    display: inline-block;
}
.box h3{
    color: #403f3f;
    font-size: 14pt;
    margin-bottom: 10px;

    text-transform: capitalize;
}
.box p {
    color: #403f3f;
    font-size: 10pt;
    padding: 10px 10px 0 0;
}
.box.padding {
    padding: 26px;
}
.circle_icons {
    background: #0085C8 none repeat scroll 0 0;
    border-radius: 50%;
    float: right;
    height: 100px;
    margin: 30px 0;
    width: 100px;
}
.circle_icons img {
    margin: 25px 18px;
}
.login-button {
    background: #ffffff none repeat scroll 0 0;
    border: 5px solid #efefef;
    color: #999999;
    margin-top: 50px;
    padding: 7px 18px;
    position: absolute;
    transition: all 500ms ease-in-out 0s;
}
.quick_quote{
    background:url("../img/form_background.png") no-repeat ;
    width: 100%;
    height: 605px;
    background-size: cover;
    margin-top: 25px;
}
.testimonial_section{
    background:url("../img/testimonial_bg.png") no-repeat ;
    width: 100%;
    height: 457px;
    background-size: cover;
}
.tab-content {
    background: #282e3d none repeat scroll 0 0;
    padding: 20px;
}
label {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 0;
    padding-top: 0px!important;
}
.heading_testimonial {
    border-bottom: 2px solid #ffffff;

    font-size: 44px;
    font-weight: 100;
    margin: 29px auto 28px;
    padding: 10px 0;
    text-align: center;
    width: 50%;
}
label.control-label span { cursor: pointer; }
blockquote .small, blockquote footer, blockquote small{
    color: #ffffff;
}

/*Testimonail section*/
/***
User Profile Sidebar by @keenthemes
A component of Metronic Theme - #1 Selling Bootstrap 3 Admin Theme in Themeforest: http://j.mp/metronictheme
Licensed under MIT
***/

/* Content */

/* Testimonials */
.testimonials blockquote {
    background: #f8f8f8 none repeat scroll 0 0;
    border: medium none;
    color: #666;
    display: block;
    font-size: 14px;
    line-height: 20px;
    padding: 15px;
    position: relative;
}
.testimonials blockquote::before {
    width: 0;
    height: 0;
	right: 0;
	bottom: 0;
	content: " ";
	display: block;
	position: absolute;
    border-bottom: 20px solid #fff;
	border-right: 0 solid transparent;
	border-left: 15px solid transparent;
	border-left-style: inset; /*FF fixes*/
	border-bottom-style: inset; /*FF fixes*/
}
.testimonials blockquote::after {
    width: 0;
    height: 0;
    right: 0;
    bottom: 0;
    content: " ";
    display: block;
    position: absolute;
    border-style: solid;
    border-width: 20px 20px 0 0;
    border-color: #e63f0c transparent transparent transparent;
}
.testimonials .carousel-info img {
    border: 1px solid #dcdcdc;
    border-radius: 150px !important;
    height: 75px;
    padding: 4px;
    width: 75px;
}
.testimonials .carousel-info {
    overflow: hidden;
}
.testimonials .carousel-info img {
    margin-right: 15px;
}
.testimonials .carousel-info span {
    display: block;
}
.testimonials span.testimonials-name {
    color: #e6400c;
    font-size: 16px;
    font-weight: 300;
    margin: 5px 0 0;

}
.testimonials span.testimonials-post {
    color: #656565;
    font-size: 12px;
}
.testimonials p {

    font-size: 16px;
    font-weight: 100;
}
.testimonials_heading{
    color: #000000;
     margin-top: 10px;
}
.btn_divider {
    background: #f2f2f2 none repeat scroll 0 0;
    height: 20px;
    margin-bottom: 7px;
    margin-top: 7px;
}
.testimonials {
    margin-bottom: 35px;
}
.testimonials_heading h3 {

    font-size: 28px;
    font-weight: 100;
    text-align: left;
    text-transform: capitalize;
}
/*-------------------------------*/
/*      Code snippet by          */
/*      @maridlcrmn              */
/*-------------------------------*/

.quote {
    color: rgba(0,0,0,.1);
    text-align: center;
    margin-bottom: 30px;
}

/*-------------------------------*/
/*    Carousel Fade Transition   */
/*-------------------------------*/

#fade-quote-carousel.carousel {
  padding-bottom: 40px;
}
#fade-quote-carousel.carousel .carousel-inner .item {
  opacity: 0;
  -webkit-transition-property: opacity;
      -ms-transition-property: opacity;
          transition-property: opacity;
}
#fade-quote-carousel.carousel .carousel-inner .active {
  opacity: 1;
  -webkit-transition-property: opacity;
      -ms-transition-property: opacity;
          transition-property: opacity;
}
#fade-quote-carousel.carousel .carousel-indicators {
  bottom: 10px;
}
#fade-quote-carousel.carousel .carousel-indicators > li {
  background-color: #ffffff;
  border: none;
}
#fade-quote-carousel blockquote {
    text-align: center;
    border: none;
}
#fade-quote-carousel .profile-circle {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    border-radius: 50%;
}
.carousel-indicators .active {
    background-color: #000000;
}
.img-circle {
    height: 100px !important;
    width: 100px !important;
}
.form-group {
    margin-bottom: 20px;
}
/*Footer Section*/

.our_branches h2{

     font-size: 36px;
     margin-top: 30px;
     text-transform: capitalize;
     border-bottom: 1px solid #ffffff;
     padding-bottom: 10px;
}
.our_branches p{

     font-size: 20px;
}
.footer{
    background: #000000;

}
.corporate_address{
    background: #3680bd;
    padding: 10px;
    width: 50%;
    margin: 0 auto 50px;
}
.corporate_address h3{

    font-size: 36px;
    border-bottom: 1px solid #ffffff;
    font-weight: 100;
    padding: 12px;
    text-transform: capitalize;
}
.corporate_address p{
    font-size: 21px;

    padding: 0px 10px;
}
.cityName h4 {
    border-bottom: 1px solid #ffffff;

    font-size: 18px;
    margin-bottom: 11px;
    padding-bottom: 10px;
    text-align: left;
}
address {
    font-size: 16px;
    font-style: normal;
    line-height: 26px;
    margin-bottom: 35px;
    padding-left: 5px;
    padding-right: 12px;
    text-align: left;
    word-wrap: break-word;

}
.footerBack{
    background:#283A4B ;
    padding: 20px;

}
.copyright.pull-left {
    margin-top: 18px;
}
.footer_logo{
    background:url("../img/footer_logo.png") no-repeat ;
    width: 176px;
    height: 52px;
}
.contact_details{
    color: #333333;
}
.contact_details h3 {
    border-bottom: 1px solid #333333;

    font-size: 24px;
    padding-bottom: 9px;
}
.contact_details p{
    font-size: 16px;

    margin: 0 0 15px;
}
.contact_details a{
    color:#283A4B;
}
.form_section {
    color: #333333;
    margin-bottom: 30px;
    margin-top: 30px;
    display: inline-block;
}
.form-control{
    background: #aeaeae;
    border: 1px solid #e7e7e7;
}
.form_section h3 {
    color: #ffffff;

    font-size: 40px;
    font-weight: 100;
    margin: 0 0 15px;
    padding-bottom: 0;
    text-align: center;
    text-transform: capitalize;
    text-shadow: 2px 2px 3px #737373;
}
.form-control::-moz-placeholder {
    color: #cccccc;

}
.form_section > p {
    font-size: 18px;

     color: #ffffff;
     text-shadow: 2px 2px 3px #737373;

}
.form_section label{
    color:#283A4B ;
}
.breadcrumb {
    background-color: #60676d;
    border-radius: 0;
    list-style: outside none none;
    margin-bottom: 20px;
    padding: 8px 15px;
}
.breadcrumb a {
    color: #ffffff;
}
.breadcrumb > .active {
    color: #337AB7;
}
.primary{
    margin-bottom: 10px;
    margin-top: 10px;
}
#contact {
    background-color: #BEBEBE;
    background-image: url("../img/map-image.png");
    background-position: center center;
    background-repeat: no-repeat;
    margin-top: 40px;
}
/*Responsive css*/
@media(max-width:786px) {
    .btn-group-lg > .btn, .btn-lg {

    font-size: 14px;
    font-weight: normal;
    line-height: 1.33333;
    margin-top: 20px;
    padding: 9px 18px;
}
.heading p {

    font-size: 14px;
    margin: 0;
    padding: 0;
    text-align: center;
}
.item p {
    font-size: 12px;
    margin-bottom: 0;
}
.corporate_address{
    width: 100%;
}
.corporate_address h3{
    font-size: 30px;
    margin: 0 0 16px;
}
.corporate_address p {
    font-size: 20px;
}
.copyright.pull-left {
    margin-top: 0px;
    text-align: center;
}
.circle_icons{
    display: none;
}
.divider {
    float: left;
    width: 100%;
}
.footerBack {
    margin: 0;
    padding: 50px 0;
}
.footer_logo{
    margin-top: 17px;
    width: 232px;
}
.logo-american {
    margin-bottom: 15px;
    margin-top: 0;
}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PopForums.Models;

namespace PopForums.Services
{
	public class IPHistoryService : IIPHistoryService
	{
		public IPHistoryService(IPostService postService, ISecurityLogService securityLogService)
		{
			_postService = postService;
			_securityLogService = securityLogService;
		}

		private readonly IPostService _postService;
		private readonly ISecurityLogService _securityLogService;

		public List<IPHistoryEvent> GetHistory(string ip, DateTime start, DateTime end)
		{
			var list = new List<IPHistoryEvent>();
			list.AddRange(_postService.GetIPHistory(ip, start, end));
			list.AddRange(_securityLogService.GetIPHistory(ip, start, end));
			return list.OrderBy(i => i.EventTime).ToList();
		}
	}
}


text:
/*
 * Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

'use strict';

/**
 * @class
 * Initializes a new instance of the Model1 class.
 * @constructor
 * @member {string} email User email account.
 *
 * @member {string} password User password
 *
 */
class Model1 {
  constructor() {
  }

  /**
   * Defines the metadata of Model1
   *
   * @returns {object} metadata of Model1
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Model 1',
      type: {
        name: 'Composite',
        className: 'Model1',
        modelProperties: {
          email: {
            required: true,
            serializedName: 'email',
            constraints: {
              MaxLength: 50
            },
            type: {
              name: 'String'
            }
          },
          password: {
            required: true,
            serializedName: 'password',
            constraints: {
              MaxLength: 200
            },
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = Model1;


text:
\hypertarget{namespace__cookbook_1_1text__pattern}{\section{\-\_\-cookbook.\-text\-\_\-pattern Namespace Reference}
\label{namespace__cookbook_1_1text__pattern}\index{\-\_\-cookbook.\-text\-\_\-pattern@{\-\_\-cookbook.\-text\-\_\-pattern}}
}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item
def \hyperlink{namespace__cookbook_1_1text__pattern_a99aed64f324c4d7bd5ee90c0aadca9d4}{test\-\_\-re\-\_\-pattern}
\item
def \hyperlink{namespace__cookbook_1_1text__pattern_ad7e6795f9dd1ab31ff51db9c61c3f1e1}{test\-\_\-shell\-\_\-pattern}
\end{DoxyCompactItemize}

\subsection{Function Documentation}
\hypertarget{namespace__cookbook_1_1text__pattern_a99aed64f324c4d7bd5ee90c0aadca9d4}{\index{\-\_\-cookbook\-::text\-\_\-pattern@{\-\_\-cookbook\-::text\-\_\-pattern}!test\-\_\-re\-\_\-pattern@{test\-\_\-re\-\_\-pattern}}
\index{test\-\_\-re\-\_\-pattern@{test\-\_\-re\-\_\-pattern}!_cookbook::text_pattern@{\-\_\-cookbook\-::text\-\_\-pattern}}
\subsubsection[{test\-\_\-re\-\_\-pattern}]{\setlength{\rightskip}{0pt plus 5cm}def \-\_\-cookbook.\-text\-\_\-pattern.\-test\-\_\-re\-\_\-pattern (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{namespace__cookbook_1_1text__pattern_a99aed64f324c4d7bd5ee90c0aadca9d4}
\begin{DoxyVerb}Regular Expression (RE) pattern.

re1|re2 - or
re1.re2 - any character except `\n`
^str - start of string
str$ - end of string
re* - 0+ occurrences
re+ - 1+ occurrences
re? - 0 or 1 occurrences
re{N} - N occurrences
re{M,N} - from M to N occurrences
[...] - any single character from character set
[x-y] - any single character from x to y
[^...] - NOT any character from character set
(...) - subgroup

\d - digit, `[0-9]`
\D - NOT digit, `[^0-9]`
\w - alphanumeric character, `[A-Za-z0-9_]`
\W - NOT alphanumeric character, `[^A-Za-z0-9_]`
\s - white space, `[ \n\t\r\v\f]`
\S - NOT white space, `[^ \n\t\r\v\f]`
\bword\b - word boundary
\A - ^
\Z - $\end{DoxyVerb}

Definition at line 30 of file text\-\_\-pattern.\-py.

\hypertarget{namespace__cookbook_1_1text__pattern_ad7e6795f9dd1ab31ff51db9c61c3f1e1}{\index{\-\_\-cookbook\-::text\-\_\-pattern@{\-\_\-cookbook\-::text\-\_\-pattern}!test\-\_\-shell\-\_\-pattern@{test\-\_\-shell\-\_\-pattern}}
\index{test\-\_\-shell\-\_\-pattern@{test\-\_\-shell\-\_\-pattern}!_cookbook::text_pattern@{\-\_\-cookbook\-::text\-\_\-pattern}}
\subsubsection[{test\-\_\-shell\-\_\-pattern}]{\setlength{\rightskip}{0pt plus 5cm}def \-\_\-cookbook.\-text\-\_\-pattern.\-test\-\_\-shell\-\_\-pattern (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{namespace__cookbook_1_1text__pattern_ad7e6795f9dd1ab31ff51db9c61c3f1e1}
\begin{DoxyVerb}Shell-style wildcards pattern matching.

Pattern | Meaning
---------------------------------------------
*       | matches everything
---------------------------------------------
?       | matches any single character
---------------------------------------------
[seq]   | matches any character in _seq_
---------------------------------------------
[!seq]  | matches any character not in _seq_
---------------------------------------------

For a literal match, wrap the meta-characters in brackets. Note that the
filename separator ('/' on Unix) is not special to `fnmatch` module.

Unlike `fnmatch.fnmatch()`, `glob` module treats file names beginning with
a dot (.) as special cases.

**NOTE**: The matching performed by `fnmatch` module sits somewhere
between the functionality of simple string methods, such as
`startswith()`, `endswith()`, and the full power of regular expressions.
If you're just trying to provide a simple mechanism for allowing wildcards
in data processing operations, it's often a reasonable solution.
\end{DoxyVerb}

Definition at line 112 of file text\-\_\-pattern.\-py.