text:
<?php

namespace Sisaf\SisafBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Sisaf\SisafBundle\Entity\Casas;
use Sisaf\SisafBundle\Form\CasasType;

/**
 * Casas controller.
 *
 */
class CasasController extends Controller
{

    /**
     * Lists all Casas entities.
     *
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('SisafBundle:Casas')->findAll();

        return $this->render('SisafBundle:Casas:index.html.twig', array(
            'entities' => $entities,
        ));
    }
    /**
     * Creates a new Casas entity.
     *
     */
    public function createAction(Request $request)
    {
        $entity = new Casas();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('casas_show', array('id' => $entity->getId())));
        }

        return $this->render('SisafBundle:Casas:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }

    /**
     * Creates a form to create a Casas entity.
     *
     * @param Casas $entity The entity
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createCreateForm(Casas $entity)
    {
        $form = $this->createForm(new CasasType(), $entity, array(
            'action' => $this->generateUrl('casas_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }

    /**
     * Displays a form to create a new Casas entity.
     *
     */
    public function newAction()
    {
        $entity = new Casas();
        $form   = $this->createCreateForm($entity);

        return $this->render('SisafBundle:Casas:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }

    /**
     * Finds and displays a Casas entity.
     *
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('SisafBundle:Casas')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Casas entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return $this->render('SisafBundle:Casas:show.html.twig', array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
     * Displays a form to edit an existing Casas entity.
     *
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('SisafBundle:Casas')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Casas entity.');
        }

        $editForm = $this->createEditForm($entity);
        $deleteForm = $this->createDeleteForm($id);

        return $this->render('SisafBundle:Casas:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
    * Creates a form to edit a Casas entity.
    *
    * @param Casas $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createEditForm(Casas $entity)
    {
        $form = $this->createForm(new CasasType(), $entity, array(
            'action' => $this->generateUrl('casas_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
    /**
     * Edits an existing Casas entity.
     *
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('SisafBundle:Casas')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Casas entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            return $this->redirect($this->generateUrl('casas_edit', array('id' => $id)));
        }

        return $this->render('SisafBundle:Casas:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        ));
    }
    /**
     * Deletes a Casas entity.
     *
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('SisafBundle:Casas')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Casas entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('casas'));
    }

    /**
     * Creates a form to delete a Casas entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('casas_delete', array('id' => $id)))
            ->setMethod('DELETE')
            ->add('submit', 'submit', array('label' => 'Delete'))
            ->getForm()
        ;
    }
}


text:
Date: Tue, 10 Dec 1996 16:51:58 GMT
Server: NCSA/1.4.2
Content-type: text/html

<title>CSE 321 Assignment #4</title>

CSE 321 Assignment #4
Autumn 1996

Due: Friday, October 25, 1996.

Reading Assignment: Read sections 3.2 and 3.3 of the text.
The following problems are from the Third Edition of the text.

Practice Problems: page 198, Problem 5; page 199, Problem 21.

 Problems:

 Prove that the square of an integer not divisible by 6 leaves a
remainder of 1, 3 or 4 when divided by 6.  (Hint:  Use a proof by cases,
one case per possible remainder when the integer is divided by 6.)

 page 198, Problem 8

 page 198, Problem 10.  (Recall that n! is the product of the numbers
from 1 to n.)

 page 199, Problem 18

 page 199, Problem 20

 page 199, Problem 28

 (Bonus) page 200, Problem 50

redpajama_set_name: RedPajamaGithub


text: Reorganize all of my views


text:
package synergynet3.web.apps.numbernet.shared;

import java.io.Serializable;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * The Class TableTarget.
 */
public class TableTarget implements Serializable, IsSerializable
{

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -536053704733381831L;

	/** The table. */
	private String table;

	/** The target. */
	private Double target;

	/**
	 * Instantiates a new table target.
	 */
	public TableTarget()
	{
		this.table = "";
		this.target = null;
	}

	/**
	 * Instantiates a new table target.
	 *
	 * @param table
	 *            the table
	 * @param target
	 *            the target
	 */
	public TableTarget(String table, Double target)
	{
		this.table = table;
		this.target = target;
	}

	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj)
	{
		if (obj instanceof TableTarget)
		{
			TableTarget tt = (TableTarget) obj;
			return tt.getTable().equals(getTable()) && (tt.getTarget() == getTarget());
		}
		return false;
	}

	/**
	 * Gets the table.
	 *
	 * @return the table
	 */
	public String getTable()
	{
		return table;
	}

	/**
	 * Gets the target.
	 *
	 * @return the target
	 */
	public Double getTarget()
	{
		return target;
	}

	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString()
	{
		return table + "->" + target;
	}
}


text:
using Knightware.Primitives;
using Spyder.Client.Common;
using Spyder.Client.IO;
using System;

namespace Spyder.Client.Net.DrawingData.Deserializers
{
    /// <summary>
    /// Deserializes DrawingData messages in the version 51 serialization format - Spyder Studio / X80
    /// </summary>
    public class DrawingDataDeserializer_Version51 : DrawingDataDeserializer_Version50
    {
        public DrawingDataDeserializer_Version51(string serverVersion)
            : base(serverVersion)
        {
        }

        public override DrawingData Deserialize(byte[] stream)
        {
            if (stream == null || stream.Length == 0)
                return null;

            DrawingData response = new DrawingData();
            int index = 0;

            int newPsCount = stream[index++];
            int newDkCount = stream[index++];
            int newPvwDkCount = stream[index++];
            int newRtrCount = stream[index++];
            int newOutputCount = stream[index++];
            int previewPixelSpaceCount = stream[index++];
            int stereoPixelSpaceCount = stream[index++];
            int newMachineCount = stream[index++];
            int frameCount = stream[index++];
            int runningScriptCount = stream[index++];
            int diagnosticWarningCount = stream[index++];

            //Global values
            response.TimeOfDay = new TimeSpan(
                stream[index++],
                stream[index++],
                stream[index++]
                );

            response.PercentComplete = stream[index++];
            response.LastFrontPanelMsg = (FrontPanelDisplayCommand)stream[index++];
            response.ProgressString = stream.GetString(ref index);
            response.ConfigSource = stream.GetString(ref index);
            response.ConfigLayer = stream.GetInt(ref index);
            response.ConfigBus = (MixerBus)stream[index++];
            response.ConfigOutput = stream.GetInt(ref index);

            response.HardwareType = (HardwareType)stream[index++];
            response.DataObjectVersion = stream.GetInt(ref index);
            response.DataObjectLastChangeType = (DataType)stream.GetInt(ref index);

            //Global Flags
            byte flags = stream[index++];
            response.OpMonOverlay = (flags & 0x01) > 0;
            response.IsLayerZeroPreviewBackground = (flags & 0x02) > 0;
            response.IsMachineHalEnabled = (flags & 0x04) > 0;
            response.IsRouterHalEnabled = (flags & 0x08) > 0;
            response.IsDataIOIdle = (flags & 0x10) > 0;
            response.IsPreviewOnlyScriptingEnabled = (flags & 0x20) > 0;
            response.IsStillServerConnected = (flags & 0x40) > 0;
            response.IsLiveUpdateEnabled = (flags & 0x80) > 0;
            flags = stream[index++];
            response.LiveUpdatesTemporarilyDisabled = (flags & 0x01) > 0;

            //System Frame Rate
            response.SystemFrameRate = (FieldRate)stream[index++];

            //Get the frames
            for (int i = 0; i < frameCount; i++)
            {
                int frameID = stream[index++];
                var frame = new DrawingFrame()
                {
                    FrameID = frameID,
                    FrameAOR = stream.GetRectangle(ref index),
                    PreviewAOR = stream.GetRectangle(ref index),
                    Model = (SpyderModels)stream[index++],
                    RenewalMasterFrameID = stream[index++]
                };
                frame.ProgramAOR = frame.FrameAOR; //In X80 for some reason we have no program AOR?
                response.Frames.Add(frameID, frame);
            }

            //Get the running scripts
            for (int i = 0; i < runningScriptCount; i++)
            {
                int scriptID = stream.GetInt(ref index);
                long countDown = stream.GetLong(ref index);
                response.RunningScripts.Add(scriptID, countDown);
            }

            //Get the preview pixelspace list
            for (int i = 0; i < previewPixelSpaceCount; i++)
            {
                int pgmID = stream.GetShort(ref index);
                int pvwID = stream.GetShort(ref index);
                response.PreviewPixelSpaceIDs.Add(pgmID, pvwID);
            }

            //Get the stereo pixelspace list
            for (int i = 0; i < stereoPixelSpaceCount; i++)
            {
                int leftEyeID = stream.GetShort(ref index);
                int rightEyeID = stream.GetShort(ref index);
                response.StereoPixelSpaceIDs.Add(leftEyeID, rightEyeID);
            }

            //Get all PixelSpaces
            for (int i = 0; i < newPsCount; i++)
            {
                //Create the new pixelspace
                DrawingPixelSpace newPS = new DrawingPixelSpace();

                //Fill the new pixelspace
                newPS.Rect = stream.GetRectangle(ref index);
                newPS.Scale = stream.GetFloat(ref index);
                newPS.RenewMasterFrameID = stream.GetInt(ref index);
                newPS.ID = stream.GetShort(ref index);
                newPS.Name = stream.GetString(ref index);
                newPS.NextBackgroundStillIsOnLayer1 = !response.IsLayerZeroPreviewBackground;
                newPS.LastBackgroundStill = stream.GetString(ref index);	//Last background still
                newPS.NextBackgroundStill = stream.GetString(ref index);	//Next Background still
                newPS.StereoMode = (PixelSpaceStereoMode)stream[index++];

                //Add Pixelspace to the list
                response.PixelSpaces.Add(newPS.ID, newPS);
            }

            //Get all of our DrawingKeyFrames
            int allLayerCount = newDkCount + newPvwDkCount;

            for (int i = 0; i < allLayerCount; i++)
            {
                DrawingKeyFrame l = new DrawingKeyFrame();
                KeyFrame kf = l.KeyFrame;

                //Fill Drawing Keyframe
                l.Priority = stream.GetShort(ref index);
                l.HActive = stream.GetShort(ref index);			//HActive of the input itself (used for calculating the scaled border size)
                l.VActive = stream.GetShort(ref index);			//VActive of the input itself (used for Pan calculations)
                l.LayerID = stream.GetShort(ref index);			//Layer ID
                short cloneHOffset = stream.GetShort(ref index);
                l.PixelSpaceID = stream.GetInt(ref index);				//Pixelspace ID
                l.EffectID = stream.GetInt(ref index);
                l.LastScript = stream.GetInt(ref index);
                l.LastCue = stream.GetInt(ref index);

                l.Thumbnail = stream.GetString(ref index);		//thumbnail
                l.WindowLabel = stream.GetString(ref index);
                l.Source = stream.GetString(ref index);
                l.LoadedStill = stream.GetString(ref index);
                l.TestPattern = stream.GetString(ref index);
                l.SourceRouterID = stream.GetInt(ref index);
                l.SourceRouterInput = stream.GetInt(ref index);
                l.InputConfigID = stream.GetInt(ref index);

                l.LinearKeySource = stream.GetString(ref index);
                l.LinearKeyRouterID = stream.GetInt(ref index);
                l.LinearKeyRouterInput = stream.GetInt(ref index);

                l.AspectRatio = stream.GetFloat(ref index);	//aspect ratio
                l.LayerRect = stream.GetRectangle(ref index);
                l.AOIRect = stream.GetRectangle(ref index);

                //Not storing element type
                //l.ElementType = (ElementType)stream[index++];	//Element Type
                index++;

                l.Transparency = stream[index++];				//Visible / Transparency

                //Layer flags (block 1)
                flags = stream[index++];
                l.IsMixer = (flags & 0x01) > 0;
                l.IsFrozen = (flags & 0x02) > 0;
                l.IsSlave = (flags & 0x04) > 0;
                l.AlwaysRelative = (flags & 0x08) > 0;
                kf.BorderOutsideSoftBottom = (flags & 0x10) > 0;
                kf.BorderOutsideSoftLeft = (flags & 0x20) > 0;
                kf.BorderOutsideSoftRight = (flags & 0x40) > 0;
                l.AutoSyncOnTimingChange = (flags & 0x80) > 0;

                //Layer flags (block 2)
                flags = stream[index++];
                kf.BorderOutsideSoftTop = (flags & 0x01) > 0;
                kf.UseDefaultMotionValues = (flags & 0x02) > 0;
                l.IsBackground = (flags & 0x04) > 0;
                l.IsHardwarePreview = (flags & 0x08) > 0;
                l.IsMixing = (flags & 0x10) > 0;
                l.IsWithinPixelSpace = (flags & 0x20) > 0;
                l.HdcpAuthenticated = (flags & 0x40) > 0;
                l.ShadowIsEnabled = (flags & 0x80) > 0;

                kf.BorderThickness = stream.GetShort(ref index);	//border thickness
                kf.Width = stream.GetShort(ref index);			//HSize
                kf.BorderInsideSoftness = stream.GetShort(ref index);	//Border inside softness
                kf.BorderOutsideSoftness = stream.GetShort(ref index);  //Border outside softness

                kf.ShadowHOffset = stream.GetShort(ref index);	//Shadow H Offset
                kf.ShadowVOffset = stream.GetShort(ref index);	//Shadow V Offset
                kf.ShadowHSize = stream.GetShort(ref index);		//Shadow H Size
                kf.ShadowVSize = kf.ShadowHSize;
                //kf.ShadowVSize = stream.GetShort(ref index);		//Shadow V Size

                kf.ShadowSoftness = stream.GetShort(ref index);	//Shadow softness
                kf.ShadowTransparency = stream.GetShort(ref index);	//Shadow Transparency
                kf.BorderLumaOffsetBottom = stream.GetShort(ref index);
                kf.BorderLumaOffsetLeft = stream.GetShort(ref index);
                kf.BorderLumaOffsetRight = stream.GetShort(ref index);
                kf.BorderLumaOffsetTop = stream.GetShort(ref index);

                kf.CloneOffset = stream.GetFloat(ref index);	//clone offset
                kf.HPosition = stream.GetFloat(ref index);			//HPosition
                kf.VPosition = stream.GetFloat(ref index);			//VPosition
                kf.TopCrop = stream.GetFloat(ref index);		//top crop
                kf.LeftCrop = stream.GetFloat(ref index);		//Left crop
                kf.RightCrop = stream.GetFloat(ref index);		//Right crop
                kf.BottomCrop = stream.GetFloat(ref index);	//Bottom crop
                kf.Zoom = stream.GetFloat(ref index);			//Zoom for zoom/pan
                kf.AspectRatioOffset = stream.GetFloat(ref index);	//Aspect ratio offset
                kf.EaseIn = stream.GetFloat(ref index);        //Ease in
                kf.EaseOut = stream.GetFloat(ref index);       //Ease out
                kf.PanH = stream.GetInt(ref index);			//Horizontal Pan
                kf.PanV = stream.GetInt(ref index);			//Vertical Pan
                kf.Transparency = stream[index++];      //Transparency
                kf.Duration = stream.GetShort(ref index);
                kf.CloneMode = (CloneMode)stream[index++];		//clone mode
                kf.BorderColor = new Color(
                    stream[index++],
                    stream[index++],
                    stream[index++]);

                kf.ShadowColor = new Color(
                    stream[index++],
                    stream[index++],
                    stream[index++]);

                kf.CropAnchor = (CropAnchorTypes)stream[index++];
                l.StereoMode = (InputStereoMode)stream[index++];

                //Frame Config
                l.FrameID = stream[index++];

                kf.BorderShapeSource = (ShapeSource)stream[index++];
                kf.BorderShape = (ShapeType)stream[index++];
                kf.BorderShapeFile = stream.GetString(ref index);

                kf.BorderFillSource = (TextureFillSource)stream[index++];
                kf.BorderTextureType = (TextureType)stream[index++];
                kf.BorderTileMode = (TextureTileMode)stream[index++];
                kf.BorderTextureFile = stream.GetString(ref index);

                //Calculated values
                l.CloneRect = new Rectangle()
                {
                    X = l.LayerRect.X + cloneHOffset,
                    Y = l.LayerRect.Y,
                    Width = l.LayerRect.Width,
                    Height = l.LayerRect.Height
                };

                //Scale (coerced from parent pixelspace)
                l.Scale = (response.PixelSpaces.ContainsKey(l.PixelSpaceID) ? response.PixelSpaces[l.PixelSpaceID].Scale : 1);

                //Add Keyframe to list
                if (i < newDkCount)
                {
                    response.DrawingKeyFrames.Add(l.LayerID, l);
                }
                else
                {
                    response.PreviewDrawingKeyFrames.Add(l.LayerID, l);
                }
            }

            //Now that we have Pixelspaces and layers, update pixelspace background transparency info from layers
            if (response.DrawingKeyFrames.Count >= 2)
            {
                byte layer1Transparency = response.DrawingKeyFrames[1].Transparency;
                foreach (DrawingPixelSpace ps in response.PixelSpaces.Values)
                {
                    ps.Layer1Transparency = layer1Transparency;
                }
            }

            //Get the routers
            for (int i = 0; i < newRtrCount; i++)
            {
                var router = new DrawingRouter();

                router.Name = stream.GetString(ref index);
                router.TransportType = stream.GetString(ref index);
                router.RouterType = stream.GetString(ref index);
                router.IPAddress = stream.GetString(ref index);

                //Router flags
                flags = stream[index++];
                router.IPRouter = (flags & 0x01) > 0;
                router.SerialRouter = (flags & 0x02) > 0;
                router.LevelControlledRouter = (flags & 0x04) > 0;

                router.ID = stream[index++];
                router.InputCount = stream.GetShort(ref index);
                router.OutputCount = stream.GetShort(ref index);
                router.Port = stream[index++];
                router.ConnectorType = ParseRouterConnectorType(stream[index++]);
                router.ControlLevel = stream.GetInt(ref index);
                router.LevelCount = stream.GetInt(ref index);

                //Write the soft patch for the router
                int patchCount = stream[index++];
                router.Patch.Clear();
                for (int patchIndex = 0; patchIndex < patchCount; patchIndex++)
                {
                    int physicalOutput = stream[index++];
                    int downstreamRouterID = stream[index++];
                    int downstreamRouterInput = stream[index++];

                    //downstream ID may be -1 or -2 if we are patched to a layer.  This will have been clipped to 255
                    if (downstreamRouterID == 255)
                        downstreamRouterID = -1;
                    else if (downstreamRouterID == 254)
                        downstreamRouterID = -2;

                    router.SetRouterOutputPatch(physicalOutput, downstreamRouterID, downstreamRouterInput);
                }

                //Write the crosspoints for the router
                for (int outputID = 0; outputID < router.OutputCount; outputID++)
                {
                    if (router.InputCount >= 255)
                    {
                        //Desrialize two bytes of data
                        router.Crosspoints.Add(stream.GetShort(ref index));
                    }
                    else
                    {
                        //Deserialize only one byte of data
                        int input = stream[index++];
                        if (input == 255)
                            input = -1;

                        router.Crosspoints.Add(input);
                    }
                }

                //Add router to list
                response.Routers.Add(router.ID, router);
            }

            //Get the Machines
            for (int i = 0; i < newMachineCount; i++)
            {
                var newMachine = new DrawingMachine();
                MachineStatus status = newMachine.Status;

                //Port ID
                newMachine.Port = stream[index++];

                //Last PlayItemID
                newMachine.LastPlayItemID = stream.GetInt(ref index);

                //Machine Time
                FieldRate frameRate = (FieldRate)stream[index++];
                long frames = stream.GetLong(ref index);
                newMachine.Time = new TimeCode(frameRate, frames);

                //Machine Status (Block 1)
                flags = stream[index++];
                status.Cued = (flags & 0x01) > 0;
                status.Ejecting = (flags & 0x02) > 0;
                status.FastForwarding = (flags & 0x04) > 0;
                status.Jog = (flags & 0x08) > 0;
                status.Local = (flags & 0x10) > 0;
                status.Playing = (flags & 0x20) > 0;
                status.Recording = (flags & 0x40) > 0;
                status.Rewinding = (flags & 0x80) > 0;

                //Machine Status (Block 2)
                flags = stream[index++];
                status.ServoLock = (flags & 0x01) > 0;
                status.ServoRefMissing = (flags & 0x02) > 0;
                status.Shuttle = (flags & 0x04) > 0;
                status.Standby = (flags & 0x08) > 0;
                status.Still = (flags & 0x10) > 0;
                status.Stopped = (flags & 0x20) > 0;
                status.TapeDir = (flags & 0x40) > 0;
                status.TapeOut = (flags & 0x80) > 0;

                //Machine Status (Block 3)
                flags = stream[index++];
                status.TsoMode = (flags & 0x01) > 0;
                status.Var = (flags & 0x02) > 0;

                //Add to collection
                response.Machines.Add(newMachine.Port, newMachine);
            }

            //Get the outputs
            for (int i = 0; i < newOutputCount; i++)
            {
                DrawingOutput output = new DrawingOutput();

                output.OutputType = (OutputModuleType)stream[index++];
                output.ID = stream.GetShort(ref index);
                output.FrameID = stream.GetShort(ref index);
                output.RenewalMasterFrameID = stream.GetShort(ref index);
                output.HActive = stream.GetShort(ref index);
                output.VActive = stream.GetShort(ref index);
                output.HTotal = stream.GetShort(ref index);
                output.VTotal = stream.GetShort(ref index);

                output.DirectAuxId = stream.GetInt(ref index);

                var outputFlags = (OutputFlags)stream[index++];
                output.Interlaced = outputFlags.HasFlag(OutputFlags.Interlaced);
                output.IsFrameLocked = outputFlags.HasFlag(OutputFlags.IsFrameLocked);

                output.VerticalRefresh = stream.GetFloat(ref index);
                output.Name = stream.GetString(ref index);
                output.HdcpStatus = (HdcpLinkStatus)stream[index++];

                output.OutputMode = (OutputMode)stream[index++];
                output.Rotation = (RotationMode)stream[index++];

                output.OpMonProgramSource = stream.GetRectangle(ref index);
                output.OpMonProgramDest = stream.GetRectangle(ref index);
                output.OpMonPreviewSource = stream.GetRectangle(ref index);
                output.OpMonPreviewDest = stream.GetRectangle(ref index);
                output.ScaledSource = stream.GetRectangle(ref index);
                output.ScaledDest = stream.GetRectangle(ref index);
                output.SourceName = stream.GetString(ref index);

                int rectCount = stream[index++];
                for (int j = 0; j < rectCount; j++)
                    output.Rectangles.Add(stream.GetRectangle(ref index));

                response.Outputs.Add(output.ID, output);
            }

            //Get Diagnostic status
            for (int i = 0; i < diagnosticWarningCount; i++)
            {
                DiagnosticStatus status = (DiagnosticStatus)stream[index++];
                DiagnosticType diagnosticType = (DiagnosticType)stream[index++];
                response.DiagnosticWarnings.Add(diagnosticType, status);
            }

            return response;
        }
    }
}


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W27353_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans14.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Oasis Petroleum Well Summary Cook 5300 12-13 8T2 Section 13 T153N R100W Williams County, ND
SURFACE CASING AND CEMENT DESIGN

    <p class="styleSans44.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">_—_ - g mmmmmm m
Collapse
0' to 2225' 13-3/ ". 54.5#. J-55, STC, 8rd

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">API Rating & Safeg Factor

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">a) Based on full casing evawatlon with 9 ppg fluid on backside (2,225' setting depth). b) Burst pressure based on 9 ppg fluid with no fluid on backside (2.225' setting depth). c) Based on string weight in 9 ppg fluid at 2.225' TVD plus 100k# overpull. (Buoyed weight equals 105k lbs.)
Cement volumes are based on 13-3/8" casing set in 17-1/2" hole with 50% excess to circulate cement back to surface. Mix and pump the following slurry.
Pre-flush (Spacer): 20 bbls fresh water

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Lead Slurry:

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Tail Slurry:

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">14

    <p class="styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans426.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">754 sks (390 bbls) 2.97 yield conventional system with 94 Ib/sk cement. .25 lblsk D130 Lost Circulation Control Agent, 2% CaClz, 4% 0079 Extender and 2% D053 Expanding Agent.
300 sks (72 bbls) 2.01 yield conventional system with 94 lb/sk cement. 25% C302 and 0.25 lblsk Lost Circulation Control Agent


text:
using namespace ocl;

bool oclPackageImpl::isInited = false;

oclPackageImpl::oclPackageImpl()
{
	setEFactoryInstance(std::shared_ptr<ecore::EFactory >( oclFactory::eInstance()));
}

oclPackageImpl::~oclPackageImpl()
{
}

oclPackage* oclPackageImpl::create()
{
	if (isInited)
	{
		return oclPackage::eInstance().get();
	}
	isInited = true;

    // Obtain or create package and create package meta-data objects
    oclPackageImpl * metaModelPackage = new oclPackageImpl();
    return metaModelPackage;
}

void oclPackageImpl::init(std::shared_ptr<ecore::EPackage> package)
{
    // Initialize created meta-data
	createPackageContents(package);
	setThisEPackagePtr(package);
    initializePackageContents();
}

std::shared_ptr<ocl::Evaluations::EvaluationsPackage> ocl::oclPackageImpl::getEvaluations_Package() const
{
	return ocl::Evaluations::EvaluationsPackage::eInstance();
}
std::shared_ptr<ocl::Expressions::ExpressionsPackage> ocl::oclPackageImpl::getExpressions_Package() const
{
	return ocl::Expressions::ExpressionsPackage::eInstance();
}
std::shared_ptr<ocl::Types::TypesPackage> ocl::oclPackageImpl::getTypes_Package() const
{
	return ocl::Types::TypesPackage::eInstance();
}
std::shared_ptr<ocl::Values::ValuesPackage> ocl::oclPackageImpl::getValues_Package() const
{
	return ocl::Values::ValuesPackage::eInstance();
}


text:
using System;
using System.Threading.Tasks;
using VkNet.Model;
using VkNet.Model.Attachments;
using VkNet.Utils;

namespace VkNet.Categories;

/// <inheritdoc />
public partial class FaveCategory
{
	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<VkCollection<User>> GetUsersAsync(int? count = null, int? offset = null) =>
		TypeHelper.TryInvokeMethodAsync(() => GetUsers(count, offset));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<VkCollection<Photo>> GetPhotosAsync(int? count = null, int? offset = null, bool? photoSizes = null) =>
		TypeHelper.TryInvokeMethodAsync(() => GetPhotos(count, offset, photoSizes));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<WallGetObject> GetPostsAsync(int? count = null, int? offset = null, bool extended = false) =>
		TypeHelper.TryInvokeMethodAsync(() => GetPosts(count, offset, extended));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<FaveVideoEx> GetVideosAsync(int? count = null, int? offset = null, bool extended = false) =>
		TypeHelper.TryInvokeMethodAsync(() => GetVideos(count, offset, extended));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<VkCollection<ExternalLink>> GetLinksAsync(int? count = null, int? offset = null) =>
		TypeHelper.TryInvokeMethodAsync(() => GetLinks(count, offset));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<bool> AddUserAsync(long userId) => TypeHelper.TryInvokeMethodAsync(() => AddUser(userId));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<bool> RemoveUserAsync(long userId) => TypeHelper.TryInvokeMethodAsync(() => RemoveUser(userId));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<bool> AddGroupAsync(long groupId) => TypeHelper.TryInvokeMethodAsync(() => AddGroup(groupId));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<bool> RemoveGroupAsync(long groupId) => TypeHelper.TryInvokeMethodAsync(() => RemoveGroup(groupId));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete + "Используйте вместо него Task<bool> AddLinkAsync(Uri link)")]
	public Task<bool> AddLinkAsync(Uri link, string text) => TypeHelper.TryInvokeMethodAsync(() => AddLink(link, text));

	/// <inheritdoc />
	[Obsolete(ObsoleteText.Obsolete)]
	public Task<VkCollection<Market>> GetMarketItemsAsync(ulong? count = null, ulong? offset = null, bool? extended = null) =>
		TypeHelper.TryInvokeMethodAsync(() => GetMarketItems(count, offset, extended));
}


text:
PATH:=node_modules/.bin:${PATH}

BOWER_SCRIPTS = \
	bower_components/jstat/index.js \
	bower_components/lodash/dist/lodash.compat.js \
	bower_components/momentjs/moment.js \
	bower_components/numeral/index.js \
	bower_components/numeric/index.js \
	bower_components/underscore.string/index.js \
	lib/excellent.compat.js \
	bower_components/formulajs/lib/formula.js \
	bower_components/jszip/jszip.js \
	bower_components/jszip/jszip-load.js \
	bower_components/jszip/jszip-inflate.js

SULLA_SCRIPTS = \
	lib/excellent.parser.browser.js \
	lib/excellent.util.js \
	lib/excellent.workbook.js \
	lib/excellent.loader.js \
	lib/excellent.xlsx.js \
	lib/excellent.xlsx-simple.js

BOWER_SIMPLE_SCRIPTS = \
	bower_components/jszip/jszip.js \
	bower_components/jszip/jszip-load.js \
	bower_components/jszip/jszip-inflate.js

SULLA_SIMPLE_SCRIPTS = \
	lib/excellent.util.js \
	lib/excellent.workbook.js \
	lib/excellent.xlsx-simple.js

test:
	mocha -u bdd

peg:
	pegjs --track-line-and-column ./grammar/formula_parser.pegjs ./lib/excellent.parser.js
	pegjs -e FormulaParser --track-line-and-column ./grammar/formula_parser.pegjs ./lib/excellent.parser.browser.js

build:
	rm -rf dist
	mkdir -p dist
	cat $(BOWER_SCRIPTS) > dist/bower.combine.js
	uglifyjs dist/bower.combine.js > dist/bower.uglify.js
	cat $(SULLA_SCRIPTS) > dist/excellent.combine.js
	uglifyjs dist/excellent.combine.js > dist/excellent.uglify.js
	cat dist/bower.uglify.js dist/excellent.uglify.js > dist/excellent.min.js
	cat dist/bower.combine.js dist/excellent.combine.js > dist/excellent.js
	cp dist/excellent.js excellent.js
	cp dist/excellent.min.js excellent.min.js

build-simple:
	rm -rf dist
	mkdir -p dist
	cat $(BOWER_SIMPLE_SCRIPTS) > dist/bower.combine.js
	uglifyjs dist/bower.combine.js > dist/bower.uglify.js
	cat $(SULLA_SIMPLE_SCRIPTS) > dist/excellent.combine.js
	uglifyjs dist/excellent.combine.js > dist/excellent.uglify.js
	cat dist/bower.uglify.js dist/excellent.uglify.js > dist/excellent.min.js
	cat dist/bower.combine.js dist/excellent.combine.js > dist/excellent.js
	cp dist/excellent.js excellent-simple.js
	cp dist/excellent.min.js excellent-simple.min.js

.PHONY: test


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
*
* Clase que representa un Modelo para Enlazar las Estadisticas de las aplicaciones.
*
* Esta clase mapea la tabla ethas_applications de  la base de datos no relacional de DynamoDB.
*
* @author Andres Felipe Herrera <anfho93@gmail.com>
*  @version 1.1
*/

class BaseStatistics extends CI_Model {

    protected $otherdb;
    //array
    protected $conditions = array();

    function __construct() {
        parent::__construct();
          $this->otherdb = $this->load->database('impala', TRUE);
         // $this->otherdb->query("refresh dailyuserdata");
          //$this->otherdb->query("refresh sessions");
         // $this->otherdb->query("refresh downloads");
         // $this->otherdb->query("refresh screen");
         // $this->otherdb->query("invalidate metadata");
    }

     public function addCondition($condition){
         $JSONCond = json_decode($condition,true);
        if($JSONCond != "" && $JSONCond!=null)
        {
            foreach ($JSONCond as $elem){//saca un obj o array con las cond
                foreach ($elem as $key => $value) {
                    //echo  $key." ".$elem["operando"]." '".$value."'";
                    $this->conditions[] = $key." ".$elem["operando"]." '".$value."'";
                    break;
                }
            }
            //$this->conditions[] = $condition;
        }
    }

    /**
     * crea una consulta basandose en las condiciones previamente almacenadas.
     * @return type
     */
    public function getSegmentQuery(){
        $query = null;
        foreach ($this->conditions as  $key =>$condicion) {
                if($key > 0)
                {
                    $query.= " AND " . $condicion;
                }else{
                    $query.= " $condicion ";
                }
        }
        return $query;
    }
    /**
     * Agrega una nueva consulta al Active Record
     * @param CActiveRecord $activeRecord
     * @return CActiveRecord
     */
    protected function addSegmentQuery(&$activeRecord){
        $s = $this->getSegmentQuery();
        if($s!=null){
           // echo $s;
            $activeRecord->where($s);
        }
        return $activeRecord;
    }

     /**
      * Perpara un arreglo q contendra informacion basado en dos fechas como limites de indices
      * @param string $initialDate  fecha inicial
      * @param string $finalDate  fecha final de la aplicacion.
      * @return array arrelgo con las fechas diarias entre los limites.
      */
    protected function generateLabels($initialDate, $finalDate){
        $daylength = 60*60*24;
        $daysBetween = abs((strtotime($initialDate)-strtotime($finalDate))/$daylength);
        $labels =  array(array("Date"));
       // if($daysBetween < 89)
        {
            $labels[1] = array(date("Y-m-d", strtotime($initialDate )));
            for ($i=2; $i-1 <= $daysBetween; $i++) {
                $v = $i-1;
                    $labels[$i] = array(date("Y-m-d", strtotime($initialDate . "+$v day" )));
            }
        }
        return $labels;
    }
       protected function getConector($y1, $y2) {
           if($y2>$y1)
               return 'or';
            return 'and';
    }
    /**
     * Prepara un formato de respuesta estilo tabla donde
     * la tabla inicial es dada por las fechas y el resto por los datos enviados por los usuarios,
     * @param array $titlearray, titulos que tendrá la tabla.
     * @param string $initialDate, fecha inicial
     * @param string $finalDate, fecha final
     * @param array $dataset, conjunto de datos resultantes de una consulta SQL. agrupada por year, month, day
     * @param array $sdataset, seugndo conjunto de datos resultantes de una consulta SQL. agrupada por year, month, day
     * @return array  Resultado final que sera enviado al usuario.
     */
    protected function prepareResultSet($titlearray, $initialDate, $finalDate, $dataset, $sdataset=null){
        $labels =  $this->generateLabels($initialDate, $finalDate);
        for($i=1; $i<=count($titlearray);$i++){
            $labels[0][$i] = $titlearray[$i-1];
        }
        for($i=1;$i<count($labels);$i++){
            for($j=1; $j<=count($titlearray);$j++){
                  $labels[$i][$j] = 0;
            }
            foreach ($dataset as $registro)
            {
                if($registro["month"]<10)
                    $registro["month"]= "0".$registro["month"];
                if($registro["day"]<10)
                    $registro["day"]= "0".$registro["day"];
                $fecha = $registro["year"]."-".$registro["month"]."-".$registro["day"];
                if($labels[$i][0] == $fecha){
                    for($k=1;$k<=count($titlearray); $k++){
                       $index = strtolower($titlearray[$k-1]);
                        $labels[$i][$k] = $registro["$index"];
                    }
                    break;
                }
            }
         }
         return $labels;
    }
}


text:
/**
 * Bootstraps environment
 *
 * @method bootstrap
 * @private
 * @return {Undefined} undefined
 */
let bootstrap = function () {
	// ES6 Array shims
	if ( Array.from === undefined ) {
		Array.from = function ( arg ) {
			return [].slice.call( arg );
		};
	}

	// Describing the Client
	if ( !server ) {
		client.version = client.version();

		if ( client.ie && client.version < 10 ) {
			throw new Error( label.upgrade );
		}
	} else {
		// XHR shim
		XMLHttpRequest = xhr();
	}

	// WeakMap shim for client & server
	if ( WeakMap === null ) {
		WeakMap = WeakMapShim;
	}

	// DataStore Worker "script"
	if ( webWorker ) {
		try {
			WORKER = global.URL.createObjectURL( utility.blob( "var " + string.fromObject( array, "array" ) + ", " + string.fromObject( regex, "regex" ) + ", " + string.fromObject( string, "string" ) + ", " + string.fromObject( utility, "utility" ) + "; onmessage = " + store.worker.toString() + ";" ) );
		}
		catch ( e ) {
			webWorker = false;
		}
	}

	TIME = new Date().getTime();

	// Setting up `utility.render()`
	if ( global.requestAnimationFrame !== undefined ) {
		RENDER = global.requestAnimationFrame
	} else {
		RENDER = function ( fn ) {
			let offset = new Date().getTime() - TIME;

			utility.defer( function () {
				fn( offset );
			}, 16, offset );
		};
	}

	if ( !server ) {
		utility.banner();
	}
};


text:
package myJdkDynamicProxy;

import java.lang.reflect.Method;

/**
 * Created by Jo on 9/24/16.
 */
public interface InvocationHandler {
	void invoke(Object o,Method method);
}


text:
define("xstyle/main", ["require", "put-selector/put"], function (require, put) {
	"use strict";
	// regular expressions used to parse CSS
	var cssScan = /\s*([^{\}\[\]\(\)\/\\'":=;]*)([=:]\??\s*([^{\}\[\]\(\)\/\\'":;]*))?([{\}\[\]\(\)\/\\'":;]|$)/g;
									// name: value 	operator
	var singleQuoteScan = /((?:\\.|[^'])*)'/g;
	var doubleQuoteScan = /((?:\\.|[^"])*)"/g;
	var commentScan = /\*\//g;
	var nextId = 0;
	// selection of default children for given elements
	var childTagForParent = {
		"TABLE": "tr",
		"TBODY": "tr",
		"TR": "td",
		"UL": "li",
		"OL": "li",
		"SELECT": "option"
	};
	var operatorMatch = {
		'{': '}',
		'[': ']',
		'(': ')'
	}
	var doc = document;
	// some utility functions
	function when(value, callback){
		return value && value.then ?
			value.then(callback) : callback(value);
	}
	function get(target, path, callback){
		return when(target, function(target){
			var name = path[0];
			if(!target){
				return callback(name || target);
			}
			if(name && target.get){
				return get(target.get(name), path.slice(1), callback);
			}
			if(target.receive){
				return target.receive(name ? function(value){
					get(value, path, callback);
				} : callback);
			}
			if(name){
				return get(target[name], path.slice(1), callback);
			}
			callback(target);
		});
	}
	function set(target, path, value){
		get(target, path.slice(0, path.length - 1), function(target){
			var property = path[path.length - 1];
			target.set ?
				target.set(property, value) :
				target[property] = value;
		});
	}
	var trim = ''.trim ? function (str){
		return str.trim();
	} : function(str){
		return str.replace(/^\s+|\s+$/g, '');
	};
	var undef, testDiv = doc.createElement("div");
	function search(tag){
		// used to search for link and style tags
		var elements = doc.getElementsByTagName(tag);
		for(var i = 0; i < elements.length; i++){
			checkImports(elements[i]);
		}
	}
	function toStringWithoutCommas(){
		return this.join('');
	}
	function arrayWithoutCommas(array){
		array.toString = toStringWithoutCommas;
		return array;
	}
	function LiteralString(string){
		this.value = string;
	}
	LiteralString.prototype.toString = function(){
		return '"' + this.value.replace(/["\\\n\r]/g, '\\$&') + '"';
	}

	var ua = navigator.userAgent;
	var vendorPrefix = ua.indexOf("WebKit") > -1 ? "-webkit-" :
		ua.indexOf("Firefox") > -1 ? "-moz-" :
		ua.indexOf("MSIE") > -1 ? "-ms-" :
		ua.indexOf("Opera") > -1 ? "-o-" : "";
	// traverse the @imports to load the sources
	function checkImports(element, callback, fixedImports){
		var sheet = element.sheet || element.styleSheet || element;
		var needsParsing = sheet.needsParsing, // load-imports can check for the need to parse when it does it's recursive look at imports
			cssRules = sheet.rules || sheet.cssRules;
		function fixImports(){
			// need to fix imports, applying load-once semantics for all browsers, and flattening for IE to fix nested @import bugs
			require(["xstyle/load-imports"], function(load){
				load(element, function(){
					checkImports(element, callback, true);
				});
			});
		}
		if(sheet.imports && !fixedImports && sheet.imports.length){
			// this is how we check for imports in IE
			return fixImports();
		}
		if(!needsParsing){
			for(var i = 0; i < cssRules.length; i++){
				var rule = cssRules[i];
				if(rule.href && !fixedImports){
					// it's an import (for non-IE browsers)
					return fixImports();
				}
				if(rule.selectorText && rule.selectorText.substring(0,2) == "x-"){
					// an extension is used, needs to be parsed
					needsParsing = true;
					if(/^'/.test(rule.style.content)){
						// this means we are in a built sheet, and can directly parse it
						// TODO: parse here
					}
				}
			}
		}
		// ok, determined that CSS extensions are in the CSS, need to get the source and really parse it
		parse(sheet.localSource || (sheet.ownerNode || sheet.ownerElement).innerHTML, sheet, callback);
	}
	parse.getStyleSheet = function(importRule, sequence){
		return importRule.styleSheet;
	};
	function parse(textToParse, styleSheet, callback) {
		// this function is responsible for parsing a stylesheet with all of xstyle's syntax rules

		// normalize the stylesheet.
		if(!styleSheet.addRule){
			// only FF doesn't have this
			styleSheet.addRule = function(selector, style, index){
				return this.insertRule(selector + "{" + style + "}", index >= 0 ? index : this.cssRules.length);
			}
		}
		if(!styleSheet.deleteRule){
			styleSheet.deleteRule = styleSheet.removeRule;
		}

		// we store a map of custom handlers for custom properties, functions, and selectors
		var handlers = {property:{}};
		function addHandler(type, name, module){
			// add a handler, can be any type (property, function, selector)
			var handlersForType = handlers[type] || (handlers[type] = {});
			handlersForType[name] = module;
		}
		function addExtensionHandler(type){
			// add a meta-handler for the x-property, x-function, etc. selectors that are used
			// to register new custom handlers
			if(!handlers[type]){
				handlers[type] = {};
			}
			addHandler("selector", 'x-' + type, {
				onRule: function(rule){
					// found a selector, let's register it
					rule.eachProperty(function(name, value){
						var asString = value.toString();
						// we iterate through each part of the handler value, using the first one that applies
						// handler values usually look like: prefix, module(some/module)
						do{
							// do some simple parsing, we really only support default, native, and require(), so this can handle that
							var parts = asString.match(/([^, \(]+)(?:[, ]+(.+))?/);
							if(!parts){
								return;
							}
							var first = parts[1];
							if(first == 'module'){
								// add a handler with a module id provided so it can be asynchronously loaded with require()
								return addHandler(type, name, value[1].args[0]);
							}if(first == "default"){
								if(type == "pseudo"){
									// if it is pseudo, we test with a query
									try{
										doc.querySelectorAll("x:" + name);
										return;
									}catch(e){}
								}
							}else if(first == "prefix"){
							}else{
								return addHandler(type, name, function(){
									return value;
								});
							}
						}while(asString = parts[2]); // wasn't supported, keep try the next part
					});
				}
			});
		}
		addExtensionHandler("property"); // add x-property selector for registering properties
		addExtensionHandler("function");// add x-function selector for registering functions
		addExtensionHandler("pseudo");// add x-pseudo selector for registering pseudos

		// make these intrinsically registered
		handlers['function']['var'] = xstyle;
		handlers['function']['extends'] = xstyle;

		var waiting = 1;
		// determine base url
		var baseUrl = (styleSheet.href || location.href).replace(/[^\/]+$/,'');

		// define the Rule class
		function Rule(){}
		Rule.prototype = {
			eachProperty: function(onProperty){
				// iterate through each property on the rule
				var values = this.values || 0;
				for(var i = 0; i < values.length; i++){
					var name = values[i];
					onProperty.call(this, name || 'unnamed', values[name]);
				}
			},
			fullSelector: function(){
				// calculate the full selector, in case this is a nested rule we determine the full selector using parent rules
				return (this.parent ? this.parent.fullSelector() : "") + (this.selector || "") + " ";
			},
			newRule: function(name){
				// called by the parser when a new child rule is encountered
				return (this.rules || (this.rules = {}))[name] = new Rule();
			},
			newCall: function(name, sequence, rule){
				// called by the parser when a function call is encountered
				var call = new Call(name);
				return call;
			},
			addSheetRule: function(selector, cssText){
				// Used to add a new rule
				if(cssText &&
					selector.charAt(0) != '@'){ // for now just ignore and don't add at-rules
					var ruleNumber = styleSheet.addRule(selector, cssText);
					if(ruleNumber == -1){
						ruleNumber = styleSheet.cssRules.length - 1;
					}
					return styleSheet.cssRules[ruleNumber];
				}
			},
			onRule: function(){
				// called by parser once a rule is finished parsing
				this.getCssRule();
			},
			getCssRule: function(){
				if(!this.cssRule){
					this.cssRule =this.addSheetRule(this.selector, this.cssText);
				}
				return this.cssRule;
			},
			get: function(key){
				// TODO: need to add inheritance? or can this be removed
				return this.values[key];
			},
			declareProperty: function(name, value, conditional){
				// called by the parser when a variable assignment is encountered
				if(value[0].toString().charAt(0) == '>'){
					// this is used to indicate that generation should be triggered
					if(!name){
						this.generator = value;
						value = generate(value, this);
						xstyle.addRenderer("", value, this, value);
						return;
					}
				}else{
					// add it to the variables for this rule
					var propertyExists = name in testDiv.style || resolveProperty(this, name);
					if(!conditional || !propertyExists){
						var properties = (this.properties || (this.properties = {}));
						properties[name] = value;
						if(propertyExists){
							console.warn('Overriding existing property "' + name + '"');
						}
					}
				}
			},
			setValue: function(name, value){
				// called by the parser when a property is encountered
				var values = (this.values || (this.values = []));
				values.push(name);
				values[name] = value;
				var calls = value.calls;
				if(calls){
					for(var i = 0; i < calls.length; i++){
						var call = calls[i];
						var handler = call.ref;
						if(handler && typeof handler.call == 'function'){
							handler.call(call, this, name, value);
						}
					}
				}
				// called when each property is parsed, and this determines if there is a handler for it
				//TODO: delete the property if it one that the browser actually uses
				// this is called for each CSS property
				if(name){
					var propertyName = name;
					do{
						// check for the handler
						var target = resolveProperty(this, name);
						if(target){
							var rule = this;
							// call the handler to handle this rule
							when(evaluateExpression(rule, name, target), function(target){
								target = target.splice ? target : [target];
								for(var i = 0; i < target.length; i++){
									var segment = target[i];
									if(segment.put(value, rule, name)){
										break;
									}
								}
							});
							break;
						}
						// we progressively go through parent property names. For example if the
						// property name is foo-bar-baz, it first checks for foo-bar-baz, then
						// foo-bar, then foo
						name = name.substring(0, name.lastIndexOf("-"));
						// try shorter name
					}while(name);
				}
			},
			cssText: ""
		};
		// a class representing function calls
		function Call(value){
			// we store the caller and the arguments
			this.caller = value;
			this.args = [];
		}
		var CallPrototype = Call.prototype = new Rule;
		CallPrototype.declareProperty = CallPrototype.setValue = function(name, value){
			// handle these both as addition of arguments
			this.args.push(value);
		};
		CallPrototype.toString = function(){
			var operator = this.operator;
			return operator + this.args + operatorMatch[operator];
		};

		// we treat the stylesheet as a "root" rule; all normal rules are children of it
		var target, root = new Rule;
		root.root = true;
		// the root has it's own intrinsic variables that provide important base and bootstrapping functionality
		root.properties = {
			Math: Math, // just useful
			module: function(mid){
				// require calls can be used to load in data in
				return {
					then: function(callback){
						require([mid], callback);
					}
				};
			},
			// TODO: add url()
			item: {
				// adds support for referencing each item in a list of items when rendering arrays
				forElement: function(element){
					// we find the parent element with an item property, and key off of that
					while(!element.item){
						element = element.parentNode;
					}
					return {
						element: element, // indicates the key element
						receive: function(callback){// handle requests for the data
							callback(element.item);
						}
					}
				}
			},
			prefix: {
				put: function(value, rule, name){
					// add a vendor prefix
					// check to see if the browser supports this feature through vendor prefixing
					if(typeof testDiv.style[vendorPrefix + name] == "string"){
						// if so, handle the prefixing right here
						return rule.addSheetRule(rule.selector, vendorPrefix + name +':' + value);
					}
				}
			},
			'var': {
				put: function(value, rule, name){
					(rule.variables || (rule.variables = {}))[name] = value;
					// TODO: can we reuse something for this?
					var variableListeners = rule.variableListeners;
					variableListeners = variableListeners && variableListeners[name] || 0;
					for(var i = 0;i < variableListeners.length;i++){
						variableListeners[i](value);
					}
				},
				call: function(call, rule, name, value){
					this.receive(function(resolvedValue){
						rule.addSheetRule(rule.selector, name + ': ' + value.toString().replace(/var\([^)]+\)/g, resolvedValue));
					}, rule, call.args[0]);
				},
				receive: function(callback, rule, name){
					var parentRule = rule;
					do{
						var target = parentRule.variables && parentRule.variables[name];
						if(target){
							var variableListeners = parentRule.variableListeners || (parentRule.variableListeners = {});
							(variableListeners[name] || (variableListeners[name] = [])).push(callback);
							return callback(target);
						}
						parentRule = parentRule.parent;
					}while(parentRule);
					callback();
				}
			},
			on: {
				put: function(value, rule, name){
					// TODO: implement this
					console.log("add event listener");
					evaluateExpression(rule, name, value);
				}
			}
		};
		// keep references
		root.css = textToParse;
		root.parse = parseSheet;

		function onRule(selector, rule){
			// check for selector handler
			rule.onRule();
			var handlerForName = handlers.selector[selector];
			if(handlerForName){
				handler(handlerForName, "onRule", rule);
			}
		}
		function onCall(identifier, value){
			// check for handler for a function call()
			var handlerForName = handlers['function'][identifier];
			if(handlerForName){
				handler(handlerForName, "onCall", identifier, value, value.args);
			}
		}
		function onPseudo(pseudo, rule){
			// check for pseudo handler
			var handlerForName = handlers.pseudo[pseudo];
			if(handlerForName){
				handler(handlerForName, "onPseudo", pseudo, rule);
			}
		}

		function handler(module, type, name, value){
			// module handler for properties, functions, etc., takes care of loading the target module
			if(module){
				var rule = target;
				var ruleHandled = function(text){
					if(typeof text == 'string'){
						/* TODO: is the a way to determine the index deterministically?
						var cssRules = styleSheet.rules || styleSheet.cssRules;
						for(var index = rule.index || 0; index < cssRules.length; index++){
							if(cssRules[index].selectorText == rule.fullSelector(){
								break;
							}
						}*/
						/* TODO: merge IE filters
						if(isIE){
							var filters = [];
							convertedText = convertedText.replace(/filter: ([^;]+);/g, function(t, filter){
								filters.push(filter);
								return "";
							});
							if(filters.length){
								console.log("filters", filters);
								convertedText = "zoom: 1;filter: " + filters.join("") + ";" + convertedText;
							}
						}
						*/
						styleSheet.addRule(rule.fullSelector(), text);
					}
					// finished loading, this function will see if everything is done yet
					finishedLoad();
				};

				waiting++;
				var onLoad = function(module){
					try{
						// module is loaded, now exectue the appropriate function on the module (like onProperty)
						var result = module[type](name, value, rule, styleSheet);
						if(rule instanceof Call){
							rule.result = result;
						}
						// a module can also return a promise
						if(result && result.then){
							// a promise, return immediately defer handling
							result.then(ruleHandled, handleError);
						}else{
							// done
							ruleHandled(result);
						}
					}catch(e){
						handleError(e);
					}
					function handleError(error){
						// Add some error handling to give developers a better idea of where error occurs.
						// TODO: Add line number, and file name
						console.error('Error occurred processing ' + type.slice(2).toLowerCase() + ' ' + name +
							(rule.operator == '{' ? (' in rule "' + rule.selector + '" {' + rule.cssText) : '') + '. ' +
												error.message);
						if(error){
							console.error(error);
						}
					}
				}
				// load the module using the module id, or direclty use it if it is already loaded
				typeof module == "string" ? require([module], onLoad) : onLoad(module);
			}
		}
		// tracks the stack of rules as they get nested
		var stack = [root];
		function parseSheet(textToParse, styleSheet){
			// parse the CSS, finding each rule
			function addInSequence(operand, dontAddToSelector){
				if(!dontAddToSelector){
					selector += operand;
				}
				if(sequence){
					// we had a string so we are accumulated sequences now
					sequence.push ?
						typeof sequence[sequence.length - 1] == 'string' && typeof operand == 'string' ?
							sequence[sequence.length - 1] += operand : // just append the string to last segment
							operand && sequence.push(operand) : // add to the sequence
						typeof sequence == 'string' && typeof operand == 'string' ?
							sequence += operand : // keep appending to the string
							sequence = arrayWithoutCommas([sequence, operand]); // start a new sequence array
				}else{
					sequence = operand;
				}
			}
			target = root; // start at root
			cssScan.lastIndex = 0; // start at zero
			var ruleIndex = 0, browserUnderstoodRule = true, selector = '', assignNextName = true;
			while(true){
				// parse the next block in the CSS
				// we could perhaps use a simplified regex when we are in a property value
				var match = cssScan.exec(textToParse);
				// the next block is parsed into several parts that comprise some operands and an operator
				var operator = match[4],
					first = match[1],
					assignment = match[2],
					value = match[3],
					assignmentOperator, name, sequence,
					conditionalAssignment;
				value = value && trim(value);

				first = trim(first);
				if(assignNextName){
					// we are at the beginning of a new property
					if(assignment){
						// remember the name, so can assign to it
						selector = name = first;
						// remember the operator (could be ':' for a property assignment or '=' for a property declaration)
						assignmentOperator = assignment.charAt(0);
						conditionalAssignment = assignment.charAt(1) == '?';
					}else{
						selector = value = first;
					}
					// store in the sequence, the sequence can contain values from multiple rounds of parsing
					sequence = value;
					if(name || operator != '/'){
						// as long we haven't hit an initial comment, we have the assigned property name now, and don't need to assign again
						assignNextName = false;
					}
				}else{
					// subsequent part of a property
					value = value ? first + assignment : first;
					// add to the current sequence
					addInSequence(value);
				}
				switch(operator){
					case "'": case '"':
						// encountered a quoted string, parse through to the end of the string and add to the current sequence
						var quoteScan = operator == "'" ? singleQuoteScan : doubleQuoteScan;
						quoteScan.lastIndex = cssScan.lastIndex; // find our current location in the parsing
						var parsed = quoteScan.exec(textToParse);
						if(!parsed){ // no match for the end of the string
							error("unterminated string");
						}
						var str = parsed[1]; // the contents of the string
						// move the css parser up to the end of the string position
						cssScan.lastIndex = quoteScan.lastIndex;
						// push the string on the current value and keep parsing
						addInSequence(new LiteralString(str));
						continue;
					case '/':
						// we parse these in case it is a comment
						if(textToParse[cssScan.lastIndex] == '*'){
							// it's a comment, scan to the end of the comment
							commentScan.lastIndex = cssScan.lastIndex + 1;
							commentScan.exec(textToParse); // find the end
							cssScan.lastIndex = commentScan.lastIndex; // move the CSS parser to the end of the comment
						}else{
							// not a comment, add the operator in the accumulating string
							addInSequence('/');
						}
						continue;
					case '\\':
						// escaping
						var lastIndex = quoteScan.lastIndex++;
						// add the escaped character to the sequence
						addInSequence(textToParse.charAt(lastIndex));
						continue;
					case '(': case '{': case '[':
						// encountered a new contents of a rule or a function call
						var newTarget;
						var doExtend = false;
						if(operator == '{'){
							// it's a rule
							assignNextName = true; // enter into the beginning of property mode
							// add this new rule to the current parent rule
							addInSequence(newTarget = target.newRule(selector), true);

							// todo: check the type
							if(assignmentOperator){
								browserUnderstoodRule = false;
								if(!assignment || assignment.charAt(1) == '>'){
									sequence.creating = true;
								}
								if(assignmentOperator == '=' && value){
									// extend the referenced target value
									// TODO: create auto-generate class?
									doExtend = true;
								}
							}
							if(target.root && browserUnderstoodRule){
								// we track the native CSSOM rule that we are attached to so we can add properties to the correct rule
								newTarget.cssRule = styleSheet.cssRules[ruleIndex++];
							}
						}else{
							// it's a call, add it in the current sequence
							var callParts = value.match(/(.*?)([\w-]*)$/);
							addInSequence(newTarget = target.newCall(callParts[2], sequence, target));
							newTarget.ref = resolveProperty(target, callParts[2]);
							(sequence.calls || (sequence.calls = [])).push(newTarget);
						}
						// make the parent reference
						newTarget.parent = target;
						if(sequence.creating){
							// in generation, we auto-generate selectors so we can reference them
							newTarget.selector = '.x-generated-' + nextId++;
						}else{
							newTarget.selector = target.root ? selector : target.selector + ' ' + selector;
						}
						if(doExtend){
							var ref = resolveProperty(target, value.match(/[^\s]+$/)[0], true);
							if(ref){
								extend(ref, newTarget);
							}
						}

						// store the current state information so we can restore it when exiting this rule or call
						target.currentName = name;
						target.currentSequence = sequence;
						target.assignmentOperator = assignmentOperator;
						// add to the stack
						stack.push(target = newTarget);
						target.operator = operator;
						target.start = cssScan.lastIndex;
						selector = '';
						// if it has a pseudo, call the pseudo handler
						target.selector && target.selector.replace(/:([-\w]+)/, function(t, pseudo){
							onPseudo(pseudo, target);
						});
						name = null;
						sequence = null;
						continue;
				}
				if(sequence){
					// now see if we need to process an assignment or directive
					var first = sequence[0];
					if(first.charAt && first.charAt(0) == "@"){
						// it's a directive
						if(sequence[0].slice(1,7) == "import"){
							// get the stylesheet
							var importedSheet = parse.getStyleSheet(styleSheet.cssRules[ruleIndex++], sequence, styleSheet);
							waiting++;
							// preserve the current index, as we are using a single regex to be shared by all parsing executions
							var currentIndex = cssScan.lastIndex;
							// parse the imported stylesheet
							parseSheet(importedSheet.localSource, importedSheet);
							// now restore our state
							cssScan.lastIndex = currentIndex;
						}
					}else{
						// need to do an assignment
						try{
							target[assignmentOperator == ':' ? 'setValue' : 'declareProperty'](name, sequence, conditionalAssignment);
						}catch(e){
							console.error(e.stack || e);
						}
					}
				}
				switch(operator){
					case ':':
						// assignment can happen after a property declaration
						assignNextName = true;
						assignmentOperator = ':';
						break;
					case '}': case ')': case ']':
						// end of a rule or function call
						// clear the name now
						if(operatorMatch[target.operator] != operator){
							console.error('Incorrect opening operator ' + target.operator + ' with closing operator ' + operator);
						}
						name = null;
						// record the cssText
						target.cssText = textToParse.slice(target.start, cssScan.lastIndex - 1);
						if(operator == '}'){
							// if it is rule, call the rule handler
							onRule(target.selector, target);
							// TODO: remove this conditional, now that we use assignment
							/*if(target.selector.slice(0,2) != "x-"){// don't trigger the property for the property registration
								target.eachProperty(onProperty);
							}*/
							browserUnderstoodRule = true;
							selector = '';
						}/*else if(operator == ')'){
							// call handler
							onCall(target.caller, target);
						}*/
						// now pop the call or rule off the stack and restore the state
						stack.pop();
						target = stack[stack.length - 1];
						sequence = target.currentSequence;
						name = target.currentName;
						assignmentOperator = target.assignmentOperator;
						if(target.root && operator == '}'){
							// CSS ASI
							assignNextName = true;
							assignmentOperator = false;
						}
						break;
					case "":
						// no operator means we have reached the end of the text to parse
						callback && callback();
						return;
					case ';':
						// end of a property, end the sequence return to the beginning of propery mode
						sequence = null;
						assignNextName = true;
						browserUnderstoodRule = false;
						assignmentOperator = false;
						selector = '';
				}
			}
		}
		// call the parser
		parseSheet(textToParse,styleSheet);

		function finishedLoad(){
			// this is called after each asynchronous action is completed, allowing us to determine
			// when everything is complete
			if(--waiting == 0){
				if(callback){
					callback(styleSheet);
				}
			}
		}
		// synchronous completion
		finishedLoad(target);
		return root;
	}

	// TODO: remove
	/*
	var rulesListeningToAttribute = {},
		reversalOfAttributes = {};

	function findAttributeInAncestors(element, tag, name, listeningRule){
		var elementAncestor = element;
		if(listeningRule){
			// TODO: make it specific to tag as well
			var rules = (rulesListeningToAttribute[name] || (rulesListeningToAttribute[name] = []));
			rules.push(listeningRule);
		}
		do{
			if(!tag || tag == elementAncestor.tagName){
				var value = elementAncestor[name];
				// if we have a callback, setup a listener
				if(listeningRule && xstyle.configDOMSetters){
					var oldDescriptor = Object.getOwnPropertyDescriptor(elementAncestor, name);
					var descriptor, setter = oldDescriptor && oldDescriptor.set;
					if(!setter){ // only if the a setter hasn't already been defined
						if(!descriptor){ // create the descriptor just once, and reuse
							// determine if we should call setAttribute
							var useSetAttribute = typeof value == 'string';
							descriptor = {
								get: function(){
									return this._values && this._values[name];
								},
								set: function(value){
									(this._values || (this._values = {}))[name] = value;
									if(!callingFromSetAttribute){
										setAttribute(this, name, value, undefined, useSetAttribute);
									}
								}
							}
						}
						value && ((elementAncestor._values || (elementAncestor._values = {}))[name] = value);
						Object.defineProperty(elementAncestor, name, descriptor);
					}
				}
			}
		}while(!value && (elementAncestor != globalAttributes) &&
				(elementAncestor = elementAncestor.parentNode || globalAttributes));
		return value;
	}
	var callingFromSetAttribute;
	function setAttribute(element, name, value, put, useSetAttribute){
		callingFromSetAttribute = true;
		element[name] = value;
		callingFromSetAttribute = false;
		// set the attribute, the default action
		useSetAttribute && this.setAttribute(name, value);
		if(put !== true){
			var rules = rulesListeningToAttribute[name] || 0;
			for(var i = 0; i < rules.length; i++){
				var rule = rules[i];
				var nodeList = element.querySelectorAll(rule.selector);
				for(var j = 0; j < nodeList.length; j++){
					rule.recomputeAttribute(nodeList[j], name);
				}
			}
		}
		if(put !== false){
			var reversals = reversalOfAttributes[name] || 0;
			for(var i = 0; i < reversals.length; i++){
				var reversal = reversals[i];
				if(matchesSelector.call(element, reversal.rule.selector)){
					reversal(element, name, value);
				}
			}
		}
	}*/
	// using delegation, listen for any input changes in the document and "put" the value
	// TODO: add a hook so one could add support for IE8, or maybe this event delegation isn't really that useful
	doc.addEventListener('change', function(event){
		var element = event.target;
		// get the variable computation so we can put the value
		var variable = element['-x-variable'];
		if(variable.put){ // if it can be put, we do so
			variable.put(element.value);
		}
	});

	// elemental section, this code is for property handlers that need to mutate the DOM for elements
	// that match it's rule
	var testDiv = doc.createElement("div");
	var features = {
		"dom-qsa2.1": !!testDiv.querySelectorAll
	};
	function has(feature){
		return features[feature];
	}
	// get the matches function, whatever it is called in this browser
	var matchesSelector = testDiv.matches || testDiv.matchesSelector || testDiv.webkitMatchesSelector || testDiv.mozMatchesSelector || testDiv.msMatchesSelector || testDiv.oMatchesSelector;
	var selectorRenderers = [];
	var classHash = {}, propertyHash = {};
	var renderQueue = [];
	var documentQueried;
	// probably want to inline our own DOM readiness code
	function domReady(){
		// search the document for <link> and <style> elements to potentially parse.
		search('link');
		search('style');

		if(!documentQueried){
			documentQueried = true;
			if(has("dom-qsa2.1")){
				// if we have a query engine, it is fastest to use that
				for(var i = 0, l = selectorRenderers.length; i < l; i++){
					// find the matches and register the renderers
					findMatches(selectorRenderers[i]);
				}
				// render all the elements that are queued up
				renderWaiting();
			}else{
			//else rely on css expressions (or maybe we should use document.all and just scan everything)
				var all = doc.all;
				for(var i = 0, l = all.length; i < l; i++){
					update(all[i]);
				}
			}
		}
	}
	// TODO: support IE7-8
	if(/e/.test(doc.readyState||'')){
		// TODO: fix the issues with sync so this can be run immediately
		setTimeout(domReady, 200);
	}else{
		doc.addEventListener("DOMContentLoaded", domReady);
	}
	function findMatches(renderer){
		// find the elements for a given selector and apply the renderers to it
		var toRender = [];
		var results = doc.querySelectorAll(renderer.selector);
		var name = renderer.name;
		for(var i = 0, l = results.length; i < l; i++){
			var element = results[i];
			var currentStyle = element.elementalStyle;
			var currentSpecificities = element.elementalSpecificities;
			if(!currentStyle){
				currentStyle = element.elementalStyle = {};
				currentSpecificities = element.elementalSpecificities = {};
			}
			// TODO: only override if the selector is equal or higher specificity
			// var specificity = renderer.selector.match(/ /).length;
			if(true || currentSpecificities[name] <= renderer.specificity){ // only process changes
				var elementRenderings = element.renderings;
				if(!elementRenderings){
					// put it in the queue
					elementRenderings = element.renderings = [];
					renderQueue.push(element);
				}

				elementRenderings.push({
					name: name,
					rendered: currentStyle[name] == renderer.propertyValue,
					renderer: renderer
				});
				currentStyle[name] = renderer.propertyValue;
			}
		}

	}
	var isCurrent;
	function renderWaiting(){
		// render all the elements in the queue to be rendered
		for(var i = 0; i < renderQueue.length; i++){
			var element = renderQueue[i];
			var renderings = element.renderings, currentStyle = element.elementalStyle;
			delete element.renderings;
			for(var j = 0; j < renderings.length; j++){
				var rendering = renderings[j];
				var renderer = rendering.renderer;
				var rendered = renderer.rendered;
				isCurrent = currentStyle[rendering.name] == renderer.propertyValue; // determine if this renderer matches the current computed style
				if(!rendered && isCurrent){
					try{
						renderer.render(element);
					}catch(e){
						console.error(e, e.stack);
						put(element, "div.error", e.toString());
					}
				}
				if(rendered && !isCurrent && renderer.unrender){
					renderer.unrender(element);
					renderings.splice(j--, 1); // TODO: need to remove duplicate rendered items as well
				}
			}
		}
		renderQueue = [];
	}
	function apply(element, renderers){
		// an element was found that matches a selector, so we apply the renderers
		for(var i = 0, l = renderers.length; i < l; i++){
			renderers[i](element);
		}
	}
	/* TODO: probably remove this:
	//window.put = window.put ? put : {};
	put.onaddclass = function(element, className){
		var selectorRenderers = classTriggers[className];
		var renderers = selectorRenderers[selector];
		for(var i = 0, l = selectorRenderers.length; i < l; i++){
			var renderer = selectorRenderers[i];
			if(matchesSelector.apply(element, renderer.selector)){
				renderer.render(element);
				(element.renderers = element.renderers || []).push(renderer);
			}
		}
	};
	put.onremoveclass = function(element){
		var elementRenderers = element.renderers;
		if(elementRenderers){
			for(var i = elementRenderers.length - 1; i >= 0; i--){
				var renderer = elementRenderers[i];
				if(!matchesSelector.apply(element, renderer.selector)){
					renderer.unrender(element);
					elementRenderers.splice(i, 1);
				}
			}
		}
	};
	put.oncreateelement = function(element){
		tagTriggers[element.tagName];
	}*/
	function update(element, selector){
	/* At some point, might want to use getMatchedCSSRules for faster access to matching rules
	 	if(typeof getMatchedCSSRules != "undefined"){
			// webkit gives us fast access to which rules apply
			getMatchedCSSRules(element);
		}else{*/
			for(var i = 0, l = selectorRenderers.length; i < l; i++){
			var renderer = selectorRenderers[i];
			if((!selector || (selector == renderer.selector)) &&
				(matchesSelector ?
					// use matchesSelector if available
					matchesSelector.call(element, renderer.selector) : // TODO: determine if it is higher specificity that other  same name properties
					// else use IE's custom css property inheritance mechanism
					element.currentStyle[renderer.name] == renderer.propertyValue)){
				renderer.render(element);
			}
		}
	}

	function generate(generatingSelector, rule){
		// this is responsible for generation of DOM elements for elements matching generative rules
		var id = nextId++;
		// normalize to array
		generatingSelector = generatingSelector.sort ? generatingSelector : [generatingSelector];
		// return a function that can do the generation for each element that matches
		return function(element, item){
			var lastElement = element;
			var subId = 0;
			for(var i = 0, l = generatingSelector.length;i < l; i++){
				// go through each part in the selector/generation sequence
				var part = generatingSelector[i];
				try{
					if(part.eachProperty){
						// it's a rule or call
						if(part.args){
							if(part.operator == '('){ // a call (or at least parans), for now we are assuming it is a binding
								var nextPart = generatingSelector[i+1];
								if(nextPart && nextPart.eachProperty){
									// apply the class for the next part so we can reference it properly
									put(lastElement, nextPart.selector);
								}
								// TODO: make sure we only do this only once
								var expression = part.args.toString();
								var apply = evaluateExpression(part, 0, expression);
								(function(element, lastElement){
									when(apply, function(apply){
										// TODO: assess how we could propagate changes categorically
										if(apply.forElement){
											apply = apply.forElement(lastElement);
											// now apply.element should indicate the element that it is actually keying or varying on
										}
										var textNode = element.appendChild(doc.createTextNode("Loading"));
										apply.receive(function(value){
											if(value && value.sort){
												// if it is an array, we do iterative rendering
												if(textNode){
													// remove the loading node
													textNode.parentNode.removeChild(textNode);
													textNode = null;
												}
												var eachHandler = nextPart && nextPart.eachProperty && nextPart.get('each');
												// if "each" is defined, we will use it render each item
												if(eachHandler){
													eachHandler = generate(eachHandler, nextPart);
												}
												value.forEach(eachHandler ?
													function(value){
														// TODO: do this inside generate
														eachHandler(element, value);
													} :
													function(value){
														// if there no each handler, we use the default tag name for the parent
														put(element, childTagForParent[element.tagName] || 'div', value);
													});
											}else{
												if("value" in element){
													// add the text
													element.value= value;
													// we are going to store the variable computation on the element
													// so that on a change we can quickly do a put on it
													// we might want to consider changing that in the future, to
													// reduce memory, but for now this probably has minimal cost
													element['-x-variable'] = apply;
												}else{
													// put text in for Loading until we are ready
													// TODO: we should do this after setting up the receive in case we synchronously get the data
													// if not an array, render as plain text
													textNode.nodeValue = value;
												}
											}
										}, rule, expression);
									});
								})(lastElement, element);
							}else{// brackets
								put(lastElement, part.toString());
							}
						}else{
							// it is plain rule (not a call), we need to apply the auto-generated selector, so CSS is properly applied
							put(lastElement, part.selector);
							// do any elemental updates
							xstyle.update(lastElement, part.selector);
						}
					}else if(typeof part == 'string'){
						// actual CSS selector syntax, we generate the elements specified
						if(part.charAt(0) == '='){
							part = part.slice(1); // remove the '=' at the beginning
						}

						var children = part.split(',');
						for(var j = 0, cl = children.length;j < cl; j++){
							var child = children[j].trim();
							var reference = null;
							if(child){
								// TODO: inline our own put-selector code, and handle bindings
								child = child.replace(/\([^)]*\)/, function(expression){
									reference = expression;
								});
								var nextElement = put(j == 0 ? lastElement : element, child);
								if(item){
									// set the item property, so the item reference will work
									nextElement.item = item;
								}
								var nextPart = generatingSelector[i + 1];
								if(nextElement != lastElement && // avoid infinite loop if it is a nop selector
									(!nextPart || !nextPart.eachProperty) // if the next part is a rule, than it should be extending it already, so we don't want to double apply
									){
									xstyle.update(nextElement);
								}
								lastElement = nextElement;
							}
						}
					}else{
						// a string literal
						lastElement.appendChild(doc.createTextNode(part.value));
					}
				}catch(e){
					console.error(e, e.stack);
					lastElement.appendChild(doc.createTextNode(e));
				}
			}
			return lastElement;
		}
	}
	function evaluateExpression(rule, name, value){
		// evaluate a binding
		var binding = rule["var-expr-" + name];
		if(variables){
			return binding;
		}
		var variables = [], isElementDependent;
		variables.id = nextId++;
		var target, parameters = [], id = 0, callbacks = [],
			attributeParts, expression = value.join ? value.join("") : value.toString(),
			simpleExpression = expression.match(/^[\w_$\/\.-]*$/);
		// Do the parsing and function creation just once, and adapt the dependencies for the element at creation time
		// deal with an array, converting strings to JS-eval'able strings
			// find all the variables in the expression
		expression = expression.replace(/("[^\"]*")|([\w_$\.\/-]+)/g, function(t, string, variable){
			if(variable){
				// for each reference, we break apart into variable reference and property references after each dot
				attributeParts = variable.split('/');
				var parameterName = attributeParts.join('_');
				parameters.push(parameterName);
				variables.push(attributeParts);
				// first find the rule that is being referenced
				var firstReference = attributeParts[0];
				var target = resolveProperty(rule, firstReference);
				if(typeof target == 'string' || target instanceof Array){
					target = evaluateExpression(rule, firstReference, target);
				}else if(!target){
					throw new Error('Could not find reference "' + firstReference + '"');
				}
				if(target.forElement){
					isElementDependent = true;
				}
				attributeParts[0] = target;
				// we will reference the variable a function argument in the function we will create
				return parameterName;
			}
			return t;
		})

		if(simpleExpression){
			// a direct reversible reference
			// no forward reactive needed
			if(name){
				// create the reverse function
				var reversal = function(element, name, value){
					when(findAttributeInAncestors(element, attributeParts[0], attributeParts[1]), function(target){
						for(var i = 2; i < attributeParts.length -1; i++){
							var name = attributeParts[i];
							target = target.get ?
								target.get(name) :
								target[name];
						}
						var name = attributeParts[i];
						if(target.set){
							target.set(name, value);
						}else{
							target[name] = value;
						}
					});
				};
				reversal.rule = rule;
//				(reversalOfAttributes[name] || (reversalOfAttributes[name] = [])).push(reversal);
			}
		}else{
			// it's a full expression, so we create a time-varying bound function with the expression
			var reactiveFunction = Function.apply(this, parameters.concat(['return xstyleReturn(' + expression + ')']));
		}
		variables.func = reactiveFunction;
		rule["var-expr-" + name] = variables;
		function getComputation(){
			var waiting = variables.length + 1;
			var values = [], callbacks = [];
			var result, isResolved;
			var done = function(i){
				return function(value){
					values[i] = value;
					waiting--;
					if(waiting <= 0){
						isResolved = true;
						result = reactiveFunction ? reactiveFunction.apply(this, values) : values[0];
						for(var j = 0; j < callbacks.length;j++){
							callbacks[j](result);
						}
					}
				};
			};
			if(reactiveFunction){
				for(var i = 0; i < variables.length; i++){
					var variable = variables[i];
					get(variable[0], variable.slice(1), done(i));
				}
			}else{
				var variable = variables[0];
				var value = {
					then: function(callback){
						callbacks.push(callback);
					}
				}
				when(variable[0], function(resolved){
					value = resolved;
					for(var j = 1; j < variable.length; j++){
						if(value && value.get){
							value = value.get(variable[j]);
						}else{
							value = {
								receive: function(callback){
									get(resolved, variable.slice(1), callback);
								},
								put: function(value){
									set(resolve, variable.slice(1), value);
								}
							};
							break;
						}
					}
					for(var j = 0; j < callbacks.length; j++){
						callbacks[j](value);
					}
				});
				return value;
				if(first && first.then){
					return {
						then: function(callback){
							get(variable[0], variable.slice(1), callback);
						}
					};
				}else{
					return variable;
				}
			}
			done(-1)();
			if(result && result.then){
				return result;
			}
			return {
				receive: function(callback){
					if(callbacks){
						callbacks.push(callback);
					}
					if(isResolved){
						callback(result);
					}
				}
			}
		}
		return rule["var-expr-" + name] = isElementDependent ? {
			forElement: function(element){
				// TODO: at some point may make this async
				var callbacks = [];
				var mostSpecificElement;
				var elementVariables = [];
				// now find the element that matches that rule, in case we are dealing with a child
				var parentElement = element;
				while(!matchesSelector.call(element, rule.selector)){
					element = element.parentNode;
				}
				for(var i = 0; i < variables.length; i++){
					var variable = variables[i];
					var target = variable[0];
					// now find the element that is keyed on
					if(target.forElement){
						target = variable[0] = target.forElement(parentElement);
					}
					// we need to find the most parent element that we need to vary on for this computation
					var varyOnElement = target.element;
					if(parentElement != mostSpecificElement){
						while(parentElement != varyOnElement){
							if(parentElement == mostSpecificElement){
								return;
							}
							parentElement = parentElement.parentNode;
						}
						mostSpecificElement = parentElement;
					}
				}
				// make sure we indicate the store we are keying off of
				var computation = mostSpecificElement["expr-result-" + variables.id];
				if(!computation){
					mostSpecificElement["expr-result-" + variables.id] = computation = getComputation();
					computation.element = mostSpecificElement;
				}
				return computation;
			}
		} : getComputation();
	}
	function resolveProperty(rule, name, includeRules){
		var parentRule = rule;
		do{
			var target = parentRule.properties && parentRule.properties[name]
				|| (includeRules && parentRule.rules && parentRule.rules[name]);
			parentRule = parentRule.parent;
		}while(!target && parentRule);
		return target;
	}

	function extend(base, derivative){
		var newText = base.cssText;
		derivative.cssText += newText;
		'values,properties,variables,calls'.replace(/\w+/g, function(property){
			if(base[property]){
				derivative[property] = Object.create(base[property]);
			}
		});
		var cssRule = derivative.getCssRule();
		base.eachProperty(function(name, value){
			derivative.setValue(name, value);
			if(name){
				var ruleStyle = cssRule.style;
				if(!ruleStyle[name]){
					ruleStyle[name] = value;
				}
			}
		});
		if(base.generator){
			derivative.declareProperty(null, base.generator);
		}

	}
	var xstyle =  {
		process: checkImports,
		vendorPrefix: vendorPrefix,
		applyProperty: function(name, value){
			// basically a noop for most operations, we rely on the vendor prefixing in the main property parser
			if(name == "opacity" && vendorPrefix == "-ms-"){
				return 'filter: alpha(opacity=' + (value * 100) + '); zoom: 1;';
			}
			return vendorPrefix + name + ':' + value + ';';
		},
		onFunction: function(name, value, rule){
		},
		onCall: function(name, rule){
			// handle extends(selector)
			var args = rule.args;
			var extendingRule = rule.parent;
			function resolve(){
				var parentRule = extendingRule;
				var namespace = name == 'extends' ? 'rules' : 'variables';
				do{
					if(!parentRule){
						throw new Error('Could not find "' + args[0] + '" in the defined ' + namespace);
					}
					var target = parentRule[namespace] && parentRule[namespace][args[0]];
					parentRule = parentRule.parent;
				}while(!target);
				return target;
			}
			if(name == 'extends'){
				var target = resolve();
				extend(target, extendingRule);
/*			}else if(name == 'bind'){
				var result = evaluateExpression(extendingRule, null, args[0]);
				if(result.forElement){
					// it is element dependent, this means we need to use inline styles
					xstyle.addRenderer();
				}else{
					result.receive(function(value){
						extendingRule.addSheetRule(extendingRule, name + ': ' + extendingRule.get(name).replace(/bind\([^)]+\)/g, target))
					});
				}*/
			}else if(name == 'var'){
				// TODO: do we need to reevaluate the value based on the new context?
				return function(parentRule){
					parentRule.addSheetRule(parentRule.selector, parentRule.currentName + ': ' + parentRule.currentSequence.toString().replace(/var\([^)]+\)/g, resolve()));
				};
			}
		},
		parse: parse,

		addRenderer: function(propertyName, propertyValue, rule, handler){
			var renderer = {
				selector: rule.selector,
				propertyValue: propertyValue,
				name: propertyName,
				render: handler
			};
			// the main entry point for adding elemental handlers for a selector. The handler
			// will be called for each element that is created that matches a given selector
			selectorRenderers.push(renderer);
			if(documentQueried){
				findMatches(renderer);
			}
			renderWaiting();
			/*if(!matchesSelector){
				// create a custom property to identify this rule in created elements
				return (renderers.triggerProperty = 'selector_' + encodeURIComponent(selector).replace(/%/g, '/')) + ': 1;' +
					(document.querySelectorAll ? '' :
						// we use css expressions for IE6-7 to find new elements that match the selector, since qSA is not available, wonder if it is better to just use document.all...
						 'zoom: expression(cssxRegister(this,"' + selector +'"));');
			}*/
		},
		update: update, // this should be called for newly created dynamic elements to ensure the proper rules are applied
		clearRenderers: function(){
			// clears all the renderers in use
			selectorRenderers = [];
		},
		load:  function(resourceDef, require, callback, config){
			// support use an AMD plugin loader
			require(['xstyle/css'], function(plugin){
				plugin.load(resourceDef, require, callback, config);
			});
		}
	};
	return xstyle;

});
xstyleReturn = function(first){
	// global function used by the reactive functions to separate out comma-separated expressions into an array
	if(arguments.length == 1){
		// one arg, just return that
		return first;
	}
	// if it is a comma separated list of values, return them as an array
	return [].slice.call(arguments);
};


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--

    Licensed to Apereo under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Apereo licenses this file to you 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 the following location:

      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.

-->
<portlet-definition xmlns="https://source.jasig.org/schemas/uportal/io/portlet-definition" xmlns:ns2="https://source.jasig.org/schemas/uportal" xmlns:ns3="https://source.jasig.org/schemas/uportal/io/stylesheet-descriptor" xmlns:ns4="https://source.jasig.org/schemas/uportal/io/permission-owner" xmlns:ns5="https://source.jasig.org/schemas/uportal/io/subscribed-fragment" xmlns:ns6="https://source.jasig.org/schemas/uportal/io/event-aggregation" xmlns:ns7="https://source.jasig.org/schemas/uportal/io/user" xmlns:ns8="https://source.jasig.org/schemas/uportal/io/portlet-type" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4.0" xsi:schemaLocation="https://source.jasig.org/schemas/uportal/io/portlet-definition https://source.jasig.org/schemas/uportal/io/portlet-definition/portlet-definition-4.0.xsd">
    <title>Notification Icon</title>
    <name>Notification Icon</name>
    <fname>notification-icon</fname>
    <desc>Icon-based launcher for the Apereo Notification portlet designed for the pre-header region of the page</desc>
    <type>Portlet</type>
    <timeout>5000</timeout>
    <portlet-descriptor>
        <ns2:webAppName>/NotificationPortlet</ns2:webAppName>
        <ns2:portletName>NotificationIcon</ns2:portletName>
    </portlet-descriptor>
    <group>Authenticated Users</group>
    <parameter>
        <name>alternate</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>blockImpersonation</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>disableDynamicTitle</name>
        <value>true</value>
    </parameter>
    <parameter>
        <name>editable</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>hasAbout</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>hasHelp</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>hideFromMobile</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>highlight</name>
        <value>false</value>
    </parameter>
    <parameter>
        <name>iconUrl</name>
        <value>/ResourceServingWebapp/rs/tango/0.8.90/32x32/status/dialog-warning.png</value>
    </parameter>
    <parameter>
        <name>mobileIconUrl</name>
        <value>/uPortal/media/skins/icons/mobile/bullhorn.png</value>
    </parameter>
    <parameter>
        <name>showChrome</name>
        <value>true</value>
    </parameter>
    <portlet-preference>
        <name>DemoNotificationService.locations</name>
        <readOnly>false</readOnly>
        <value>demo/demoNotificationResponse2.json</value>
        <value>demo/demoNotificationResponse.json</value>
    </portlet-preference>
</portlet-definition>


text:
package org.kaaproject.kaa.client.channel;

/**
 * Interface for server information. Used by {@link KaaDataChannel} and
 * {@link KaaChannelManager}
 */
public interface TransportConnectionInfo {

    /**
     * Retrieves the channel's server type (i.e. OPERATIONS or BOOTSTRAP).
     *
     * @return the channel's server type.
     * @see ServerType
     *
     */
    ServerType getServerType();

    /**
     * Retrieves the {@link TransportProtocolId}.
     *
     * @return the transport protocol id.
     * @see TransportProtocolId
     *
     */
    TransportProtocolId getTransportId();

    /**
     * Retrieves the access point id (operations/bootstrap server id)
     *
     * @return access point id
     */
    int getAccessPointId();

    /**
     * Retrieves serialized connection properties. Serialization may be specific for each transport protocol implementation.
     * @return serialized connection properties
     */
    byte[] getConnectionInfo();
}