text:
#!/bin/bash

#https://docs.openclinica.com/3.1/installation/installation-linux

#colors
bldred='\e[1;31m' # Red
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
bldblu='\e[1;34m' # Blue
bldpur='\e[1;35m' # Purple
bldcyn='\e[1;36m' # Cyan
bldwht='\e[1;37m' # White
txtrst='\e[0m'

#dirs
OC_HOME="/usr/local/oc/install"
CAT_HOME="/usr/local/tomcat"
F_PATH=$CAT_HOME/files
CONFIG=$CAT_HOME/webapps/OpenClinica/WEB-INF/classes/datainfo.properties

#root
if [[ $EUID -ne 0 ]];
then
   echo -e "$bldred $0 must be run as root ONLY! Please use \"sudo $0\" or \"su\" commands $txtrst"
   exit 1
fi

#check dist
DIST=$(cat /etc/lsb-release | grep DISTRIB_ID |  awk -F '=' '{ print $2 }')

if [ "$DIST" == "Ubuntu" ]; then
  apt-get install unzip
elif [ "$DIST" == "RHEL"  ]; then
  yum install unzip
else
   echo -e "$bldred $0 Please install unzip.  $txtrst"
   return 0;
fi

####################### fucntions #######################
download()
{
    local url=$1
    echo -e "Dowloading: $url"
    wget -nc --progress=dot $url 2>&1|grep --line-buffered -o "[0-9]*%"|xargs -L1 echo -en "\b\b\b\b";
    echo -ne "\b\b\b\b"
    echo -e "$bldgrn DONE $txtrst"
}

#get os version
OS=$(uname -a |  awk -F ' ' '{ print $12 }')
echo -e "$bldylw You have $OS system.\n $txtrst"

#1
mkdir -p $OC_HOME
cd $OC_HOME

#2
if [ "$OS" == "x86_64" ];
 then
   #x64
   download http://svn.akazaresearch.com/oc/software/OpenClinica-3.1/linux/apache-tomcat-6.0.32.tar.gz
   download http://svn.akazaresearch.com/oc/software/OpenClinica-3.1/linux/jdk-6u24-linux-x64.bin
   download http://svn.akazaresearch.com/oc/software/OpenClinica-3.1/linux/postgresql-8.4.1-1-linux-x64.bin
 else
  #x32
   download http://svn.akazaresearch.com/oc/software/OpenClinica-3.1/linux/apache-tomcat-6.0.32.tar.gz
   download http://svn.akazaresearch.com/oc/software/OpenClinica-3.1/linux/jdk-6u24-linux-i586.bin
   download http://svn.akazaresearch.com/oc/software/OpenClinica-3.1/linux/postgresql-8.4.1-1-linux.bin
fi

#3
download https://community.openclinica.com/sites/fileuploads/akaza/cms-community/OpenClinica-3.1.4.1.zip
download https://community.openclinica.com/sites/fileuploads/akaza/cms-community/OpenClinica-ws-3.1.4.1.zip

#install java
echo -e "\n $bldblu Going to install Java 6 \t $txtrst"
chmod a+x jdk-6*
./jdk-6*
rm -rf /usr/local/jdk1*
rm -rf /usr/local/java
mv jdk1* /usr/local/
ln -s /usr/local/jdk1* /usr/local/java
echo "export JAVA_HOME=/usr/local/jdk1.6.0_24/" >> ~/.bashrc
export JAVA_HOME=/usr/local/jdk1.6.0_24/
echo -e "\n $bldylw Java has been installed \t $txtrst"

#install tomcat
echo -e "\n $bldblu Going to install Tomcat \t $txtrst"
cd $OC_HOME
tar -xvf apache-tomcat-* 2>&1 >/dev/null
rm -rf /usr/local/apache-tomcat-6.0.32/
mv apache-tomcat-6.0.32 /usr/local/
rm -f $CAT_HOME
ln -s /usr/local/apache-tomcat-6.0.32 $CAT_HOME
/usr/sbin/adduser tomcat
echo -e "\n $bldylw Making dir $CAT_HOME/oldwebapps $txtrst"
mkdir -p $CAT_HOME/oldwebapps
mv $CAT_HOME/webapps/* $CAT_HOME/oldwebapps
echo -e "\n $bldylw Tomcat has been installed \t $txtrst"

#install pgsql
echo -e "\n $bldblu Going to install PostgreSQL database \t $txtrst"
cd $OC_HOME
chmod a+x postgresql-8.4.*
./postgresql-8.4.* --mode text
echo -e "$bldcyn  Please, enter password \"postgres\" PostgreSQL database user (its need for setup procedure) and press [ENTER]: $txtrst"
read PPASSWD
echo -e "$bldcyn  Please, enter password for new PostgreSQL database clinica user (Please enter secure password) and press [ENTER]: $txtrst"
read NEW_USER_PWD
PGUSER=postgres
PGPASSWORD=$PPASSWD
export PGUSER PGPASSWORD
echo -e "$bldcyn  Please, enter DATA BASE NAME and press [ENTER] (standart db name: openclinica): $txtrst"
read DB_NAME

if [ -z "$DB_NAME" ]; then
    DB_NAME="openclinica"
fi
echo -e "\n $bldylw PostgreSQL database name is: $DB_NAME\t $txtrst"
/opt/PostgreSQL/8.4/bin/psql -U postgres -c "CREATE ROLE clinica LOGIN ENCRYPTED PASSWORD '$NEW_USER_PWD' SUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE"
/opt/PostgreSQL/8.4/bin/psql -U postgres -c "CREATE DATABASE $DB_NAME WITH ENCODING='UTF8' OWNER=clinica"
echo -e "\n $bldylw PostgreSQL database has been installed \t $txtrst"

#install OC
cd $OC_HOME
OC_NAME=$(ls OpenClinica*.zip | grep -iv ws)
unzip $OC_NAME
OC_NAME=$(echo $OC_NAME| awk -F '.zip' '{ print $1 }')
cd $OC_NAME/distribution
unzip OpenClinica.war -d OpenClinica
echo -e "\n $bldylw Coping to $CAT_HOME/webapps \t $txtrst"
cp -rf OpenClinica* $CAT_HOME/webapps
rm -f $CAT_HOME/webapps/OpenClinica.war
echo -e "\n $bldylw OpenClinica app has been copied to server dir \t $txtrst"

#install Web Services
cd $OC_HOME
unzip OpenClinica-ws*
cd OpenClinica-ws*/distribution
unzip OpenClinica-ws.war -d OpenClinica-ws
echo -e "\n $bldylw Coping to $CAT_HOME/webapps \t $txtrst"
cp -rf OpenClinica-ws* $CAT_HOME/webapps
rm -f $CAT_HOME/webapps/OpenClinica-ws.war
echo -e "\n $bldylw OpenClinica web services has been copied to server dir \t $txtrst"

#setup tomcat
echo -e "\n $bldblu Going to setup tomcat \t $txtrst"
cp $OC_HOME/$OC_NAME/install-docs/linux/tomcat /etc/init.d/
cd /etc/init.d
chmod a+x /etc/init.d/tomcat

if [ "$DIST" == "Ubuntu" ]; then
  update-rc.d tomcat defaults
elif [ "$DIST" == "RHEL"  ]; then
  /sbin/chkconfig --add tomcat
else
   echo -e "$bldred $0 Unknow dist. Please add \"/etc/init.d/tomcat\" to auto start manualy $txtrst"
fi

chown -R tomcat:tomcat /usr/local/tomcat/*
chown -R tomcat:tomcat /usr/local/apache-*

chmod -R 777 /usr/local/tomcat/*
chmod -R 777 /usr/local/apache-*

echo -e "\n $bldylw Going to put main configs to  $CONFIG \t $txtrst"
sed -i -r 's/dbPass=.*/dbPass='$PPASSWD'/' $CONFIG
sed -i -r 's/db=.*/db='$DB_NAME'/' $CONFIG
sed -i -r 's/filePath=.*/filePath=\/home\/tomcat\/'/'' $CONFIG

echo -e "$bldcyn  Please, enter your email [ENTER] (standart db name: admin@example.com): $txtrst"
read EMAIL

if [ -z "$EMAIL" ]; then
    EMAIL="admin@example.com"
fi

sed -i -r 's/adminEmail=.*/adminEmail='$EMAIL'/' $CONFIG
echo -e "\n $bldylw Please NOTE other parameter you can change at $CONFIG \t $txtrst"

sleep 20
#/etc/init.d/tomcat start
#/etc/init.d/tomcat status
mkdir -p /home/tomcat/
mkdir -p /home/tomcat/xslt
mkdir -p /home/tomcatxslt

chown -R tomcat:tomcat /home/tomcat/
chown -R tomcat:tomcat /home/tomcat/xslt
chown -R tomcat:tomcat /home/tomcatxslt

chmod -R 777  /home/tomcat/
chmod -R 777  /home/tomcat/xslt
chmod -R 777  /home/tomcatxslt

/usr/local/apache-tomcat-6.0.32/bin/startup.sh


text:
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class GameSet extends Model {

	public function home_points() {
		return $this->hasMany('App\Point')->where('team_id', $this->game->home_team->id);
	}

	public function away_points() {
		return $this->hasMany('App\Point')->where('team_id', $this->game->away_team->id);
	}

	public function game() {
		return $this->belongsTo('App\Game');
	}

}

redpajama_set_name: RedPajamaGithub


text:
module.exports = {
  description: "",
  ns: "react-material-ui",
  type: "ReactNode",
  dependencies: {
    npm: {
      "material-ui/TextField/TextFieldLabel": require('material-ui/TextField/TextFieldLabel')
    }
  },
  name: "TextFieldLabel",
  ports: {
    input: {
      children: {
        type: "array",
        propType: "node",
        name: "children",
        required: false
      },
      className: {
        type: "string",
        name: "className",
        required: false
      },
      disabled: {
        type: "boolean",
        name: "disabled",
        "default": false
      },
      htmlFor: {
        type: "string",
        name: "htmlFor",
        required: false
      },
      muiTheme: {
        type: "object",
        name: "muiTheme",
        required: true
      },
      onTouchTap: {
        title: "Enable onTouchTap",
        type: "boolean",
        name: "onTouchTap",
        required: false
      },
      shrink: {
        type: "boolean",
        name: "shrink",
        "default": false
      },
      shrinkStyle: {
        type: "object",
        name: "shrinkStyle",
        required: false
      },
      style: {
        type: "object",
        name: "style",
        required: false
      }
    },
    output: {
      component: {
        title: "TextFieldLabel",
        type: "Component"
      },
      onTouchTap: {
        type: "any"
      }
    }
  }
}


text:
![feettracking](src/feettracking.jpg)

Ein ferngesteuertes Auto war Grundlage des Hardware Hacks. Die Signale der Fernbedienung wurden durch [Fabian](https://github.com/fabiantheblind) durch die Signale in Form von den Besucher- und Klickzahlen der [Website der FH Potsdam](http://www.fh-potsdam.de/) ersetzt. Sie dienen als Input, während der Output eine von mir frei gewählte Visualisierung sein sollte.

So entstanden Schuhe, die die Besucherzahlen veranschaulichen, indem sie Schritte nach vorne sowie nach hinten machen. Die Signale werden minütlich verarbeitet; bei einer höheren Besucheranzahl bewegen sich die Schuhe nach vorne, bei wenig Besuchertraffic nach hinten.

![Innenleben](src/doku8-komplett.png)

In die Schuhe verbaut sind ein Arduino UNO, die Platine des ferngesteuerten Autos sowie eine Lötplatine, auf der unter anderem die H–Bridge platziert ist. Diese sorgt dafür, dass die Motoren vorwärts und rückwärts angesteuert werden können.

![Ansicht unten](src/doku4-motoschuh.png)

Die beiden "Walzen" (Motoren von Fishertechnik) sind genau so platziert, dass sie die Schuhe sowohl nach vorne als auch nach hinten transportieren können.

Trifft ein Signal ein, läuft jeder Schuh jeweils zwei Sekunden

#### MIT License

The MIT License (MIT)

Copyright (c) 2014 ameliekirchmeyer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
#include "fuse_dfs.h"
#include "fuse_init.h"
#include "fuse_options.h"
#include "fuse_context_handle.h"
#include "fuse_connect.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static void print_env_vars(void)
{
  const char *cp = getenv("CLASSPATH");
  const char *ld = getenv("LD_LIBRARY_PATH");

  ERROR("LD_LIBRARY_PATH=%s",ld == NULL ? "NULL" : ld);
  ERROR("CLASSPATH=%s",cp == NULL ? "NULL" : cp);
}

// Hacked up function to basically do:
//  protectedpaths = split(options.protected,':');

static void init_protectedpaths(dfs_context *dfs)
{
  char *tmp = options.protected;

  // handle degenerate case up front.
  if (tmp == NULL || 0 == *tmp) {
    dfs->protectedpaths = (char**)malloc(sizeof(char*));
    dfs->protectedpaths[0] = NULL;
    return;
  }

  if (options.debug) {
    print_options();
  }

  int i = 0;
  while (tmp && (NULL != (tmp = index(tmp,':')))) {
    tmp++; // pass the ,
    i++;
  }
  i++; // for the last entry
  i++; // for the final NULL
  dfs->protectedpaths = (char**)malloc(sizeof(char*)*i);
  assert(dfs->protectedpaths);
  tmp = options.protected;
  int j  = 0;
  while (NULL != tmp && j < i) {
    int length;
    char *eos = index(tmp,':');
    if (NULL != eos) {
      length = eos - tmp; // length of this value
    } else {
      length = strlen(tmp);
    }
    dfs->protectedpaths[j] = (char*)malloc(sizeof(char)*length+1);
    assert(dfs->protectedpaths[j]);
    memcpy(dfs->protectedpaths[j], tmp, length);
    dfs->protectedpaths[j][length] = '\0';
    if (eos) {
      tmp = eos + 1;
    } else {
      tmp = NULL;
    }
    j++;
  }
  dfs->protectedpaths[j] = NULL;
}

static void dfsPrintOptions(FILE *fp, const struct options *o)
{
  INFO("Mounting with options: [ protected=%s, nn_uri=%s, nn_port=%d, "
          "debug=%d, read_only=%d, initchecks=%d, "
          "no_permissions=%d, usetrash=%d, entry_timeout=%d, "
          "attribute_timeout=%d, rdbuffer_size=%zd, direct_io=%d, max_background=%d ]",
          (o->protected ? o->protected : "(NULL)"), o->nn_uri, o->nn_port,
          o->debug, o->read_only, o->initchecks,
          o->no_permissions, o->usetrash, o->entry_timeout,
          o->attribute_timeout, o->rdbuffer_size, o->direct_io, o->max_background);
}

void *dfs_init(struct fuse_conn_info *conn)
{
  int ret;

  //
  // Create a private struct of data we will pass to fuse here and which
  // will then be accessible on every call.
  //
  dfs_context *dfs = calloc(1, sizeof(*dfs));
  if (!dfs) {
    ERROR("FATAL: could not malloc dfs_context");
    exit(1);
  }

  // initialize the context
  dfs->debug                 = options.debug;
  dfs->usetrash              = options.usetrash;
  dfs->protectedpaths        = NULL;
  dfs->rdbuffer_size         = options.rdbuffer_size;
  dfs->direct_io             = options.direct_io;

  dfsPrintOptions(stderr, &options);

  init_protectedpaths(dfs);
  assert(dfs->protectedpaths != NULL);

  if (dfs->rdbuffer_size <= 0) {
    DEBUG("dfs->rdbuffersize <= 0 = %zd", dfs->rdbuffer_size);
    dfs->rdbuffer_size = 32768;
  }

  ret = fuseConnectInit(options.nn_uri, options.nn_port);
  if (ret) {
    ERROR("FATAL: dfs_init: fuseConnectInit failed with error %d!", ret);
    print_env_vars();
    exit(EXIT_FAILURE);
  }
  if (options.initchecks == 1) {
    ret = fuseConnectTest();
    if (ret) {
      ERROR("FATAL: dfs_init: fuseConnectTest failed with error %d!", ret);
      print_env_vars();
      exit(EXIT_FAILURE);
    }
  }

#ifdef FUSE_CAP_ATOMIC_O_TRUNC
  // If FUSE_CAP_ATOMIC_O_TRUNC is set, open("foo", O_CREAT | O_TRUNC) will
  // result in dfs_open being called with O_TRUNC.
  //
  // If this capability is not present, fuse will try to use multiple
  // operation to "simulate" open(O_TRUNC).  This doesn't work very well with
  // HDFS.
  // Unfortunately, this capability is only implemented on Linux 2.6.29 or so.
  // See HDFS-4140 for details.
  if (conn->capable & FUSE_CAP_ATOMIC_O_TRUNC) {
    conn->want |= FUSE_CAP_ATOMIC_O_TRUNC;
  }
#endif

#ifdef FUSE_CAP_ASYNC_READ
  // We're OK with doing reads at the same time as writes.
  if (conn->capable & FUSE_CAP_ASYNC_READ) {
    conn->want |= FUSE_CAP_ASYNC_READ;
  }
#endif

#ifdef FUSE_CAP_BIG_WRITES
  // Yes, we can read more than 4kb at a time.  In fact, please do!
  if (conn->capable & FUSE_CAP_BIG_WRITES) {
    conn->want |= FUSE_CAP_BIG_WRITES;
  }
#endif

#ifdef FUSE_CAP_DONT_MASK
  if ((options.no_permissions) && (conn->capable & FUSE_CAP_DONT_MASK)) {
    // If we're handing permissions ourselves, we don't want the kernel
    // applying its own umask.  HDFS already implements its own per-user
    // umasks!  Sadly, this only actually does something on kernels 2.6.31 and
    // later.
    conn->want |= FUSE_CAP_DONT_MASK;
  }
#endif

  return (void*)dfs;
}

void dfs_destroy(void *ptr)
{
  TRACE("destroy")
}


text:
package org.drools.compiler.lang.descr;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

public class EntryPointDeclarationDescr extends AnnotatedBaseDescr {

    private static final long            serialVersionUID = 530l;
    private String                       entryPoint = null;

    public EntryPointDeclarationDescr() {
        super();
    }

    @Override
    public void readExternal( ObjectInput in ) throws IOException,
                                              ClassNotFoundException {
        super.readExternal( in );
        this.entryPoint = (String) in.readObject();
    }

    @Override
    public void writeExternal( ObjectOutput out ) throws IOException {
        super.writeExternal( out );
        out.writeObject( entryPoint );
    }

    public void setEntryPointId( String name ) {
        this.entryPoint = name;
    }

    public String getEntryPointId() {
        return this.entryPoint;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((entryPoint == null) ? 0 : entryPoint.hashCode());
        return result;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals( Object obj ) {
        if ( this == obj ) return true;
        if ( obj == null ) return false;
        if ( getClass() != obj.getClass() ) return false;
        EntryPointDeclarationDescr other = (EntryPointDeclarationDescr) obj;
        if ( entryPoint == null ) {
            if ( other.entryPoint != null ) return false;
        } else if ( !entryPoint.equals( other.entryPoint ) ) return false;
        return true;
    }

}


text:
<?php

namespace app\assets;

use yii\web\AssetBundle;

class FrontendAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        'css/frontend/style.css',
//        'css/frontend/queryLoader2.css',
        'packages/font-awesome-4.7.0/font-awesome-animation.css',
        '/css/frontend/alerts.css',
        'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.7.2/css/bootstrap-slider.css',
        // 'fullcalendar-3.1.0/fullcalendar.print.min.css',
    ];
    public $js = [
    	// 'js/queryLoader/queryloader2.min.js'
    ];
    public $depends = [
        'app\assets\Html5ShivAsset',
        'app\assets\RespondAsset',
        'yii\web\YiiAsset',
        'yii\bootstrap\BootstrapAsset',
    ];
    public $jsOptions = ['position' => \yii\web\View::POS_END];
}


text:
<?php

namespace Juanber84\Bundle\ScheduleBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Juanber84\Bundle\ScheduleBundle\Entity\Jobs;
use Juanber84\Bundle\ScheduleBundle\Form\JobsType;

/**
 * Jobs controller.
 *
 * @Route("/schedule/jobs")
 */
class JobsController extends Controller
{

    /**
     * Lists all Jobs entities.
     *
     * @Route("/", name="schedule_jobs")
     * @Template()
     */
    public function indexAction(Request $request)
    {

        $em    = $this->get('doctrine.orm.entity_manager');

        if (true === $this->container->get('security.context')->isGranted('ROLE_ADMIN')) {
            $dql   = "SELECT a FROM 'Juanber84ScheduleBundle:Jobs' a";
            $users = $this->getDoctrine()->getRepository('Juanber84ScheduleBundle:User')->findAll();
            $arrayusers= array();
            foreach ($users as $value) {
                $arrayusers[$value->getId()] = $value->getUsername();
            }
        }else{
            $profileId  = $this->container->get('security.context')->getToken()->getUser()->getId();
            $dql   = "SELECT a FROM 'Juanber84ScheduleBundle:Jobs' a where a.userid = ".$profileId;
            $arrayusers = array('$profileId' => $this->container->get('security.context')->getToken()->getUser()->getUsername(), );
        }

        $projects = $this->getDoctrine()->getRepository('Juanber84ScheduleBundle:Project')->findAll();
        $arrayproyects = array();
        foreach ($projects as $value) {
            $arrayproyects[$value->getId()] = $value->getName();
        }
        $activities = $this->getDoctrine()->getRepository('Juanber84ScheduleBundle:Activity')->findAll();
        $arrayactivities = array();
        foreach ($activities as $value) {
            $arrayactivities[$value->getId()] = $value->getName();
        }
        $form = $this->createFormBuilder()
            ->add('Project', 'choice', array(
                'choices'   => $arrayproyects,
                'required'  => false,
            ))
            ->add('Activity', 'choice', array(
                'choices'   => $arrayactivities,
                'required'  => false,
            ))
            ->add('User', 'choice', array(
                'choices'   => $arrayusers,
                'required'  => false,
            ))
            ->add('Init', 'text', array(
                'required'  => false,
            ))
            ->add('End', 'text', array(
                'required'  => false,
            ))
            ->getForm();

        if ($request->getMethod() == 'POST') {
            $form->handleRequest($request);

            if ($form->isValid()) {
                $formrequest = $request->request->get('form');
                $param1 = '';
                if ($formrequest['Project'] != '') {
                    $param1 = ' and a.projectid ='.$formrequest['Project'];
                }
                $param2 = '';
                if ($formrequest['Activity'] != '') {
                    $param2 = ' and a.activityid ='.$formrequest['Activity'];
                }
                $param3 = '';
                if ($formrequest['User'] != '') {
                    $param3 = ' and a.userid ='.$formrequest['User'];
                }
                $param4 = '';
                if ($formrequest['Init'] != '') {
                    $param4 = " and a.initdatetime > '".$formrequest["Init"]." 00:00:00'";
                }
                $param5 = '';
                if ($formrequest['End'] != '') {
                    $param5 = " and a.enddatetime < '".$formrequest["End"]." 23:59:59'";
                }
                if (true === $this->container->get('security.context')->isGranted('ROLE_ADMIN')) {
                    $dql   = "SELECT a FROM 'Juanber84ScheduleBundle:Jobs' a where 1 = 1".$param1.$param2.$param3.$param4.$param5;
                    $users = $this->getDoctrine()->getRepository('Juanber84ScheduleBundle:User')->findAll();
                }else{
                    $profileId  = $this->container->get('security.context')->getToken()->getUser()->getId();
                    $dql   = "SELECT a FROM 'Juanber84ScheduleBundle:Jobs' a where a.userid = ".$profileId.$param1.$param2.$param3.$param4.$param5;
                    $users = array('$profileId' => $this->container->get('security.context')->getToken()->getUser()->getUsername(), );
                }
            }
        }

        $query = $em->createQuery($dql);
        $registers = $query->getResult();
        $numberregisters = count($query);
        $numberhours = 0;
        $raised = 0;
        foreach ($registers as $key => $value) {
            if ($value->getEnddatetime() != null ) {
                $timed = (strtotime($value->getEnddatetime()->format('Y-m-d H:i:s'))-strtotime($value->getInitdatetime()->format('Y-m-d H:i:s')))/60/60;
                if ($value->getProjectid()->getPrice() != '') {
                    $raised = $raised + ($value->getProjectid()->getPrice()*$timed);# code...
                }
                $numberhours = $numberhours + (strtotime($value->getEnddatetime()->format('Y-m-d H:i:s'))-strtotime($value->getInitdatetime()->format('Y-m-d H:i:s')));
            }
        }
        $hours = (int)($numberhours/60/60);
        $numberhours = $numberhours - ($hours*60*60);
        $minutes = (int)($numberhours/60);
        $seconds = $numberhours - ($minutes*60);
        $paginator  = $this->get('knp_paginator');
        $pagination = $paginator->paginate(
            $query,
            $this->get('request')->query->get('page', 1)/*page number*/,
            10/*limit per page*/
        );

        return array(
            'pagination'        => $pagination,
            'form'              => $form->createView(),
            'numberregisters'   => $numberregisters,
            'hours'             => $hours,
            'minutes'           => $minutes,
            'seconds'           => $seconds,
            'raised'            => $raised,
        );
    }

    /**
     * Creates a new Jobs entity.
     *
     * @Route("/create", name="schedule_jobs_create")
     * @Method("POST")
     * @Template("Juanber84ScheduleBundle:Jobs:new.html.twig")
     */
    public function createAction(Request $request)
    {
        $entity  = new Jobs();
        $form = $this->createForm(new JobsType(), $entity);
        $form->submit($request);

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

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

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Displays a form to create a new Jobs entity.
     *
     * @Route("/new", name="schedule_jobs_new")
     * @Method("GET")
     * @Template()
     */
    public function newAction()
    {
        $entity = new Jobs();
        $form   = $this->createForm(new JobsType(), $entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Finds and displays a Jobs entity.
     *
     * @Route("/{id}", name="schedule_jobs_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        if (true === $this->container->get('security.context')->isGranted('ROLE_ADMIN')) {
            $entity = $em->getRepository('Juanber84ScheduleBundle:Jobs')->find($id);
        }else{
            $profileId  = $this->container->get('security.context')->getToken()->getUser()->getId();
            $entity = $em->getRepository('Juanber84ScheduleBundle:Jobs')->findOneBy(array('id' => $id, 'userid' => $profileId ));
        }

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Jobs entity or you dont have permisions.');
        }

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

        return array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Displays a form to edit an existing Jobs entity.
     *
     * @Route("/{id}/edit", name="schedule_jobs_edit")
     * @Method("GET")
     * @Template()
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        if (true === $this->container->get('security.context')->isGranted('ROLE_ADMIN')) {
            $entity = $em->getRepository('Juanber84ScheduleBundle:Jobs')->find($id);
        }else{
            $profileId  = $this->container->get('security.context')->getToken()->getUser()->getId();
            $entity = $em->getRepository('Juanber84ScheduleBundle:Jobs')->findOneBy(array('id' => $id, 'userid' => $profileId ));
        }

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Jobs entity or you dont have permisions.');
        }

        $editForm = $this->createForm(new JobsType(), $entity);
        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Edits an existing Jobs entity.
     *
     * @Route("/{id}", name="schedule_jobs_update")
     * @Method("PUT")
     * @Template("Juanber84ScheduleBundle:Jobs:edit.html.twig")
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        if (true === $this->container->get('security.context')->isGranted('ROLE_ADMIN')) {
            $entity = $em->getRepository('Juanber84ScheduleBundle:Jobs')->find($id);
        }else{
            $profileId  = $this->container->get('security.context')->getToken()->getUser()->getId();
            $entity = $em->getRepository('Juanber84ScheduleBundle:Jobs')->findOneBy(array('id' => $id, 'userid' => $profileId ));
        }

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Jobs entity or you dont have permisions.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createForm(new JobsType(), $entity);
        $editForm->submit($request);

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

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

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
    /**
     * Deletes a Jobs entity.
     *
     * @Route("/{id}", name="schedule_jobs_delete")
     * @Method("DELETE")
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->submit($request);

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

            if (true === $this->container->get('security.context')->isGranted('ROLE_ADMIN')) {
                $entity = $em->getRepository('Juanber84ScheduleBundle:Jobs')->find($id);
            }else{
                $profileId  = $this->container->get('security.context')->getToken()->getUser()->getId();
                $entity = $em->getRepository('Juanber84ScheduleBundle:Jobs')->findOneBy(array('id' => $id, 'userid' => $profileId ));
            }

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Jobs entity or you dont have permisions.');
            }

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

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

    /**
     * Creates a form to delete a Jobs entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder(array('id' => $id))
            ->add('id', 'hidden')
            ->getForm()
        ;
    }
}


text:
import datetime
import os
from collections import defaultdict

from django import forms
from django.conf import settings

import basket
import happyforms
import waffle
from tower import ugettext as _, ugettext_lazy as _lazy

import amo
from addons.models import Addon, AddonUpsell, BlacklistedSlug, Webapp
from amo.utils import slug_validator
from apps.users.models import UserNotification
from apps.users.notifications import app_surveys
from editors.models import RereviewQueue
from files.models import FileUpload
from files.utils import parse_addon
from market.models import AddonPremium, Price
from translations.fields import TransField
from translations.forms import TranslationFormMixin
from translations.widgets import TransInput, TransTextarea

from mkt.constants import APP_FEATURES, FREE_PLATFORMS, PAID_PLATFORMS
from mkt.site.forms import AddonChoiceField, APP_PUBLIC_CHOICES
from mkt.webapps.models import AppFeatures
from mkt.developers.forms import verify_app_domain

def mark_for_rereview(addon, added_devices, removed_devices):
    msg = _(u'Device(s) changed: {0}').format(', '.join(
        [_(u'Added {0}').format(unicode(amo.DEVICE_TYPES[d].name))
         for d in added_devices] +
        [_(u'Removed {0}').format(unicode(amo.DEVICE_TYPES[d].name))
         for d in removed_devices]))
    RereviewQueue.flag(addon, amo.LOG.REREVIEW_DEVICES_ADDED, msg)

def mark_for_rereview_features_change(addon, added_features, removed_features):
    # L10n: {0} is the list of requirements changes.
    msg = _(u'Requirements changed: {0}').format(', '.join(
        [_(u'Added {0}').format(f) for f in added_features] +
        [_(u'Removed {0}').format(f) for f in removed_features]))
    RereviewQueue.flag(addon, amo.LOG.REREVIEW_FEATURES_CHANGED, msg)

class DeviceTypeForm(happyforms.Form):
    ERRORS = {
        'both': _lazy(u'Cannot be free and paid.'),
        'none': _lazy(u'Please select a device.'),
        'packaged': _lazy(u'Packaged apps are not yet supported for those '
                          u'platforms.'),
    }

    free_platforms = forms.MultipleChoiceField(
        choices=FREE_PLATFORMS(), required=False)
    paid_platforms = forms.MultipleChoiceField(
        choices=PAID_PLATFORMS(), required=False)

    def save(self, addon, is_paid):
        data = self.cleaned_data[
            'paid_platforms' if is_paid else 'free_platforms']
        submitted_data = self.get_devices(t.split('-', 1)[1] for t in data)

        new_types = set(dev.id for dev in submitted_data)
        old_types = set(amo.DEVICE_TYPES[x.id].id for x in addon.device_types)

        added_devices = new_types - old_types
        removed_devices = old_types - new_types

        for d in added_devices:
            addon.addondevicetype_set.create(device_type=d)
        for d in removed_devices:
            addon.addondevicetype_set.filter(device_type=d).delete()

        # Send app to re-review queue if public and new devices are added.
        if added_devices and addon.status in amo.WEBAPPS_APPROVED_STATUSES:
            mark_for_rereview(addon, added_devices, removed_devices)

    def _add_error(self, msg):
        self._errors['free_platforms'] = self._errors['paid_platforms'] = (
            self.ERRORS[msg])

    def _get_combined(self):
        devices = (self.cleaned_data.get('free_platforms', []) +
                   self.cleaned_data.get('paid_platforms', []))
        return set(d.split('-', 1)[1] for d in devices)

    def _set_packaged_errors(self):
        """Add packaged-app submission errors for incompatible platforms."""
        devices = self._get_combined()
        bad_android = (
            not waffle.flag_is_active(self.request, 'android-packaged') and
            ('android-mobile' in devices or 'android-tablet' in devices)
        )
        bad_desktop = (
            not waffle.flag_is_active(self.request, 'desktop-packaged') and
            'desktop' in devices
        )
        if bad_android or bad_desktop:
            self._errors['free_platforms'] = self._errors['paid_platforms'] = (
                self.ERRORS['packaged'])

    def clean(self):
        data = self.cleaned_data
        paid = data.get('paid_platforms', [])
        free = data.get('free_platforms', [])

        # Check that they didn't select both.
        if free and paid:
            self._add_error('both')
            return data

        # Check that they selected one.
        if not free and not paid:
            self._add_error('none')
            return data

        return super(DeviceTypeForm, self).clean()

    def get_devices(self, source=None):
        """Returns a device based on the requested free or paid."""
        if source is None:
            source = self._get_combined()

        platforms = {'firefoxos': amo.DEVICE_GAIA,
                     'desktop': amo.DEVICE_DESKTOP,
                     'android-mobile': amo.DEVICE_MOBILE,
                     'android-tablet': amo.DEVICE_TABLET}
        return map(platforms.get, source)

    def is_paid(self):
        return bool(self.cleaned_data.get('paid_platforms', False))

    def get_paid(self):
        """Returns the premium type. Should not be used if the form is used to
        modify an existing app.

        """

        return amo.ADDON_PREMIUM if self.is_paid() else amo.ADDON_FREE

class DevAgreementForm(happyforms.Form):
    read_dev_agreement = forms.BooleanField(label=_lazy(u'Agree and Continue'),
                                            widget=forms.HiddenInput)
    newsletter = forms.BooleanField(required=False, label=app_surveys.label,
                                    widget=forms.CheckboxInput)

    def __init__(self, *args, **kw):
        self.instance = kw.pop('instance')
        super(DevAgreementForm, self).__init__(*args, **kw)

    def save(self):
        self.instance.read_dev_agreement = datetime.datetime.now()
        self.instance.save()
        if self.cleaned_data.get('newsletter'):
            UserNotification.update_or_create(user=self.instance,
                notification_id=app_surveys.id, update={'enabled': True})
            basket.subscribe(self.instance.email,
                             'app-dev',
                             format='H',
                             source_url=os.path.join(settings.SITE_URL,
                                                     'developers/submit'))

class NewWebappVersionForm(happyforms.Form):
    upload_error = _lazy(u'There was an error with your upload. '
                         u'Please try again.')
    upload = forms.ModelChoiceField(widget=forms.HiddenInput,
        queryset=FileUpload.objects.filter(valid=True),
        error_messages={'invalid_choice': upload_error})

    def __init__(self, *args, **kw):
        request = kw.pop('request', None)
        self.addon = kw.pop('addon', None)
        self._is_packaged = kw.pop('is_packaged', False)
        super(NewWebappVersionForm, self).__init__(*args, **kw)

        if (not waffle.flag_is_active(request, 'allow-b2g-paid-submission')
            and 'paid_platforms' in self.fields):
            del self.fields['paid_platforms']

    def clean(self):
        data = self.cleaned_data
        if 'upload' not in self.cleaned_data:
            self._errors['upload'] = self.upload_error
            return

        if self.is_packaged():
            # Now run the packaged app check, done in clean, because
            # clean_packaged needs to be processed first.
            try:
                pkg = parse_addon(data['upload'], self.addon)
            except forms.ValidationError, e:
                self._errors['upload'] = self.error_class(e.messages)
                return

            ver = pkg.get('version')
            if (ver and self.addon and
                self.addon.versions.filter(version=ver).exists()):
                self._errors['upload'] = _(u'Version %s already exists') % ver
                return

            origin = pkg.get('origin')
            if origin:
                try:
                    origin = verify_app_domain(origin, packaged=True,
                                               exclude=self.addon)
                except forms.ValidationError, e:
                    self._errors['upload'] = self.error_class(e.messages)
                    return
                if origin:
                    data['origin'] = origin

        else:
            # Throw an error if this is a dupe.
            # (JS sets manifest as `upload.name`.)
            try:
                verify_app_domain(data['upload'].name)
            except forms.ValidationError, e:
                self._errors['upload'] = self.error_class(e.messages)
                return

        return data

    def is_packaged(self):
        return self._is_packaged

class NewWebappForm(DeviceTypeForm, NewWebappVersionForm):
    upload = forms.ModelChoiceField(widget=forms.HiddenInput,
        queryset=FileUpload.objects.filter(valid=True),
        error_messages={'invalid_choice': _lazy(
            u'There was an error with your upload. Please try again.')})
    packaged = forms.BooleanField(required=False)

    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request', None)
        super(NewWebappForm, self).__init__(*args, **kwargs)
        if 'paid_platforms' in self.fields:
            self.fields['paid_platforms'].choices = PAID_PLATFORMS(
                self.request)

    def _add_error(self, msg):
        self._errors['free_platforms'] = self._errors['paid_platforms'] = (
            self.ERRORS[msg])

    def clean(self):
        data = super(NewWebappForm, self).clean()
        if not data:
            return

        if self.is_packaged():
            self._set_packaged_errors()
            if self._errors.get('free_platforms'):
                return

        return data

    def is_packaged(self):
        return self._is_packaged or self.cleaned_data.get('packaged', False)

class UpsellForm(happyforms.Form):
    price = forms.ModelChoiceField(queryset=Price.objects.active(),
                                   label=_lazy(u'App Price'),
                                   empty_label=None,
                                   required=True)
    make_public = forms.TypedChoiceField(choices=APP_PUBLIC_CHOICES,
                                    widget=forms.RadioSelect(),
                                    label=_lazy(u'When should your app be '
                                                 'made available for sale?'),
                                    coerce=int,
                                    required=False)
    free = AddonChoiceField(queryset=Addon.objects.none(),
        required=False, empty_label='',
        # L10n: "App" is a paid version of this app. "from" is this app.
        label=_lazy(u'App to upgrade from'),
        widget=forms.Select())

    def __init__(self, *args, **kw):
        self.extra = kw.pop('extra')
        self.request = kw.pop('request')
        self.addon = self.extra['addon']

        if 'initial' not in kw:
            kw['initial'] = {}

        kw['initial']['make_public'] = amo.PUBLIC_IMMEDIATELY
        if self.addon.premium:
            kw['initial']['price'] = self.addon.premium.price

        super(UpsellForm, self).__init__(*args, **kw)
        self.fields['free'].queryset = (self.extra['amo_user'].addons
                                    .exclude(pk=self.addon.pk)
                                    .filter(premium_type__in=amo.ADDON_FREES,
                                            status__in=amo.VALID_STATUSES,
                                            type=self.addon.type))

        if len(self.fields['price'].choices) > 1:
            # Tier 0 (Free) should not be the default selection.
            self.initial['price'] = (Price.objects.active()
                                     .exclude(price='0.00')[0])

    def clean_make_public(self):
        return (amo.PUBLIC_WAIT if self.cleaned_data.get('make_public')
                                else None)

    def save(self):
        if 'price' in self.cleaned_data:
            premium = self.addon.premium
            if not premium:
                premium = AddonPremium()
                premium.addon = self.addon
            premium.price = self.cleaned_data['price']
            premium.save()

        upsell = self.addon.upsold
        if self.cleaned_data['free']:

            # Check if this app was already a premium version for another app.
            if upsell and upsell.free != self.cleaned_data['free']:
                upsell.delete()

            if not upsell:
                upsell = AddonUpsell(premium=self.addon)
            upsell.free = self.cleaned_data['free']
            upsell.save()
        elif upsell:
            upsell.delete()

        self.addon.update(make_public=self.cleaned_data['make_public'])

class AppDetailsBasicForm(TranslationFormMixin, happyforms.ModelForm):
    """Form for "Details" submission step."""

    app_slug = forms.CharField(max_length=30,
                           widget=forms.TextInput(attrs={'class': 'm'}))
    description = TransField(required=True,
        label=_lazy(u'Description:'),
        help_text=_lazy(u'This description will appear on the details page.'),
        widget=TransTextarea(attrs={'rows': 4}))
    privacy_policy = TransField(widget=TransTextarea(attrs={'rows': 6}),
        label=_lazy(u'Privacy Policy:'),
        help_text=_lazy(u"A privacy policy that explains what "
                         "data is transmitted from a user's computer and how "
                         "it is used is required."))
    homepage = TransField.adapt(forms.URLField)(required=False,
        label=_lazy(u'Homepage:'),
        help_text=_lazy(u'If your app has another homepage, enter its address '
                         'here.'),
        widget=TransInput(attrs={'class': 'full'}))
    support_url = TransField.adapt(forms.URLField)(required=False,
        label=_lazy(u'Support Website:'),
        help_text=_lazy(u'If your app has a support website or forum, enter '
                         'its address here.'),
        widget=TransInput(attrs={'class': 'full'}))
    support_email = TransField.adapt(forms.EmailField)(
        label=_lazy(u'Support Email:'),
        help_text=_lazy(u'This email address will be listed publicly on the '
                        u'Marketplace and used by end users to contact you '
                        u'with support issues. This email address will be '
                        u'listed publicly on your app details page.'),
        widget=TransInput(attrs={'class': 'full'}))
    flash = forms.TypedChoiceField(required=False,
        coerce=lambda x: bool(int(x)),
        label=_lazy(u'Does your app require Flash support?'),
        initial=0,
        choices=(
            (1, _lazy(u'Yes')),
            (0, _lazy(u'No')),
        ),
        widget=forms.RadioSelect)
    publish = forms.BooleanField(required=False, initial=1,
        label=_lazy(u"Publish my app in the Firefox Marketplace as soon as "
                     "it's reviewed."),
        help_text=_lazy(u"If selected your app will be published immediately "
                         "following its approval by reviewers.  If you don't "
                         "select this option you will be notified via email "
                         "about your app's approval and you will need to log "
                         "in and manually publish it."))

    class Meta:
        model = Addon
        fields = ('app_slug', 'description', 'privacy_policy', 'homepage',
                  'support_url', 'support_email')

    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request')
        super(AppDetailsBasicForm, self).__init__(*args, **kwargs)

    def clean_app_slug(self):
        slug = self.cleaned_data['app_slug']
        slug_validator(slug, lower=False)

        if slug != self.instance.app_slug:
            if Webapp.objects.filter(app_slug=slug).exists():
                raise forms.ValidationError(
                    _('This slug is already in use. Please choose another.'))

            if BlacklistedSlug.blocked(slug):
                raise forms.ValidationError(
                    _('The slug cannot be "%s". Please choose another.'
                      % slug))

        return slug.lower()

    def save(self, *args, **kw):
        uses_flash = self.cleaned_data.get('flash')
        af = self.instance.get_latest_file()
        if af is not None:
            af.update(uses_flash=bool(uses_flash))

        form = super(AppDetailsBasicForm, self).save(commit=False)
        form.save()

        return form

class AppFeaturesForm(happyforms.ModelForm):
    class Meta:
        exclude = ['version']
        model = AppFeatures

    def __init__(self, *args, **kwargs):
        super(AppFeaturesForm, self).__init__(*args, **kwargs)
        if self.instance:
            self.initial_features = sorted(self.instance.to_keys())
        else:
            self.initial_features = None

    def all_fields(self):
        """
        Degeneratorizes self.__iter__(), the list of fields on the form. This
        allows further manipulation of fields: to display a subset of fields or
        order them in a specific way.
        """
        return [f for f in self.__iter__()]

    def required_api_fields(self):
        """
        All fields on the form, alphabetically sorted by help text.
        """
        return sorted(self.all_fields(), key=lambda x: x.help_text)

    def get_tooltip(self, field):
        field_id = field.name.split('_', 1)[1].upper()
        return (unicode(APP_FEATURES[field_id].get('description') or '') if
                field_id in APP_FEATURES else None)

    def _changed_features(self):
        old_features = defaultdict.fromkeys(self.initial_features, True)
        old_features = set(unicode(f) for f
                           in AppFeatures(**old_features).to_list())
        new_features = set(unicode(f) for f in self.instance.to_list())

        added_features = new_features - old_features
        removed_features = old_features - new_features
        return added_features, removed_features

    def save(self, *args, **kwargs):
        mark_for_rereview = kwargs.pop('mark_for_rereview', True)
        addon = self.instance.version.addon
        rval = super(AppFeaturesForm, self).save(*args, **kwargs)
        if (self.instance and mark_for_rereview and
                addon.status in amo.WEBAPPS_APPROVED_STATUSES and
                sorted(self.instance.to_keys()) != self.initial_features):
            added_features, removed_features = self._changed_features()
            mark_for_rereview_features_change(addon,
                                              added_features,
                                              removed_features)
        return rval


text:
import pattern from "./pat-redactor";
import utils from "@patternslib/patternslib/src/core/utils";

describe("pat-redactor", () => {
    beforeEach(() => {
        document.body.innerHTML = "";
    });

    it("is initialized correctly", async () => {
        document.body.innerHTML = `
          <textarea class="pat-redactor"></textarea>
        `;

        pattern.init(document.querySelector(".pat-redactor"));
        await utils.timeout(1);

        expect(document.querySelectorAll(".redactor-toolbar").length).toBe(1);
    });
});


text:
title: Multiple Pointers
page_title: Multiple Pointers - RadGauge
description: Check our Web Forms article about Multiple Pointers.
slug: gauge/gauge-types/multiple-pointers
tags: multiple,pointers
published: True
position: 2
---

# Multiple Pointers

As for **Q1 2015**, you can add multiple pointers in a	RadGauge control by using the Pointers collection. It is available for	both the [Linear Gauge]({%slug gauge/gauge-types/linear%}) and the [Radial Gauge]({%slug gauge/gauge-types/radial%}) (**Figure 1**).

>caption Figure 1: Multiple pointers in Linear Gauge and Radial Gauge.

![gauge-multiple-pointers](images/gauge-multiple-pointers.png)

## Adding Pointers

You can add multiple pointers in a **RadGauge** control by using the **Pointers** collection and add LinearPointeritems for a **LinearGauge** and **RadialPointer** items for a **RadialGauge**.

**Figure 1** shows two gauge controls with multiple pointers and you can examine the code that renders them in **Example 1** and **Example 2**.

>important Note that the **Pointer** inner tag used together with the **Pointers** collection is not a valid scenario.	If it happens that both are added to one **RadGauge** configuration, the multiple pointers will overwrite	the single one and it won't be rendered.

The style and value options available for each type of the multiple pointers are the same as the ones exposed for the single pointer.You can learn more about the available properties for [Linear Gauge]({%slug gauge/gauge-types/linear%}) itemsand for the [Radial Gauge]({%slug gauge/gauge-types/radial%}).

In **Figure 1** are shown the two gauge controls with multiple pointers added, whereas in	**Example 1** you can examine the code that renders them.

>caption Example 1: Adding pointers in the Pointers collection of Linear Gauge and Radial Gauge in the markup.

````ASP.NET
<telerik:RadLinearGauge runat="server" ID="RadLinearGauge1" Width="100px" Height="300px">
	<Pointers>
		<telerik:LinearPointer Value="12" Margin="10" Shape="BarIndicator" Color="#1b8892"></telerik:LinearPointer>
		<telerik:LinearPointer Value="35" Margin="19" Shape="BarIndicator" Color="#56c3cd"></telerik:LinearPointer>
		<telerik:LinearPointer Value="80" Margin="28" Shape="BarIndicator" Color="#9fe8ef"></telerik:LinearPointer>
	</Pointers>
</telerik:RadLinearGauge>
<telerik:RadRadialGauge runat="server" ID="RadRadialGauge1" Width="300px" Height="300px">
	<Pointers>
		<telerik:RadialPointer Value="2" Cap-Size="0.2" Color="#1b8892"></telerik:RadialPointer>
		<telerik:RadialPointer Value="35" Cap-Size="0.15" Color="#56c3cd"></telerik:RadialPointer>
		<telerik:RadialPointer Value="80" Cap-Size="0.1" Color="#9fe8ef"></telerik:RadialPointer>
	</Pointers>
</telerik:RadRadialGauge>
````

>caption Example 2: Adding pointers in the Pointers collection via the code behind.

````ASP.NET
<telerik:RadLinearGauge runat="server" ID="RadLinearGauge1" Width="100px" Height="300px">
</telerik:RadLinearGauge>

<telerik:RadRadialGauge runat="server" ID="RadRadialGauge1" Width="300px" Height="300px">
</telerik:RadRadialGauge>
````

````C#
protected void Page_Load(object sender, EventArgs e)
{
	LinearPointer linearPointer1 = new LinearPointer();
	linearPointer1.Value = 12;
	linearPointer1.Margin = 10;
	linearPointer1.Shape = Telerik.Web.UI.Gauge.PointerShape.BarIndicator;
	linearPointer1.Color = ColorTranslator.FromHtml("#1b8892");

	LinearPointer linearPointer2 = new LinearPointer();
	linearPointer2.Value = 35;
	linearPointer2.Margin = 19;
	linearPointer2.Shape = Telerik.Web.UI.Gauge.PointerShape.BarIndicator;
	linearPointer2.Color = ColorTranslator.FromHtml("#56c3cd");

	LinearPointer linearPointer3 = new LinearPointer();
	linearPointer3.Value = 80;
	linearPointer3.Margin = 28;
	linearPointer3.Shape = Telerik.Web.UI.Gauge.PointerShape.BarIndicator;
	linearPointer3.Color = ColorTranslator.FromHtml("#9fe8ef");

	RadLinearGauge1.Pointers.Add(linearPointer1);
	RadLinearGauge1.Pointers.Add(linearPointer2);
	RadLinearGauge1.Pointers.Add(linearPointer3);

	RadialPointer radialPointer1 = new RadialPointer();
	radialPointer1.Value = 2;
	radialPointer1.Cap.Size = 0.2f;
	radialPointer1.Color = ColorTranslator.FromHtml("#1b8892");

	RadialPointer radialPointer2 = new RadialPointer();
	radialPointer2.Value = 35;
	radialPointer2.Cap.Size = 0.15f;
	radialPointer2.Color = ColorTranslator.FromHtml("#56c3cd");

	RadialPointer radialPointer3 = new RadialPointer();
	radialPointer3.Value = 80;
	radialPointer3.Cap.Size = 0.1f;
	radialPointer3.Color = ColorTranslator.FromHtml("#9fe8ef");

	RadRadialGauge1.Pointers.Add(radialPointer1);
	RadRadialGauge1.Pointers.Add(radialPointer2);
	RadRadialGauge1.Pointers.Add(radialPointer3);
}
````
````VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
	Dim linearPointer1 As New LinearPointer()
	linearPointer1.Value = 12
	linearPointer1.Margin = 10
	linearPointer1.Shape = Telerik.Web.UI.Gauge.PointerShape.BarIndicator
	linearPointer1.Color = ColorTranslator.FromHtml("#1b8892")

	Dim linearPointer2 As New LinearPointer()
	linearPointer2.Value = 35
	linearPointer2.Margin = 19
	linearPointer2.Shape = Telerik.Web.UI.Gauge.PointerShape.BarIndicator
	linearPointer2.Color = ColorTranslator.FromHtml("#56c3cd")

	Dim linearPointer3 As New LinearPointer()
	linearPointer3.Value = 80
	linearPointer3.Margin = 28
	linearPointer3.Shape = Telerik.Web.UI.Gauge.PointerShape.BarIndicator
	linearPointer3.Color = ColorTranslator.FromHtml("#9fe8ef")

	RadLinearGauge1.Pointers.Add(linearPointer1)
	RadLinearGauge1.Pointers.Add(linearPointer2)
	RadLinearGauge1.Pointers.Add(linearPointer3)

	Dim radialPointer1 As New RadialPointer()
	radialPointer1.Value = 2
	radialPointer1.Cap.Size = 0.2F
	radialPointer1.Color = ColorTranslator.FromHtml("#1b8892")

	Dim radialPointer2 As New RadialPointer()
	radialPointer2.Value = 35
	radialPointer2.Cap.Size = 0.15F
	radialPointer2.Color = ColorTranslator.FromHtml("#56c3cd")

	Dim radialPointer3 As New RadialPointer()
	radialPointer3.Value = 80
	radialPointer3.Cap.Size = 0.1F
	radialPointer3.Color = ColorTranslator.FromHtml("#9fe8ef")

	RadRadialGauge1.Pointers.Add(radialPointer1)
	RadRadialGauge1.Pointers.Add(radialPointer2)
	RadRadialGauge1.Pointers.Add(radialPointer3)

End Sub
````

## See Also

 * [RadGauge Structure]({%slug gauge/radgauge-structure%})

 * [Linear]({%slug gauge/gauge-types/linear%})

 * [Radial]({%slug gauge/gauge-types/radial%})

 * [Demo: Multiple Pointers](https://demos.telerik.com/aspnet-ajax/gauge/examples/multiplepointers/defaultcs.aspx)


text:
import { Component } from '@angular/core';

/**
 * This class represents the Side Panel component.
 */
@Component({
    selector: 'uxg-side-panel',
    templateUrl: 'side-panel.component.html',
    styleUrls: ['side-panel.component.css']
})

export class SidePanelComponent {}


text:
paasta\_tools.api.views.instance module
=======================================

.. automodule:: paasta_tools.api.views.instance
   :members:
   :undoc-members:
   :show-inheritance:


text:
@interface M3U8MasterPlaylist : NSObject

@property (readonly, nonatomic, copy) NSString *originalText;
@property (readonly, nonatomic, strong) NSURL *baseURL;

@property (readonly, nonatomic, strong) M3U8ExtXStreamInfList *xStreamList;
@property (readonly, nonatomic, strong) M3U8ExtXMediaList *xMediaList;

- (instancetype)initWithContent:(NSString *)string baseURL:(NSURL *)baseURL;

- (instancetype)initWithContentOfURL:(NSURL *)URL error:(NSError **)error;

@end