text:
using System;
using Haven;
using SharpHaven.Client;
using SharpHaven.UI.Widgets;

namespace SharpHaven.UI.Remote
{
	public class ServerClaimWindow : ServerWindow
	{
		private ClaimWindow widget;
		private MapOverlay overlay;

		public ServerClaimWindow(ushort id, ServerWidget parent)
			: base(id, parent)
		{
			SetHandler("upd", UpdateArea);
			SetHandler("shared", UpdateRights);
		}

		public override Widget Widget
		{
			get { return widget; }
		}

		public static new ServerWidget Create(ushort id, ServerWidget parent)
		{
			return new ServerClaimWindow(id, parent);
		}

		protected override void OnInit(Point2D position, object[] args)
		{
			var p1 = (Point2D)args[0];
			var p2 = (Point2D)args[1];
			var area = Rect.FromLTRB(p1.X, p1.Y, p2.X + 1, p2.Y + 1);

			overlay = new MapOverlay(16);
			overlay.Bounds = area;
			Session.Map.Overlays.Add(overlay);

			widget = new ClaimWindow(Parent.Widget, area);
			widget.Move(position);
			widget.Closed += OnClosed;
			widget.SelectedAreaChanged += OnSelectedAreaChanged;
			widget.Buy += OnBuy;
			widget.Declaim += OnDeclaim;
			widget.RightsChanged += OnRightsChanged;
		}

		protected override void OnDestroy()
		{
			Session.Map.Overlays.Remove(overlay);
		}

		private void UpdateArea(object[] args)
		{
			var p1 = (Point2D)args[0];
			var p2 = (Point2D)args[1];
			var area = Rect.FromLTRB(p1.X, p1.Y, p2.X + 1, p2.Y + 1);
			widget.Area = area;
		}

		private void UpdateRights(object[] args)
		{
			int group = (int)args[0];
			int rights = (int)args[1];
			widget.SetRight(group, (ClaimRight)rights);
		}

		private void OnClosed()
		{
			SendMessage("close");
		}

		private void OnSelectedAreaChanged(object sender, EventArgs e)
		{
			overlay.Bounds = widget.SelectedArea;
		}

		private void OnBuy(object sender, EventArgs e)
		{
			var ul = new Point2D(widget.SelectedArea.Left, widget.SelectedArea.Top);
			var br = new Point2D(widget.SelectedArea.Right - 1, widget.SelectedArea.Bottom - 1);
			SendMessage("take", ul, br);
		}

		private void OnDeclaim(object sender, EventArgs e)
		{
			SendMessage("declaim");
		}

		private void OnRightsChanged(object sender, ClaimRightsChangeEvent e)
		{
			SendMessage("shared", e.Group, (int)e.Rights);
		}
	}
}


text:
int main()
{

	xEngine_test(true); //without using this, the extern functions seems to be not compiled into the dll -> in c# entrypoint not found ???
	auto testfkt =  xEngine_create("E:/Projekte/coop/XEngine/data/Test/XETController/resources.cfg", "Ogre3D v2.1 and SFML v2.2 - XETController");
	return 0;

	std::cout << "start" << std::endl;

	EI::stateInit("", 200, 200);

	char* test = new char[3];
	//###		EI::getStates(test);

	std::cout << "EI::getStates:" << test;

	bool running = true;
	while (running)
	{

		sfEvent event;
		event.type = sfEventType::sfEvtKeyPressed;
		event.key.code = sfKeyW;

		//###		EI::pushEvent(event);

	//###	EI::stateUpdate();

		//		EI::quit();
		//	// handle events
		//	sf::Event event;
		//	while (window.pollEvent(event))
		//	{
		//		if (event.type == sf::Event::Closed)
		//		{
		//			// end the program
		//			running = false;
		//		}
	}

	// leaving the scope of 'game' will cleanup the engine

	//XE::XEngine game("E:/Projekte/coop/XEngine/data/Test/XETController/resources.cfg", "Ogre3D v2.0 and SFML v2.2 - XETEditor");

	//game.run(game.build<EditorState>(&game, true));

	//while (game.running())
	//{
	//	game.update();
	//}

	//game.quit();
}

redpajama_set_name: RedPajamaGithub


text:
var HttpAdapter = require('./httpadapter.js'),
    util        = require("util");

var HttpsAdapter = function(http) {

    if (!http || http === 'undefined') {
        http = require('https');
    }

    this.url = require('url');
    this.http = http;
};

HttpAdapter.prototype.supportsHttps = function() {
    return true;
};

util.inherits(HttpsAdapter, HttpAdapter);

module.exports = HttpsAdapter


text:
.. _cinder_volume_supporting:

Cinder volume support
~~~~~~~~~~~~~~~~~~~~~

Cinder volume is a block storage service for OpenStack, which represents a
detachable device, similar to a USB hard drive. You can attach a volume to
only one instance. In murano, it is possible to work with Cinder volumes
in several ways:

* Attaching Cinder volumes to murano instance
* Booting from Cinder volume

Below both ways are considered with ApacheHttpServer application as an
example.

For more information about Cinder volumes, see
`Manage Cinder volumes
<http://docs.openstack.org/user-guide/common/cli_manage_volumes.html>`_.

Attaching Cinder volumes
------------------------

Several volumes can be attached to the murano instance. Consider an example
that shows how to attach a created volume to the instance (next, in the
*Booting from Cinder volume* section, we are going to boot from a volume
created by us).

**Example**

#. In the Openstack dashboard, go to :guilabel:`Volumes` to create a volume.

#. Modify the ``ui.yaml`` file:

.. code-block:: yaml

    ....

    Application:
      ....
      instance:
        ....
        volumes:
          $.volumeConfiguration.volumePath:
            ?:
              type: io.murano.resources.ExistingCinderVolume
            openstackId: $.volumeConfiguration.volumeID

     ....

An existing Cinder volume can be initialized with its ``openstackId`` and can
be attached with its ``volumePath``. These parameters come here from
modified ``Forms`` section of the ``ui.yaml`` file:

.. code-block:: yaml

    ....

    Forms:
      - appConfiguration:
          ....
      - instanceConfiguration:
          ....
      - volumeConfiguration:
          fields:
            - name: volumeID
              type: string
              label: Existing volume ID
              description: Put in existing volume openstackID
              required: true
            - name: volumePath
              type: string
              label: Path
              description: Put in volume path to be mounted
              required: true

Therefore, create a ZIP archive of the built package and upload it to murano.
Attach created application to the environment. Enter its openstackId (which
can be found in Openstack dashboard) and path for mounting. For example, you
can fill the latter with ``/dev/vdb`` value.

After the application is deployed, verify that the volume is attached to the
instance in the OpenStack dashboard :guilabel:`Volumes` tab. Alternatively,
see the topology of the ``Heat Stack``.

Booting from Cinder volume
--------------------------

You can create a volume from an existing image. The example below shows how to
create a volume from an image and use the volume to boot an instance.

**Example**

It is possible to create a volume through the Heat template, instead of
the OpenStack dashboard. For this, modify the ``ui.yaml`` file:

.. code-block:: yaml

    ....

    Templates:
      customJoinNet:
        ....
      bootVolumes:
        - volume:
            ?:
              type: io.murano.resources.CinderVolume
            size: $.instanceConfiguration.volSize
            sourceImage: $.instanceConfiguration.osImage
          bootIndex: 0
          deviceName: vda
          deviceType: disk
    ....

    Application:
      ....
      instance:
        ....
        blockDevices: $bootVolumes

    ....

The example above shows that the ``Templates`` section now has a
``bootVolumes`` field, which is stored in the changed ``Application``
section.
Pay attention that ``image`` property should be deleted from
``Application`` to avoid defining both image and volume to boot.
The ``size`` and ``sourceImage`` properties come in ``Templates`` from the
changed ``Forms`` section of the ``ui.yaml`` file:

.. code-block:: yaml

    ....

    Forms:
      - appConfiguration:
          ....

      - instanceConfiguration:
          fields:
            ....
            - name: volSize
              type: integer
              label: Size of volume
              required: true
              description: >-
                Specify volume size which is going to be created from image
            ....

After sending this package to murano you can boot your instance from the
volume by chosen image.


text:
package com.nowellpoint.api.rest.domain;

import java.time.Instant;
import java.util.Date;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

import javax.annotation.Nullable;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.immutables.value.Value;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.nowellpoint.api.rest.OrganizationResource;
import com.nowellpoint.mongodb.document.MongoDocument;
import com.nowellpoint.util.Assert;

@Value.Immutable
@Value.Modifiable
@Value.Style(typeImmutable = "*", jdkOnly=true, create = "new", depluralize = true, depluralizeDictionary = {"transaction:transactions, user:users"})
@JsonSerialize(as = Organization.class)
@JsonDeserialize(as = Organization.class)
public abstract class AbstractOrganization extends AbstractImmutableResource {
	public abstract UserInfo getCreatedBy();
	public abstract UserInfo getLastUpdatedBy();
	public abstract String getNumber();
	public abstract String getDomain();
	public abstract @Nullable String getName();
	public abstract @Nullable Subscription getSubscription();
	public abstract @Nullable Set<Transaction> getTransactions();
	public abstract @Nullable Set<UserInfo> getUsers();

	@Override
	public Meta getMeta() {
		return Meta.builder()
				.id(getId())
				.resourceClass(OrganizationResource.class)
				.build();
	}

	@Override
	public void replace(MongoDocument document) {
		modelMapper.map(document, this);
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(Organization.class);
	}

	@Override
	public MongoDocument toDocument() {
		return modelMapper.map(this, com.nowellpoint.api.model.document.Organization.class);
	}

	public static Organization of(com.nowellpoint.api.model.document.Organization source) {
		ModifiableOrganization organization = sourceToModifiableOrganization(source);
		return organization.toImmutable();
	}

	public static Organization of(com.nowellpoint.api.model.document.Organization source, JsonNode subscriptionEvent) {

		ModifiableOrganization organization = sourceToModifiableOrganization(source);

		ModifiableSubscription subscription = ModifiableSubscription.create()
				.from(organization.getSubscription())
				.setStatus(subscriptionEvent.get("status").asText())
				.setNextBillingDate(new Date(subscriptionEvent.get("nextBillingDate").asLong()));

		Optional<Transaction> optional = organization.getTransactions()
				.stream()
				.filter(transaction -> transaction.getId().equals(subscriptionEvent.get("transaction").get("id").asText()))
				.findAny();

		if (! optional.isPresent()) {

			ModifiableTransaction transaction = ModifiableTransaction.create()
					.setId(subscriptionEvent.get("transaction").get("id").asText())
					.setAmount(subscriptionEvent.get("transaction").get("amount").asDouble())
					.setCreatedOn(new Date(subscriptionEvent.get("transaction").get("createdAt").asLong()))
					.setCurrencyIsoCode(subscriptionEvent.get("transaction").get("currencyIsoCode").asText())
					.setStatus(subscriptionEvent.get("transaction").get("status").asText())
					.setUpdatedOn(new Date(subscriptionEvent.get("transaction").get("updatedAt").asLong()));

			if (! subscriptionEvent.get("transaction").get("creditCard").isNull()) {

				Date now = Date.from(Instant.now());

				ModifiableCreditCard creditCard = ModifiableCreditCard.create()
						.setAddedOn(now)
						.setUpdatedOn(now)
						.setLastFour(subscriptionEvent.get("transaction").get("creditCard").get("last4").asText())
						.setCardType(subscriptionEvent.get("transaction").get("creditCard").get("cardType").asText())
						.setCardholderName(subscriptionEvent.get("transaction").get("creditCard").get("cardholderName").asText())
						.setExpirationMonth(subscriptionEvent.get("transaction").get("creditCard").get("expirationMonth").asText())
						.setExpirationYear(subscriptionEvent.get("transaction").get("creditCard").get("expirationYear").asText())
						.setImageUrl(subscriptionEvent.get("transaction").get("creditCard").get("imageUrl").asText())
						.setToken(subscriptionEvent.get("transaction").get("creditCard").get("token").asText());

				transaction.setCreditCard(creditCard.toImmutable());
			}

			organization.addTransaction(transaction.toImmutable());
		}

		organization.setSubscription(subscription.toImmutable());

		return organization.toImmutable();
	}

	private static ModifiableOrganization sourceToModifiableOrganization(com.nowellpoint.api.model.document.Organization source) {
		if (Assert.isNull(source)) {
			return null;
		}

		Set<Transaction> transactions = source.getTransactions().stream()
				.map(t -> Transaction.of(t))
				.collect(Collectors.toSet());

		ModifiableOrganization organization = new ModifiableOrganization()
				.setCreatedBy(UserInfo.of(source.getCreatedBy()))
				.setCreatedOn(source.getCreatedOn())
				.setDomain(source.getDomain())
				.setId(source.getId().toString())
				.setLastUpdatedBy(UserInfo.of(source.getLastUpdatedBy()))
				.setLastUpdatedOn(source.getLastUpdatedOn())
				.setName(source.getName())
				.setNumber(source.getNumber())
				.setSubscription(Subscription.of(source.getSubscription()))
				.setTransactions(transactions);

		return organization;
	}
}


text:
package com.wideplay.warp.persist.db4o;

import com.db4o.ObjectContainer;
import com.wideplay.warp.persist.internal.InternalWorkManager;
import com.wideplay.warp.persist.TransactionType;
import com.wideplay.warp.persist.Transactional;
import com.wideplay.warp.persist.UnitOfWork;
import net.jcip.annotations.ThreadSafe;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import java.lang.reflect.Method;

/**
 * TODO Rolled-back objects need to be refreshed?
 *
 * @author Jeffrey Chung (jeffreymchung@gmail.com)
 */
@ThreadSafe
class Db4oLocalTxnInterceptor implements MethodInterceptor {
	private final UnitOfWork unitOfWork;
    private final InternalWorkManager<ObjectContainer> internalWorkManager;

    @Transactional
	private static class Internal {}

    public Db4oLocalTxnInterceptor(InternalWorkManager<ObjectContainer> internalWorkManager, UnitOfWork unitOfWork) {
        this.internalWorkManager = internalWorkManager;
        this.unitOfWork = unitOfWork;
    }

    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        Transactional transactional = readTransactionMetadata(methodInvocation);
        if (transactional.type() != null && transactional.type() == TransactionType.READ_ONLY) {
            throw new UnsupportedOperationException("Transaction type READ_ONLY is not supported with DB4O");
        }

		ObjectContainer oc = internalWorkManager.beginWork();

		Object result;
		try {
			result = methodInvocation.proceed();
		} catch (Exception e) {
            try {
                if (rollbackIfNecessary(transactional, e, oc))
                    oc.commit();

            } finally {
                if (isUnitOfWorkTransaction())
                    endWork();
            }

			throw e;
		}

		// normal, so commit the transaction
		try {
			oc.commit();
		} finally {
            if (isUnitOfWorkTransaction())
                endWork();
        }

		return result;
	}

    private void endWork() {
        this.internalWorkManager.endWork();
    }

    private Transactional readTransactionMetadata(MethodInvocation methodInvocation) {
		Transactional transactional;
		Method method = methodInvocation.getMethod();

		// if none on method, try the class
		Class<?> targetClass = methodInvocation.getThis().getClass().getSuperclass();

		// if there is no transactional annotation of Warp's present, use the default
		if (method.isAnnotationPresent(Transactional.class)) {
			transactional = method.getAnnotation(Transactional.class);
		} else if (targetClass.isAnnotationPresent(Transactional.class)) {
			transactional = targetClass.getAnnotation(Transactional.class);
		} else {
			transactional = Internal.class.getAnnotation(Transactional.class);
		}
		return transactional;
	}

	/**
	 *
	 * @param transactional
	 * @param e
	 * @return Returns true if rollback did NOT occur
	 */
	private boolean rollbackIfNecessary(Transactional transactional, Exception e, ObjectContainer oc) {
		boolean commit = true;

		for (Class<? extends Exception> rollBackOn : transactional.rollbackOn()) {
			if (rollBackOn.isInstance(e)) {
				commit = false;

				for (Class<? extends Exception> exceptOn : transactional.exceptOn()) {
					// an exception to the rollback clause was found; don't rollback (i.e., commit and throw anyway)
					if (exceptOn.isInstance(e)) {
						commit = true;
						break;
					}
				}

				// rollback only if nothing matched the exceptOn check
				if (!commit) {
					oc.rollback();
				}

				break;
			}
		}

		return commit;
	}

    private boolean isUnitOfWorkTransaction() {
        return UnitOfWork.TRANSACTION.equals(this.unitOfWork);
    }
}


text:
<?php

/**
 * The parent class of all data classes
 *
 * @author Nuno Barreto <nbarreto@gmail.com>
 */
abstract class DataClass {
    /**
     * Child class.
     * @access private
     * @var DataClass
     */
    private $_caller;

    /**
     * MongoDB connector's instance.
     * @access protected
     * @var MongoDB_Connector
     */
    protected $_mongodbConnector;

    /**
     * MySQL DB read connector's instance.
     * @access protected
     * @var MySQL_Connector
     */
    protected $_mysqlConnectorRead;

    /**
     * MySQL DB write connector's instance.
     * @access protected
     * @var MySQL_Connector
     */
    protected $_mysqlConnectorWrite;

    /**
     * Config instance.
     * @access protected
     * @var ApplicationConfig
     */
    protected $_config;

    /**
     * Object table name
     * @access protected
     * @var string
     */
    protected $_sTable;

    /**
     * Object primary keys
     * @access protected
     * @var array
     */
    protected $_aPrimaryKeys;

    /**
     * Used to check combinations of primary keys (fill just if really needed)
     * @access protected
     * @var array
     */
    protected $_aPrimariesChecks;

    protected $_aOldPrimaryValues;

    /**
     * Set if primary key is autoincremented
     * @access protected
     * @var boolean
     */
    protected $_isAutoIncrement = false;

    /**
     * Database attributes
     * @access protected
     * @var array
     */
    protected $_dbAttributes;

    /**
     * Class constructor
     *
     * @access public
     * @param Mixed         $data SQL Resource or int
     * @return void
     */
    public function __construct($data = null)
    {
        $this->_mysqlConnectorRead  = $this->_getDefaultDBConnector('read');
        $this->_mysqlConnectorWrite = $this->_getDefaultDBConnector('write');
        $this->_config              = ApplicationConfig::getInstance();
        $this->_caller              = get_called_class();

        // check others args
        $args               = func_get_args();
        if (count($args)>1) {
            $data           = $args;
        }
        // init
        $this->init($data);
    }

    /**
     * Class destructor
     * @return void
     */
    function __destruct()
    {
        unset($this->_mysqlConnectorRead, $this->_mysqlConnectorWrite, $this->_config, $this->_caller);
    }

    /**
     * Initialize the object from datas
     *
     * @access public
     * @param mixed         $data SQL Resource or int
     * @return void
     */
    public function init($data)
    {
        switch (true) {
            case (null === $data) : {
                $this->constructEmpty();
                break;
            }
            case (is_scalar($data) OR (is_array($data) AND count($data) == count($this->_aPrimaryKeys))) : {
                $this->constructFromPrimaryKeys($data, false);
                break;
            }
            case is_object($data) OR is_array($data) : {
                $this->constructFromResource($data, null, false, false);
                break;
            }
            default : {
                break;
            }
        }

        $this->_saveOldPrimaryValues();

        $this->_initialize();
    }

    public function getPrimaryKeys(){
        return $this->_aPrimaryKeys;
    }

    /**
     * Class constructor using primary keys
     * @access public
     * @param scalar|array $primaryKeyValue    (there's barely no table with a unique primary key !)
     *                                          this value can be used like this:
     *                                          array(value1, value2) following the order of primary fields set in $this->_aPrimaryKeys
     *                                          or
     *                                          array('primaryKey1'=>value1, 'primaryKey2'=>value2)  Use the second method at your own risks...
     * @return DataClass
     */
    public function constructFromPrimaryKeys($primaryKeyValue, $wInit = true)
    {
        $primaryKeyValue = Utils::getMultiValues($primaryKeyValue, true);

        if ($primaryKeyValue) {
            $aWhere     = array();
            $aValues    = array();
            foreach ($primaryKeyValue as $key=>$value) {
                if (is_string($key) AND property_exists($this, $key)) {
                    $fieldName  = $key;
                } else if (is_array($this->_aPrimaryKeys) AND isset($this->_aPrimaryKeys[$key])) {
                    $fieldName  = $this->_aPrimaryKeys[$key];
                } else {
                    continue;
                }

                $aWhere[]       = 'trim('.$fieldName.') = trim(?)';
                $aValues[]      = $value;
            }

            if (count($aWhere) === count($this->_aPrimaryKeys)) {
                $sQuery = 'SELECT '.$this->_getFields(null, null, false).'
                            FROM '.$this->_sTable.'
                           WHERE '.implode(' AND ', $aWhere);

                $cache = Caching::getInstance();
				$primaryKey = is_array($primaryKeyValue) ? current($primaryKeyValue) : $primaryKeyValue;
                $cacheID = 'DataClass_constructFromPrimaryKeys_'.$this->_sTable.'_'.$this->id.'_'.$primaryKey.'_'.$wInit;

                $aResult = $cache->get($cacheID);

                if (!$aResult) {
                    $aResult = $this->_mysqlConnectorRead->executePreparedRead($sQuery, 0, 0, $aValues);
                    $cache->save($cacheID, $aResult, rand(55, 70) * 1); // About 1 minute
                }

                $aResult = $this->_mysqlConnectorRead->executePreparedRead($sQuery, 0, 0, $aValues);
                if (count($aResult)) {
                    $this->constructFromResource($aResult[0]);
                } else {
                    throw new MySQL_Exception(_("Can't construct specified").' '.$this->_caller.' ('.  json_encode($primaryKeyValue).')', MySQL_Exception::ELEMENT_NOT_EXISTS);
                }
            }
        }

        return $this;
    }

    /**
     * Class constructor using SQL resources
     * @access public
     * @param object    $resource       SQL resources Object
     * @param string    $sAlias         Alias used to decode resource
     * @return DataClass
     */
    public function constructFromResource($resource)
    {
        if ($resource) {
            $resource = (array)$resource;

            foreach ($resource AS $key => $value) {
                // If property has the same name as the database field
                if (property_exists($this, $key)) {
                    $propertyName = $key;
                // If property is camel cased compared to the database field
                /*} else if (property_exists($this, Utils::toCamelCase($key))) {
                    $propertyName = Utils::toCamelCase($key);*/
                // If property is different than the database field
                } else if (in_array($key, $this->_aFields)) {
                    $propertyName = array_search($key, $this->_aFields);
                }

                // numeric
                if (is_numeric($value) AND (strlen((int)$value) == strlen($value)) AND !strstr($value, '.')) {
                    $this->$propertyName = (int) $value;
                // others
                } else {
                    $this->$propertyName = $value;
                }
            }
        } else {
            throw new MySQL_Exception(_("Can't construct specified").' '.$this->_caller, MySQL_Exception::NULL_RESSOURCE);
        }

        return $this;
    }

    /**
     * Empty class constructor
     * @access protected
     * @return void
     */
    protected function constructEmpty() {}

    protected function _saveOldPrimaryValues()
    {
        foreach ($this->_aPrimaryKeys as $primaryKey) {
            $this->_aOldPrimaryValues[$primaryKey]  = $this->$primaryKey;
        }
    }

    /**
     * Return the default DB connector of the class
     * Please override this function to set your own DBConnector
     * @access protected
     * @return DB_Connector
     */
    protected function _getDefaultDBConnector($type = 'write')
    {
        return MySQL_Connector::getInstance($type);
    }

    /*************************************************************
     *
     *                  INSERT, DELETE, UPDATE
     *
     *************************************************************/

    /**
     * Add the object to database
     * @access public
     * @return boolean
     */
    public function add($getLastInsertedId = false)
    {
        if ($this->_checkElementExists()) {
            throw new MySQL_Connector(_("Can't add specified").' '.$this->_caller, MySQL_Connector::ELEMENT_EXISTS);
//            Utils::abort(_('Element already exists.'));
        }

        return $this->_addDB($getLastInsertedId);
    }

    /**
     * Update the object into database
     * @access public
     * @return boolean
     */
    public function update()
    {
        if (!$this->_checkElementExists()) {
            throw new MySQL_Connector(_("Can't update specified").' '.$this->_caller, MySQL_Connector::ELEMENT_NOT_EXISTS);
            //Utils::abort(_('A primary key of the element is empty.'));
        } else if ($this->_checkPrimaryKeysChanges() AND $this->_checkElementExists(true)) {
            throw new MySQL_Connector(_("Can't update specified").' '.$this->_caller, MySQL_Connector::ELEMENT_EXISTS);
        }

        return $this->_updateDB();
    }

    /**
     * Delete the object from database
     * @access public
     * @return boolean
     */
    public function delete()
    {
        if (!$this->_checkElementExists()) {
            throw new MySQL_Connector(_("Can't delete specified").' '.$this->_caller, MySQL_Connector::ELEMENT_NOT_EXISTS);
//            Utils::abort(_('Element already exists.'));
        }

        return $this->_deleteDB();
    }

    /**
     * @see add()
     *
     * @access protected
     * @return Boolean $success
     */
        protected function _addDB($getLastInsertedId = false )
    {
        $success    = false;

        $omit       = null;
        if ($this->_isAutoIncrement) {
            $omit   = $this->_aPrimaryKeys;
        }

        $aFields    = $this->_getFields(null, $omit, false, true);
        $aValues    = array();
        $sQuery     = "INSERT INTO ".$this->_sTable." (".implode(', ', $aFields).")\n VALUES (?".str_repeat(', ?', count($aFields)-1).")";

        foreach ($aFields AS $field) {
            if (isset($this->$field)) {
                $aValues[] = $this->$field;
            } else if (in_array($field, $this->_aFields)) {
                $varName = array_search($field, $this->_aFields);
                $aValues[] = $this->$varName;
            } else {
                $aValues[] = 'NULL';
            }
        }

        $result   = $this->_mysqlConnectorRead->executePreparedWrite($sQuery, $aValues);

        unset($aValues);

        if ($result) {

            // get the auto-incremented primaryKey if needed
            if ($this->_isAutoIncrement) {
                foreach ($result as $res) {
                    $this->constructFromResource($res);
                }
            }

            $success = true;
        }

        if($getLastInsertedId === true){
            return $this->_mysqlConnectorRead->getLastInsertID();
        }else{
            return $success;
        }
    }

    /**
     * @see update()
     *
     * @access protected
     * @return Boolean $success
     */
    protected function _updateDB()
    {
        $omit       = null;
        if ($this->_isAutoIncrement) {
            $omit   = $this->_aPrimaryKeys;
        }
        $success    = false;

        $aFields    = $this->_getFields(null, $omit, false, true);
        $aQuery     = array();
        $aValues    = array();
        $aWhere     = array();
        $sQuery     = " UPDATE ".$this->_sTable ." SET \n";

        foreach ($aFields AS $field) {
            $aQuery[]   = $field.' = ?';
            if (isset($this->$field)) {
                $aValues[]  = $this->$field;
            } else if (in_array($field, $this->_aFields)) {
                $varName = array_search($field, $this->_aFields);
                $aValues[] = $this->$varName;
            } else {
                $aValues[]  = 'NULL';
            }
        }

        foreach ($this->_aPrimaryKeys as $primaryKey) {
            $aWhere[]       = 'trim('.$primaryKey.') = trim(?)';
            $aValues[]      = $this->_aOldPrimaryValues[$primaryKey];
        }

        $sQuery  .= implode(", ", $aQuery);
        $sQuery  .= "\n WHERE ".implode(' AND ', $aWhere);

        $result   = $this->_mysqlConnectorWrite->executePreparedWrite($sQuery, $aValues);
        unset($aValues, $aQuery);

        if ($result) {
            $success = true;
        }

        return $success;
    }

    /**
     * @see delete()
     *
     * @access protected
     * @return Boolean $success
     */
    protected function _deleteDB()
    {
        $success = false;

        $aValues    = array();
        $aWhere     = array();
        $sQuery     = "DELETE FROM ".$this->_sTable;
        foreach ($this->_aPrimaryKeys as $primaryKey) {
            $aWhere[]       = 'trim('.$primaryKey.') = trim(?)';
            $aValues[]      = $this->$primaryKey;
        }
        $sQuery  .= "\n WHERE ".implode(' AND ', $aWhere);

        $result = $this->_mysqlConnectorWrite->executePreparedWrite($sQuery, $aValues);
        unset($aValues);

        if ($result) {
            $success = true;
        }
        return $success;
    }

    /**
     * Returns all fields formated for use in SQL queries
     *
     * @access public
     * @static
     * @see DataClass->_getFields()
     * @param string        $sAlias         To prefix fields with the alias ( e.g: ALIAS.field)
     * @param scalar|array  $omit           Fields those will be left off
     * @param bool          $bSuffix        Allow to suffix fields with the alias or className (e.g : field__ALIAS or field__className)
     * @param bool          $bArray         if true The return value will be an array
     * @return string|array
     */
    public static function getFields($sAlias = null, $omit = null, $bSuffix = false, $bArray = false)
    {
        $instance = new static();
        return $instance->_getFields($sAlias, $omit, $bSuffix, $bArray);
    }

    /**
     * Returns all fields formated for use in SQL queries
     *
     * @access protected
     * @param string        $sAlias         To prefix fields with the alias ( e.g: ALIAS.field)
     * @param scalar|array  $omit           Fields those will be left off
     * @param bool          $bSuffix        Allow to suffix fields with the alias or className (e.g : field__ALIAS or field__className)
     * @param bool          $bArray         if true The return value will be an array
     * @return string|array
     */
    protected function _getFields($sAlias = null, $omit = null, $bSuffix = false, $bArray = false)
    {
        $aOmit = (!is_array($omit)) ? array($omit) : $omit;
        $sAlias = (string) $sAlias;
        $suffix = $sAlias;

        // get database fields
        $aFields = $this->_getDBAttributes();

        // delete omitted fields
        $aFields = array_diff($aFields, $aOmit);

        if ($sAlias OR $bSuffix) {

            if (!$sAlias AND $bSuffix) {
                $suffix = $this->_caller;
            }

            $sAlias = ($sAlias) ? $sAlias.'.' : $sAlias;

            foreach ($aFields AS &$sField) {
                $sField = $sAlias.$sField.' AS '.$sField;
                if ($bSuffix) {
                    $sField .= Utils::DELIM_DOUBLE_UNDERSCORE.$suffix;
                }
            }
        }

        return ($bArray) ? $aFields : implode(', ', $aFields);
    }

    /**
     * Returns all database attributes of the class
     * /!\  By default, this function get all public attributes
     *      Please override this function if all publics attributes are not database fields !
     *      e.g: return array('attribute1', 'attribute2', 'attribute5');
     *
     * @access protected
     * @return array
     */
    protected function _getDBAttributes()
    {
        if (!$this->_dbAttributes) {
            $ref = new ReflectionObject($this);
            $attributes = $ref->getProperties(ReflectionProperty::IS_PUBLIC);
            $attributes = Utils::array_child($attributes, 'name');

            // Check for cases where table name is diferent from atribute name
            foreach ($attributes as $attKey => $attribute) {
                if (isset($this->_aFields[$attribute])) {
                    $attributes[$attKey] = $this->_aFields[$attribute];
                }
            }

            $this->_dbAttributes = $attributes;
        }
        return $this->_dbAttributes;
    }

    /**
     * Check if primary keys are setted
     * @access protected
     * @return boolean
     */
    protected function _checkPrimaryKeys()
    {
        $primaryKeysSetted = true;
        if (is_array($this->_aPrimaryKeys)) {
            foreach ($this->_aPrimaryKeys as $primaryKey) {
                if (!$this->$primaryKey) {
                    $primaryKeysSetted = false;
                    break;
                }
            }
        }

        return $primaryKeysSetted;
    }

    /**
     * Check if primary keys have been modified
     */
    protected function _checkPrimaryKeysChanges()
    {
        $isChanged          = false;
        if (is_array($this->_aPrimaryKeys) AND is_array($this->_aOldPrimaryValues)) {
            foreach ($this->_aPrimaryKeys as $primaryKey) {
                if ($this->$primaryKey != $this->_aOldPrimaryValues[$primaryKey]) {
                    $isChanged  = true;
                    break;
                }
            }
        }

        return $isChanged;
    }

    /**
     * Check if element exists in database
     * @access protected
     * @return boolean
     */
    protected function _checkElementExists($wUpdatedAttributes = false)
    {
        $isElementExists    = false;
        $aWhere             = array();
        $aValues            = array();
        $sWhere             = '';
        if (is_array($this->_aPrimaryKeys)) {
            if (is_array($this->_aPrimariesChecks) AND count($this->_aPrimariesChecks)) {

                foreach ($this->_aPrimariesChecks as $primariesCheck) {
                    $aWhereChecks       = array();
                    $isOK = true;

                    if (is_array($primariesCheck) AND count($primariesCheck)) {
                        foreach ($primariesCheck as $primaryKey) {
                            $aWhereChecks[]   = 'trim(upper('.$primaryKey.')) = trim(upper(?))';
                            if (!$wUpdatedAttributes AND isset($this->_aOldPrimaryValues[$primaryKey]) AND $this->_aOldPrimaryValues[$primaryKey]) {
                                if (!$this->_aOldPrimaryValues[$primaryKey]) {
                                    $isOK    = false;
                                    break;
                                }
                                $aValues[]  = $this->_aOldPrimaryValues[$primaryKey];

                            } else {
                                if (!$this->$primaryKey) {
                                    $isOK    = false;
                                    break;
                                }
                                $aValues[]  = $this->$primaryKey;
                            }
                        }
                    }

                    if (count($aWhereChecks) AND $isOK) {
                        $aWhere[] = '('.implode(" AND\n ", $aWhereChecks).')';
                    }
                }

                if (count($aWhere)) {
                    $sWhere = "\nWHERE ".implode(" OR\n ", $aWhere);
                }
            } else {
                foreach ($this->_aPrimaryKeys as $primaryKey) {
                    $aWhere[]   = 'trim(upper('.$primaryKey.')) = trim(upper(?))';
                    if (!$wUpdatedAttributes AND isset($this->_aOldPrimaryValues[$primaryKey]) AND $this->_aOldPrimaryValues[$primaryKey]) {
                        $aValues[]  = $this->_aOldPrimaryValues[$primaryKey];
                    } else {
                        $aValues[]  = $this->$primaryKey;
                    }
                }

                if (count($aWhere)) {
                    $sWhere = "\nWHERE ".implode(" AND\n ", $aWhere);
                }
            }

        }
        $sQuery     = "SELECT 'True' FROM ".$this->_sTable;
        $sQuery    .= $sWhere;
        //Utils::log(Utils::sprintf_array(str_replace('?','%s', $sQuery), $aValues));

        $aResult    = $this->_mysqlConnectorRead->executePreparedRead($sQuery, 0, 0, $aValues);
        if (count($aResult)) {
            $isElementExists = true;
        }

        return $isElementExists;
    }

    /**
     * Init method called by constructor
     * @access protected
     * @return void
     */
    protected function _initialize() {}

    /**
     * Returns a URL query string with all id values
     *
     * @access public
     * @return String $queryString
     */
    public function getIDQueryString()
    {
        $aPrimaryKeys = array();
        foreach ($this->_aPrimaryKeys as $primaryKey) {
            $aPrimaryKeys[] = $primaryKey.'='.trim($this->$primaryKey);
        }

        $queryString = join('&', $aPrimaryKeys);

        return $queryString;
    }

    /**
     * Returns a string with all id values glued by |
     * @access public
     * @return string
     */
    public function getPrimaryKeysString($glue = '|')
    {
        $primaryString              = '';
        $aPrimaryKeysValues         = array();
        foreach ($this->_aPrimaryKeys as $primaryKey) {
            $aPrimaryKeysValues[]   = trim($this->$primaryKey);
        }

        $primaryString              = implode($glue, $aPrimaryKeysValues);

        return $primaryString;
    }

    /**
     * Returns table name
     * @access public
     * @return string
     */
    public static function getTableName(){
        $instance = new static();
        return $instance->_sTable;
    }
}

?>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dynamic Drive: CSS Left Frame Layout</title>

CSS Left Frame Layout

Sample text here

Dynamic Drive CSS Library

Credits: Dynamic Drive CSS Library


text:
package com.thoughtworks.go.server.perf;

import com.thoughtworks.go.domain.JobIdentifier;
import com.thoughtworks.go.remote.AgentIdentifier;
import com.thoughtworks.go.remote.work.BuildWork;
import com.thoughtworks.go.remote.work.Work;
import com.thoughtworks.go.server.service.AgentRuntimeInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class WorkAssignmentPerformanceLogger {
    private PerformanceLogger performanceLogger;

    @Autowired
    public WorkAssignmentPerformanceLogger(PerformanceLogger performanceLogger) {
        this.performanceLogger = performanceLogger;
    }

    public void retrievedWorkForAgent(AgentRuntimeInfo agentRuntimeInfo, Work work, long retrieveWorkStartTime, long retrieveWorkEndTime) {
        if (work == null || !(work instanceof BuildWork)) {
            performanceLogger.log("WORK-NOWORK {} {} {}", agentRuntimeInfo.getIdentifier().getUuid(), retrieveWorkStartTime, retrieveWorkEndTime);
            return;
        }
        BuildWork buildWork = (BuildWork) work;

        performanceLogger.log("WORK-RETRIEVED {} {} {} {}", agentRuntimeInfo.getIdentifier().getUuid(), buildWork.identifierForLogging(), retrieveWorkStartTime, retrieveWorkEndTime);
    }

    public void agentReportedCompletion(AgentRuntimeInfo agentRuntimeInfo, JobIdentifier jobIdentifier, long reportCompletionStartTime, long reportCompletionEndTime) {
        performanceLogger.log("WORK-COMPLETED {} {} {} {}", agentRuntimeInfo.getIdentifier().getUuid(), jobIdentifier, reportCompletionStartTime, reportCompletionEndTime);
    }

    public void assignedWorkToAgent(Work work, AgentIdentifier agentIdentifier, long assignWorkStartTime, long assignWorkEndTime) {
        if (work == null || !(work instanceof BuildWork)) {
            return;
        }
        BuildWork buildWork = (BuildWork) work;

        performanceLogger.log("WORK-ASSIGNED {} {} {} {}", agentIdentifier.getUuid(), buildWork.identifierForLogging(), assignWorkStartTime, assignWorkEndTime);
    }
}


text:
namespace Vk.Api.Schema.Parameters.Board
{
    /// <summary>
    /// Интерфейс для представления параметров запроса для board.restoreComment <para/>
    /// Документация: <see href="https://vk.com/dev/board.restoreComment"/>
    /// </summary>
    public interface IBoardRestoreCommentParameters
    {
        /// <summary>
        /// Идентификатор сообщества, в котором размещено обсуждение
        /// </summary>
        /// <remarks>
        /// Обязательный параметр
        /// </remarks>
        int GroupId { get; set; }

        /// <summary>
        /// Идентификатор обсуждения
        /// </summary>
        /// <remarks>
        /// Обязательный параметр
        /// </remarks>
        int TopicId { get; set; }

        /// <summary>
        /// Идентификатор комментария
        /// </summary>
        /// <remarks>
        /// Обязательный параметр
        /// </remarks>
        int CommentId { get; set; }
    }
}


text:
from __future__ import absolute_import

import itertools
import logging
import random
import time

from django.utils.encoding import force_bytes

logger=logging.getLogger(__name__)

class RetryException(Exception):
  def __init__(self,message,exception):
    self.message=message
    self.exception=exception

  def __str__(self):
    return force_bytes(self.message,errors='replace')

  def __repr__(self):
    return u'<{}: {!r}>'.format(
      type(self).__name__,
      self.message,
    )

class RetryPolicy(object):
  def __call__(self,function):
    raise NotImplementedError

class TimedRetryPolicy(RetryPolicy):
  """
  A time-based policy that can be used to retry a callable in the case of
  failure as many times as possible up to the ``timeout`` value (in seconds.)

  The ``delay`` function accepts one argument, a number which represents the
  number of this attempt (starting at 1.)
  """

  def __init__(self,timeout,delay=None,exceptions=(Exception,)):
    if delay is None:
      # 100ms +/- 50ms of randomized jitter
      def delay(i):
        return 0.1+((random.random()-0.5)/10)

    self.timeout=timeout
    self.delay=delay
    self.exceptions=exceptions
    self.clock=time

  def __call__(self,function):
    start=self.clock.time()
    for i in itertools.count(1):
      try:
        return function()
      except self.exceptions as error:
        delay=self.delay(i)
        now=self.clock.time()
        if (now+delay)>(start+self.timeout):
          raise RetryException(
            'Could not successfully execute %r within %.3f seconds (%s attempts.)'%
            (function,now-start,i),
            error,
          )
        else:
          logger.debug(
            'Failed to execute %r due to %r on attempt #%s, retrying in %s seconds...',
            function,
            error,
            i,
            delay,
          )
          self.clock.sleep(delay)


text:
package de.freiburg.iif.extraction.performance;

import com.google.inject.Inject;

import de.freiburg.iif.extraction.MetadataMatcher;

/**
 * The class TitlePerformanceTest that can be used to evaluate the performance
 * of the title extraction.
 *
 * @author Claudius Korzen
 *
 */
public class DocumentMetadataPerformanceTest extends BasePerformanceTest {
  /**
   * The constructor of TitlePerformanceTest
   *
   * @param matcher the implementation of MetadataMatcher.
   */
  @Inject
  public DocumentMetadataPerformanceTest(MetadataMatcher matcher) {
    super();
    this.matcher = matcher;
  }

  @Override
  protected GroundTruthElement getGroundTruthElement(String line) {
    String[] elements = line.split("\t");
    return new GroundTruthElement(elements[0], elements[1], elements[2]);
  }
}


text:
package com.quexten.ravtech.net;

public interface PacketProcessor {

	boolean process (Player player, Packet packet);

}


text:
'use strict';

angular.module('myApp.equipmentTickets')

.factory('mongoService', ['$http', function($http) {
    return {
		queryDb: function(query, collection){
			var config = {
				method:'POST',
				headers: {'Collection': collection},
				url:"http://10.239.3.132:9763/MongoServlet-0.0.1-SNAPSHOT/send",
				data: angular.toJson(query, false) // false means don't "prettify" the json
			};
			var promise = $http(config);
			return promise.then(function(response) {
				return response.data.result;
			}, function() {
				console.log('fail to query from database');
			});
		}
    };
}]);


text:
package cn.com.warlock.filesystem.sdk.fdfs.codec;

import cn.com.warlock.filesystem.sdk.fdfs.FileId;
import cn.com.warlock.filesystem.sdk.fdfs.exchange.Requestor;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.ByteBufUtil;

import java.util.Collections;
import java.util.List;

import static cn.com.warlock.filesystem.sdk.fdfs.FastdfsConstants.*;
import static cn.com.warlock.filesystem.sdk.fdfs.FastdfsUtils.writeFixLength;

/**
 * @author siuming
 */
public abstract class FileIdOperationEncoder implements Requestor.Encoder {

    private final FileId fileId;

    /**
     * @param fileId
     */
    protected FileIdOperationEncoder(FileId fileId) {
        this.fileId = fileId;
    }

    @Override
    public List<Object> encode(ByteBufAllocator alloc) {
        byte cmd = cmd();
        int length = FDFS_GROUP_LEN + fileId.pathBytes().length;
        ByteBuf buf = alloc.buffer(length + FDFS_HEAD_LEN);
        buf.writeLong(length);
        buf.writeByte(cmd);
        buf.writeByte(ERRNO_OK);
        writeFixLength(buf, fileId.group(), FDFS_GROUP_LEN);
        ByteBufUtil.writeUtf8(buf, fileId.path());
        return Collections.singletonList(buf);
    }

    /**
     * @return
     */
    protected abstract byte cmd();
}


text:
#ifndef _NETNS_SPP_VAR_H_
#define _NETNS_SPP_VAR_H_

/*
 * Sp control block, one per connection
 */
struct sppcb {
	struct	spidp_q	s_q;		/* queue for out-of-order receipt */
	struct	nspcb	*s_nspcb;	/* backpointer to internet pcb */
	u_char	s_state;
	u_char	s_flags;
#define	SF_ACKNOW	0x01		/* Ack peer immediately */
#define	SF_DELACK	0x02		/* Ack, but try to delay it */
#define	SF_HI	0x04			/* Show headers on input */
#define	SF_HO	0x08			/* Show headers on output */
#define	SF_PI	0x10			/* Packet (datagram) interface */
#define SF_WIN	0x20			/* Window info changed */
#define SF_RXT	0x40			/* Rxt info changed */
#define SF_RVD	0x80			/* Calling from read usrreq routine */
	u_short s_mtu;			/* Max packet size for this stream */
/* use sequence fields in headers to store sequence numbers for this
   connection */
	struct	idp	*s_idp;
	struct	sphdr	s_shdr;		/* prototype header to transmit */
#define s_cc s_shdr.sp_cc		/* connection control (for EM bit) */
#define s_dt s_shdr.sp_dt		/* datastream type */
#define s_sid s_shdr.sp_sid		/* source connection identifier */
#define s_did s_shdr.sp_did		/* destination connection identifier */
#define s_seq s_shdr.sp_seq		/* sequence number */
#define s_ack s_shdr.sp_ack		/* acknowledge number */
#define s_alo s_shdr.sp_alo		/* allocation number */
#define s_dport s_idp->idp_dna.x_port	/* where we are sending */
	struct sphdr s_rhdr;		/* last received header (in effect!)*/
	u_short s_rack;			/* their acknowledge number */
	u_short s_ralo;			/* their allocation number */
	u_short s_smax;			/* highest packet # we have sent */
	u_short	s_snxt;			/* which packet to send next */

/* congestion control */
#define	CUNIT	1024			/* scaling for ... */
	int	s_cwnd;			/* Congestion-controlled window */
					/* in packets * CUNIT */
	short	s_swnd;			/* == tcp snd_wnd, in packets */
	short	s_smxw;			/* == tcp max_sndwnd */
					/* difference of two spp_seq's can be
					   no bigger than a short */
	u_short	s_swl1;			/* == tcp snd_wl1 */
	u_short	s_swl2;			/* == tcp snd_wl2 */
	int	s_cwmx;			/* max allowable cwnd */
	int	s_ssthresh;		/* s_cwnd size threshhold for
					 * slow start exponential-to-
					 * linear switch */
/* transmit timing stuff
 * srtt and rttvar are stored as fixed point, for convenience in smoothing.
 * srtt has 3 bits to the right of the binary point, rttvar has 2.
 */
	short	s_idle;			/* time idle */
	short	s_timer[SPPT_NTIMERS];	/* timers */
	short	s_rxtshift;		/* log(2) of rexmt exp. backoff */
	short	s_rxtcur;		/* current retransmit value */
	u_short	s_rtseq;		/* packet being timed */
	short	s_rtt;			/* timer for round trips */
	short	s_srtt;			/* averaged timer */
	short	s_rttvar;		/* variance in round trip time */
	char	s_force;		/* which timer expired */
	char	s_dupacks;		/* counter to intuit xmt loss */

/* out of band data */
	char	s_oobflags;
#define SF_SOOB	0x08			/* sending out of band data */
#define SF_IOOB 0x10			/* receiving out of band data */
	char	s_iobc;			/* input characters */
/* debug stuff */
	u_short	s_want;			/* Last candidate for sending */
	char	s_outx;			/* exit taken from spp_output */
	char	s_inx;			/* exit taken from spp_input */
	u_short	s_flags2;		/* more flags for testing */
#define SF_NEWCALL	0x100		/* for new_recvmsg */
#define SO_NEWCALL	10		/* for new_recvmsg */
};

#define	nstosppcb(np)	((struct sppcb *)(np)->nsp_pcb)
#define	sotosppcb(so)	(nstosppcb(sotonspcb(so)))

struct	sppstat {
	long	spps_connattempt;	/* connections initiated */
	long	spps_accepts;		/* connections accepted */
	long	spps_connects;		/* connections established */
	long	spps_drops;		/* connections dropped */
	long	spps_conndrops;		/* embryonic connections dropped */
	long	spps_closed;		/* conn. closed (includes drops) */
	long	spps_segstimed;		/* segs where we tried to get rtt */
	long	spps_rttupdated;	/* times we succeeded */
	long	spps_delack;		/* delayed acks sent */
	long	spps_timeoutdrop;	/* conn. dropped in rxmt timeout */
	long	spps_rexmttimeo;	/* retransmit timeouts */
	long	spps_persisttimeo;	/* persist timeouts */
	long	spps_keeptimeo;		/* keepalive timeouts */
	long	spps_keepprobe;		/* keepalive probes sent */
	long	spps_keepdrops;		/* connections dropped in keepalive */

	long	spps_sndtotal;		/* total packets sent */
	long	spps_sndpack;		/* data packets sent */
	long	spps_sndbyte;		/* data bytes sent */
	long	spps_sndrexmitpack;	/* data packets retransmitted */
	long	spps_sndrexmitbyte;	/* data bytes retransmitted */
	long	spps_sndacks;		/* ack-only packets sent */
	long	spps_sndprobe;		/* window probes sent */
	long	spps_sndurg;		/* packets sent with URG only */
	long	spps_sndwinup;		/* window update-only packets sent */
	long	spps_sndctrl;		/* control (SYN|FIN|RST) packets sent */
	long	spps_sndvoid;		/* couldn't find requested packet*/

	long	spps_rcvtotal;		/* total packets received */
	long	spps_rcvpack;		/* packets received in sequence */
	long	spps_rcvbyte;		/* bytes received in sequence */
	long	spps_rcvbadsum;		/* packets received with ccksum errs */
	long	spps_rcvbadoff;		/* packets received with bad offset */
	long	spps_rcvshort;		/* packets received too short */
	long	spps_rcvduppack;	/* duplicate-only packets received */
	long	spps_rcvdupbyte;	/* duplicate-only bytes received */
	long	spps_rcvpartduppack;	/* packets with some duplicate data */
	long	spps_rcvpartdupbyte;	/* dup. bytes in part-dup. packets */
	long	spps_rcvoopack;		/* out-of-order packets received */
	long	spps_rcvoobyte;		/* out-of-order bytes received */
	long	spps_rcvpackafterwin;	/* packets with data after window */
	long	spps_rcvbyteafterwin;	/* bytes rcvd after window */
	long	spps_rcvafterclose;	/* packets rcvd after "close" */
	long	spps_rcvwinprobe;	/* rcvd window probe packets */
	long	spps_rcvdupack;		/* rcvd duplicate acks */
	long	spps_rcvacktoomuch;	/* rcvd acks for unsent data */
	long	spps_rcvackpack;	/* rcvd ack packets */
	long	spps_rcvackbyte;	/* bytes acked by rcvd acks */
	long	spps_rcvwinupd;		/* rcvd window update packets */
};
struct	spp_istat {
	short	hdrops;
	short	badsum;
	short	badlen;
	short	slotim;
	short	fastim;
	short	nonucn;
	short	noconn;
	short	notme;
	short	wrncon;
	short	bdreas;
	short	gonawy;
	short	notyet;
	short	lstdup;
	struct sppstat newstats;
};

#ifdef KERNEL
struct spp_istat spp_istat;

/* Following was struct sppstat sppstat; */
#ifndef sppstat
#define sppstat spp_istat.newstats
#endif

u_short spp_iss;
extern struct sppcb *spp_close(), *spp_disconnect(),
	*spp_usrclosed(), *spp_timers(), *spp_drop();
#endif

#define	SPP_ISSINCR	128
/*
 * SPP sequence numbers are 16 bit integers operated
 * on with modular arithmetic.  These macros can be
 * used to compare such integers.
 */
#ifdef sun
short xnsCbug;
#define	SSEQ_LT(a,b)	((xnsCbug = (short)((a)-(b))) < 0)
#define	SSEQ_LEQ(a,b)	((xnsCbug = (short)((a)-(b))) <= 0)
#define	SSEQ_GT(a,b)	((xnsCbug = (short)((a)-(b))) > 0)
#define	SSEQ_GEQ(a,b)	((xnsCbug = (short)((a)-(b))) >= 0)
#else
#define	SSEQ_LT(a,b)	(((short)((a)-(b))) < 0)
#define	SSEQ_LEQ(a,b)	(((short)((a)-(b))) <= 0)
#define	SSEQ_GT(a,b)	(((short)((a)-(b))) > 0)
#define	SSEQ_GEQ(a,b)	(((short)((a)-(b))) >= 0)
#endif

#endif


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyThread++: duration< _Rep, _Period > Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>

TinyThread++ 1.1

Main Page

Namespaces

Classes

Files

Class List

Class Members

tthread

chrono

duration

Public Member Functions

duration< _Rep, _Period > Class Template Reference

Duration template class.
 More...

#include <tinythread.h>

List of all members.

Public Member Functions

template<class _Rep2 >

 	duration (const _Rep2 &r)

 	Construct a duration object with the given duration.

rep 	count () const

 	Return the value of the duration object.

Detailed Description

template<class _Rep, class _Period = ratio<1>>

class tthread::chrono::duration< _Rep, _Period >

Duration template class.

This class provides enough functionality to implement this_thread::sleep_for().

The documentation for this class was generated from the following file:

tinythread.h

<address class="footer">Generated on Mon May 7 2012 21:50:48 for TinyThread++ by

 1.7.4 </address>


text:
<?xml version="1.0"?>
<package>
  <name>quadrotor_local_planner</name>
  <version>0.0.0</version>
  <description>Quadrotor Obstacle Avoidance with Artificial Potential Fields</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
  <maintainer email="daikimaekawa@todo.todo">daikimaekawa</maintainer>

  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>

  <!-- Url tags are optional, but mutiple are allowed, one per tag -->
  <!-- Optional attribute type can be: website, bugtracker, or repository -->
  <!-- Example: -->
  <!-- <url type="website">http://wiki.ros.org/quadrotor_obstacle_avoidance</url> -->

  <!-- Author tags are optional, mutiple are allowed, one per tag -->
  <!-- Authors do not have to be maintianers, but could be -->
  <!-- Example: -->
  <!-- <author email="jane.doe@example.com">Jane Doe</author> -->

  <build_depend>roscpp</build_depend>
  <build_depend>tf</build_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>tf</run_depend>
  <buildtool_depend>catkin</buildtool_depend>

  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- You can specify that this package is a metapackage here: -->
    <!-- <metapackage/> -->

    <!-- Other tools can request additional information be placed here -->

  </export>
</package>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.topview.dao.imagesubject.SubjectDao">
<!--
	添加:可选:introduction
		必选:name、majorId
		后台指定:createTime、modifiedTime、id
		因此在service需要对必选字段判空
 -->
	<insert id="insert" parameterType="com.topview.po.imagesubject.Subject">
		insert into subject(subject_name,
		<if test="introduction!=null">
			subject_introduction,
		</if>
			gmt_create,gmt_modified,major_id)values(#{name},
		<if test="introduction!=null">
			#{introduction},
		</if>
		NOW(),NOW(),#{majorId})
	</insert>

<!--
	删除:必选:id
 -->
	<delete id="deleteById" parameterType="Long">
		delete from subject where subject_id=#{id}
	</delete>
<!--
	更新: 可选:name、introduction、majorId
		必选:id、
		后台指定:modifiedTime
		允许为空的字段!!!!:introduction,应该在这里设置一个代号
 -->
	<update id="update" parameterType="com.topview.po.imagesubject.Subject">
		update subject
		<set>
			<if test="name!=null">
				subject_name=#{name},
			</if>
			<if test='introduction!="空"'>
				subject_introduction=#{introduction},
			</if>
			<if test='introduction=="空"'>
				subject_introduction = NULL,
			</if>
			<if test="true">
				gmt_modified=NOW(),
			</if>
			<if test="majorId!=null">
				major_id = #{majorId}
			</if>
		</set>
		where subject_id = #{id}
	</update>
<!--
	注意此处返回一个List而不是单个对象
	查询:可选:id、name、introduction(模糊查询)、createTime、modifiedTime
 -->
	<select id="select" parameterType="com.topview.po.imagesubject.Subject" resultType="com.topview.po.imagesubject.Subject">
		select subject_id id, subject_name name,subject_introduction introduction,gmt_create createTime,gmt_modified modifiedTime
		from subject
		<trim prefix="where" prefixOverrides="and |or">
			<if test="id!=null">
				subject_id = #{id}
			</if>
			<if test="name!=null">
				and subject_name=#{name}
			</if>
			<if test="introduction!=null">
				and
				<if test='introduction!=""'>
					subject_introduction like '%${introduction}%'
				</if>
				<if test='introduction==""'>
					1 = 1
				</if>
			</if>
			<if test="createTime!=null">
				and gmt_create=#{createTime}
			</if>
			<if test="modifiedTime!=null">
				and gmt_modifiedTime=#{modifiedTime}
			</if>
			<if test="majorId!=null">
				and major_id = #{majorId}
			</if>
		</trim>
	</select>
<!--
	根据id查询:必选:id
 -->
 	<select id="selectOneById" parameterType="java.lang.Long" resultType="com.topview.po.imagesubject.Subject">
 		select subject_id id,
 				subject_name name,
 				subject_introduction introduction,
 				gmt_create createTime,
 				gmt_modified modifiedTime,
 				major_id majorId
 				from subject where subject_id=#{id}
 	</select>
 <!--
 	查询分页对象:同上
  -->
  	<select id="selectPage" resultType="com.topview.po.imagesubject.Subject">
  		select subject_id id,
  				subject_name name,
  				subject_introduction introduction,
  				gmt_create createTime,
  				gmt_modified modifiedTime,
  				major_id majorId
  		from subject
  		<trim prefix="where" prefixOverrides="and |or" >
			<if test="t.name!=null">
				subject_name=#{t.name}
			</if>
			<if test="t.introduction!=null">
				and subject_introduction like '%${t.introduction}%'
			</if>
			<if test="t.createTime!=null">
				and gmt_create = #{t.createTime}
			</if>
			<if test="t.modifiedTime!=null">
				and gmt_modified = #{t.modifiedTime}
			</if>

			<if test="t.majorId!=null">
				and major_id = #{t.majorId}
			</if>
		</trim>
		<if test="page.index!=null">
		  limit #{page.index},#{page.pageSize}
		  </if>
  	</select>
  	<select id="getTotal" resultType="Integer" parameterType="com.topview.po.imagesubject.Subject">
  		select count(subject_id) from subject
  		<trim prefix="where" prefixOverrides="and |or">
			<if test="id!=null">
				subject_id = #{id}
			</if>
			<if test="name!=null">
				and subject_name=#{name}
			</if>
			<if test="introduction!=null">
				and subject_introduction like '%${introduction}%'
			</if>
			<if test="createTime!=null">
				and gmt_create = #{createTime}
			</if>
			<if test="modifiedTime!=null">
				and gmt_modified = #{modifiedTime}
			</if>
			<if test="majorId!=null">
				and major_id = #{majorId}
			</if>
		</trim>
  	</select>

</mapper>


text:
package org.projecte.egradus.repository.impl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.projecte.egradus.domain.Alumne;
import org.projecte.egradus.domain.Assignatura;
import org.projecte.egradus.domain.Pregunta;
import org.projecte.egradus.domain.Professor;
import org.projecte.egradus.domain.Questionari;
import org.projecte.egradus.domain.RespostaPregunta;
import org.projecte.egradus.domain.RespostaQuestionari;
import org.projecte.egradus.repository.RespostaQuestionariDao;
import org.springframework.stereotype.Repository;

@Repository(value = "respostaQuestionariDao")
public class JPARespostaQuestionariDao implements RespostaQuestionariDao {

	private EntityManager em = null;

	@PersistenceContext
    public void setEntityManager(EntityManager em) {
        this.em = em;
    }

	public void persistRespostaQuestionari(RespostaQuestionari respostaQuestionari) {
		em.persist(respostaQuestionari);
	}

	public RespostaQuestionari getRespostaQuestionariByCodi(int codi) {
		return em.find(RespostaQuestionari.class, codi);
	}

	@SuppressWarnings("unchecked")
	public List<RespostaQuestionari> getRespostaQuestionari(Questionari questionari, Professor assignador, Alumne contestador) {
		Query q = em.createQuery("select rq "
				                +  "from RespostaQuestionari rq "
				                + "where rq.alumne = :alumne "
				                +   "and rq.questionari = :questionari "
				                +   "and rq.assignador = :assignador");
		q.setParameter("alumne", contestador);
		q.setParameter("questionari", questionari);
		q.setParameter("assignador", assignador);
		return q.getResultList();
	}

	@SuppressWarnings("unchecked")
	public List<RespostaQuestionari> getRespostesQuestionari(Alumne alumne, Boolean contestades, Boolean corregides, Boolean revisades) {
		String strQuery = "select rq "
		                 +  "from RespostaQuestionari rq "
		                 +  	    "inner join rq.questionari qst "
		                 + "where rq.alumne = :alumne "
		                 +   "and rq.contestat = :contestat "
		                 +   "and rq.corregit = :corregit ";

		if (corregides) {
			if (revisades) {
				strQuery += "and ("
						  +          "(rq.revisat = :true and exists ("
			              +                                            "select pq "
			              +                                              "from PreguntaQuestionari pq "
			              +                                             "where pq.pregunta.raonarResposta = :true "
			              +                                               "and pq.questionari.codi = qst.codi"
			              +                                         ")"
			              +          ") "
						  +       "or (rq.revisat = :false and not exists ("
						  +                                                 "select pq "
			              +                                                   "from PreguntaQuestionari pq "
			              +                                                  "where pq.pregunta.raonarResposta = :true "
			              +                                                    "and pq.questionari.codi = qst.codi"
			              +                                              ")"
			              +          ")"
						  +     ") ";
			} else {
				strQuery += "and rq.revisat = :false "
						  + "and exists ("
			              +                "select pq "
			              +                  "from PreguntaQuestionari pq "
			              +                 "where pq.pregunta.raonarResposta = :true "
			              +                   "and pq.questionari.codi = qst.codi"
			              +            ") ";
			}
		}

		if (corregides) 		strQuery += "order by rq.dataCorreccio desc";
		else if (contestades)   strQuery += "order by rq.dataContestacioFi desc";
		else 					strQuery += "order by rq.dataAlta desc";

		Query q = em.createQuery(strQuery);
		q.setParameter("alumne", alumne);
		q.setParameter("contestat", contestades);
		q.setParameter("corregit", corregides);
		if (corregides) {
			q.setParameter("true", Boolean.TRUE);
			q.setParameter("false", Boolean.FALSE);
		}
		return q.getResultList();
	}

	public RespostaQuestionari updateRespostaQuestionari(RespostaQuestionari respostaQuestionari) {
		return em.merge(respostaQuestionari);
	}

	@SuppressWarnings("unchecked")
	public List<RespostaQuestionari> getRespostesQuestionariPendentsCorregir(Professor professor) {
		String strQuery = "select rq "
		                 +  "from RespostaQuestionari rq "
		                 + 			"inner join rq.questionari qst "
		                 + "where rq.assignador = :assignador "
		                 +   "and rq.contestat = :true "
		                 +   "and ("
		                 +            "(rq.corregit = :false and exists ("
			             +                                                "select pq "
			             +                                                  "from PreguntaQuestionari pq "
			             +                                                 "where pq.pregunta.tipus = :tipusPregunta "
			             +                                                   "and pq.questionari.codi = qst.codi"
			             +                                             ")"
			             +            ") "
			             +         "or (rq.revisat = :false  and exists ("
			             +                                                "select pq "
			             +                                                  "from PreguntaQuestionari pq "
			             +                                                 "where pq.pregunta.raonarResposta = :true "
			             +                                                   "and pq.questionari.codi = qst.codi"
			             +                                             ")"
			             +            ")"
			             +       ") "
			             + "order by rq.dataContestacioFi desc";

		Query q = em.createQuery(strQuery);
		q.setParameter("assignador", professor);
		q.setParameter("tipusPregunta", Pregunta.TIPUS_REC);
		q.setParameter("true", Boolean.TRUE);
		q.setParameter("false", Boolean.FALSE);
		return q.getResultList();
	}

	@SuppressWarnings("unchecked")
	public List<RespostaQuestionari> getRespostesQuestionariCorregides(Professor professor) {
		String strQuery = "select rq "
		                 +  "from RespostaQuestionari rq "
		                 + 			"inner join rq.questionari qst "
		                 + "where rq.assignador = :assignador "
		                 +   "and rq.contestat = :true "
		                 +   "and ("
		                 +            "(rq.corregit = :true and exists ("
			             +                                               "select pq "
			             +                                                 "from PreguntaQuestionari pq "
			             +                                                "where pq.pregunta.tipus = :tipusPregunta "
			             +                                                  "and pq.questionari.codi = qst.codi"
			             +                                            ")"
			             +            ") "
			             +         "or (rq.revisat = :true  and exists ("
			             +                                               "select pq "
			             +                                                 "from PreguntaQuestionari pq "
			             +                                                "where pq.pregunta.raonarResposta = :true "
			             +                                                  "and pq.questionari.codi = qst.codi"
			             +                                            ")"
			             +            ")"
			             +       ") "
			             + "order by rq.dataContestacioFi desc";

		Query q = em.createQuery(strQuery);
		q.setParameter("assignador", professor);
		q.setParameter("tipusPregunta", Pregunta.TIPUS_REC);
		q.setParameter("true", Boolean.TRUE);
		return q.getResultList();
	}

	@SuppressWarnings("unchecked")
	public List<RespostaQuestionari> getRespostesQuestionari(Professor professor, Boolean corregides, Boolean revisades) {
		String strQuery = "select rq "
		                 +  "from RespostaQuestionari rq "
		                 + 			"inner join rq.questionari qst "
		                 + "where rq.assignador = :assignador "
		                 +   "and rq.contestat = :contestat "
		                 +   "and rq.corregit = :corregit ";

		if (corregides) {
			if (revisades) {
				strQuery += "and ("
						  +          "(rq.revisat = :true and exists ("
			              +                                            "select pq "
			              +                                              "from PreguntaQuestionari pq "
			              +                                             "where pq.pregunta.raonarResposta = :true "
			              +                                               "and pq.questionari.codi = qst.codi"
			              +                                         ")"
			              +          ") "
						  +       "or (rq.revisat = :false and not exists ("
						  +                                                 "select pq "
			              +                                                   "from PreguntaQuestionari pq "
			              +                                                  "where pq.pregunta.raonarResposta = :true "
			              +                                                    "and pq.questionari.codi = qst.codi"
			              +                                              ") "
			              +                               "and exists ("
			              +                                             "select pq "
			              +                                               "from PreguntaQuestionari pq "
			              +                                              "where pq.pregunta.tipus = :tipusPregunta "
			              +                                                "and pq.questionari.codi = qst.codi"
			              +                                          ")"
			              +          ")"
						  +     ") ";
			} else {
				strQuery += "and rq.revisat = :false "
						  + "and exists ("
						  +                "select pq "
			              +                  "from PreguntaQuestionari pq "
			              +                 "where pq.pregunta.raonarResposta = :true "
			              +                   "and pq.questionari.codi = qst.codi"
			              +            ") ";
			}
		} else {
			strQuery += "and exists ("
	                  +               "select pq "
	                  +                 "from PreguntaQuestionari pq "
	                  +                "where pq.pregunta.tipus = :tipusPregunta "
	                  +                  "and pq.questionari.codi = qst.codi "
	                  +            ") ";
		}

		if (corregides) strQuery += "order by rq.dataCorreccio desc";
		else            strQuery += "order by rq.dataContestacioFi desc";

		Query q = em.createQuery(strQuery);

		q.setParameter("assignador", professor);
		q.setParameter("contestat", Boolean.TRUE);
		q.setParameter("corregit", corregides);

		if (corregides) {
			q.setParameter("true", Boolean.TRUE);
			q.setParameter("false", Boolean.FALSE);
			if (revisades) q.setParameter("tipusPregunta", Pregunta.TIPUS_REC);
		} else {
			q.setParameter("tipusPregunta", Pregunta.TIPUS_REC);
		}

		return q.getResultList();
	}

	@SuppressWarnings("unchecked")
	public List<RespostaPregunta> getRespostaPreguntes(RespostaQuestionari respostaQuestionari) {
		String strQuery = "select rp "
		                 +  "from RespostaPregunta rp "
		                 + "where rp.respostaQuestionari = :respostaQuestionari";

		Query q = em.createQuery(strQuery);
		q.setParameter("respostaQuestionari", respostaQuestionari);
		return q.getResultList();
	}

	@SuppressWarnings("unchecked")
	public List<RespostaQuestionari> getRespostesQuestionari(Questionari questionari, Assignatura assignatura, Boolean contestats, Boolean corregits, Boolean assignacioDirecta) {
		String strQuery = "select rq "
		                +   "from RespostaQuestionari rq "
		                +  "where 1 = 1 ";

		if (questionari != null) strQuery += "and rq.questionari = :questionari ";
		else {
			if (assignatura != null) {
				strQuery += "and rq.questionari in ("
		                  +                           "select rq2.questionari "
		                  +                             "from RespostaQuestionari rq2 "
		                  +                            "where rq2.assignador in ("
		                  +                                                       "select pro "
		                  +                                                         "from Professor pro "
		                  +                                                        "where pro.assignatura = :assignatura"
		                  +                                                    ")"
		                  +                        ") ";
			}
		}

		if (assignatura != null) {
			strQuery += "and rq.assignador in ("
					  +                         "select pro "
					  +                           "from Professor pro "
					  +                          "where pro.assignatura = :assignatura"
					  +                      ") ";
		}

		if (contestats != null) strQuery += "and rq.contestat = :contestat ";
		if (corregits != null)  strQuery += "and rq.corregit = :corregit ";

		strQuery += "order by rq.dataCorreccio desc";

		Query q = em.createQuery(strQuery);
		if (questionari != null) q.setParameter("questionari", questionari);
		else if (assignatura != null) q.setParameter("assignatura", assignatura);
		if (assignatura != null) q.setParameter("assignatura", assignatura);
		if (contestats  != null) q.setParameter("contestat", contestats);
		if (corregits   != null) q.setParameter("corregit", corregits);

		return q.getResultList();
	}

}


text:
package alluxio.util;

import org.apache.commons.lang3.SystemUtils;

import javax.annotation.concurrent.ThreadSafe;

/**
 * OS related utility functions.
 */
@ThreadSafe
public final class OSUtils {
  /** The OS name. */
  public static final String OS_NAME = System.getProperty("os.name");
  /** The processor bit. */
  public static final String PROCESSOR_BIT = System.getProperty("os.arch");
  /** The java vendor name used in this platform. */
  public static final String JAVA_VENDOR_NAME = System.getProperty("java.vendor");
  /** Indicates the current java vendor is IBM java or not. */
  public static final boolean IBM_JAVA = JAVA_VENDOR_NAME.contains("IBM");

  /**
   * @return true if current processor is 64 bit
   */
  public static boolean is64Bit() {
    return OSUtils.PROCESSOR_BIT.contains("64");
  }

  /**
   * @return true if current OS is Windows
   */
  public static boolean isWindows() {
    return SystemUtils.IS_OS_WINDOWS;
  }

  /**
   * @return true if current OS is MacOS
   */
  public static boolean isMacOS() {
    return SystemUtils.IS_OS_MAC_OSX;
  }

  /**
   * @return true if current OS is Linux
   */
  public static boolean isLinux() {
    return SystemUtils.IS_OS_LINUX;
  }

  /**
   * @return true if current OS is AIX
   */
  public static boolean isAIX() {
    return OSUtils.OS_NAME.equals("AIX");
  }

  private OSUtils() {} // prevent instantiation
}