text:
<?php

namespace Explotic\TiersBundle\Controller;

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

use Explotic\TiersBundle\Entity\Stagiaire;
use Explotic\TiersBundle\Form\StagiaireType;
use Ivory\GoogleMap\Controls\ControlPosition;

/**
 * Stagiaire controller.
 *
 */
class StagiaireController extends Controller
{
    /**
     * Lists all Stagiaire entities.
     *
     */
    public function indexAction()
    {

        return $this->render('ExploticTiersBundle:Stagiaire:index.html.twig', array(
            'entities' => $this->get('explotic_admin.user.access_control')->findAuthorizedStagiaires(),
        ));
    }

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

        $entity = $em->getRepository('ExploticTiersBundle:Stagiaire')->find($id);
        $this->get('explotic_admin.user.access_control')->controlAccessToUser($entity);
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Stagiaire entity.');
        }

        $agenda = $this->get('explotic_admin.user.access_control')->findUserAgenda($entity);

        $agendaExtractor = new \Explotic\AgendaBundle\Model\AgendaExtractor();
        $now= new \DateTime();
        $agendaExtractor->setYear((int)$now->format('o'));
        $agendaExtractor->setWeek((int)$now->format('W'));
        $agendaExtractor->setDuree(4);
        $agendaExtractor->setAgendaEntities($agenda['entities']);

        $type = new \Explotic\AgendaBundle\Form\AgendaExtractType();
        $type->setAgendaList($agenda['ids']);

        $extractAgendaForm = $this->createForm($type, $agendaExtractor);

        $myUserMap = new \Explotic\MainBundle\Model\MyUserMap(
                $this->get('ivory_google_map.map'),
                $entity,
                $this->get('explotic_main.icopaths')->getPaths());

        $myUserMap->addProfil($entity);

        $myUserMap->addMarkersToGMaps();
        $myUserMap->getMap()->setStylesheetOptions(array(
            'width'=>'915px',
            'height'=>'450px',
            ));

        $myUserMap->getMap()->setPanControl('top_left');
        $myUserMap->getMap()->setRotateControl(ControlPosition::BOTTOM_LEFT);
        $myUserMap->getMap()->setZoomControl('top_left','default');
        $myUserMap->getMap()->setScaleControl('bottom_left','default');
        $myUserMap->getMap()->setMapTypeControl(
                array('roadmap','satellite'),
                'top_right',
                'default');
        $myUserMap->getMap()->setStreetViewControl('top_left');

        //Gestion des disponibilités

        $rdvSelector = new \Explotic\AgendaBundle\Model\RdvSelector();
        $rdvSelector->setDateDebut(new \DateTime('last monday'));
        $rdvSelector->setPeriod('1');
        $rdvSelector->setAgenda($agenda['entities'][0]);//La 1ère entité agenda correspond au calendrier du stagiaire
        $rdvSelector->setBookingType('tiers');
        $formDispoType = new \Explotic\AgendaBundle\Form\RdvSelectorType();
        $formDispo = $this->createForm($formDispoType, $rdvSelector);

        return $this->render('ExploticTiersBundle:Stagiaire:show.html.twig', array(
            'user'      => $entity,
            'map'=> $myUserMap->getMap(),
            'extractAgendaForm'=>$extractAgendaForm->createView(),
            'entreprise' => $entity->getEntreprise(),
            'dispoForm'=>$formDispo->createView(),
            ));
    }

    /**
     * Displays a form to create a new Stagiaire entity.
     *
     */
    public function newAction()
    {
        $entity = new Stagiaire();
        $form   = $this->createForm(new StagiaireType(), $entity);

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

    /**
     * Creates a new Stagiaire entity.
     *
     */
    public function createAction(Request $request)
    {
        $entity  = new Stagiaire();
        $form = $this->createForm(new StagiaireType(), $entity);
        $form->bind($request);

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

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

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

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

        $entity = $em->getRepository('ExploticTiersBundle:Stagiaire')->find($id);
        $this->get('explotic_admin.user.access_control')->controlAccessToUser($entity);
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Stagiaire entity.');
        }

        $editForm = $this->createForm(new StagiaireType(), $entity);

        return $this->render('ExploticTiersBundle:Stagiaire:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),

        ));
    }

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

        $entity = $em->getRepository('ExploticTiersBundle:Stagiaire')->find($id);
        $this->get('explotic_admin.user.access_control')->controlAccessToUser($entity);

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

        $editForm = $this->createForm(new StagiaireType(), $entity);
        $editForm->bind($request);

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

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

        return $this->render('ExploticTiersBundle:Stagiaire:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),

        ));
    }

    public function programmationAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $stagiaire = $em->getRepository('ExploticTiersBundle:Stagiaire')->find($id);
        $this->get('explotic_admin.user.access_control')->controlAccessToUser($stagiaire);
        if (!$stagiaire) {
            throw $this->createNotFoundException('Unable to find Stagiaire entity.');
        }

        $programmes = $em->getRepository('ExploticFormationBundle:Programme')->findByStagiaire($id);

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

        return $this->render('ExploticFormationBundle:Programme:indexStagiaire.html.twig', array(
            'entities'      => $programmes,
            'stagiaire' => $stagiaire,
        ));
    }

    public function voirPostesAction(Request $request, $id)
    {

        $em = $this->getDoctrine()->getManager();
        $stagiaire = $em->getRepository('ExploticTiersBundle:Stagiaire')->find($id);

        $this->get('explotic_admin.user.access_control')->controlAccessToUser($stagiaire);

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

        $postes = $em->getRepository('ExploticTiersBundle:Poste')->findByStagiaire($id);

        if (!$postes) {
            throw $this->createNotFoundException('Unable to find Poste entities.');
        }

        return $this->render('ExploticTiersBundle:Poste:indexStagiaire/content.html.twig', array(
            'entities'      => $postes,
            'stagiaire' => $stagiaire,
        ));
    }

    public function editAgendaForm(Stagiaire $stagiaire){
        $agenda = $stagiaire->getCalendrier();

        $rdvSelector = new \Explotic\AgendaBundle\Model\RdvSelector();
        $rdvSelector->setDateDebut(new \DateTime('last monday'));
        $rdvSelector->setPeriod('1');
        $rdvSelector->setBookingType('tiers');
        $rdvSelector->setAgenda($agenda);
        $formType = new \Explotic\AgendaBundle\Form\RdvSelectorType();
        return $this->createForm($formType, $rdvSelector);
    }

    public function showAgendaForm(Stagiaire $stagiaire){
        $entity = new \Explotic\AgendaBundle\Model\AgendaExtractor();
        $now= new \DateTime();
        $entity->setYear((int)$now->format('o'));
        $entity->setWeek((int)$now->format('W'));
        $entity->setDuree= 4;
        return $this->createForm(new AgendaExtractType(), $entity);
    }

}


text:
package com.softwaremill.session.javadsl

/**
 * Can't use the trait com.softwaremill.session.InMemoryRefreshTokenStorage in Java code, hence this wrapper
 * http://stackoverflow.com/questions/7637752/using-scala-traits-with-implemented-methods-in-java
 */
abstract class InMemoryRefreshTokenStorage[T]() extends com.softwaremill.session.InMemoryRefreshTokenStorage[T]

redpajama_set_name: RedPajamaGithub


text:
module MDUI
  class DiscoHints < Sequel::Model
    many_to_one :idp_sso_descriptor, class: 'IDPSSODescriptor'

    one_to_many :ip_hints
    one_to_many :domain_hints
    one_to_many :geolocation_hints

    plugin :association_dependencies, ip_hints: :destroy,
                                      domain_hints: :destroy,
                                      geolocation_hints: :destroy

    def validate
      super
      validates_presence %i[idp_sso_descriptor created_at updated_at]
    end
  end
end


text:
CALayer动画样例

![](https://github.com/faimin/ZDCALayerDemo/blob/master/GIF/CAShapeLayer.gif)

![](https://github.com/faimin/ZDCALayerDemo/blob/master/GIF/CAReplicatorLayer.gif)

![](https://github.com/faimin/ZDCALayerDemo/blob/master/GIF/maskLayer.gif)


text:
import logging
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)

from .var import *

__all__ = ['Bool', 'Int', 'Float']

class Bool(Variable):

    __slots__ = []

    basetype = bool

class Int(Variable):

    __slots__ = []

    basetype = int

class Float(Variable):

    __slots__ = []

    basetype = float


text:
package org.apache.batik.svggen.font.table;

import java.io.IOException;
import java.io.RandomAccessFile;

/**
 *
 * @author David Schweinsberg
 * @version $Id$
 */
public abstract class Coverage {

    public abstract int getFormat();

    /**
     * @param glyphId The ID of the glyph to find.
     * @return The index of the glyph within the coverage, or -1 if the glyph
     * can't be found.
     */
    public abstract int findGlyph(int glyphId);

    protected static Coverage read(RandomAccessFile raf) throws IOException {
        Coverage c = null;
        int format = raf.readUnsignedShort();
        if (format == 1) {
            c = new CoverageFormat1(raf);
        } else if (format == 2) {
            c = new CoverageFormat2(raf);
        }
        return c;
    }

}


text:
package sign

import (
	"crypto/x509"
	"encoding/pem"
	"fmt"

	"github.com/pkg/errors"

	"github.com/open-policy-agent/opa/internal/jwx/jwa"
)

// New creates a signer that signs payloads using the given signature algorithm.
func New(alg jwa.SignatureAlgorithm) (Signer, error) {
	switch alg {
	case jwa.RS256, jwa.RS384, jwa.RS512, jwa.PS256, jwa.PS384, jwa.PS512:
		return newRSA(alg)
	case jwa.ES256, jwa.ES384, jwa.ES512:
		return newECDSA(alg)
	case jwa.HS256, jwa.HS384, jwa.HS512:
		return newHMAC(alg)
	default:
		return nil, errors.Errorf(`unsupported signature algorithm %s`, alg)
	}
}

// GetSigningKey returns a *rsa.PrivateKey or *ecdsa.PrivateKey typically encoded in PEM blocks of type "RSA PRIVATE KEY"
// or "EC PRIVATE KEY" for RSA and ECDSA family of algorithms.
// For HMAC family, it return a []byte value
func GetSigningKey(key string, alg jwa.SignatureAlgorithm) (interface{}, error) {
	switch alg {
	case jwa.RS256, jwa.RS384, jwa.RS512, jwa.PS256, jwa.PS384, jwa.PS512:
		block, _ := pem.Decode([]byte(key))
		if block == nil {
			return nil, fmt.Errorf("failed to parse PEM block containing the key")
		}

		priv, err := x509.ParsePKCS1PrivateKey(block.Bytes)
		if err != nil {
			pkcs8priv, err2 := x509.ParsePKCS8PrivateKey(block.Bytes)
			if err2 != nil {
				return nil, fmt.Errorf("error parsing private key (%v), (%v)", err, err2)
			}
			return pkcs8priv, nil
		}
		return priv, nil
	case jwa.ES256, jwa.ES384, jwa.ES512:
		block, _ := pem.Decode([]byte(key))
		if block == nil {
			return nil, fmt.Errorf("failed to parse PEM block containing the key")
		}

		priv, err := x509.ParseECPrivateKey(block.Bytes)
		if err != nil {
			pkcs8priv, err2 := x509.ParsePKCS8PrivateKey(block.Bytes)
			if err2 != nil {
				return nil, fmt.Errorf("error parsing private key (%v), (%v)", err, err2)
			}
			return pkcs8priv, nil
		}
		return priv, nil
	case jwa.HS256, jwa.HS384, jwa.HS512:
		return []byte(key), nil
	default:
		return nil, errors.Errorf("unsupported signature algorithm: %s", alg)
	}
}


text:
//
//  CategoriesViewController.m
//  EbayKitDemo
//
//  Created by Oded Klein on 8/17/14.
//  Copyright (c) 2014 Oded Klein. All rights reserved.
//

#import "CategoriesViewController.h"
#import "EbayEngine.h"
#import "EbayCategory.h"

@interface CategoriesViewController ()

@property (strong, nonatomic) NSMutableArray* categories;

@end

@implementation CategoriesViewController

- (id)initWithStyle:(UITableViewStyle)style andCategoryID:(NSNumber*)aCategoryID andTitle:(NSString*)aTitle;
{
    self = [super initWithStyle:style];
    if (self) {
        self.categoryID = [aCategoryID intValue];
        self.title = aTitle;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"CategoryCell"];
    self.clearsSelectionOnViewWillAppear = NO;

    [self loadCategories];
}

- (void) loadCategories
{
    //Calling this method will get all sub categories of the category id.
    //If -1 is passed, the root category and its first childs will be retrieved as well.
    NSAssert(self.categoryID != 0 && self.categoryID > -2, @"Not a valid category ID");

    [[EbayEngine sharedShoppingEngine] getCategoryInfoWithCategoryID:self.categoryID
                withSuccess:^(NSArray *categories) {
                    self.categories = [NSMutableArray arrayWithArray:[categories subarrayWithRange:NSMakeRange(1, categories.count-1)]];
                    [self.tableView reloadData];
                }
                failure:^(NSError *error) {
                    NSLog(@"%@", error);
                }];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (!self.categories) return 0;

    return self.categories.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CategoryCell" forIndexPath:indexPath];

    EbayCategory* category = [self.categories objectAtIndex:indexPath.row];

    cell.textLabel.text = category.categoryName;
    //cell.detailTextLabel.text = [NSString stringWithFormat:@"Category id: %@", category.categoryId];

    cell.selectionStyle = UITableViewCellSelectionStyleDefault;
    cell.accessoryType = category.isLeaf ? UITableViewCellAccessoryNone : UITableViewCellAccessoryDetailButton;

    return cell;
}

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
    EbayCategory* category = [self.categories objectAtIndex:indexPath.row];

    NSNumberFormatter* formatter = [[NSNumberFormatter alloc] init];
    formatter.numberStyle = NSNumberFormatterDecimalStyle;

    CategoriesViewController* categoriesViewController = [[CategoriesViewController alloc] initWithStyle:self.tableView.style andCategoryID:[formatter numberFromString:category.categoryId] andTitle:category.categoryName];
    [self.navigationController pushViewController:categoriesViewController animated:YES];

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];

    EbayCategory* category = [self.categories objectAtIndex:indexPath.row];

    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:category.categoryName message:[NSString stringWithFormat:@"Category id: %@", category.categoryId] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
    [alert show];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
(function () {
    var widget = Retina.Widget.extend({
        about: {
            title: "AWE Panel",
            name: "awe_panel",
            author: "Tobias Paczian",
            requires: [ "rgbcolor.js" ]
        }
    });

    widget.history = [ [ Date.now(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ];
    widget.maxEntries = RetinaConfig.maxHistoryEntries || 100;

    widget.setup = function () {
	return [ Retina.load_renderer("plot") ];
    };

    widget.display = function (wparams) {
	widget = Retina.WidgetInstances.awe_panel[1];

	widget.target = widget.target || wparams.target;

	if (! RetinaConfig.authentication || widget.loggedIn) {
	    widget.target.innerHTML = "

";
	    widget.getAWEDetails();
	} else {
	    widget.target.innerHTML = "
authorization required
";
	}
    };

    widget.showAWEDetails = function () {
	var widget = Retina.WidgetInstances.awe_panel[1];

	var target = document.getElementById('awe_details');

	var data = widget.aweClientData;

	var coreGroups = {};
	var stats = { stati: {} };
	for (var i=0; i<data.length; i++) {
	    if (! stats.stati.hasOwnProperty(data[i].Status)) {
		stats.stati[data[i].Status] = 0;
	    }
	    stats.stati[data[i].Status]++;
	    if (! coreGroups.hasOwnProperty(data[i].cores)) {
		coreGroups[data[i].cores] = [];
	    }
	    coreGroups[data[i].cores].push(data[i]);
	}
	for (var i in coreGroups) {
	    if (coreGroups.hasOwnProperty(i)) {
		coreGroups[i].sort(Retina.propSort("id"));
	    }
	}
	var clientData = { all: data.length };
	for (var i in stats.stati) {
	    if (stats.stati.hasOwnProperty(i)) {
		clientData[i] = stats.stati[i];
	    }
	}

	// client counts
	var numIdle = 0;
	var numBusy = 0;
	var numDeleted = 0;
	var numError = 0;

	// box-display
	var boxDisplay = "
";
	var coreList = Retina.keys(coreGroups).sort();
	for (var h=0; h<coreList.length; h++) {
	    boxDisplay += "
"+coreList[h]+" cores
";
	    for (var i=0; i<coreGroups[coreList[h]].length; i++) {
		if (coreGroups[coreList[h]][i].Status == "active-idle") {
		    boxDisplay += widget.aweNode('info', i);
		    numIdle++;
		} else if (coreGroups[coreList[h]][i].Status == "active-busy") {
		    boxDisplay += widget.aweNode('success', i);
		    numBusy++;
		} else if (coreGroups[coreList[h]][i].Status == "suspend") {
		    boxDisplay += widget.aweNode('danger', i);
		    numError++;
		} else if (coreGroups[coreList[h]][i].Status == "deleted") {
		    boxDisplay += widget.aweNode('warning', i);
		    numDeleted++;
		}
	    }
	}
	boxDisplay += "

";

	// store history
	widget.history.push([ Date.now(), numIdle, numBusy, numError, numDeleted, parseInt(widget.aweServerData["jobs"].inprogress), parseInt(widget.aweServerData["jobs"].suspended), parseInt(widget.aweServerData["tasks"].queuing), parseInt(widget.aweServerData["tasks"].inprogress), parseInt(widget.aweServerData["tasks"].pending), parseInt(widget.aweServerData["tasks"].completed), parseInt(widget.aweServerData["tasks"].suspended), parseInt(widget.aweServerData["workunits"].queueing), parseInt(widget.aweServerData["workunits"].checkout), parseInt(widget.aweServerData["workunits"].suspended) ]);
	if (widget.history.length > widget.maxEntries) {
	    widget.history.shift();
	}

	// clients
	var html = "

"+data.length+"	"+numIdle+"	"+numBusy+"	"+numDeleted+"	"+numError+"

";
	html += boxDisplay;
	html += "
";

	// jobs, tasks & workunits
	html += "
\

\

jobs	"+widget.aweServerData["jobs"].all+"
\

in-progress	"+widget.aweServerData["jobs"].inprogress+"
\

suspended	"+widget.aweServerData["jobs"].suspended+"
\

tasks	"+widget.aweServerData["tasks"].all+"
\

queuing	"+widget.aweServerData["tasks"].queuing+"
\

in-progress	"+widget.aweServerData["tasks"].inprogress+"
\

pending	"+widget.aweServerData["tasks"].pending+"
\

completed	"+widget.aweServerData["tasks"].completed+"
\

suspended	"+widget.aweServerData["tasks"].suspended+"	\

workunits	"+widget.aweServerData["workunits"].all+"
\

queuing	"+widget.aweServerData["workunits"].queueing+"
\

checkout	"+widget.aweServerData["workunits"].checkout+"
\

suspended	"+widget.aweServerData["workunits"].suspended+"
\

\

";

	// graph
	html += "

client status

";
	html += "

job status

";
	html += "

task status

";
	html += "

workunit status

";

	target.innerHTML = html;

	// draw the graphs
	var now = Date.now();
	var pointsClients = [ [], [], [], [] ];
	var pointsJobs = [ [], [] ];
	var pointsTasks = [ [], [], [], [], [] ];
	var pointsWorkunits = [ [], [], [] ];
	for (var i=0; i<widget.history.length; i++) {
	    for (var h=1; h<5; h++) {
		pointsClients[h - 1].push({ x: parseInt((now - widget.history[i][0]) / 1000), y: widget.history[i][h] });
	    }
	    for (var h=5; h<7; h++) {
		pointsJobs[h - 5].push({ x: parseInt((now - widget.history[i][0]) / 1000), y: widget.history[i][h] });
	    }
	    for (var h=7; h<12; h++) {
		pointsTasks[h - 7].push({ x: parseInt((now - widget.history[i][0]) / 1000), y: widget.history[i][h] });
	    }
	    for (var h=12; h<15; h++) {
		pointsWorkunits[h - 12].push({ x: parseInt((now - widget.history[i][0]) / 1000), y: widget.history[i][h] });
	    }
	}
	var pdataC = { series: [ { name: "idle", color: 'blue' },
				 { name: "busy", color: 'green' },
				 { name: "error", color: 'red' },
				 { name: "deleted", color: 'orange' } ],
		       points: pointsClients };
	var pdataJ = { series: [ { name: "in-progress", color: 'green' },
				 { name: "suspended", color: 'red' } ],
		       points: pointsJobs };
	var pdataT = { series: [ { name: "queuing", color: 'yellow' },
				 { name: "in-progress", color: 'blue' },
				 { name: "pending", color: 'orange' },
				 { name: "completed", color: 'green' },
				 { name: "suspended", color: 'red' } ],
		       points: pointsTasks };
	var pdataW = { series: [ { name: "queuing", color: 'blue' },
				 { name: "checkout", color: 'green' },
				 { name: "suspended", color: 'red' } ],
		       points: pointsWorkunits };

	if (! widget.hasOwnProperty('rendPlotC')) {
	    widget.rendPlotC = Retina.Renderer.create("plot", { target: document.getElementById('plotC'),
								show_legend: true,
								show_dots: false,
								x_scale: "int",
								y_scale: "int",
								height: 200,
								data: pdataC }).render();
	} else {
	    widget.rendPlotC.settings.data = pdataC;
	    widget.rendPlotC.settings.x_min = undefined;
	    widget.rendPlotC.settings.target = document.getElementById('plotC');
	    widget.rendPlotC.render();
	}
	if (! widget.hasOwnProperty('rendPlotJ')) {
	    widget.rendPlotJ = Retina.Renderer.create("plot", { target: document.getElementById('plotJ'),
								show_legend: true,
								x_scale: "int",
								y_scale: "int",
								height: 200,
								show_dots: false,
								data: pdataJ }).render();
	} else {
	    widget.rendPlotJ.settings.data = pdataJ;
	    widget.rendPlotJ.settings.x_min = undefined;
	    widget.rendPlotJ.settings.target = document.getElementById('plotJ');
	    widget.rendPlotJ.render();
	}
	if (! widget.hasOwnProperty('rendPlotT')) {
	    widget.rendPlotT = Retina.Renderer.create("plot", { target: document.getElementById('plotT'),
								show_legend: true,
								x_scale: "int",
								y_scale: "int",
								height: 200,
								show_dots: false,
								data: pdataT }).render();
	} else {
	    widget.rendPlotT.settings.data = pdataT;
	    widget.rendPlotT.settings.x_min = undefined;
	    widget.rendPlotT.settings.target = document.getElementById('plotT');
	    widget.rendPlotT.render();
	}
	if (! widget.hasOwnProperty('rendPlotW')) {
	    widget.rendPlotW = Retina.Renderer.create("plot", { target: document.getElementById('plotW'),
								show_legend: true,
								x_scale: "int",
								y_scale: "int",
								height: 200,
								show_dots: false,
								data: pdataW }).render();
	} else {
	    widget.rendPlotW.settings.data = pdataW;
	    widget.rendPlotW.settings.x_min = undefined;
	    widget.rendPlotW.settings.target = document.getElementById('plotW');
	    widget.rendPlotW.render();
	}
    };

    widget.getAWEDetails = function () {
	if (!(RetinaConfig.hasOwnProperty("alertPanelRefresh") && RetinaConfig.hasOwnProperty("alertPanelRefresh") == 0)) {
	    setTimeout(widget.getAWEDetails, RetinaConfig.alertPanelRefresh || 15000);
	}
	jQuery.ajax({ url: RetinaConfig.awe_ip+"/client",
		      headers: widget.authHeader,
		      dataType: "json",
		      success: function(data) {
			  jQuery.ajax({ url: RetinaConfig.awe_ip+"/queue",
					headers: widget.authHeader,
					dataType: "json",
					clients: data.data,
					success: function(data) {
					    var widget = Retina.WidgetInstances.awe_panel[1];
					    widget.aweClientData = this.clients;
					    var result = data.data;
					    var rows = result.split("\n");
					    widget.aweServerData = { "jobs": { "all": rows[1].match(/\d+/)[0],
									       "inprogress": rows[2].match(/\d+/)[0],
									       "suspended": rows[3].match(/\d+/)[0] },
								     "tasks": { "all": rows[4].match(/\d+/)[0],
										"queuing": rows[5].match(/\d+/)[0],
										"inprogress": rows[6].match(/\d+/)[0],
										"pending": rows[7].match(/\d+/)[0],
										"completed": rows[8].match(/\d+/)[0],
										"suspended": rows[9].match(/\d+/)[0] },
								     "workunits": { "all": rows[11].match(/\d+/)[0],
										    "queueing": rows[12].match(/\d+/)[0],
										    "checkout": rows[13].match(/\d+/)[0],
										    "suspended": rows[14].match(/\d+/)[0] } };
					    widget.showAWEDetails();
					}});
		      }
		    });
    };

    widget.aweNode = function (status, id) {
	return "

";
    };

    widget.aweNodeDetail = function (nodeID) {

    };

    widget.resumeAllJobs = function () {
	var widget = Retina.WidgetInstances.awe_panel[1];
	jQuery.ajax({
	    method: "PUT",
	    dataType: "json",
	    headers: widget.authHeader,
	    url: RetinaConfig["awe_ip"]+"/job?resumeall",
	    success: function (data) {
		Retina.WidgetInstances.awe_panel[1].test_components();
		alert('all jobs resumed');
	    }}).fail(function(xhr, error) {
		alert('failed to resume all jobs');
	    });
    };

    widget.resumeAllClients = function () {
	var widget = Retina.WidgetInstances.awe_panel[1];
	jQuery.ajax({
	    method: "PUT",
	    dataType: "json",
	    headers: widget.authHeader,
	    url: RetinaConfig["awe_ip"]+"/client?resumeall",
	    success: function (data) {
		Retina.WidgetInstances.awe_panel[1].test_components();
		alert('all clients resumed');
	    }}).fail(function(xhr, error) {
		alert('failed to resume all clients');
	    });
    };

    widget.loginAction = function (action) {
	var widget = Retina.WidgetInstances.awe_panel[1];
	if (action.action == "login" && action.result == "success") {
	    widget.loggedIn = true;
	    widget.authHeader = { "Authorization": "OAuth "+action.token };
	} else {
	    widget.loggedIn = false;
	    widget.authHeader = {};
	}
	widget.display();
    };

})();


text:
require 'rails_helper'

describe 'Issue Boards', feature: true, js: true do
  let(:user)         { create(:user) }
  let(:user2)        { create(:user) }
  let(:project)      { create(:empty_project, :public) }
  let!(:milestone)   { create(:milestone, project: project) }
  let!(:development) { create(:label, project: project, name: 'Development') }
  let!(:bug)         { create(:label, project: project, name: 'Bug') }
  let!(:regression)  { create(:label, project: project, name: 'Regression') }
  let!(:stretch)     { create(:label, project: project, name: 'Stretch') }
  let!(:issue1)      { create(:labeled_issue, project: project, assignees: [user], milestone: milestone, labels: [development], relative_position: 2) }
  let!(:issue2)      { create(:labeled_issue, project: project, labels: [development, stretch], relative_position: 1) }
  let(:board)        { create(:board, project: project) }
  let!(:list)        { create(:list, board: board, label: development, position: 0) }
  let(:card) { find('.board:nth-child(2)').first('.card') }

  before do
    Timecop.freeze

    project.team << [user, :master]

    sign_in(user)

    visit project_board_path(project, board)
    wait_for_requests
  end

  after do
    Timecop.return
  end

  it 'shows sidebar when clicking issue' do
    click_card(card)

    expect(page).to have_selector('.issue-boards-sidebar')
  end

  it 'closes sidebar when clicking issue' do
    click_card(card)

    expect(page).to have_selector('.issue-boards-sidebar')

    click_card(card)

    expect(page).not_to have_selector('.issue-boards-sidebar')
  end

  it 'closes sidebar when clicking close button' do
    click_card(card)

    expect(page).to have_selector('.issue-boards-sidebar')

    find('.gutter-toggle').trigger('click')

    expect(page).not_to have_selector('.issue-boards-sidebar')
  end

  it 'shows issue details when sidebar is open' do
    click_card(card)

    page.within('.issue-boards-sidebar') do
      expect(page).to have_content(issue2.title)
      expect(page).to have_content(issue2.to_reference)
    end
  end

  it 'removes card from board when clicking ' do
    click_card(card)

    page.within('.issue-boards-sidebar') do
      click_button 'Remove from board'
    end

    wait_for_requests

    page.within(find('.board:nth-child(2)')) do
      expect(page).to have_selector('.card', count: 1)
    end
  end

  it 'does not show remove button for backlog or closed issues' do
    create(:issue, project: project)
    create(:issue, :closed, project: project)

    visit project_board_path(project, board)
    wait_for_requests

    click_card(find('.board:nth-child(1)').first('.card'))

    expect(find('.issue-boards-sidebar')).not_to have_button 'Remove from board'

    click_card(find('.board:nth-child(3)').first('.card'))

    expect(find('.issue-boards-sidebar')).not_to have_button 'Remove from board'
  end

  context 'assignee' do
    it 'updates the issues assignee' do
      click_card(card)

      page.within('.assignee') do
        click_link 'Edit'

        wait_for_requests

        page.within('.dropdown-menu-user') do
          click_link user.name

          wait_for_requests
        end

        expect(page).to have_content(user.name)
      end

      expect(card).to have_selector('.avatar')
    end

    it 'removes the assignee' do
      card_two = find('.board:nth-child(2)').find('.card:nth-child(2)')
      click_card(card_two)

      page.within('.assignee') do
        click_link 'Edit'

        wait_for_requests

        page.within('.dropdown-menu-user') do
          click_link 'Unassigned'
        end

        wait_for_requests

        expect(page).to have_content('No assignee')
      end

      expect(card_two).not_to have_selector('.avatar')
    end

    it 'assignees to current user' do
      click_card(card)

      page.within(find('.assignee')) do
        expect(page).to have_content('No assignee')

        click_button 'assign yourself'

        wait_for_requests

        expect(page).to have_content(user.name)
      end

      expect(card).to have_selector('.avatar')
    end

    it 'updates assignee dropdown' do
      click_card(card)

      page.within('.assignee') do
        click_link 'Edit'

        wait_for_requests

        page.within('.dropdown-menu-user') do
          click_link user.name

          wait_for_requests
        end

        expect(page).to have_content(user.name)
      end

      page.within(find('.board:nth-child(2)')) do
        find('.card:nth-child(2)').trigger('click')
      end

      page.within('.assignee') do
        click_link 'Edit'

        expect(find('.dropdown-menu')).to have_selector('.is-active')
      end
    end
  end

  context 'milestone' do
    it 'adds a milestone' do
      click_card(card)

      page.within('.milestone') do
        click_link 'Edit'

        wait_for_requests

        click_link milestone.title

        wait_for_requests

        page.within('.value') do
          expect(page).to have_content(milestone.title)
        end
      end
    end

    it 'removes a milestone' do
      click_card(card)

      page.within('.milestone') do
        click_link 'Edit'

        wait_for_requests

        click_link "No Milestone"

        wait_for_requests

        page.within('.value') do
          expect(page).not_to have_content(milestone.title)
        end
      end
    end
  end

  context 'due date' do
    it 'updates due date' do
      click_card(card)

      page.within('.due_date') do
        click_link 'Edit'

        click_button Date.today.day

        wait_for_requests

        expect(page).to have_content(Date.today.to_s(:medium))
      end
    end
  end

  context 'labels' do
    it 'adds a single label' do
      click_card(card)

      page.within('.labels') do
        click_link 'Edit'

        wait_for_requests

        click_link bug.title

        wait_for_requests

        find('.dropdown-menu-close-icon').click

        page.within('.value') do
          expect(page).to have_selector('.label', count: 3)
          expect(page).to have_content(bug.title)
        end
      end

      expect(card).to have_selector('.label', count: 2)
      expect(card).to have_content(bug.title)
    end

    it 'adds a multiple labels' do
      click_card(card)

      page.within('.labels') do
        click_link 'Edit'

        wait_for_requests

        click_link bug.title
        click_link regression.title

        wait_for_requests

        find('.dropdown-menu-close-icon').click

        page.within('.value') do
          expect(page).to have_selector('.label', count: 4)
          expect(page).to have_content(bug.title)
          expect(page).to have_content(regression.title)
        end
      end

      expect(card).to have_selector('.label', count: 3)
      expect(card).to have_content(bug.title)
      expect(card).to have_content(regression.title)
    end

    it 'removes a label' do
      click_card(card)

      page.within('.labels') do
        click_link 'Edit'

        wait_for_requests

        click_link stretch.title

        wait_for_requests

        find('.dropdown-menu-close-icon').click

        page.within('.value') do
          expect(page).to have_selector('.label', count: 1)
          expect(page).not_to have_content(stretch.title)
        end
      end

      expect(card).not_to have_selector('.label')
      expect(card).not_to have_content(stretch.title)
    end
  end

  context 'subscription' do
    it 'changes issue subscription' do
      click_card(card)

      page.within('.subscription') do
        click_button 'Subscribe'
        wait_for_requests
        expect(page).to have_content("Unsubscribe")
      end
    end
  end

  def click_card(card)
    page.within(card) do
      first('.card-number').click
    end

    wait_for_sidebar
  end

  def wait_for_sidebar
    # loop until the CSS transition is complete
    Timeout.timeout(0.5) do
      loop until evaluate_script('$(".right-sidebar").outerWidth()') == 290
    end
  end
end


text:
/**
 *
 */
package com.transcend.rds.worker;

import java.util.Collection;
import java.util.List;

import org.hibernate.Session;
import org.slf4j.Logger;
import org.springframework.transaction.annotation.Transactional;

import com.msi.tough.core.Appctx;
import com.msi.tough.core.HibernateUtil;
import com.msi.tough.model.AccountBean;
import com.msi.tough.model.rds.RdsDbinstance;
import com.msi.tough.model.rds.RdsDbsecurityGroup;
import com.msi.tough.query.ErrorResponse;
import com.msi.tough.query.QueryFaults;
import com.msi.tough.query.ServiceRequestContext;
import com.msi.tough.utils.RDSQueryFaults;
import com.msi.tough.utils.rds.InstanceEntity;
import com.msi.tough.utils.rds.SecurityGroupEntity;
import com.msi.tough.workflow.core.AbstractWorker;
import com.transcend.rds.message.DeleteDBSecurityGroupActionMessage.DeleteDBSecurityGroupActionRequestMessage;
import com.transcend.rds.message.DeleteDBSecurityGroupActionMessage.DeleteDBSecurityGroupActionResultMessage;

/**
 * @author tdhite
 */
public class DeleteDBSecurityGroupActionWorker extends
		AbstractWorker<DeleteDBSecurityGroupActionRequestMessage, DeleteDBSecurityGroupActionResultMessage> {
	private final static Logger logger = Appctx
			.getLogger(DeleteDBSecurityGroupActionWorker.class.getName());

    /**
    * We need a local copy of this doWork to provide the transactional
    * annotation.  Transaction management is handled by the annotation, which
    * can only be on a concrete class.
    * @param req
    * @return
    * @throws Exception
    */
   @Transactional
   public DeleteDBSecurityGroupActionResultMessage doWork(
           DeleteDBSecurityGroupActionRequestMessage req) throws Exception {
       logger.debug("Performing work for DeleteDBSecurityGroupAction.");
       return super.doWork(req, getSession());
   }

	/**
	 * deleteDBSecurityGroup ********************************************** This
	 * Operation deletes a database security group. Database security group must
	 * not be associated with any RDS Instances. Request: SecurityGroupName (R)
	 * Response: None Exceptions: DBSecurityGroupNotFound
	 * InvalidDBSecurityGroupState Processing 1. Check if SecurityGroup is
	 * associated with DBInstance 2. Delete security group 3. Return response
	 *
	 * @param requestID
	 * @param userID
	 */
	@Override
	protected DeleteDBSecurityGroupActionResultMessage doWork0(DeleteDBSecurityGroupActionRequestMessage req,
ServiceRequestContext context) throws Exception {

        final DeleteDBSecurityGroupActionResultMessage.Builder resp =
        		DeleteDBSecurityGroupActionResultMessage.newBuilder();
        final Session sess = HibernateUtil.newSession();
		try {
			sess.beginTransaction();
			final AccountBean ac = context.getAccountBean();
			if (ac == null) {
				throw QueryFaults.AuthorizationNotFound();
			}
			final long userID = ac.getId();

			final String grpName = req.getDbSecurityGroupName();

			logger.info("DeleteDBSecurityGroup: UserID = " + userID
					+ " DBSecurityGroupName = " + grpName);

			if (grpName.equals("default")) {
				// user does not have authority to delete the default
				// DBSecurityGroup
				throw RDSQueryFaults
						.InvalidClientTokenId("The security token included in the request is invalid.");
			}

			final RdsDbsecurityGroup secGrp = SecurityGroupEntity
					.getSecurityGroup(sess, grpName, ac.getId());
			if (secGrp == null) {
				throw RDSQueryFaults.DBSecurityGroupNotFound();
			}

			// check status - cannot delete if it is associated with
			// DBInstance records - select DBSecurityGroupMemebershipRecords
			final Collection<RdsDbinstance> instances = InstanceEntity
					.selectBySecurityGroup(sess, grpName, ac);
			if (instances != null) {
				logger.debug(instances.size()
						+ " DBInstances are using this DBSecurityGroup.");
			} else {
				logger.debug("No DBInstance is using this DBSecurityGroup.");
			}
			if (instances != null && instances.size() > 0) {
				throw RDSQueryFaults.InvalidDBSecurityGroupState();
			}

			SecurityGroupEntity.deleteSecurityGroup(sess, secGrp);

			sess.getTransaction().commit();
		} catch (final ErrorResponse rde) {
			sess.getTransaction().rollback();
			throw rde;
		} catch (final Exception e) {
			e.printStackTrace();
			sess.getTransaction().rollback();
			final String msg = "DeleteDBSecurityGroup: Class: " + e.getClass()
					+ "Msg:" + e.getMessage();
			logger.error(msg);
			throw RDSQueryFaults.InternalFailure();
		} finally {
			sess.close();
		}
		return resp.buildPartial();
	}

	public void deleteInternalSecurityGroup(final Session sess,
			final AccountBean ac, final String grpName) {

		// delete the named record
		final List<RdsDbsecurityGroup> grps = SecurityGroupEntity
				.selectAllSecurityGroups(sess, grpName, ac.getId(), null, 1);
		if (grps == null || grps.size() != 1) {
			throw RDSQueryFaults.InternalFailure();
		}
		final RdsDbsecurityGroup grp = grps.get(0);
		if (grp == null) {
			throw RDSQueryFaults.InternalFailure();
		}
		// for (final RdsIPRangeBean ip : grp.getIPRange()) {
		// sess.delete(ip);
		// }
		// for (final RdsEC2SecurityGroupBean sec : grp.getEC2SecGroup()) {
		// sess.delete(sec);
		// }
		sess.delete(grp);
	}
}


text:
* Enhance moving point in editors fix for tablets to accomodate inaccurate taps

## 0.72
### Fixes
* Fix update moving point on editors that don't work properly in tablets

## 0.71
### Fixes
* Fix drag event mistaken for long press event #390

## 0.71
### Fixes
* Fix update moving point on editors that don't work properly in tablets #385

## 0.69
### Fixes
* Fix `finishCreation()` missing functionality for `PolygonEditorService` and `PolylineEditorService`

## 0.68
### Features
* Add `finishCreation()` functionality to shape editors to allow users to finish creation programmatically.
* Update dependencies

## 0.67
### Features
* Upgrade to Angular 11

## 0.66
### Feautures
* Add in `MapboxStyleImageryProvider` functionality
### Fixes
* Fix `HippodromeEditorObservable` using wrong interface
* Fix `ContextMenuService` can't create instance bug - replace `div` with `ng-template`
* Fix `viewer.destroy()` throwing exception `TypeError: e[i].destroy is not a function`. Added missing `destroy()` to `HtmlCollection`.
* Fix Editors `dispose()` issue when component is destroyed.
* Fix Rectangle editor `edit()`.

## 0.65
### Features
* Upgrade to Angular 9 (Ivy)

### Fixes
* Fix EllipseEditorObservable Disposing throws `undefined` error
* Fix Cesium breaking change with `createTileMapServiceImageryProvider` and `createOpenStreetMapImageryProvider`.
### Breaking changes
* `CesiumHeatMapMaterialCreator` removed to avoid compilation warnings. TBD: publish as external library.

## 0.64
### Features
* Add points-editor component, model, and service. `Points` are now first class components that support entity features, such as labels and enable/disable.
### Fixes
* Fix shape editor drag feature - in disable mode dont disable cesium camera rotation.

## 0.63
### Features
* Refactor demo project and create: https://github.com/articodeltd/angular-cesium-demo

### Fixes
* Fix `ng add angular-cesium`

## 0.62
### Features
* Add more stackblitz examples and refactor the demo examples.
* Change Circle, Ellipse and Hippodrome default point color changed to white.

### Fixes
* Fix `ng add angular-cesium`

## 0.61
### Features
* Add `PickConfiguration` for `MapEventManager` for setting `pick()` width, height and `drillPick()` limit.
* Add support for Polyline and Polygon editors to clamp most detailed ground in `clampHeightTo3D` mode.
 using `clampHeightTo3DOptions.clampMostDetailed = true`.
* Add stackblitz examples to the docs.

### Fixes
* Shape Editor default label `disableDepthTestDistance` changed to 0.
* Fix `AcHtml` toggle `show` created new html elements instead of updating the current element.

## 0.60
### Fixes
* Polyline and polygon editor - fix support of events modifiers (`alt`, `ctrl`, `shift`).
* Polyline and polygon editor - fix screen position to geo position.

### Features
* Added a rectangle drawing editor widget
* Added an example rectangle component in the demo app
* Added `ac-map-terrain-provider` component which supports Cesium terrain providers
* Added `ac-map-terrain-provider` component to demo app to show it's usage

## 0.59
### Fixes
* Fix `CameraService.trackEntity()` doc.
* Fix `AcHtmlDesc` remove.
* Add doc to the `ContextMenuService`
### Features
* Add support for terrain in Polygon and Polyline Editors.
* To enable terrain support: `this.polylineEditor.create({ clampHeightTo3D: true, clampHeightTo3DOptions: {clampToTerrain: true} });`

### Breaking Changes
* Demo layers name change to `-example` suffix.
* Updated library and demo application to Angular 8
* Bumped CircleCI Node version to 10.16.1

## 0.58
### Fixes
* Fix AOT build - remove unwanted type in `PolygonEditorComponent` and `PolylinesEditorComponent`.
* Fix entity `availability` bug in `entities-drawer.service.ts `

## 0.57
### Features
* Added `debug` prop to `ac-layer` component for printing received AcNotifications
* Polygon Editor and Polyline Editor support 3D tiles and terrain, to enable set `clampHeightTo3D` parameter to `true`.
* Added examples for 3D mode in `polyline-editor-layer.ts` and `polygon-editor-layer.ts`.
* Add Angular CLI schematics

### Fixes
* Fix `CameraService` zoomOut().
* Fix Shape editors not cloning geometries props
* Change Shape editor points to be shown above the lines (uses `disableDepthTestDistance` prop)
* Fixed demo app unit tests
* Updated README with instructions for including Cesium scripts in test config
* Added use of the 'availability' field inside of the Cesium entity API
* Add `MapsManagerService` and other global service to be provided by `forRoot()` - for lazy loading.

### Breaking Changes
* Remove default `viewer` configuration (the defualt was setting offline map as the initial imagery).
* Change editors initial props - different color and outline.
* Change editors initial props - to use Cesium `CallbackProperties`.

## 0.56
### Features
* Added `onDrag` hook into the `ac-toolbar` component.
* Altered `ac-toolbar` to listen in to changes on its `allowDrag` input and subscribe/unsubscribe dynamically.
* Added threshold option to `ZoomToRectangleService` options.
* Added keepRotation option to `ZoomToRectangleService` options.
* Added mouseButton option to `ZoomToRectangleService` options.

## 0.55
### Features
* New Angular CLI build system.

## 0.54
### Fixes
* Fixed `ac-layer` onDestroy.
* Fixed `ac-map` onDestroy.
* Fixed `CircleEditorService` shape dragging.
* Fixed `ac-model-desc` docs [#243](https://github.com/TGFTech/angular-cesium/issues/243).
* Fixed entities drawing directly to map - without ac-layer [#212](https://github.com/TGFTech/angular-cesium/issues/212).
* Fixed plonter behavior.

### Features
* Multiple `AcMap` support using `ngFor` - The optional `@Input() containerId` in `AcMap` can be used to place the map canvas in any container / move the canvas to a new container.
* New `bind2DMapsCameras()` function added to `MapsManagerService` for binding cameras position in different 2D maps.
* New `unbindMapsCameras()` function added to `MapsManagerService` for unbinding maps camera.
* New `setRotation()` function added to `CameraService`.
* New `lockRotation()` function added to `CameraService`.
* New `ZoomToRectangleService` was added to `AngularCesiumWidgetsModule` - a tool for zooming into a rectangle that is drawn on the map.
* Added initial support for `Cesium.CallbackProperty`.
* Added new ellipses shape editor that can be used to draw circles and ellipses.

## 0.53
### Features
* New `<ac-czml-desc>` component for adding CzmlDataSource to ac-layer.
* New `czml-drawer` service
* New `<czml-layer` component in demo app to show usage of `<ac-czml-desc>`
* Support RxJs 6

### Fixes
* Fixed AOT compilation for angular 6, the issue was with `angular2parse` reaching angular compiler pipes.
* Fixed Shape editors points zIndex in 2D.
* Updated demo dependencies

### Breaking Changes
* From now Angular Pipes need to be set in `AngularCesiumModule.forRoot(ustomPipes: myCustomPipes)`.
angular-cesium won't be aware of pipes that wont be defined as `customPipes`.
There for any user Pipes need to be declared when initializing angular cesium.
* For upgrade to 0.53 from older versions remove `rxjs-compat` dependency and refactor to rxjs 6 new import paths.

## 0.0.52
### Fixes
* Fixed shape editors 2D points bug - remove height reference
* Fixed polygon editor moving point updates

## 0.0.51
### Fixes
* Fixed `package.json` engines section.

## 0.0.50
### Features
* New `<range-and-bearing>` component that is used to to draw range & bearing on the map.
* Refactored `KeyboardControlService` docs.
* Added `maximumNumberOfPoints` to `PolygonEditOptions` - you can now set maximum number of points when creating polygon using `PolygonEditorService` .
* Refactored `KeyboardControlService` docs.
* Added flyTo options to `CameraService.trackEntity()` + example in the demo.

### Fixes
* `ac-point-desc` changed to Entity instead of Primitive. For primitive use `ac-point-primitive-desc`.

## 0.0.49
### Fixes
* Fixed mistakenly rejecting Observables from other contexts
* Fixed `ac-toolbar` onDestroy() [#217](https://github.com/TGFTech/angular-cesium/issues/217).
* Fixed `ac-html` element is shown when show initially set to false [#216](https://github.com/TGFTech/angular-cesium/issues/216).
* Changed `ellipse-drawer` service collection max size cap to 100
* Fixed `sim-generator` in demo server
* Changed `SmartAssigner` allowUndefined default from true to false
* Removed deprecated code in `ViewerFactory` that set CESIUM_BASE_URL if ti wasn't already set.

## 0.0.48
### Fixes
* Fixed `ac-circle-desc` radius changing.
* Fixed `ac-ellipse-desc` & `ac-circle-desc` updating bug

## 0.0.45
### Fixes
* Some minor fixes

## 0.0.43
### Fixes
* Improved shape editors performance
* Fixed undragable editable hippodrome
* Fixed editable hippodrome updating
* Fixed editing multiple shapes of the same type simultaneously

### Features
* Labels of editable shapes now update on mouse move
* Update Cesium version to 1.41.0

## 0.0.42
### Fixes
* Fixed `PolygonsEditorService` shape drag

## 0.0.41
### Features
* Added `pickFilter` to `EventRegistrationInput` - you can now pass a filter function to `MapEventsManager.register()` - in order to filter the returned entities.

### Fixes
* Fixed editing of multiple shapes simultaneously

## 0.0.40
### Features
* Upgraded to Angular 5
* Fixed aot build

## 0.0.39
### Fixes
* Fix range and bearing example

### Features
* Added `ac-primitive-polyline` - Using primitive drawer

## 0.0.37
### Fixes
* Html Primitive - change primitive screen position to Cesium.Cartesian2
* Fix demo typescript compilation
* Fix project implicit any
* Change `ngOutletContext` to `ngTemplateOutletContext`

## 0.0.36
### Fixes
* Hippodrome Editor - Expose hippodrome width

### Breaking Changes
* `HippodromeEditorService` is no longer provided by `AngularCesiumWidgetsModule`, user should provide it himself
* `CircleEditorService` is no longer provided by `AngularCesiumWidgetsModule`, user should provide it himself
* `PolylineEditorService` is no longer provided by `AngularCesiumWidgetsModule`, user should provide it himself
* `PolygonEditorService` is no longer provided by `AngularCesiumWidgetsModule`, user should provide it himself

## 0.0.35
### Features
* Added `calcEllipseContainingRect` static function to `CesiumHeatMapMaterialCreator`
* Added `ac-toolbar` and `ac-toolbar-button` components
* Added toolbar example and flyTo home toolbar option
* Added Range and bearing example

### Breaking changes
* `AngularCesiumEntitiesDrawerModule` refactored to `AngularCesiumWigetsModule`

## 0.0.34
### Fixes
* Fixed a bug in editors.

### Features
* Added customizable labels to shape editors.
* Added `DraggableToMapDirective` directive for dragging icons from outside the map over the map.
* Added `IconDragService` service that exposes an observable that listens to dragging with `DraggableToMapDirective`.

## 0.0.33
## Fixes
* fix missing Cartesian3 typings

## 0.0.32
### Features
* Polyline edtior supports drag shape events.
* Add ability to change width to Hippodrome editor
* Added `ac-array-desc` for representing dynamic arrays in entity - ALPHA

## Fixes
* Hippodrome editor - setManually supports positions and hippodrome width.
* Fixed Polygons Editing  bug that happened when dragging a point.
* Fixed Polyline Editing bug that happened when dragging a point.
* Fixed `EntitesDrawerService` show prop bug.

## Breaking changes
* Observer Editors methods: `setPolygonManually()`, `setPolylineManually()`,`setCircleManually()`,`setHippodromeManually()` changed to: `setManually()`.
Each shape accepts here own specific arguments to configure the edited object, for example: `polygonEditor$.setManaually(positions, pointOptions, polygonOptions)`.

## 0.0.31
### Features
* All editors now except allowDrag option to allow or disable the ability to drag the edited shape.
* Added options to circle editor  - `CircleEditOptions`.

### Fixes
* Fix hippodrome editor outline bug.
* Fixed bug that caused polygons hiding to throw an error if they had outline.

## 0.0.30
### Fixes
* Service init order  [#131](https://github.com/TGFTech/angular-cesium/issues/131)

### Features
* Added `selectionManagerService` and example in selection-layer.component.ts
* Added context menu service that allows dynamic injection of custom components.
* Added Polyline editor `PolylinesEditorService` - allow for creating polylines and editing them from the map of from the code.
* Added Circle editor `CirclesEditorService` - allow for creating circles and editing them from the map of from the code.
* Added Hippodrome editor `HippodromeEditorService` - allow for creating hippodromes and editing them from the map of from the code.
* Added `CesiumHeatMapMaterialCreator` for creating heatmap material for cesium entities.
* edited polygons are now draggable.
* added `ac-point-primitive-desc`
* added `ac-html-desc` - ac-layer supports ac-html

## 0.0.29
### Features
* polygon editor(alpha) - edit points manually.

## 0.0.28
### Features
* polygon editor(alpha) - edit mode, disable,enable, add points to the editor result.

## 0.0.26
### Features
* added screenshot service
* polygon editor - alpha

## 0.0.25
### Fixes
* fix draw on map example

## 0.0.21
### Features
* Allow `KeyboardControlService` to run outside of angular zone.

## 0.0.20
### Features
* Added `enableInput()`, `enableZoom()` to `CameraService`.

### Fixes
* Fixed bug removed default height 0
* Fixed AngularCesiumModule loading
* Fixed `npm run server`

### Breaking Changes
* Renamed `ModuleOptions` to `ModuleConfiguration`.

## 0.0.19
### Features
* Added `done` callback to `KeyboardControlService` definitions - now it's possible to know when the event is done.
* Added internal `IGNORED` state to `KeyboardControlService` - now when action returns `false` it will ignore it until the next event cycle (keydown then keyup)
* Added zIndex to `<ac-layer [zIndex]="1"/>`, ability to control the layers order.
* Added `CameraService` that is provided by `ac-map`. The service exposes the scene's camera and screenSpaceCameraController.
* Added `[sceneMode]` attribute to `ac-map` .
* Added new components: `ac-billboard-primitive-desc`, `ac-label-primitive-desc`, `ac-polyline-primitive-desc`. The components uses Cesium Primitives for performance efficient drawing of map entities.

### Breaking Changes
* Event triggered from `KeyboardControlService` is now triggered with `cesiumService: CesiumService, key: string, keyboardEvent: KeyboardEvent`.
* CesiumService no longer supports camera actions such as `setEnableTilt`, `setMaximumZoom`, etc... - instead use CameraService that is provided by `ac-map`.
* `ac-map` function `getMapEventManager()` renamed to `getMapEventsManager()`
* `maximumZoom`, `minimumZoom` and `enableTilt` attributes in `ac-map` were removed. use `CameraService` instead.
* `ViewersManagerService` renamed into `MapsManagerService`. It now manage ac-map instances. Internal functions changed accordingly to `getMap()` and `registerMap()`. The logic remained the same.
* `AngularCesiumModule` should be loaded with `.forRoot()`. Additionally, `AngularCesiumModule.forRoot()` takes options of type `ModuleOptions`. Fixes cesium [bug](https://github.com/AnalyticalGraphicsInc/cesium/pull/5736) (height=0 on entities creates entities with shadows,shadows cant be turn off).

## 0.0.18
### Features
* Exposed `onDraw` and `onRemove` for `BasicDesc` component - now it's possible to know when an Cesium object is drawn.
* Exposed `getCesiumObjectsMap` from `BasicDesc` component.
* Added drag and drop event to `MapEventManagerService`
* Added new drawable entities:
  * `ac-box-dec`
  * `ac-corridor-dec`
  * `ac-cylinder-dec`
  * `ac-ellipsoid-dec`
  * `ac-polyline-volume-dec`
  * `ac-wall-dec`
  * `ac-rectangle-dec`

## 0.0.15
### Features
* Expose `MapEventManagerService` from `<ac-map #map/>` component reference: `acMapComponent.getMapEventManager()`
* New `KeyboardControlService` for controlling the camera using the keyboard
* add `<ac-3d-tile-layer/>` for 3d tiles

## 0.0.14
### Breaking changes
* deprecated:
  * AcStaticEllipseDescComponent, instead use `ac-ellipse-desc`
  * AcDynamicPolylineDescComponent, instead use `ac-polyline-desc`
  * AcStaticPolylineDescComponent, instead use `ac-polyline-desc`
  * AcStaticCircleDescComponent, instead use `ac-circle-desc`
  * AcStaticPolygonDescComponent, instead use `ac-polygon-desc`
* MapEventManagerService: EventResult.primitives changed to EventResult.cesiumEntities
* `ac-polyline-desc` and `ac-polyline` accept Cesium.Color as material in props input.

### Features
* support models `ac-model-desc`

## 0.0.13
### Features
* ac-map-layer-provider - Support all cesium imagery providers
* Expose cesium viewer through ViewesManagerService and `ac-map`

## 0.0.12 (30-7-17)
### Breaking changes
* AcEntity id filed changed to string from number
* AcNotification id filed changed to string from number


text:
package co.cask.cdap.common.zookeeper.coordination;

import com.google.common.collect.Multimap;

/**
 * This interface is for retrieving existing assignment as well as doing new assignment. Assignment is done in a way
 * that no two handler would be handling the same {@link PartitionReplica}.
 *
 * @param <T> Type of the resource handler.
 */
public interface ResourceAssigner<T> {

  /**
   * Returns an immutable {@link Multimap} that is a view of map from handler to partition replica that is
   * currently assigned to the handler. Changes in this assigner would be reflected in the returning map.
   */
  Multimap<T, PartitionReplica> get();

  /**
   * Returns the handler that is currently assigned to handle the given partition and replica.
   *
   * @return the handler name or {@code null} if no handler is assigned.
   */
  T getHandler(String partition, int replica);

  /**
   * Assigns a particular partition replica pair to a given handler. Same as calling
   * {@link #set(Object, PartitionReplica) set(handler, new PartitionReplica(partition, replica))}.
   */
  void set(T handler, String partition, int replica);

  /**
   * Assigns a particular partition replica pair to a given handler. If there is any handler currently assigned
   * to the given {@link PartitionReplica}, it will get replaced by the new one.
   *
   * @param handler The handler to assign to.
   * @param partitionReplica The partition replica pair to assign to the given handler.
   */
  void set(T handler, PartitionReplica partitionReplica);
}


text:
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/assistant/assistant_alarm_timer_controller.h"

#include <map>
#include <string>
#include <utility>

#include "ash/assistant/assistant_controller_impl.h"
#include "ash/assistant/assistant_notification_controller.h"
#include "ash/assistant/util/deep_link_util.h"
#include "ash/public/mojom/assistant_controller.mojom.h"
#include "ash/strings/grit/ash_strings.h"
#include "base/i18n/message_formatter.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "chromeos/services/assistant/public/cpp/features.h"
#include "chromeos/services/assistant/public/mojom/assistant.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/icu/source/common/unicode/utypes.h"
#include "third_party/icu/source/i18n/unicode/measfmt.h"
#include "third_party/icu/source/i18n/unicode/measunit.h"
#include "third_party/icu/source/i18n/unicode/measure.h"
#include "ui/base/l10n/l10n_util.h"

namespace ash {

namespace {

using assistant::util::AlarmTimerAction;

// Grouping key and ID prefix for timer notifications.
constexpr char kTimerNotificationGroupingKey[] = "assistant/timer";
constexpr char kTimerNotificationIdPrefix[] = "assistant/timer";

constexpr base::TimeDelta kOneMin = base::TimeDelta::FromMinutes(1);

// Interval at which alarms/timers are ticked.
constexpr base::TimeDelta kTickInterval = base::TimeDelta::FromSeconds(1);

// Helpers ---------------------------------------------------------------------

// Creates a notification ID for the given |timer|. It is guaranteed that this
// method will always return the same notification ID given the same timer.
std::string CreateTimerNotificationId(const mojom::AssistantTimer& timer) {
  return std::string(kTimerNotificationIdPrefix) + timer.id;
}

// Creates a notification message for the given |timer|.
std::string CreateTimerNotificationMessage(const mojom::AssistantTimer& timer) {
  // Method aliases to prevent line-wrapping below.
  const auto createHour = icu::MeasureUnit::createHour;
  const auto createMinute = icu::MeasureUnit::createMinute;
  const auto createSecond = icu::MeasureUnit::createSecond;

  // Calculate hours/minutes/seconds remaining.
  const int64_t total_seconds = std::abs(timer.remaining_time.InSeconds());
  const int32_t hours = total_seconds / 3600;
  const int32_t minutes = (total_seconds - hours * 3600) / 60;
  const int32_t seconds = total_seconds % 60;

  // Success of the ICU APIs is tracked by |status|.
  UErrorCode status = U_ZERO_ERROR;

  // Create our distinct |measures| to be formatted. We only show |hours| if
  // necessary, otherwise they are omitted.
  std::vector<icu::Measure> measures;
  if (hours)
    measures.push_back(icu::Measure(hours, createHour(status), status));
  measures.push_back(icu::Measure(minutes, createMinute(status), status));
  measures.push_back(icu::Measure(seconds, createSecond(status), status));

  // Format our |measures| into a |unicode_message|.
  icu::UnicodeString unicode_message;
  icu::FieldPosition field_position = icu::FieldPosition::DONT_CARE;
  UMeasureFormatWidth width = UMEASFMT_WIDTH_NUMERIC;
  icu::MeasureFormat measure_format(icu::Locale::getDefault(), width, status);
  measure_format.formatMeasures(measures.data(), measures.size(),
                                unicode_message, field_position, status);

  std::string message;
  if (U_SUCCESS(status)) {
    // If formatting was successful, convert our |unicode_message| into UTF-8.
    unicode_message.toUTF8String(message);
  } else {
    // If something went wrong, we'll fall back to using "hh:mm:ss" instead.
    LOG(ERROR) << "Error formatting timer notification message: " << status;
    message = base::StringPrintf("%02d:%02d:%02d", hours, minutes, seconds);
  }

  // If time has elapsed since the |timer| has fired, we'll need to negate the
  // amount of time remaining.
  if (timer.remaining_time.InSeconds() < 0) {
    const auto format = l10n_util::GetStringUTF16(
        IDS_ASSISTANT_TIMER_NOTIFICATION_MESSAGE_EXPIRED);
    return base::UTF16ToUTF8(
        base::i18n::MessageFormatter::FormatWithNumberedArgs(format, message));
  }

  // Otherwise, all necessary formatting has been performed.
  return message;
}

// Creates a notification for the given |timer|.
chromeos::assistant::mojom::AssistantNotificationPtr CreateTimerNotification(
    const mojom::AssistantTimer& timer) {
  using chromeos::assistant::mojom::AssistantNotification;
  using chromeos::assistant::mojom::AssistantNotificationButton;
  using chromeos::assistant::mojom::AssistantNotificationPtr;
  using chromeos::assistant::mojom::AssistantNotificationType;

  const std::string title =
      l10n_util::GetStringUTF8(IDS_ASSISTANT_TIMER_NOTIFICATION_TITLE);
  const std::string message = CreateTimerNotificationMessage(timer);

  base::Optional<GURL> stop_alarm_timer_action_url =
      assistant::util::CreateAlarmTimerDeepLink(
          AlarmTimerAction::kRemoveAlarmOrTimer, timer.id);

  base::Optional<GURL> add_time_to_timer_action_url =
      assistant::util::CreateAlarmTimerDeepLink(
          AlarmTimerAction::kAddTimeToTimer, timer.id, kOneMin);

  AssistantNotificationPtr notification = AssistantNotification::New();
  notification->type = AssistantNotificationType::kSystem;
  notification->title = title;
  notification->message = message;
  notification->client_id = CreateTimerNotificationId(timer);
  notification->grouping_key = kTimerNotificationGroupingKey;

  // This notification should be able to wake up the display if it was off.
  notification->is_high_priority = true;

  if (!stop_alarm_timer_action_url.has_value()) {
    LOG(ERROR) << "Can't create stop alarm timer action URL";
    return notification;
  }

  notification->action_url = stop_alarm_timer_action_url.value();

  // "STOP" button.
  notification->buttons.push_back(AssistantNotificationButton::New(
      l10n_util::GetStringUTF8(IDS_ASSISTANT_TIMER_NOTIFICATION_STOP_BUTTON),
      stop_alarm_timer_action_url.value()));

  if (!add_time_to_timer_action_url.has_value()) {
    LOG(ERROR) << "Can't create add time to timer action URL";
    return notification;
  }

  // "ADD 1 MIN" button.
  notification->buttons.push_back(
      chromeos::assistant::mojom::AssistantNotificationButton::New(
          l10n_util::GetStringUTF8(
              IDS_ASSISTANT_TIMER_NOTIFICATION_ADD_1_MIN_BUTTON),
          add_time_to_timer_action_url.value()));

  return notification;
}

}  // namespace

// AssistantAlarmTimerController -----------------------------------------------

AssistantAlarmTimerController::AssistantAlarmTimerController(
    AssistantControllerImpl* assistant_controller)
    : assistant_controller_(assistant_controller) {
  AddModelObserver(this);
  assistant_controller_observer_.Add(AssistantController::Get());
}

AssistantAlarmTimerController::~AssistantAlarmTimerController() {
  RemoveModelObserver(this);
}

void AssistantAlarmTimerController::BindReceiver(
    mojo::PendingReceiver<mojom::AssistantAlarmTimerController> receiver) {
  receiver_.Bind(std::move(receiver));
}

void AssistantAlarmTimerController::AddModelObserver(
    AssistantAlarmTimerModelObserver* observer) {
  model_.AddObserver(observer);
}

void AssistantAlarmTimerController::RemoveModelObserver(
    AssistantAlarmTimerModelObserver* observer) {
  model_.RemoveObserver(observer);
}

void AssistantAlarmTimerController::SetAssistant(
    chromeos::assistant::mojom::Assistant* assistant) {
  assistant_ = assistant;
}

void AssistantAlarmTimerController::OnAssistantControllerConstructed() {
  AssistantState::Get()->AddObserver(this);
}

void AssistantAlarmTimerController::OnAssistantControllerDestroying() {
  AssistantState::Get()->RemoveObserver(this);
}

void AssistantAlarmTimerController::OnDeepLinkReceived(
    assistant::util::DeepLinkType type,
    const std::map<std::string, std::string>& params) {
  using assistant::util::DeepLinkParam;
  using assistant::util::DeepLinkType;

  if (type != DeepLinkType::kAlarmTimer)
    return;

  const base::Optional<AlarmTimerAction>& action =
      assistant::util::GetDeepLinkParamAsAlarmTimerAction(params);
  if (!action.has_value())
    return;

  const base::Optional<std::string>& alarm_timer_id =
      assistant::util::GetDeepLinkParam(params, DeepLinkParam::kId);
  if (!alarm_timer_id.has_value())
    return;

  // Duration is optional. Only used for adding time to timer.
  const base::Optional<base::TimeDelta>& duration =
      assistant::util::GetDeepLinkParamAsTimeDelta(params,
                                                   DeepLinkParam::kDurationMs);

  PerformAlarmTimerAction(action.value(), alarm_timer_id.value(), duration);
}

void AssistantAlarmTimerController::OnAssistantStatusChanged(
    chromeos::assistant::AssistantStatus status) {
  // If LibAssistant is no longer running we need to clear our cache to
  // accurately reflect LibAssistant alarm/timer state.
  if (status == chromeos::assistant::AssistantStatus::NOT_READY)
    model_.RemoveAllTimers();
}

void AssistantAlarmTimerController::OnTimerStateChanged(
    std::vector<mojom::AssistantTimerPtr> timers) {
  if (timers.empty()) {
    model_.RemoveAllTimers();
    return;
  }

  // First we remove all old timers that no longer exist.
  for (const auto* old_timer : model_.GetAllTimers()) {
    if (std::none_of(timers.begin(), timers.end(),
                     [&old_timer](const auto& new_or_updated_timer) {
                       return old_timer->id == new_or_updated_timer->id;
                     })) {
      model_.RemoveTimer(old_timer->id);
    }
  }

  // Then we add any new timers and update existing ones.
  for (auto& new_or_updated_timer : timers)
    model_.AddOrUpdateTimer(std::move(new_or_updated_timer));
}

void AssistantAlarmTimerController::OnTimerAdded(
    const mojom::AssistantTimer& timer) {
  // Schedule a repeating timer to tick the tracked timers.
  if (!ticker_.IsRunning()) {
    ticker_.Start(FROM_HERE, kTickInterval, &model_,
                  &AssistantAlarmTimerModel::Tick);
  }

  // Create a notification for the added alarm/timer.
  assistant_controller_->notification_controller()->AddOrUpdateNotification(
      CreateTimerNotification(timer));
}

void AssistantAlarmTimerController::OnTimerUpdated(
    const mojom::AssistantTimer& timer) {
  // When a |timer| is updated we need to update the corresponding notification
  // unless it has already been dismissed by the user.
  auto* notification_controller =
      assistant_controller_->notification_controller();
  if (notification_controller->model()->HasNotificationForId(
          CreateTimerNotificationId(timer))) {
    notification_controller->AddOrUpdateNotification(
        CreateTimerNotification(timer));
  }
}

void AssistantAlarmTimerController::OnTimerRemoved(
    const mojom::AssistantTimer& timer) {
  // If our model is empty, we no longer need tick updates.
  if (model_.empty())
    ticker_.Stop();

  // Remove any notification associated w/ |timer|.
  assistant_controller_->notification_controller()->RemoveNotificationById(
      CreateTimerNotificationId(timer), /*from_server=*/false);
}

void AssistantAlarmTimerController::OnAllTimersRemoved() {
  // We can stop our timer from ticking when all timers are removed.
  ticker_.Stop();

  // Remove any notifications associated w/ timers.
  assistant_controller_->notification_controller()
      ->RemoveNotificationByGroupingKey(kTimerNotificationGroupingKey,
                                        /*from_server=*/false);
}

void AssistantAlarmTimerController::PerformAlarmTimerAction(
    const AlarmTimerAction& action,
    const std::string& alarm_timer_id,
    const base::Optional<base::TimeDelta>& duration) {
  DCHECK(assistant_);

  switch (action) {
    case AlarmTimerAction::kAddTimeToTimer:
      if (!duration.has_value()) {
        LOG(ERROR) << "Ignoring add time to timer action duration.";
        return;
      }
      assistant_->AddTimeToTimer(alarm_timer_id, duration.value());
      break;
    case AlarmTimerAction::kPauseTimer:
      DCHECK(!duration.has_value());
      assistant_->PauseTimer(alarm_timer_id);
      break;
    case AlarmTimerAction::kRemoveAlarmOrTimer:
      DCHECK(!duration.has_value());
      assistant_->RemoveAlarmOrTimer(alarm_timer_id);
      break;
    case AlarmTimerAction::kResumeTimer:
      DCHECK(!duration.has_value());
      assistant_->ResumeTimer(alarm_timer_id);
      break;
  }
}

}  // namespace ash


text:
package com.jpattern.gwt.client.communication;

import com.jpattern.gwt.client.IErrorMessages;
import com.jpattern.gwt.client.command.ACommand;
import com.jpattern.gwt.client.command.ICommandResult;
import com.jpattern.gwt.client.logger.ILogger;
import com.jpattern.gwt.client.util.GenericWrapper;
import com.jpattern.shared.result.ErrorMessage;
import com.jpattern.shared.result.facade.ICommandFacadeResult;

/**
 *
 * @author Francesco Cina'
 *
 * 07/mag/2011
 */
public abstract class AServerCallCommand<T extends ICommandFacadeResult<?>> extends ACommand {

	final class ServerCommandCallBack implements ICallbackAction<T> {

		private final ICommandResult commandResult;
		private final GenericWrapper<T> callResult;
		private final ILogger logger;

		public ServerCommandCallBack(ICommandResult commandResult, GenericWrapper<T> callResult) {
			this.logger = getProvider().getLoggerService().getLogger(this.getClass());
			this.commandResult = commandResult;
			this.callResult = callResult;
		}

		@Override
		public void onSuccess(T result, int responseCode) {
			logger.debug("onSuccess", "onSuccess ServerCallCommand callback called: " + result.getReturnedObject());
			callResult.setValue(result);
			commandResult.setResponseCode(responseCode);
			if (!result.getErrorMessages().isEmpty()) {
				commandResult.getErrorMessages().addAll(result.getErrorMessages());
			}
			callback(commandResult);
		}

		@Override
		public void onError(Throwable exception, int responseCode) {
			commandResult.getErrorMessages().add(new ErrorMessage(IErrorMessages.SERVER_COMMUNICATION_ERROR, exception.getMessage()));
			commandResult.setResponseCode(responseCode);
			logger.error("onError", "Exception on ServerCallCommand callbak", exception);
			callback(commandResult);
		}

	}
}


text:
module.exports = function fscanf (handle, format) {
  // http://kevin.vanzonneveld.net
  // +   original by: Brett Zamir (http://brett-zamir.me)
  // -    depends on: fgets
  // -    depends on: sscanf
  // *     example 1: var handle = fopen('http://example.com/names_and_professions.html', 'r');
  // *     example 1: fscanf(handle, '%s\t%s\t%s\n');
  // *     returns 1: ['robert', 'slacker', 'us']

  var mixed; // Could be an array or an integer

  mixed = this.sscanf.apply(this, [fgets(handle), format].concat(Array.prototype.slice.call(arguments, 2)));

  return mixed;
}


text:
package org.apache.hadoop.hive.ql.exec.vector.expressions;

import org.apache.hadoop.hive.ql.exec.vector.VectorExpressionDescriptor;
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;

public class FilterColOrScalar extends VectorExpression {

  private static final long serialVersionUID = 1L;
  private long value;
  private int colNum;

  public FilterColOrScalar() {
    super();
  }

  public FilterColOrScalar(int colNum, long scalarVal) {
    this();
    this.colNum = colNum;
    this.value = scalarVal;
  }

  @Override
  public void evaluate(VectorizedRowBatch batch) {
    // Evaluate children only of scalar is FALSE.
    if (value == 0) {
      super.evaluateChildren(batch);
    }
    return;
  }

  @Override
  public int getOutputColumn() {
    return -1;
  }

  @Override
  public String getOutputType() {
    return "boolean";
  }

  public int getColNum() {
    return colNum;
  }

  public void setColNum(int colNum) {
    this.colNum = colNum;
  }

  public double getValue() {
    return value;
  }

  public void setValue(long value) {
    this.value = value;
  }

  @Override
  public String vectorExpressionParameters() {
    return "col " + colNum + ", val " + value;
  }

  @Override
  public VectorExpressionDescriptor.Descriptor getDescriptor() {
    return (new VectorExpressionDescriptor.Builder())
        .setMode(
            VectorExpressionDescriptor.Mode.FILTER)
        .setNumArguments(2)
        .setArgumentTypes(
            VectorExpressionDescriptor.ArgumentType.INT_FAMILY,
            VectorExpressionDescriptor.ArgumentType.INT_FAMILY)
        .setInputExpressionTypes(
            VectorExpressionDescriptor.InputExpressionType.COLUMN,
            VectorExpressionDescriptor.InputExpressionType.SCALAR).build();
  }
}


text:
import { Type } from 'angular2/src/facade/lang';
import { RouteRegistry } from './route_registry';
import { Pipeline } from './pipeline';
import { Instruction } from './instruction';
import { RouterOutlet } from './router_outlet';
import { Location } from './location';
/**
 * # Router
 * The router is responsible for mapping URLs to components.
 *
 * You can see the state of the router by inspecting the read-only field `router.navigating`.
 * This may be useful for showing a spinner, for instance.
 *
 * ## Concepts
 * Routers and component instances have a 1:1 correspondence.
 *
 * The router holds reference to a number of "outlets." An outlet is a placeholder that the
 * router dynamically fills in depending on the current URL.
 *
 * When the router navigates from a URL, it must first recognizes it and serialize it into an
 * `Instruction`.
 * The router uses the `RouteRegistry` to get an `Instruction`.
 *
 * @exportedAs angular2/router
 */
export declare class Router {
    _registry: RouteRegistry;
    _pipeline: Pipeline;
    parent: Router;
    hostComponent: any;
    navigating: boolean;
    lastNavigationAttempt: string;
    previousUrl: string;
    private _currentInstruction;
    private _currentNavigation;
    private _outlet;
    private _subject;
    constructor(_registry: RouteRegistry, _pipeline: Pipeline, parent: Router, hostComponent: any);
    /**
     * Constructs a child router. You probably don't need to use this unless you're writing a reusable
     * component.
     */
    childRouter(hostComponent: any): Router;
    /**
     * Register an object to notify of route changes. You probably don't need to use this unless
     * you're writing a reusable component.
     */
    registerOutlet(outlet: RouterOutlet): Promise<boolean>;
    /**
     * Dynamically update the routing configuration and trigger a navigation.
     *
     * # Usage
     *
     * ```
     * router.config({ 'path': '/', 'component': IndexCmp});
     * ```
     *
     * Or:
     *
     * ```
     * router.config([
     *   { 'path': '/', 'component': IndexComp },
     *   { 'path': '/user/:id', 'component': UserComp },
     * ]);
     * ```
     */
    config(config: any): Promise<any>;
    /**
     * Navigate to a URL. Returns a promise that resolves when navigation is complete.
     *
     * If the given URL begins with a `/`, router will navigate absolutely.
     * If the given URL does not begin with `/`, the router will navigate relative to this component.
     */
    navigate(url: string): Promise<any>;
    _startNavigating(): void;
    _finishNavigating(): void;
    /**
     * Subscribe to URL updates from the router
     */
    subscribe(onNext: any): void;
    /**
     * Updates this router and all descendant routers according to the given instruction
     */
    commit(instruction: Instruction): Promise<any>;
    /**
     * Removes the contents of this router's outlet and all descendant outlets
     */
    deactivate(): Promise<any>;
    /**
     * Given a URL, returns an instruction representing the component graph
     */
    recognize(url: string): Promise<Instruction>;
    /**
     * Navigates to either the last URL successfully navigated to, or the last URL requested if the
     * router has yet to successfully navigate.
     */
    renavigate(): Promise<any>;
    /**
     * Generate a URL from a component name and optional map of parameters. The URL is relative to the
     * app's base href.
     */
    generate(name: string, params: StringMap<string, string>): string;
}
export declare class RootRouter extends Router {
    _location: Location;
    constructor(registry: RouteRegistry, pipeline: Pipeline, location: Location, hostComponent: Type);
    commit(instruction: any): Promise<any>;
}


text:
class wxNativePrinterDC;
class WXDLLIMPEXP_CORE wxPrinterDCImpl : public wxGCDCImpl
{
#  if  wxUSE_PRINTING_ARCHITECTURE
public:
  wxPrinterDCImpl(wxPrinterDC* owner, const wxPrintData& printdata);
  virtual ~wxPrinterDCImpl();
  bool StartDoc(const wxString&) override;
  void EndDoc() override;
  void StartPage() override;
  void EndPage() override;
  wxRect GetPaperRect() const override;
  wxPrintData& GetPrintData()
  {
    return m_printData;
  }
  wxSize GetPPI() const override;
protected:
  void DoGetSize(int* width, int* height) const override;
  wxPrintData m_printData;
  wxNativePrinterDC* m_nativePrinterDC;
private:
  wxDECLARE_CLASS(wxPrinterDC);
#  endif
};
#endif
    // _WX_DCPRINT_H_


text:
package org.apache.sling.scripting.jsp.jasper.compiler;

import java.io.File;
import java.io.FilePermission;
import java.net.URL;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Policy;
import java.security.cert.Certificate;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.jsp.JspApplicationContext;
import javax.servlet.jsp.JspEngineInfo;
import javax.servlet.jsp.JspFactory;
import javax.servlet.jsp.PageContext;

import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.sling.scripting.jsp.jasper.Constants;
import org.apache.sling.scripting.jsp.jasper.IOProvider;
import org.apache.sling.scripting.jsp.jasper.Options;
import org.apache.sling.scripting.jsp.jasper.runtime.JspFactoryImpl;
import org.apache.sling.scripting.jsp.jasper.security.SecurityClassLoad;
import org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper;

/**
 * Class for tracking JSP compile time file dependencies when the
 * &060;%@include file="..."%&062; directive is used.
 *
 * A background thread periodically checks the files a JSP page
 * is dependent upon.  If a dpendent file changes the JSP page
 * which included it is recompiled.
 *
 * Only used if a web application context is a directory.
 *
 * @author Glenn L. Nielsen
 * @version $Revision: 505593 $
 */
public final class JspRuntimeContext {

    // Logger
    private final Log log = LogFactory.getLog(JspRuntimeContext.class);

    /** The {@link IOProvider} used to get access to output */
    private final IOProvider ioProvider;

    /** This is a delegate forwarding either to our own factory
     * or the original one.
     * Depending on the USE_OWN_FACTORY flag.
     */
    public static final class JspFactoryHandler extends JspFactory {

        private final JspFactory original;

        private final JspFactory own;

        public JspFactoryHandler(final JspFactory orig, final JspFactory own) {
            this.original = (orig instanceof JspFactoryHandler ? ((JspFactoryHandler)orig).original : orig);
            this.own = own;
        }

        private JspFactory getFactory() {
            final Integer useOwnFactory = USE_OWN_FACTORY.get();
            if ( useOwnFactory == null || useOwnFactory.intValue() == 0 ) {
                return this.original;
            }
            return this.own;
        }

        @Override
        public PageContext getPageContext(Servlet paramServlet,
                ServletRequest paramServletRequest,
                ServletResponse paramServletResponse, String paramString,
                boolean paramBoolean1, int paramInt, boolean paramBoolean2) {
            return this.getFactory().getPageContext(paramServlet, paramServletRequest,
                    paramServletResponse, paramString, paramBoolean1,
                    paramInt, paramBoolean2);
        }

        @Override
        public void releasePageContext(PageContext paramPageContext) {
            this.getFactory().releasePageContext(paramPageContext);
        }

        @Override
        public JspEngineInfo getEngineInfo() {
            return this.getFactory().getEngineInfo();
        }

        @Override
        public JspApplicationContext getJspApplicationContext(
                ServletContext paramServletContext) {
            return this.getFactory().getJspApplicationContext(paramServletContext);
        }

        /**
         * Reset the jsp factory.
         */
        public void destroy() {
            final JspFactory current = JspFactory.getDefaultFactory();
            if ( current == this ) {
                JspFactory.setDefaultFactory(this.original);
            }
        }

        public void incUsage() {
            final Integer count = JspRuntimeContext.USE_OWN_FACTORY.get();
            int newCount = 1;
            if ( count != null ) {
                newCount = count + 1;
            }
            JspRuntimeContext.USE_OWN_FACTORY.set(newCount);
        }

        public void decUsage() {
            final Integer count = JspRuntimeContext.USE_OWN_FACTORY.get();
            JspRuntimeContext.USE_OWN_FACTORY.set(count - 1);
        }

        public int resetUsage() {
            final Integer count = JspRuntimeContext.USE_OWN_FACTORY.get();
            JspRuntimeContext.USE_OWN_FACTORY.set(0);
            return count;
        }

        public void setUsage(int count) {
            JspRuntimeContext.USE_OWN_FACTORY.set(count);
        }
    }

    /**
     * Preload classes required at runtime by a JSP servlet so that
     * we don't get a defineClassInPackage security exception.
     * And set jsp factory
     */
    public static JspFactoryHandler initFactoryHandler() {
        JspFactoryImpl factory = new JspFactoryImpl();
        SecurityClassLoad.securityClassLoad(factory.getClass().getClassLoader());
        if( System.getSecurityManager() != null ) {
            String basePackage = "org.apache.sling.scripting.jsp.jasper.";
            try {
                factory.getClass().getClassLoader().loadClass( basePackage +
                                                               "runtime.JspFactoryImpl$PrivilegedGetPageContext");
                factory.getClass().getClassLoader().loadClass( basePackage +
                                                               "runtime.JspFactoryImpl$PrivilegedReleasePageContext");
                factory.getClass().getClassLoader().loadClass( basePackage +
                                                               "runtime.JspRuntimeLibrary");
                factory.getClass().getClassLoader().loadClass( basePackage +
                                                               "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper");
                factory.getClass().getClassLoader().loadClass( basePackage +
                                                               "runtime.ServletResponseWrapperInclude");
                factory.getClass().getClassLoader().loadClass( basePackage +
                                                               "servlet.JspServletWrapper");
            } catch (ClassNotFoundException ex) {
                throw new IllegalStateException(ex);
            }
        }

        final JspFactoryHandler key = new JspFactoryHandler(JspFactory.getDefaultFactory(), factory);
        JspFactory.setDefaultFactory(key);
        return key;
    }

    private static final ThreadLocal<Integer> USE_OWN_FACTORY = new ThreadLocal<Integer>();

    // ----------------------------------------------------------- Constructors

    /**
     * Create a JspRuntimeContext for a web application context.
     *
     * Loads in any previously generated dependencies from file.
     *
     * @param context ServletContext for web application
     */
    public JspRuntimeContext(ServletContext context, Options options, final IOProvider ioProvider) {

        this.context = context;
        this.options = options;
        this.ioProvider = ioProvider;

        if (Constants.IS_SECURITY_ENABLED) {
            initSecurity();
        }
    }

    // ----------------------------------------------------- Instance Variables

    /**
     * This web applications ServletContext
     */
    private ServletContext context;
    private Options options;
    private PermissionCollection permissionCollection;

    /**
     * Maps JSP pages to their JspServletWrapper's
     */
    private final ConcurrentHashMap<String, JspServletWrapper> jsps = new ConcurrentHashMap<String, JspServletWrapper>();

    /**
     * Maps dependencies to the using jsp.
     */
    private final Map<String, Set<String>> depToJsp = new HashMap<String, Set<String>>();

    /**
     * Locks for loading tag files.
     */
    private final ConcurrentHashMap<String, Lock> tagFileLoadingLocks = new ConcurrentHashMap<String, Lock>();

    // ------------------------------------------------------ Public Methods

    public void addJspDependencies(final JspServletWrapper jsw, final List<String> deps) {
        if ( deps != null ) {
            final String jspUri = jsw.getJspUri();
            synchronized ( depToJsp ) {
                for(final String dep : deps) {
                    Set<String> set = depToJsp.get(dep);
                    if ( set == null ) {
                        set = new HashSet<String>();
                        depToJsp.put(dep, set);
                    }
                    set.add(jspUri);
                }
            }
        }
    }

    /**
     * Handle jsp modifications
     */
    public boolean handleModification(final String scriptName) {
        if ( log.isDebugEnabled() ) {
            log.debug("Handling modification " + scriptName);
        }

        JspServletWrapper wrapper = jsps.remove(scriptName);

        // first check if jsps contains this
        boolean removed = this.invalidate(wrapper);

        final Set<String> deps;
        synchronized ( depToJsp ) {
            deps = depToJsp.remove(scriptName);
        }
        if ( deps != null ) {
            for(final String dep : deps) {
                wrapper = jsps.remove(dep);
                removed |= this.invalidate(wrapper);
            }
        }
        return removed;
    }

    /**
     * Invalidate a wrapper and destroy it.
     */
    private boolean invalidate(final JspServletWrapper wrapper) {
        if ( wrapper != null ) {
            if ( log.isDebugEnabled() ) {
                log.debug("Invalidating jsp " + wrapper.getJspUri());
            }
            wrapper.destroy(true);
            return true;
        }
        return false;
    }

    /**
     * Add a new wrapper
     *
     * @param jspUri JSP URI
     * @param jsw Servlet wrapper for JSP
     */
    public JspServletWrapper addWrapper(final String jspUri, final JspServletWrapper jsw) {
        final JspServletWrapper previous = jsps.putIfAbsent(jspUri, jsw);
        if ( previous == null ) {
            addJspDependencies(jsw, jsw.getDependants());
            return jsw;
        }
        return previous;
    }

    /**
     * Get an already existing JspServletWrapper.
     *
     * @param jspUri JSP URI
     * @return JspServletWrapper for JSP
     */
    public JspServletWrapper getWrapper(final String jspUri) {
        return jsps.get(jspUri);
    }

    /**
     * Locks a tag file path. Use this before loading it.
     * @param tagFilePath Tag file path
     */
    public void lockTagFileLoading(final String tagFilePath) {
        final Lock lock = getTagFileLoadingLock(tagFilePath);
        lock.lock();
    }

    /**
     * Unlocks a tag file path. Use this after loading it.
     * @param tagFilePath Tag file path
     */
    public void unlockTagFileLoading(final String tagFilePath) {
        final Lock lock = getTagFileLoadingLock(tagFilePath);
        lock.unlock();
    }

    /**
     * Process a "destroy" event for this web application context.
     */
    public void destroy() {
        Iterator<JspServletWrapper> servlets = jsps.values().iterator();
        while (servlets.hasNext()) {
            servlets.next().destroy(false);
        }
        jsps.clear();
        synchronized ( depToJsp ) {
            depToJsp.clear();
        }
    }

    /**
     * Returns the current {@link IOProvider} of this context.
     */
    public IOProvider getIOProvider() {
        return ioProvider;
    }

    // -------------------------------------------------------- Private Methods

    /**
     * Method used to initialize SecurityManager data.
     */
    private void initSecurity() {

        // Setup the PermissionCollection for this web app context
        // based on the permissions configured for the root of the
        // web app context directory, then add a file read permission
        // for that directory.
        Policy policy = Policy.getPolicy();
        if( policy != null ) {
            try {
                // Get the permissions for the web app context
                String docBase = context.getRealPath("/");
                if( docBase == null ) {
                    docBase = options.getScratchDir().toString();
                }
                String codeBase = docBase;
                if (!codeBase.endsWith(File.separator)){
                    codeBase = codeBase + File.separator;
                }
                File contextDir = new File(codeBase);
                URL url = contextDir.getCanonicalFile().toURL();
                final CodeSource codeSource = new CodeSource(url,(Certificate[])null);
                permissionCollection = policy.getPermissions(codeSource);

                // Create a file read permission for web app context directory
                if (!docBase.endsWith(File.separator)){
                    permissionCollection.add
                        (new FilePermission(docBase,"read"));
                    docBase = docBase + File.separator;
                } else {
                    permissionCollection.add
                        (new FilePermission
                            (docBase.substring(0,docBase.length() - 1),"read"));
                }
                docBase = docBase + "-";
                permissionCollection.add(new FilePermission(docBase,"read"));

                // Create a file read permission for web app tempdir (work)
                // directory
                String workDir = options.getScratchDir().toString();
                if (!workDir.endsWith(File.separator)){
                    permissionCollection.add
                        (new FilePermission(workDir,"read"));
                    workDir = workDir + File.separator;
                }
                workDir = workDir + "-";
                permissionCollection.add(new FilePermission(workDir,"read"));

                // Allow the JSP to access org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase
                permissionCollection.add( new RuntimePermission(
                    "accessClassInPackage.org.apache.jasper.runtime") );
            } catch (final Exception e) {
                context.log("Security Init for context failed",e);
            }
        }
    }

    /**
     * Returns and optionally creates a lock to load a tag file.
     */
    private Lock getTagFileLoadingLock(final String tagFilePath) {
        Lock lock = tagFileLoadingLocks.get(tagFilePath);
        if (lock == null) {
            lock = new ReentrantLock();
            final Lock existingLock = tagFileLoadingLocks.putIfAbsent(tagFilePath, lock);
            if (existingLock != null) {
                lock = existingLock;
            }
        }

        return lock;
    }

}


text:
package org.apache.logging.log4j.core.config;

import java.util.HashMap;
import java.util.Map;

import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
import org.apache.logging.log4j.core.config.plugins.PluginElement;
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
import org.apache.logging.log4j.core.lookup.Interpolator;
import org.apache.logging.log4j.core.lookup.MapLookup;
import org.apache.logging.log4j.core.lookup.StrLookup;

/**
 * Handles properties defined in the configuration.
 */
@Plugin(name = "properties", category = Node.CATEGORY, printObject = true)
public final class PropertiesPlugin {

    private PropertiesPlugin() {
    }

    /**
     * Creates the Properties component.
     * @param properties An array of Property elements.
     * @param config The Configuration.
     * @return An Interpolator that includes the configuration properties.
     */
    @PluginFactory
    public static StrLookup configureSubstitutor(@PluginElement("Properties") final Property[] properties,
                                                 @PluginConfiguration final Configuration config) {
        if (properties == null) {
            return new Interpolator(config.getProperties());
        }
        final Map<String, String> map = new HashMap<String, String>(config.getProperties());

        for (final Property prop : properties) {
            map.put(prop.getName(), prop.getValue());
        }

        return new Interpolator(new MapLookup(map), config.getPluginPackages());
    }
}