text:
package org.apache.kafka.streams.state.internals;

import org.apache.kafka.common.serialization.Serde;
import org.apache.kafka.common.utils.Bytes;
import org.apache.kafka.streams.KeyValue;
import org.apache.kafka.streams.kstream.internals.CacheFlushListener;
import org.apache.kafka.streams.processor.ProcessorContext;
import org.apache.kafka.streams.processor.StateStore;
import org.apache.kafka.streams.processor.internals.InternalProcessorContext;
import org.apache.kafka.streams.processor.internals.ProcessorStateManager;
import org.apache.kafka.streams.processor.internals.RecordContext;
import org.apache.kafka.streams.state.KeyValueIterator;
import org.apache.kafka.streams.state.KeyValueStore;
import org.apache.kafka.streams.state.StateSerdes;

import java.util.List;
import java.util.Objects;

class CachingKeyValueStore<K, V> extends WrappedStateStore.AbstractStateStore implements KeyValueStore<Bytes, byte[]>, CachedStateStore<K, V> {

    private final KeyValueStore<Bytes, byte[]> underlying;
    private final Serde<K> keySerde;
    private final Serde<V> valueSerde;
    private CacheFlushListener<K, V> flushListener;
    private String cacheName;
    private ThreadCache cache;
    private InternalProcessorContext context;
    private StateSerdes<K, V> serdes;
    private Thread streamThread;

    CachingKeyValueStore(final KeyValueStore<Bytes, byte[]> underlying,
                         final Serde<K> keySerde,
                         final Serde<V> valueSerde) {
        super(underlying);
        this.underlying = underlying;
        this.keySerde = keySerde;
        this.valueSerde = valueSerde;
    }

    @Override
    public void init(final ProcessorContext context, final StateStore root) {
        underlying.init(context, root);
        initInternal(context);
        // save the stream thread as we only ever want to trigger a flush
        // when the stream thread is the current thread.
        streamThread = Thread.currentThread();
    }

    @SuppressWarnings("unchecked")
    private void initInternal(final ProcessorContext context) {
        this.context = (InternalProcessorContext) context;
        this.serdes = new StateSerdes<>(ProcessorStateManager.storeChangelogTopic(context.applicationId(), underlying.name()),
                                        keySerde == null ? (Serde<K>) context.keySerde() : keySerde,
                                        valueSerde == null ? (Serde<V>) context.valueSerde() : valueSerde);

        this.cache = this.context.getCache();
        this.cacheName = ThreadCache.nameSpaceFromTaskIdAndStore(context.taskId().toString(), underlying.name());
        cache.addDirtyEntryFlushListener(cacheName, new ThreadCache.DirtyEntryFlushListener() {
            @Override
            public void apply(final List<ThreadCache.DirtyEntry> entries) {
                for (ThreadCache.DirtyEntry entry : entries) {
                    putAndMaybeForward(entry, (InternalProcessorContext) context);
                }
            }
        });
    }

    private void putAndMaybeForward(final ThreadCache.DirtyEntry entry, final InternalProcessorContext context) {
        final RecordContext current = context.recordContext();
        try {
            context.setRecordContext(entry.recordContext());
            if (flushListener != null) {

                flushListener.apply(serdes.keyFrom(entry.key().get()),
                                    serdes.valueFrom(entry.newValue()),
                                    serdes.valueFrom(underlying.get(entry.key())));

            }
            underlying.put(entry.key(), entry.newValue());
        } finally {
            context.setRecordContext(current);
        }
    }

    public void setFlushListener(final CacheFlushListener<K, V> flushListener) {
        this.flushListener = flushListener;
    }

    @Override
    public synchronized void flush() {
        cache.flush(cacheName);
        underlying.flush();
    }

    @Override
    public void close() {
        flush();
        underlying.close();
        cache.close(cacheName);
    }

    @Override
    public boolean persistent() {
        return underlying.persistent();
    }

    @Override
    public boolean isOpen() {
        return underlying.isOpen();
    }

    @Override
    public synchronized byte[] get(final Bytes key) {
        validateStoreOpen();
        Objects.requireNonNull(key);
        return getInternal(key);
    }

    private byte[] getInternal(final Bytes key) {
        final LRUCacheEntry entry = cache.get(cacheName, key);
        if (entry == null) {
            final byte[] rawValue = underlying.get(key);
            if (rawValue == null) {
                return null;
            }
            // only update the cache if this call is on the streamThread
            // as we don't want other threads to trigger an eviction/flush
            if (Thread.currentThread().equals(streamThread)) {
                cache.put(cacheName, key, new LRUCacheEntry(rawValue));
            }
            return rawValue;
        }

        if (entry.value == null) {
            return null;
        }

        return entry.value;
    }

    @Override
    public KeyValueIterator<Bytes, byte[]> range(final Bytes from, final Bytes to) {
        validateStoreOpen();
        final KeyValueIterator<Bytes, byte[]> storeIterator = underlying.range(from, to);
        final ThreadCache.MemoryLRUCacheBytesIterator cacheIterator = cache.range(cacheName, from, to);
        return new MergedSortedCacheKeyValueBytesStoreIterator(cacheIterator, storeIterator);
    }

    @Override
    public KeyValueIterator<Bytes, byte[]> all() {
        validateStoreOpen();
        final KeyValueIterator<Bytes, byte[]> storeIterator = new DelegatingPeekingKeyValueIterator<>(this.name(), underlying.all());
        final ThreadCache.MemoryLRUCacheBytesIterator cacheIterator = cache.all(cacheName);
        return new MergedSortedCacheKeyValueBytesStoreIterator(cacheIterator, storeIterator);
    }

    @Override
    public synchronized long approximateNumEntries() {
        validateStoreOpen();
        return underlying.approximateNumEntries();
    }

    @Override
    public synchronized void put(final Bytes key, final byte[] value) {
        Objects.requireNonNull(key, "key cannot be null");
        validateStoreOpen();
        putInternal(key, value);
    }

    private synchronized void putInternal(final Bytes rawKey, final byte[] value) {
        Objects.requireNonNull(rawKey, "key cannot be null");
        cache.put(cacheName, rawKey, new LRUCacheEntry(value, true, context.offset(),
                  context.timestamp(), context.partition(), context.topic()));
    }

    @Override
    public synchronized byte[] putIfAbsent(final Bytes key, final byte[] value) {
        Objects.requireNonNull(key, "key cannot be null");
        validateStoreOpen();
        final byte[] v = getInternal(key);
        if (v == null) {
            putInternal(key, value);
        }
        return v;
    }

    @Override
    public synchronized void putAll(final List<KeyValue<Bytes, byte[]>> entries) {
        for (KeyValue<Bytes, byte[]> entry : entries) {
            put(entry.key, entry.value);
        }
    }

    @Override
    public synchronized byte[] delete(final Bytes key) {
        validateStoreOpen();
        Objects.requireNonNull(key);
        final byte[] v = getInternal(key);
        cache.delete(cacheName, key);
        underlying.delete(key);
        return v;
    }

    KeyValueStore<Bytes, byte[]> underlying() {
        return underlying;
    }

    @Override
    public StateStore inner() {
        if (underlying instanceof WrappedStateStore) {
            return ((WrappedStateStore) underlying).inner();
        }
        return underlying;
    }
}


text:
FacebookSample
==============

This sample project for the V-Play Facebook Plugin connect the app with Facebook and displays information about the current user after a successful login. It also demonstrates how to perform Facebook Graph API GET requests.

Instructions
------------

- Install the Facebook plugin as described here: http://plugins.v-play.net/doc/plugin-installation/#downloading-v-play-plugins

- Open `FaebookSample.pro` in Qt Creator and configure the project for an iOS or Android target

- Make sure that the [Gradle build system](http://plugins.v-play.net/doc/android-gradle/#enable-gradle-build-system) for Android is enabled

- Android: In case you want to test the plugin on Android you need to create an own Facebook app on http://developers.facebook.com and add your Android signing certificate's key hash to the app. Otherwise you won't be able to login to Facebook with this sample app.

- Run the project and enjoy the Facebook integration

Please also have a look at http://plugins.v-play.net/doc/plugin-facebook/ on how to integrate the plugin into your own Qt 5 apps.

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.ma.sample.TextSample"
    android:orientation="vertical"
    android:id="@+id/some_layout"
    >
    <!--<com.ma.nestedwheels.NestedWheelsView-->
        <!--android:layout_width="match_parent"-->
        <!--android:layout_height="match_parent"-->
        <!--android:id="@+id/mySpinner1"-->
        <!--android:layout_weight="1" />-->
    <TextView
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:id="@+id/outer_degree1"
        android:text="Inner Wheel      degree=0°    selected= --" />
    <TextView
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:id="@+id/inner_degree1"
        android:text="Outer Wheel      degree=0°    selected= --" />
</LinearLayout>


text:
<?php

$cssAnsScriptFilesModule = array(
	'/plugins/mixitup/src/jquery.mixitup.js'
);

HtmlHelper::registerCssAndScriptsFiles( $cssAnsScriptFilesModule ,Yii::app()->request->baseUrl);
?>

<?php

/*
$this->renderPartial('../default/panels/toolbar',array("toolbarStyle"=>"width:50px")); */
$contextName = "";
$contextIcon = "connectdevelop";
$contextTitle = "";
$parentId="";
$parentType="";
$manage="";

if( @$type == Organization::CONTROLLER && @$organization ){
	Menu::organization( $organization );
	$thisOrga = Organization::getById($organization["_id"]);
	$contextName = Yii::t("common","Organization")." : ".$thisOrga["name"];
	$contextIcon = "users";
	$contextTitle = Yii::t("common","Community of organization");
	if (isset($organization["_id"]) && isset(Yii::app()->session["userId"])
			 && Authorisation::isOrganizationAdmin(Yii::app()->session["userId"], $organization["_id"])) {
		if(!isset($organization["disabled"]))
			$manage=1;
	}
	$parentName=$organization["name"];
	$parentId=$organization["_id"];
	$parentType=Organization::COLLECTION;
	$connectType="members";
	$contextData = $thisOrga;
	$projects=array();
}
else if( @$type == City::CONTROLLER && @$city ){
	Menu::city($city, $cityGlobal);
	//$contextName = Yii::t("common","City")." : ".$city["name"];
	$contextName = Yii::t("common","City")." : ".(($cityGlobal == false) ? $city["namePc"]. " ( ".$city["cp"]." ) " /*((count($city["postalCodes"]) > 1) ? ." ".Yii::t("common", "town of")." ".$city["name"])*/ : $city["name"]);
	$contextIcon = "university";
	$contextTitle = Yii::t("common", "DIRECTORY Local network of")." ".(($cityGlobal == false) ? $city["namePc"]. " ( ".$city["cp"]." ) " /*." ".Yii::t("common", "town of")." ".$city["name"] */: $city["name"]);
}
else if( @$type == Event::CONTROLLER && @$event ){
	Menu::event( $event,true );
	$contextName = Yii::t("common","Event")." : ".$event["name"];
	$contextIcon = "calendar";
	$contextTitle = Yii::t("common", "Visualize Event")." ".$event["name"];
	if (isset($event["_id"]) && isset(Yii::app()->session["userId"])
			 && Authorisation::isEventAdmin($event["_id"], Yii::app()->session["userId"])) {
			$manage=1;
	}
	$parentName=$event["name"];
	$parentId=$event["_id"];
	$parentType=Event::COLLECTION;
	$connectType="contributors";
	$contextData = $event;
	$projects=array();
	$events=array();
}
else if( @$type == Person::CONTROLLER && @$person ){
	Menu::person( $person );
	$contextName = Yii::t("common","Person")." : ".$person["name"];
	$contextIcon = "user";
	$contextTitle =  Yii::t("common", "DIRECTORY of")." ".$person["name"];
	$connectType="network";
	$contextData = $person;
	$parentType=Person::COLLECTION;
}
else if( @$type == Project::CONTROLLER && @$project ){
	//Menu::project( $person );
	$contextName = Yii::t("common","Project")." : ".$project["name"];
	$contextIcon = "lightbulb-o";
	$contextTitle = Yii::t("common", "Community of project");
	if(isset($project["_id"]) && isset(Yii::app()->session["userId"])
			 && Authorisation::isProjectAdmin($project["_id"], Yii::app()->session["userId"]) == 1){
		$manage=1;
	}

	$parentName=$project["name"];
	$parentId=$project["_id"];
	$parentType=Project::COLLECTION;
	$connectType="contributors";
	$contextData = $project;
	$projects=array();
	$events=array();
}else if( @$type == "favorites"  ){
	$contextName = Yii::t("common","My Favorites");
	$contextIcon = "star";
	$contextTitle =  Yii::t("common", "MY FAVORITES");
	$connectType="star";
}
$this->renderPartial('../default/panels/toolbar');

$countPeople = 0; $countOrga = 0; $countProject = 0; $countEvent = 0; $countFollowers = 0; $followsProject = 0; $followsPeople = 0 ; $followsOrga = 0; $countAttendees = 0; $countGuests = 0;
if (@$people)
	foreach (@$people as $key => $onePeople) { if( @$onePeople["name"]) $countPeople++;}
if (@$organizations)
	foreach (@$organizations as $key => $orga) { if( @$orga["name"]) $countOrga++;	}
if (@$projects)
	foreach (@$projects as $key => $project) { if( @$project["name"]) $countProject++;	}
if (@$events)
	foreach (@$events as $key => $event) { if( @$event["name"]) $countEvent++;	}
if (@$followers){
	foreach ($followers as $key => $follower) { if( @$follower["name"]) $countFollowers++;}
}
if (@$attendees){
	foreach ($attendees as $key => $attendee) { if( @$attendee["name"]) $countAttendees++;}
}
if (@$guests){
	foreach ($guests as $key => $guest) { if( @$guest["name"]) $countGuests++;}
}

if (@$follows){
	if(@$follows[Person::COLLECTION]){
		foreach ($follows[Person::COLLECTION] as $e) {
			$followsPeople++;
			$countPeople++;
		}
	}
	if(@$follows[Organization::COLLECTION]){
		foreach ($follows[Organization::COLLECTION] as $e) {
			$followsOrga++;
			$countOrga++;
		}
	}
	if(@$follows[Project::COLLECTION]){
		foreach ($follows[Project::COLLECTION] as $e) {
			$followsProject++;
			$countProject++;
		}
	}

}
?>

					<?php echo $contextTitle; ?>

							<a href="javascript:;" class="bg-dark" onclick="$('.optionFilter').hide();<?php if(($followsProject+$followsOrga) > 0){ ?>$('.labelFollows').show();<?php }else{ ?>$('.labelFollows').hide();<?php } ?>">
								 <?php echo Yii::t("common","All") ?>
								<?php echo $countPeople + $countOrga + $countEvent + $countProject + $countGuests + $countAttendees;  ?>

						<?php if($countPeople > 0){  ?>

								 <?php echo Yii::t("common", "People"); ?>
								<?php echo $countPeople;  ?>

						<?php } ?>
						<?php if(@$organizations && count($organizations) > 0){  ?>

								 <?php echo Yii::t("common","Organizations") ?>
								<?php echo $countOrga;  ?>

						<?php } ?>
						<?php if(@$events && count($events) > 0){  ?>

								 <?php echo Yii::t("common","Events") ?>
								<?php echo $countEvent;  ?>

						<?php } ?>
						<?php if(@$projects && count($projects) > 0){  ?>

							<a href="javascript:;" class="filterprojects bg-purple" onclick="$('.optionFilter').hide();<?php if($followsProject > 0){ ?>$('.labelFollows').show();<?php }else{ ?>$('.labelFollows').hide();<?php } ?>">
								 <?php echo Yii::t("common","Projects") ?>
								<?php echo $countProject;  ?>

						<?php } ?>
						<?php if($countFollowers > 0){  ?>

								 <?php echo Yii::t("common","Followers") ?>
								<?php echo $countFollowers;  ?>

						<?php } ?>
						<?php if($countAttendees > 0){  ?>

								 <?php echo Yii::t("event", "Attendees"); ?>
								<?php echo $countAttendees;  ?>

						<?php } ?>
						<?php if($countGuests > 0){  ?>

								 <?php echo Yii::t("event", "Guests"); ?>
								<?php echo $countGuests;  ?>

						<?php } ?>

							 <?php echo Yii::t("common","Tags"); ?>

							 <?php echo Yii::t("common","Places"); ?>

 <?php echo Yii::t("common","Organizations types") ?>

						<?php echo Yii::t("common","NGO") ?>
						<?php echo Yii::t("common","Local Business") ?>
						<?php echo Yii::t("common","Group") ?>
						<?php echo Yii::t("common","Government Organization") ?>

					<?php if (@$manage){ ?>
						<input type="hidden" id="parentType" value="<?php echo $parentType ?>"/>
						<input type="hidden" id="parentId" value="<?php echo $parentId ?>"/>
						<input type="hidden" id="connectType" value="<?php echo $connectType ?>"/>
					<?php } ?>
					<?php
					$memberId = Yii::app()->session["userId"];
					$memberType = Person::COLLECTION;
					$tags = array();
					$tagsHTMLFull = "";
					$scopes = array(
						"codeInsee"=>array(),
						"postalCode"=>array(),
						"region"=>array(),
						"addressLocality"=>array(),
					);
					$scopesHTMLFull = "";
					/*if ($parentType==Person::COLLECTION){

							<?php echo ucfirst(Yii::t("common",$connectType))

					 */
					/* ************ ORGANIZATIONS ********************** */
					if(@$organizations)
					{
						foreach ($organizations as $e)
						{
							buildDirectoryLine($e, Organization::COLLECTION, Organization::CONTROLLER, Organization::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage);
						};
					}

					/* ********** PEOPLE ****************** */
					if(@$people)
					{
						foreach ($people as $e)
						{
							buildDirectoryLine($e, Person::COLLECTION, Person::CONTROLLER, Person::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage,$parentType,$parentId);
						}
					}

					/* ************ EVENTS ************************ */
					if(@$events)
					{
						foreach ($events as $e)
						{
							buildDirectoryLine($e, Event::COLLECTION, Event::CONTROLLER, Event::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage /*$manage=null*/);
						}
					}

					/* ************ PROJECTS **************** */
					if( @$projects )
					{
						foreach ($projects as $e)
						{
							buildDirectoryLine($e, Project::COLLECTION, Project::CONTROLLER, Project::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage /*$manage=null*/);
						}
					}
					/* ************ ATTENDEES OF AN EVENT ************************ */
					if(@$attendees)
					{
						foreach ($attendees as $e)
						{
							buildDirectoryLine($e, Person::COLLECTION, Person::CONTROLLER, Person::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage /*$manage=null*/);
						}
					}
					/* ************ GUESTS OF AN EVENT ************************ */
					if(@$guests)
					{
						foreach ($guests as $e)
						{
							buildDirectoryLine($e, Person::COLLECTION, Person::CONTROLLER, Person::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage /*$manage=null*/);
						}
					}

					function dateToStr($date, $lang, $inline){
						//echo $date;
						$year 	= substr($date, 0, 4);
						$month 	= substr($date, 5, 2);//getMonthStr(date.substr(5, 2), lang);
						$day 	= substr($date, 8, 2);
						$hours 	= substr($date, 11, 2);
						$minutes = substr($date, 14, 2);

						$str = $day . "/" . $month . "/" . $year;
						if(!$inline) $str .= "
";
						else $str .= " - ";
						$str .= $hours . "h" . $minutes;
						//echo "[[".$str."]]";
						return $str;
					}
					if( @$follows[Person::COLLECTION])
						{
							foreach ($follows[Person::COLLECTION] as $e)
							{
								buildDirectoryLine($e, Person::COLLECTION, Person::CONTROLLER, Person::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage,$parentType,$parentId);
							}
					}
					///// SHOW FOLLOWERS !!!!!
					if( @$followers){
						foreach ($followers as $e)
							{
								buildDirectoryLine($e, "followers", Person::CONTROLLER, Person::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,false);
							}
						}
					///// SHOW FOLLOWS
					if (@$follows && ($followsProject+$followsOrga) > 0){ ?>

							<?php echo ucfirst(Yii::t("common","follows")) ?>

					<?php
						if(@$follows[Organization::COLLECTION])
						{
							foreach ($follows[Organization::COLLECTION] as $e)
							{
								buildDirectoryLine($e, Organization::COLLECTION, Organization::CONTROLLER, Organization::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage);
							};
						}

						/* ********** PEOPLE ****************** */
						/* Intégrer au réseau en attendant un lien plus fort
							if(isset($follows[Person::COLLECTION]))
						{
							foreach ($follows[Person::COLLECTION] as $e)
							{
								buildDirectoryLine($e, Person::COLLECTION, Person::CONTROLLER, Person::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage,$parentType,$parentId);
							}
						}	*/
						if(@$follows[Project::COLLECTION])
						{
							foreach ($follows[Project::COLLECTION] as $e)
							{
								buildDirectoryLine($e, Project::COLLECTION, Project::CONTROLLER, Project::ICON, $this->module->id,$tags,$scopes,$tagsHTMLFull,$scopesHTMLFull,$manage=null);
							}
						}
					}

					function buildDirectoryLine( $e, $collection, $type, $icon, $moduleId, &$tags, &$scopes, &$tagsHTMLFull,&$scopesHTMLFull,$manage,$parentType=null,$parentId=null)
					{
						if((!@$e['_id']  && !@$e["id"] )|| !@$e["name"] || $e["name"] == "" )
							return;
						$actions = "";
						if(@$e['_id'])
							$id = $e["_id"];
						else
							$id = $e["id"];

						/* **************************************
						* TYPE + ICON
						***************************************** */
						$img = '';//' ';
						if ($e && !empty($e["profilThumbImageUrl"])){
							$img = 'createUrl('/'.$e['profilThumbImageUrl']).'">';
						}else{
							if(!empty($e["profilImageUrl"]))
								$img = 'createUrl('/communecter/document/resized/50x50'.$e['profilImageUrl']).'">';
							else
							$img = "

";
						}

						/* **************************************
						* TAGS FILTER
						***************************************** */
						$tagsClasses = "";
						if(@$e["tags"]){
							foreach ($e["tags"] as $key => $value) {
								$tagsClasses .= ' '.preg_replace("/[^A-Za-z0-9]/", "", $value) ;
							}
						}

						/* **************************************
						* SCOPES FILTER
						***************************************** */
						$scopesClasses = "";
						if( @$e["address"] && @$e["address"]['codeInsee'] )
							$scopesClasses .= ' '.$e["address"]['codeInsee'];
						if( @$e["address"] && @$e["address"]['postalCode'] )
							$scopesClasses .= ' '.$e["address"]['postalCode'];
						if( @$e["address"] && @$e["address"]['region'] )
							$scopesClasses .= ' '.$e["address"]['region'];
						if( @$e["address"] && @$e["address"]['addressLocality'] ){
							$locality = str_replace( " ", "", $e["address"]['addressLocality']);
							$scopesClasses .= ' '.$locality;
						}

						//$url = Yii::app()->createUrl('/'.$moduleId.'/'.$type.'/dashboard/id/'.$id);
						$name = ( @$e["name"] ) ? $e["name"] : "" ;
						$url = "loadByHash('#".$type.".detail.id.".$id."')";
						$url = 'href="javascript:;" onclick="'.$url.'"';
						$process = "";
						if(@$e["isAdminPending"])
							$process = " <color class='text-red'>(".Yii::t("common","Wait for confirmation").")</color>";
						else if(!@$e["isAdmin"] && @$e["toBeValidated"])
							$process = " <color class='text-red'>(en attente de confirmation)</color>";

						if(@$e["tobeactivated"] || @$e["pending"]){
							$process= " (En cours d'inscription)";
							$processStyle='style="filter:grayscale(100%);-webkit-filter:grayscale(100%);"';
						}
						else{
							$processStyle="";
						}
						$entryType = ( @$e["type"]) ? $e["type"] : "";
						$panelHTML = '
'.
							'
'.
										'
';
						$strHTML = ''.$name.'';

						if ($process) {
							$strHTML .= ''.$process.'';
						}

						/* **************************************
						* EMAIL for admin use only
						***************************************** */
						//$strHTML .= isset($e["email"]) ? '
'.$e["email"].'' : "";

						/* **************************************
						* DATE for Event and PROJECT uses
						***************************************** */

						if(isset($e["startDate"]) && !isset($e["endDate"]) && $type == "event"){
						 	$strHTML .=  '
Le '.date("d/m/y H:i",(isset($e["startDate"]->sec))  ? $e["startDate"]->sec : strtotime($e["startDate"]) ).'';
						}
						if(isset($e["startDate"]) && isset($e["endDate"]) && $type == "event"){
						 	if(isset($e["startDate"]->sec)){
						 		$strHTML .=  '
'.
						 					 ''.date('m/d/Y', $e["startDate"]->sec).'';
						 		$strHTML .=  ''.date('m/d/Y', $e["endDate"]->sec).'';

							}else{
								$start = dateToStr($e["startDate"], "fr", true);
								$end = dateToStr($e["endDate"], "fr", true);

								if(substr($start, 0, 10) != substr($end, 0, 10)){
									$strHTML .=  '
'.
												 ''.$e["startDate"].'';
									$strHTML .=  ''.$e["endDate"].'';
								}else{
									$hour1 = substr($start, strpos($start, "-")+2, strlen($start));
									$hour2 = substr($end,   strpos($end,   "-")+2, strlen($end));

									if($hour1 == "00h00" && $hour2 == "23h59") {
										$strHTML .=  '
'.
													 ' Le '.substr($start, 0, 10).'';
										$strHTML .=  ''.Yii::t("event","All day",null,Yii::app()->controller->module->id).'';
									}else{
										$strHTML .=  '
'.
													 ' Le '.substr($start, 0, 10).'';
										$strHTML .=  ''.$hour1. " - ".$hour2.'';
									}
								}
							}
						}

						/* **************************************
						* TAGS
						***************************************** */
						$tagsHTML = "";
						if(isset($e["tags"])){
							foreach ($e["tags"] as $key => $value) {
								$tagsHTML .= ' #'.$value.'';
								if( $tags != "" && !in_array($value, $tags) ) {
									array_push($tags, $value);
									$tagsHTMLFull .= ' #'.$value.'';
								}
							}
						}

						/* **************************************
						* SCOPES
						***************************************** */
						$scopeHTML = "";
						if( isset($e["address"]) && isset( $e["address"]['codeInsee'])){
							//$scopeHTML .= ' '.$e["address"]['codeInsee'].'';
							if( !in_array($e["address"]['codeInsee'], $scopes['codeInsee']) ) {
								array_push($scopes['codeInsee'], $e["address"]['codeInsee'] );
								$scopesHTMLFull .= ' insee '.$e["address"]['codeInsee'].'';
							}
						}
						if( isset($e["address"]) && isset( $e["address"]['postalCode'])){
							$scopeHTML .= ' '.$e["address"]['postalCode'].'';
							if( !in_array($e["address"]['postalCode'], $scopes['postalCode']) ) {
								$insee = isset($e["address"]['codeInsee']) ? $e["address"]['codeInsee'] : $e["address"]['postalCode'];
								array_push($scopes['postalCode'], $e["address"]['postalCode'] );
								$scopesHTMLFull .= ' cp '.$e["address"]['postalCode'].'';
							}
						}
						if( isset($e["address"]) && isset( $e["address"]['region']) ){
							$scopeHTML .= ' '.$e["address"]['region'].'';
							if( !in_array($e["address"]['region'], $scopes['region']) ) {
								array_push($scopes['region'], $e["address"]['region'] );
								$scopesHTMLFull .= ' region '.$e["address"]['region'].'';
							}
						}
						if( isset($e["address"]) && isset( $e["address"]['addressLocality'])){
							if ($e["address"]['addressLocality']=="Unknown")
								$adresseLocality="Adresse non renseignée";
							else
								$adresseLocality=$e["address"]['addressLocality'];
							$scopeHTML .= ' '.$adresseLocality.'';
							if( !in_array($e["address"]['addressLocality'], $scopes['addressLocality']) ) {
								array_push($scopes['addressLocality'], $e["address"]['addressLocality'] );
								$scopesHTMLFull .= ' Locality  '.$e["address"]['addressLocality'].'';
							}
						}

						//$strHTML .= '
'.$tagsHTML."
".$scopeHTML.'
';
						$featuresHTML = "";
						if( $scopeHTML != "" ){
							$strHTML .= '
'.$scopeHTML.'
';
							//$featuresHTML .= ' ';
						}
						$strHTML .= '
';
						$strHTML .= "

";//$tagsHTML."
".$scopeHTML;
						if( isset( $e["tags"]) ){
							$strHTML .= '
'.$tagsHTML.'
';
							//$featuresHTML .= '';
						}
						if( isset($e["geo"]) && isset($e["geo"]["latitude"]) && isset($e["geo"]["longitude"]) ){
							//$featuresHTML .= ' ';
						}
						if($manage==1){
							$strHTML .= '
'.
											''.
												' '.
											''.
											'
';
							if(@$e["toBeValidated"]){
								$strHTML .= 	'
'.
													''.
														''.
														Yii::t("common","Accept this ".$type."").
													''.
												'
';
							}

							if(@$e["isAdminPending"]){
								$strHTML .= 	'
'.
													''.
														''.
														Yii::t("common","Accept as admin").
													''.
												'
';
							} else {
								if(!@$e["isAdmin"] && !@$e["toBeValidated"] && !@$e["isAdminPending"]){
								$strHTML .= 	'
'.
													''.
														''.
														Yii::t("common","Add as admin").
													''.
												'
';
								}
							}
							$strHTML .=			'
'.
													''.
														''.
														Yii::t("common","Unlink").
													''.
												'
';
							$strHTML .= 	'
'.
							'
';
						}
						$color = "";
						if($icon == "fa-users") $color = "green";
						if($icon == "fa-user") $color = "yellow";
						if($icon == "fa-calendar") $color = "orange";
						if($icon == "fa-lightbulb-o") $color = "purple";
						$flag = '
';
						if(@$e["isAdmin"] && !@$e["isAdminPending"])
							$flag .= "";
						$flag.="
";
						echo $panelHTML.
							'
'.$img.$flag.$featuresHTML.'
'.
							'
'.$strHTML.'

';
					}
					?>

<?php
    $contextMap = array();
    if(@$contextData) $contextMap = array("context" => $contextData);
    //Add follows : people, organization and project
    if(@$follows) {
    	if (@$follows[Person::COLLECTION])
    		$contextMap = array_merge($contextMap, $follows[Person::COLLECTION]);
    	if (@$follows[Organization::COLLECTION])
    		$contextMap = array_merge($contextMap, $follows[Organization::COLLECTION]);
    	if (@$follows[Project::COLLECTION])
    		$contextMap = array_merge($contextMap, $follows[Project::COLLECTION]);
    }
    if(@$organizations)   $contextMap = array_merge($contextMap, $organizations);
    if(@$events)         $contextMap = array_merge($contextMap, $events);
    if(@$projects)        $contextMap = array_merge($contextMap, $projects);
?>


text:
require 'spec_helper'

describe 'percona-hardening::hardening' do
  cached(:chef_run) do
    ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe)
  end

  it 'create /etc/mysql/my.cnf file' do
    expect(chef_run).to create_file('/etc/mysql/my.cnf').with(
      mode: '600',
      owner: 'mysql',
      group: 'root'
    )
  end

  it 'create /etc/mysql/conf.d/hardening.cnf template' do
    expect(chef_run).to create_template('/etc/mysql/conf.d/hardening.cnf').with(
      owner: 'mysql',
      mode: '750',
      source: 'hardening.cnf.erb'
    )
    resource = chef_run.template('/etc/mysql/conf.d/hardening.cnf')
    expect(resource).to notify('service[mysql]').to(:restart).immediately
  end

  it 'create /var/lib/mysql directory' do
    expect(chef_run).to create_directory('/var/lib/mysql').with(
      owner: 'mysql',
      mode: '755'
    )
  end

  it 'stubbing mysql service for chefspec' do
    expect(chef_run).to_not enable_service('mysql')
  end

  context 'chef-solo' do
    cached(:chef_run) do
      ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe)
    end

    it 'does not raise an error' do
      expect { chef_run }.not_to raise_error
    end
  end
end


text:
namespace SPIRV {

class SPIRVType : public SPIRVEntry {
public:
  // Complete constructor
  SPIRVType(SPIRVModule *M, unsigned TheWordCount, Op TheOpCode, SPIRVId TheId)
      : SPIRVEntry(M, TheWordCount, TheOpCode, TheId) {}
  // Incomplete constructor
  SPIRVType(Op TheOpCode) : SPIRVEntry(TheOpCode) {}

  SPIRVType *getArrayElementType() const;
  uint64_t getArrayLength() const;
  unsigned getDerivedArrayStride() const;
  unsigned getBitWidth() const;
  unsigned getSizeInBytes() const;
  unsigned getFloatBitWidth() const;
  unsigned getIntegerBitWidth() const;
  SPIRVType *getFunctionReturnType() const;
  SPIRVType *getPointerElementType() const;
  SPIRVStorageClassKind getPointerStorageClass() const;
  SPIRVType *getStructMemberType(size_t) const;
  SPIRVWord getStructMemberCount() const;
  SPIRVWord getVectorComponentCount() const;
  SPIRVType *getVectorComponentType() const;
  SPIRVWord getMatrixColumnCount() const;
  SPIRVType *getMatrixColumnType() const;
  unsigned getDerivedMatrixStride() const;
  SPIRVType *getCompositeElementType(size_t) const;
  SPIRVWord getCompositeElementCount() const;
  bool isTypeVoid() const;
  bool isTypeArray() const;
  bool isTypeRuntimeArray() const;
  bool isTypeBool() const;
  bool isTypeComposite() const;
  bool isTypeFloat(unsigned Bits = 0) const;
  bool isTypeImage() const;
  bool isTypeSampledImage() const;
  bool isTypeInt(unsigned Bits = 0) const;
  bool isTypePointer() const;
  bool isTypeForwardPointer() const;
  bool isTypeSampler() const;
  bool isTypeStruct() const;
  bool isTypeScalar() const;
  bool isTypeVector() const;
  bool isTypeMatrix() const;
  bool isTypeVectorInt(unsigned Bits = 0) const;
  bool isTypeVectorFloat(unsigned Bits = 0) const;
  bool isTypeVectorBool() const;
  bool isTypeVectorOrScalarInt(unsigned Bits = 0) const;
  bool isTypeVectorOrScalarFloat(unsigned Bits = 0) const;
  bool isTypeVectorOrScalarBool() const;
#if VKI_RAY_TRACING
  bool isTypeAccelerationStructureKHR() const;
  bool isTypeRayQueryKHR() const;
#endif
};

class SPIRVTypeVoid : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeVoid(SPIRVModule *M, SPIRVId TheId) : SPIRVType(M, 2, OpTypeVoid, TheId) {}
  // Incomplete constructor
  SPIRVTypeVoid() : SPIRVType(OpTypeVoid) {}

protected:
  _SPIRV_DEF_DECODE1(Id)
};

class SPIRVTypeBool : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeBool(SPIRVModule *M, SPIRVId TheId) : SPIRVType(M, 2, OpTypeBool, TheId) {}
  // Incomplete constructor
  SPIRVTypeBool() : SPIRVType(OpTypeBool) {}

protected:
  _SPIRV_DEF_DECODE1(Id)
};

class SPIRVTypeInt : public SPIRVType {
public:
  static const Op OC = OpTypeInt;
  // Complete constructor
  SPIRVTypeInt(SPIRVModule *M, SPIRVId TheId, unsigned TheBitWidth, bool ItIsSigned)
      : SPIRVType(M, 4, OC, TheId), BitWidth(TheBitWidth), IsSigned(ItIsSigned) {
    validate();
  }
  // Incomplete constructor
  SPIRVTypeInt() : SPIRVType(OC), BitWidth(0), IsSigned(false) {}

  unsigned getBitWidth() const { return BitWidth; }
  bool isSigned() const { return IsSigned; }
  SPIRVCapVec getRequiredCapability() const override {
    SPIRVCapVec CV;
    switch (BitWidth) {
    case 8:
      CV.push_back(CapabilityInt8);
      break;
    case 16:
      CV.push_back(CapabilityInt16);
      break;
    case 64:
      CV.push_back(CapabilityInt64);
      break;
    default:
      break;
    }
    return CV;
  }

protected:
  _SPIRV_DEF_DECODE3(Id, BitWidth, IsSigned)
  void validate() const override {
    SPIRVEntry::validate();
    assert(BitWidth > 1 && BitWidth <= 64 && "Invalid bit width");
  }

private:
  unsigned BitWidth; // Bit width
  bool IsSigned;     // Whether it is signed
};

class SPIRVTypeFloat : public SPIRVType {
public:
  static const Op OC = OpTypeFloat;
  // Complete constructor
  SPIRVTypeFloat(SPIRVModule *M, SPIRVId TheId, unsigned TheBitWidth)
      : SPIRVType(M, 3, OC, TheId), BitWidth(TheBitWidth) {}
  // Incomplete constructor
  SPIRVTypeFloat() : SPIRVType(OC), BitWidth(0) {}

  unsigned getBitWidth() const { return BitWidth; }

  SPIRVCapVec getRequiredCapability() const override {
    SPIRVCapVec CV;
    if (isTypeFloat(64))
      CV.push_back(CapabilityFloat64);
    return CV;
  }

protected:
  _SPIRV_DEF_DECODE2(Id, BitWidth)
  void validate() const override {
    SPIRVEntry::validate();
    assert(BitWidth >= 16 && BitWidth <= 64 && "Invalid bit width");
  }

private:
  unsigned BitWidth; // Bit width
};

class SPIRVTypePointer : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypePointer(SPIRVModule *M, SPIRVId TheId, SPIRVStorageClassKind TheStorageClass, SPIRVType *ElementType)
      : SPIRVType(M, 4, OpTypePointer, TheId), ElemStorageClass(TheStorageClass), ElemTypeId(ElementType->getId()) {
    validate();
  }
  // Incomplete constructor
  SPIRVTypePointer() : SPIRVType(OpTypePointer), ElemStorageClass(StorageClassFunction), ElemTypeId(0) {}

  SPIRVType *getElementType() const { return static_cast<SPIRVType *>(getEntry(ElemTypeId)); }
  SPIRVStorageClassKind getStorageClass() const { return ElemStorageClass; }
  SPIRVCapVec getRequiredCapability() const override {
    auto Cap = getVec(CapabilityAddresses);
    auto C = getCapability(ElemStorageClass);
    Cap.insert(Cap.end(), C.begin(), C.end());
    return Cap;
  }
  std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
    return std::vector<SPIRVEntry *>(1, getEntry(ElemTypeId));
  }

protected:
  _SPIRV_DEF_DECODE3(Id, ElemStorageClass, ElemTypeId)
  void validate() const override {
    SPIRVEntry::validate();
    assert(isValid(ElemStorageClass));
  }

private:
  SPIRVStorageClassKind ElemStorageClass; // Storage Class
  SPIRVId ElemTypeId;
};

class SPIRVTypeForwardPointer : public SPIRVType {
public:
  SPIRVTypeForwardPointer(SPIRVModule *M, SPIRVTypePointer *Pointer, SPIRVStorageClassKind SC)
      : SPIRVType(M, 3, OpTypeForwardPointer, Pointer->getId()), Pointer(Pointer), SC(SC) {}

  SPIRVTypeForwardPointer() : SPIRVType(OpTypeForwardPointer), Pointer(nullptr), SC(StorageClassUniformConstant) {}

  SPIRVTypePointer *getPointer() const { return Pointer; }
  void setPointer(SPIRVTypePointer *const P) { Pointer = P; }
  SPIRVStorageClassKind getStorageClass() const { return SC; }

  _SPIRV_DCL_DECODE
private:
  SPIRVTypePointer *Pointer;
  SPIRVStorageClassKind SC;
};

class SPIRVTypeVector : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeVector(SPIRVModule *M, SPIRVId TheId, SPIRVType *TheCompType, SPIRVWord TheCompCount)
      : SPIRVType(M, 4, OpTypeVector, TheId), CompType(TheCompType), CompCount(TheCompCount) {
    validate();
  }
  // Incomplete constructor
  SPIRVTypeVector() : SPIRVType(OpTypeVector), CompType(nullptr), CompCount(0) {}

  SPIRVType *getComponentType() const { return CompType; }
  SPIRVWord getComponentCount() const { return CompCount; }
  bool isValidIndex(SPIRVWord Index) const { return Index < CompCount; }
  SPIRVCapVec getRequiredCapability() const override {
    SPIRVCapVec V(getComponentType()->getRequiredCapability());
    return V;
  }

  std::vector<SPIRVEntry *> getNonLiteralOperands() const override { return std::vector<SPIRVEntry *>(1, CompType); }

protected:
  _SPIRV_DEF_DECODE3(Id, CompType, CompCount)
  void validate() const override {
    SPIRVEntry::validate();
    CompType->validate();
    assert(CompCount == 2 || CompCount == 3 || CompCount == 4 || CompCount == 8 || CompCount == 16);
  }

private:
  SPIRVType *CompType; // Component Type
  SPIRVWord CompCount; // Component Count
};

class SPIRVTypeMatrix : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeMatrix(SPIRVModule *M, SPIRVId TheId, SPIRVType *TheColumnType, SPIRVWord TheColumnCount)
      : SPIRVType(M, 4, OpTypeMatrix, TheId), ColumnType(TheColumnType), ColumnCount(TheColumnCount) {
    validate();
  }
  // Incomplete constructor
  SPIRVTypeMatrix() : SPIRVType(OpTypeMatrix), ColumnType(nullptr), ColumnCount(0) {}

  SPIRVType *getColumnType() const { return ColumnType; }
  SPIRVWord getColumnCount() const { return ColumnCount; }
  bool isValidIndex(SPIRVWord Index) const { return Index < ColumnCount; }
  SPIRVCapVec getRequiredCapability() const override {
    SPIRVCapVec V(getColumnType()->getRequiredCapability());
    V.push_back(CapabilityMatrix);
    return V;
  }

  virtual std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
    return std::vector<SPIRVEntry *>(1, ColumnType);
  }

protected:
  _SPIRV_DEF_DECODE3(Id, ColumnType, ColumnCount)
  void validate() const override {
    SPIRVEntry::validate();
    ColumnType->validate();
    assert(ColumnCount == 2 || ColumnCount == 3 || ColumnCount == 4);
  }

private:
  SPIRVType *ColumnType; // Column Type
  SPIRVWord ColumnCount; // Column Count
};

class SPIRVConstant;
class SPIRVTypeArray : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeArray(SPIRVModule *M, SPIRVId TheId, SPIRVType *TheElemType, SPIRVConstant *TheLength);
  // Incomplete constructor
  SPIRVTypeArray() : SPIRVType(OpTypeArray), ElemType(nullptr), Length(SPIRVID_INVALID) {}

  SPIRVType *getElementType() const { return ElemType; }
  SPIRVConstant *getLength() const;
  SPIRVCapVec getRequiredCapability() const override { return getElementType()->getRequiredCapability(); }
  std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
    std::vector<SPIRVEntry *> Operands(2, ElemType);
    Operands[1] = (SPIRVEntry *)getLength();
    return Operands;
  }

protected:
  _SPIRV_DCL_DECODE
  void validate() const override;

private:
  SPIRVType *ElemType; // Element Type
  SPIRVId Length;      // Array Length
};

class SPIRVTypeRuntimeArray : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeRuntimeArray(SPIRVModule *M, SPIRVId TheId, SPIRVType *TheElemType);
  // Incomplete constructor
  SPIRVTypeRuntimeArray() : SPIRVType(OpTypeRuntimeArray), ElemType(nullptr) {}

  SPIRVType *getElementType() const { return ElemType; }
  SPIRVCapVec getRequiredCapability() const override { return getElementType()->getRequiredCapability(); }
  virtual std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
    std::vector<SPIRVEntry *> Operands(1, ElemType);
    return Operands;
  }

protected:
  _SPIRV_DCL_DECODE
  void validate() const override;

private:
  SPIRVType *ElemType; // Element Type
};

struct SPIRVTypeImageDescriptor {
  SPIRVImageDimKind Dim;
  SPIRVWord Depth;
  SPIRVWord Arrayed;
  SPIRVWord MS;
  SPIRVWord Sampled;
  SPIRVWord Format;
  static std::tuple<std::tuple<SPIRVImageDimKind, SPIRVWord, SPIRVWord, SPIRVWord, SPIRVWord>, SPIRVWord>
  getAsTuple(const SPIRVTypeImageDescriptor &Desc) {
    return std::make_tuple(std::make_tuple(Desc.Dim, Desc.Depth, Desc.Arrayed, Desc.MS, Desc.Sampled), Desc.Format);
  }
  SPIRVTypeImageDescriptor() : Dim(Dim1D), Depth(0), Arrayed(0), MS(0), Sampled(0), Format(0) {}
  SPIRVTypeImageDescriptor(SPIRVImageDimKind Dim, SPIRVWord Cont, SPIRVWord Arr, SPIRVWord Comp, SPIRVWord Mult,
                           SPIRVWord F)
      : Dim(Dim), Depth(Cont), Arrayed(Arr), MS(Comp), Sampled(Mult), Format(F) {}
};

template <> inline void SPIRVMap<std::string, SPIRVTypeImageDescriptor>::init() {
#define _SPIRV_OP(x, ...)                                                                                \
  {                                                                                \
    SPIRVTypeImageDescriptor S(__VA_ARGS__);                                                                           \
    add(#x, S);                                                                                \
  }
  _SPIRV_OP(image1d_t, Dim1D, 0, 0, 0, 0, 0)
  _SPIRV_OP(image1d_buffer_t, DimBuffer, 0, 0, 0, 0, 0)
  _SPIRV_OP(image1d_array_t, Dim1D, 0, 1, 0, 0, 0)
  _SPIRV_OP(image2d_t, Dim2D, 0, 0, 0, 0, 0)
  _SPIRV_OP(image2d_array_t, Dim2D, 0, 1, 0, 0, 0)
  _SPIRV_OP(image2d_depth_t, Dim2D, 1, 0, 0, 0, 0)
  _SPIRV_OP(image2d_array_depth_t, Dim2D, 1, 1, 0, 0, 0)
  _SPIRV_OP(image2d_msaa_t, Dim2D, 0, 0, 1, 0, 0)
  _SPIRV_OP(image2d_array_msaa_t, Dim2D, 0, 1, 1, 0, 0)
  _SPIRV_OP(image2d_msaa_depth_t, Dim2D, 1, 0, 1, 0, 0)
  _SPIRV_OP(image2d_array_msaa_depth_t, Dim2D, 1, 1, 1, 0, 0)
  _SPIRV_OP(image3d_t, Dim3D, 0, 0, 0, 0, 0)
#undef _SPIRV_OP
}

// Comparison function required to use the struct as map key.
inline bool operator<(const SPIRVTypeImageDescriptor &A, const SPIRVTypeImageDescriptor &B) {
  return SPIRVTypeImageDescriptor::getAsTuple(A) < SPIRVTypeImageDescriptor::getAsTuple(B);
}

class SPIRVTypeImage : public SPIRVType {
public:
  const static Op OC = OpTypeImage;
  const static SPIRVWord FixedWC = 9;
  SPIRVTypeImage(SPIRVModule *M, SPIRVId TheId, SPIRVId TheSampledType, const SPIRVTypeImageDescriptor &TheDesc)
      : SPIRVType(M, FixedWC, OC, TheId), SampledType(TheSampledType), Desc(TheDesc) {
    validate();
  }
  SPIRVTypeImage() : SPIRVType(OC), SampledType(SPIRVID_INVALID), Desc() {}
  const SPIRVTypeImageDescriptor &getDescriptor() const { return Desc; }
  SPIRVCapVec getRequiredCapability() const override {
    SPIRVCapVec CV;
    if (Desc.Dim == SPIRVImageDimKind::Dim1D)
      CV.push_back(CapabilitySampled1D);
    else if (Desc.Dim == SPIRVImageDimKind::DimBuffer)
      CV.push_back(CapabilitySampledBuffer);
    return CV;
  }
  SPIRVType *getSampledType() const { return get<SPIRVType>(SampledType); }

  std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
    return std::vector<SPIRVEntry *>(1, get<SPIRVType>(SampledType));
  }

protected:
  _SPIRV_DEF_DECODE8(Id, SampledType, Desc.Dim, Desc.Depth, Desc.Arrayed, Desc.MS, Desc.Sampled, Desc.Format)
  void validate() const override {
    assert(OpCode == OC);
    assert(WordCount == FixedWC);
    assert(SampledType != SPIRVID_INVALID && "Invalid sampled type");
    assert(Desc.Dim <= 6);
    assert(Desc.Depth <= 2);
    assert(Desc.Arrayed <= 1);
    assert(Desc.MS <= 1);
    if (getSampledType()->isTypeVectorOrScalarInt(64))
      assert(getDescriptor().Format == ImageFormatR64i || getDescriptor().Format == ImageFormatR64ui ||
             getDescriptor().Format == ImageFormatUnknown);
  }
  void setWordCount(SPIRVWord TheWC) override { WordCount = TheWC; }

private:
  SPIRVId SampledType;
  SPIRVTypeImageDescriptor Desc;
};

class SPIRVTypeSampler : public SPIRVType {
public:
  const static Op OC = OpTypeSampler;
  const static SPIRVWord FixedWC = 2;
  SPIRVTypeSampler(SPIRVModule *M, SPIRVId TheId) : SPIRVType(M, FixedWC, OC, TheId) { validate(); }
  SPIRVTypeSampler() : SPIRVType(OC) {}

protected:
  _SPIRV_DEF_DECODE1(Id)
  void validate() const override {
    assert(OpCode == OC);
    assert(WordCount == FixedWC);
  }
};

class SPIRVTypeSampledImage : public SPIRVType {
public:
  const static Op OC = OpTypeSampledImage;
  const static SPIRVWord FixedWC = 3;
  SPIRVTypeSampledImage(SPIRVModule *M, SPIRVId TheId, SPIRVTypeImage *TheImgTy)
      : SPIRVType(M, FixedWC, OC, TheId), ImgTy(TheImgTy) {
    validate();
  }
  SPIRVTypeSampledImage() : SPIRVType(OC), ImgTy(nullptr) {}

  SPIRVTypeImage *getImageType() const { return ImgTy; }

  void setImageType(SPIRVTypeImage *TheImgTy) { ImgTy = TheImgTy; }

  std::vector<SPIRVEntry *> getNonLiteralOperands() const override { return std::vector<SPIRVEntry *>(1, ImgTy); }

protected:
  SPIRVTypeImage *ImgTy;
  _SPIRV_DEF_DECODE2(Id, ImgTy)
  void validate() const override {
    assert(OpCode == OC);
    assert(WordCount == FixedWC);
    assert(ImgTy && ImgTy->isTypeImage());
  }
};

class SPIRVTypeStruct : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeStruct(SPIRVModule *M, SPIRVId TheId, const std::vector<SPIRVType *> &TheMemberTypes,
                  const std::string &TheName)
      : SPIRVType(M, 2 + TheMemberTypes.size(), OpTypeStruct, TheId), Literal(false) {
    MemberTypeIdVec.resize(TheMemberTypes.size());
    for (auto &T : TheMemberTypes)
      MemberTypeIdVec.push_back(T->getId());
    Name = TheName;
    validate();
  }
  SPIRVTypeStruct(SPIRVModule *M, SPIRVId TheId, unsigned NumMembers, const std::string &TheName)
      : SPIRVType(M, 2 + NumMembers, OpTypeStruct, TheId), Literal(false) {
    Name = TheName;
    validate();
    MemberTypeIdVec.resize(NumMembers);
  }
  // Incomplete constructor, and use Literal mode in default
  SPIRVTypeStruct() : SPIRVType(OpTypeStruct), Literal(true) {}

  SPIRVWord getMemberCount() const { return MemberTypeIdVec.size(); }
  SPIRVType *getMemberType(size_t I) const { return static_cast<SPIRVType *>(getEntry(MemberTypeIdVec[I])); }
  void setMemberType(size_t I, SPIRVType *Ty) { MemberTypeIdVec[I] = Ty->getId(); }

  bool isLiteral() const { return Literal; }
  void setLiteral(bool LiteralStruct) { Literal = LiteralStruct; }

  void setWordCount(SPIRVWord WordCount) override {
    SPIRVType::setWordCount(WordCount);
    MemberTypeIdVec.resize(WordCount - 2);
  }

  std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
    std::vector<SPIRVEntry *> Operands(MemberTypeIdVec.size());
    for (size_t I = 0, E = MemberTypeIdVec.size(); I < E; ++I)
      Operands[I] = getEntry(MemberTypeIdVec[I]);
    return Operands;
  }

protected:
  _SPIRV_DEF_DECODE2(Id, MemberTypeIdVec)

  void validate() const override { SPIRVEntry::validate(); }

private:
  // Flag to indicate whether this structure is "literal" or "identified"
  bool Literal;
  std::vector<SPIRVId> MemberTypeIdVec; // Member Type Ids
};

class SPIRVTypeFunction : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeFunction(SPIRVModule *M, SPIRVId TheId, SPIRVType *TheReturnType,
                    const std::vector<SPIRVType *> &TheParameterTypes)
      : SPIRVType(M, 3 + TheParameterTypes.size(), OpTypeFunction, TheId), ReturnType(TheReturnType),
        ParamTypeVec(TheParameterTypes) {
    validate();
  }
  // Incomplete constructor
  SPIRVTypeFunction() : SPIRVType(OpTypeFunction), ReturnType(NULL) {}

  SPIRVType *getReturnType() const { return ReturnType; }
  SPIRVWord getNumParameters() const { return ParamTypeVec.size(); }
  SPIRVType *getParameterType(unsigned I) const { return ParamTypeVec[I]; }
  std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
    std::vector<SPIRVEntry *> Operands(1 + ParamTypeVec.size(), ReturnType);
    std::copy(ParamTypeVec.begin(), ParamTypeVec.end(), ++Operands.begin());
    return Operands;
  }

protected:
  _SPIRV_DEF_DECODE3(Id, ReturnType, ParamTypeVec)
  void setWordCount(SPIRVWord WordCount) override {
    SPIRVType::setWordCount(WordCount);
    ParamTypeVec.resize(WordCount - 3);
  }
  void validate() const override {
    SPIRVEntry::validate();
    ReturnType->validate();
    for (auto T : ParamTypeVec)
      T->validate();
  }

private:
  SPIRVType *ReturnType;                 // Return Type
  std::vector<SPIRVType *> ParamTypeVec; // Parameter Types
};

class SPIRVTypeOpaqueGeneric : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeOpaqueGeneric(Op TheOpCode, SPIRVModule *M, SPIRVId TheId) : SPIRVType(M, 2, TheOpCode, TheId) {
    validate();
  }

  // Incomplete constructor
  SPIRVTypeOpaqueGeneric(Op TheOpCode) : SPIRVType(TheOpCode), Opn(SPIRVID_INVALID) {}

  SPIRVValue *getOperand() { return getValue(Opn); }

protected:
  _SPIRV_DEF_DECODE1(Id)
  void validate() const override { SPIRVEntry::validate(); }
  SPIRVId Opn;
};

template <Op TheOpCode> class SPIRVOpaqueGenericType : public SPIRVTypeOpaqueGeneric {
public:
  // Complete constructor
  SPIRVOpaqueGenericType(SPIRVModule *M, SPIRVId TheId) : SPIRVTypeOpaqueGeneric(TheOpCode, M, TheId) {}
  // Incomplete constructor
  SPIRVOpaqueGenericType() : SPIRVTypeOpaqueGeneric(TheOpCode) {}
};

#if VKI_RAY_TRACING
class SPIRVTypeAccelerationStructureKHR : public SPIRVType {
public:
  // Complete constructor
  SPIRVTypeAccelerationStructureKHR(SPIRVModule *M, SPIRVId TheId)
      : SPIRVType(M, 2, OpTypeAccelerationStructureKHR, TheId) {}
  // Incomplete constructor
  SPIRVTypeAccelerationStructureKHR() : SPIRVType(OpTypeAccelerationStructureKHR) {}
  SPIRVType *getComponentType() const { return static_cast<SPIRVType *>(getEntry(OpTypeInt)); }

protected:
  _SPIRV_DEF_DECODE1(Id)
};

class SPIRVTypeRayQueryKHR : public SPIRVType {
public:
  // Compile constructor
  SPIRVTypeRayQueryKHR(SPIRVModule *M, SPIRVId TheId) : SPIRVType(M, 2, OpTypeRayQueryKHR, TheId) {}
  // Incomplete constructor
  SPIRVTypeRayQueryKHR() : SPIRVType(OpTypeRayQueryKHR) {}
  SPIRVType *getComponentType() const { return static_cast<SPIRVType *>(getEntry(OpTypeInt)); }

protected:
  _SPIRV_DEF_DECODE1(Id)
};
#endif

template <typename T2, typename T1> bool isType(const T1 *Ty, unsigned Bits = 0) {
  bool Is = Ty->getOpCode() == T2::OC;
  if (!Is)
    return false;
  if (Bits == 0)
    return true;
  return static_cast<const T2 *>(Ty)->getBitWidth() == Bits;
}

} // namespace SPIRV
#endif


text:
<?php

abstract class AlmanacManagementWorkflow
  extends PhabricatorManagementWorkflow {

  protected function loadServices(array $names) {
    if (!$names) {
      return array();
    }

    $services = id(new AlmanacServiceQuery())
      ->setViewer($this->getViewer())
      ->withNames($names)
      ->execute();

    $services = mpull($services, null, 'getName');
    foreach ($names as $name) {
      if (empty($services[$name])) {
        throw new PhutilArgumentUsageException(
          pht(
            'Service "%s" does not exist or could not be loaded!',
            $name));
      }
    }

    return $services;
  }

}


text:
// ======================================================================
/*!
 * \file NFmiOrthographicArea.h
 * \brief Interface of class NFmiOrthographicArea
 */
// ======================================================================

#pragma once

#define MunFmiMax(x, y) ((x) > (y) ? (x) : (y))
#define MunFmiMin(x, y) ((x) < (y) ? (x) : (y))

#include "NFmiAzimuthalArea.h"

class NFmiOrthographicArea : public NFmiAzimuthalArea
{
 public:
  virtual ~NFmiOrthographicArea();

  NFmiOrthographicArea();

  NFmiOrthographicArea(const NFmiOrthographicArea &thePerspectiveArea);

  NFmiOrthographicArea(const NFmiPoint &theCentralLatLonPoint,
                       const double theRadialRange = kRearth,
                       const double theAzimuthAngle = 0.,
                       const NFmiPoint &theTopLeftXY = NFmiPoint(0.f, 0.f),
                       const NFmiPoint &theBottomRightXY = NFmiPoint(1.f, 1.f),
                       bool usePacificView = false);

  /*
          HUOM! NFmiOrthographicArea -PROJEKTIOSSA NURKKAPISTEIDEN MUUNNOS
          EI VÄLTTÄMÄTTÄ AINA OLE BIJEKTIO:
          ESIM. JOILLEKIN SUORAKULMAISEN KOORDINAATISTON XY-PISTEILLE EI LÖYDY
          VASTAAVIA MAANTIETEELLISIÄ LONLAT -PISTEITÄ (PISTEET OVAT "KARTTAPALLON" ULKOPUOLELLA)
  */
  NFmiOrthographicArea(const NFmiPoint &theBottomLeftLatLon,
                       const NFmiPoint &theTopRightLatLon,
                       const double theAzimuthAngle = 0.0,
                       const NFmiPoint &theTopLeftXY = NFmiPoint(0.f, 0.f),
                       const NFmiPoint &theBottomRightXY = NFmiPoint(1.f, 1.f),
                       bool usePacificView = false);

  virtual void Init(bool fKeepWorldRect = false);

  using NFmiAzimuthalArea::LatLonToWorldXY;
  virtual const NFmiPoint LatLonToWorldXY(const NFmiPoint &theLatLonPoint) const;
  virtual const NFmiPoint WorldXYToLatLon(const NFmiPoint &theXY) const;

  void ZoomFactor(double theZoomFactor);
  double ZoomFactor() const;

  virtual double GlobeRadius() const;
  virtual void GlobeRadius(double &theGlobeRadius);

  virtual double AzimuthAngle() const;
  virtual void AzimuthAngle(double &theAzimuthAngle);

  virtual NFmiArea *Clone() const;
  virtual NFmiArea *NewArea(const NFmiPoint &theBottomLeftLatLon,
                            const NFmiPoint &theTopRightLatLon,
                            bool allowPacificFix = true) const;

  NFmiOrthographicArea &operator=(const NFmiOrthographicArea &theArea);
  bool operator==(const NFmiOrthographicArea &theArea) const;
  bool operator!=(const NFmiOrthographicArea &theArea) const;

  using NFmiAzimuthalArea::operator==;
  using NFmiAzimuthalArea::operator!=;
  bool operator==(const NFmiArea &theArea) const;
  bool operator!=(const NFmiArea &theArea) const;

  virtual const char *ClassName() const;
  const std::string AreaStr() const;
  virtual const std::string WKT() const;

  virtual std::ostream &Write(std::ostream &file) const;
  virtual std::istream &Read(std::istream &file);

  std::size_t HashValue() const;

 protected:
  virtual double K(const double /* delta */) const { return 1.; };
  virtual double CalcDelta(const double /* xyDistance */) const { return 0.; };
  virtual double DistanceFromPerspectivePointToCenterOfEarth() const { return 0.; };
  double itsAzimuthAngle;
  double itsLat0;
  double itsLon0;
  double itsSinLat0;
  double itsCosLat0;
  double itsVisibilityTerm;
  double itsZoomFactor;
  double itsGlobeRadius;
  NFmiPoint itsCurrentLatlonPoint;

 private:
};  // class NFmiOrthographicArea

//! Undocumented, should be removed
typedef NFmiOrthographicArea *PNFmiOrthographicArea;

// ----------------------------------------------------------------------
/*!
 * Destructor does nothing special
 */
// ----------------------------------------------------------------------

inline NFmiOrthographicArea::~NFmiOrthographicArea() {}
// ----------------------------------------------------------------------

inline double NFmiOrthographicArea::GlobeRadius() const
{
  return itsGlobeRadius;
}
// ----------------------------------------------------------------------

inline const char *NFmiOrthographicArea::ClassName() const
{
  return "kNFmiOrthographicArea";
}

// ======================================================================


text:
using namespace sh;

class GeometryShaderTest : public testing::Test
{
  public:
    GeometryShaderTest() {}

  protected:
    void SetUp() override
    {
        ShBuiltInResources resources;
        InitBuiltInResources(&resources);
        resources.OES_geometry_shader = 1;

        mTranslator = new TranslatorESSL(GL_GEOMETRY_SHADER_OES, SH_GLES3_1_SPEC);
        ASSERT_TRUE(mTranslator->Init(resources));
    }

    void TearDown() override { SafeDelete(mTranslator); }

    // Return true when compilation succeeds
    bool compile(const std::string &shaderString)
    {
        const char *shaderStrings[] = {shaderString.c_str()};

        bool status         = mTranslator->compile(shaderStrings, 1, SH_OBJECT_CODE | SH_VARIABLES);
        TInfoSink &infoSink = mTranslator->getInfoSink();
        mInfoLog            = infoSink.info.c_str();
        return status;
    }

    bool compileGeometryShader(const std::string &statement1, const std::string &statement2)
    {
        std::ostringstream sstream;
        sstream << kHeader << statement1 << statement2 << kEmptyBody;
        return compile(sstream.str());
    }

    bool compileGeometryShader(const std::string &statement1,
                               const std::string &statement2,
                               const std::string &statement3,
                               const std::string &statement4)
    {
        std::ostringstream sstream;
        sstream << kHeader << statement1 << statement2 << statement3 << statement4 << kEmptyBody;
        return compile(sstream.str());
    }

    static std::string GetGeometryShaderLayout(const std::string &layoutType,
                                               const std::string &primitive,
                                               int invocations,
                                               int maxVertices)
    {
        std::ostringstream sstream;

        sstream << "layout (";
        if (!primitive.empty())
        {
            sstream << primitive;
        }
        if (invocations > 0)
        {
            sstream << ", invocations = " << invocations;
        }
        if (maxVertices >= 0)
        {
            sstream << ", max_vertices = " << maxVertices;
        }
        sstream << ") " << layoutType << ";" << std::endl;

        return sstream.str();
    }

    const std::string kHeader =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n";
    const std::string kEmptyBody =
        "void main()\n"
        "{\n"
        "}\n";
    const std::string kInputLayout  = "layout (points) in;\n";
    const std::string kOutputLayout = "layout (points, max_vertices = 1) out;\n";

    std::string mInfoLog;
    TranslatorESSL *mTranslator = nullptr;
};

// Geometry Shaders are not supported in GLSL ES shaders version lower than 310.
TEST_F(GeometryShaderTest, Version300)
{
    const std::string &shaderString =
        "#version 300 es\n"
        "layout(points) in;\n"
        "layout(points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders are not supported in GLSL ES shaders version 310 without extension
// OES_geometry_shader enabled.
TEST_F(GeometryShaderTest, Version310WithoutExtension)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "layout(points) in;\n"
        "layout(points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders are supported in GLSL ES shaders version 310 with OES_geometry_shader enabled.
TEST_F(GeometryShaderTest, Version310WithOESExtension)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout(points) in;\n"
        "layout(points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Missing the declaration of input primitive in a geometry shader should be a link error instead of
// a compile error.
TEST_F(GeometryShaderTest, NoInputPrimitives)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout(points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders can only support 5 kinds of input primitives, which cannot be used as output
// primitives except 'points'.
// Skip testing "points" as it can be used as both input and output primitives.
TEST_F(GeometryShaderTest, ValidInputPrimitives)
{
    const std::array<std::string, 4> kInputPrimitives = {
        {"lines", "lines_adjacency", "triangles", "triangles_adjacency"}};

    for (const std::string &inputPrimitive : kInputPrimitives)
    {
        if (!compileGeometryShader(GetGeometryShaderLayout("in", inputPrimitive, -1, -1),
                                   kOutputLayout))
        {
            FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
        }
        if (compileGeometryShader(kInputLayout,
                                  GetGeometryShaderLayout("out", inputPrimitive, -1, 6)))
        {
            FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
        }
    }
}

// Geometry Shaders allow duplicated declaration of input primitive, but all of them must be same.
TEST_F(GeometryShaderTest, RedeclareInputPrimitives)
{
    const std::array<std::string, 5> kInputPrimitives = {
        {"points", "lines", "lines_adjacency", "triangles", "triangles_adjacency"}};

    for (GLuint i = 0; i < kInputPrimitives.size(); ++i)
    {
        const std::string &inputLayoutStr1 =
            GetGeometryShaderLayout("in", kInputPrimitives[i], -1, -1);
        if (!compileGeometryShader(inputLayoutStr1, inputLayoutStr1, kOutputLayout, ""))
        {
            FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
        }

        for (GLuint j = i + 1; j < kInputPrimitives.size(); ++j)
        {
            const std::string &inputLayoutStr2 =
                GetGeometryShaderLayout("in", kInputPrimitives[j], -1, -1);
            if (compileGeometryShader(inputLayoutStr1, inputLayoutStr2, kOutputLayout, ""))
            {
                FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
            }
        }
    }
}

// Geometry Shaders don't allow declaring different input primitives in one layout.
TEST_F(GeometryShaderTest, DeclareDifferentInputPrimitivesInOneLayout)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, triangles) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow 'invocations' < 1.
TEST_F(GeometryShaderTest, InvocationsLessThanOne)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, invocations = 0) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders allow declaring 'invocations' == 1 together with input primitive declaration in
// one layout.
TEST_F(GeometryShaderTest, InvocationsEqualsOne)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, invocations = 1) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders allow declaring 'invocations' == 1 in an individual layout.
TEST_F(GeometryShaderTest, InvocationsEqualsOneInSeparatedLayout)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (invocations = 1) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow 'invocations' larger than the implementation-dependent maximum value
// (32 in this test).
TEST_F(GeometryShaderTest, TooLargeInvocations)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, invocations = 9989899) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders allow 'invocations' declared together with input primitives in one layout.
TEST_F(GeometryShaderTest, InvocationsDeclaredWithInputPrimitives)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, invocations = 3) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders allow 'invocations' declared before input primitives in one input layout.
TEST_F(GeometryShaderTest, InvocationsBeforeInputPrimitives)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (invocations = 3, points) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders allow 'invocations' declared in an individual input layout.
TEST_F(GeometryShaderTest, InvocationsInIndividualLayout)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (invocations = 3) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders allow duplicated 'invocations' declarations.
TEST_F(GeometryShaderTest, DuplicatedInvocations)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, invocations = 3) in;\n"
        "layout (invocations = 3) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow multiple different 'invocations' declarations in different
// layouts.
TEST_F(GeometryShaderTest, RedeclareDifferentInvocations)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, invocations = 3) in;\n"
        "layout (invocations = 5) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow multiple different 'invocations' declarations in different
// layouts.
TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsAfterInvocationEqualsOne)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, invocations = 1) in;\n"
        "layout (invocations = 5) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow multiple different 'invocations' declarations in one layout.
TEST_F(GeometryShaderTest, RedeclareDifferentInvocationsInOneLayout)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, invocations = 3, invocations = 5) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow 'invocations' in out layouts.
TEST_F(GeometryShaderTest, DeclareInvocationsInOutLayout)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, invocations = 3, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow 'invocations' in layouts without 'in' qualifier.
TEST_F(GeometryShaderTest, DeclareInvocationsInLayoutNoQualifier)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (invocations = 3);\n"
        "layout (points, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders allow declaring output primitive before input primitive declaration.
TEST_F(GeometryShaderTest, DeclareOutputPrimitiveBeforeInputPrimitiveDeclare)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, max_vertices = 1) out;\n"
        "layout (points) in;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders allow declaring 'max_vertices' before output primitive in one output layout.
TEST_F(GeometryShaderTest, DeclareMaxVerticesBeforeOutputPrimitive)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (max_vertices = 1, points) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Missing the declaration of output primitive should be a link error instead of a compile error in
// a geometry shader.
TEST_F(GeometryShaderTest, NoOutputPrimitives)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders can only support 3 kinds of output primitives, which cannot be used as input
// primitives except 'points'.
// Skip testing "points" as it can be used as both input and output primitives.
TEST_F(GeometryShaderTest, ValidateOutputPrimitives)
{
    const std::string outputPrimitives[] = {"line_strip", "triangle_strip"};

    for (const std::string &outPrimitive : outputPrimitives)
    {
        if (!compileGeometryShader(kInputLayout,
                                   GetGeometryShaderLayout("out", outPrimitive, -1, 6)))
        {
            FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
        }

        if (compileGeometryShader(GetGeometryShaderLayout("in", outPrimitive, -1, -1),
                                  kOutputLayout))
        {
            FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
        }
    }
}

// Geometry Shaders allow duplicated output primitive declarations, but all of them must be same.
TEST_F(GeometryShaderTest, RedeclareOutputPrimitives)
{
    const std::array<std::string, 3> outPrimitives = {{"points", "line_strip", "triangle_strip"}};

    for (GLuint i = 0; i < outPrimitives.size(); i++)
    {
        constexpr int maxVertices = 1;
        const std::string &outputLayoutStr1 =
            GetGeometryShaderLayout("out", outPrimitives[i], -1, maxVertices);
        const std::string &outputLayoutStr2 =
            GetGeometryShaderLayout("out", outPrimitives[i], -1, -1);
        if (!compileGeometryShader(kInputLayout, outputLayoutStr1, outputLayoutStr2, ""))
        {
            FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
        }
        for (GLuint j = i + 1; j < outPrimitives.size(); j++)
        {
            const std::string &outputLayoutStr3 =
                GetGeometryShaderLayout("out", outPrimitives[j], -1, -1);
            if (compileGeometryShader(kInputLayout, outputLayoutStr1, outputLayoutStr3, ""))
            {
                FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
            }
        }
    }
}

// Geometry Shaders don't allow declaring different output primitives in one layout.
TEST_F(GeometryShaderTest, RedeclareDifferentOutputPrimitivesInOneLayout)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, max_vertices = 3, line_strip) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Missing the declarations of output primitives and 'max_vertices' in a geometry shader should
// be a link error instead of a compile error.
TEST_F(GeometryShaderTest, NoOutLayouts)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Missing the declarations of 'max_vertices' in a geometry shader should be a link error
// instead of a compile error.
TEST_F(GeometryShaderTest, NoMaxVertices)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders cannot declare a negative 'max_vertices'.
TEST_F(GeometryShaderTest, NegativeMaxVertices)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, max_vertices = -1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders allow max_vertices == 0.
TEST_F(GeometryShaderTest, ZeroMaxVertices)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, max_vertices = 0) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders cannot declare a 'max_vertices' that is greater than
// MAX_GEOMETRY_OUTPUT_VERTICES_EXT (256 in this test).
TEST_F(GeometryShaderTest, TooLargeMaxVertices)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, max_vertices = 257) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders can declare 'max_vertices' in an individual out layout.
TEST_F(GeometryShaderTest, MaxVerticesInIndividualLayout)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points) out;\n"
        "layout (max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders allow duplicated 'max_vertices' declarations.
TEST_F(GeometryShaderTest, DuplicatedMaxVertices)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "layout (max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (!compile(shaderString))
    {
        FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow declaring different 'max_vertices'.
TEST_F(GeometryShaderTest, RedeclareDifferentMaxVertices)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, max_vertices = 1) out;\n"
        "layout (max_vertices = 2) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow declaring different 'max_vertices'.
TEST_F(GeometryShaderTest, RedeclareDifferentMaxVerticesInOneLayout)
{
    const std::string &shaderString =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, max_vertices = 2, max_vertices = 1) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow 'location' declared with input/output primitives in one layout.
TEST_F(GeometryShaderTest, invalidLocation)
{
    const std::string &shaderString1 =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, location = 1) in;\n"
        "layout (points, max_vertices = 2) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    const std::string &shaderString2 =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (invocations = 2, location = 1) in;\n"
        "layout (points, max_vertices = 2) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    const std::string &shaderString3 =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, location = 3, max_vertices = 2) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    const std::string &shaderString4 =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points) out;\n"
        "layout (max_vertices = 2, location = 3) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString1) || compile(shaderString2) || compile(shaderString3) ||
        compile(shaderString4))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}

// Geometry Shaders don't allow invalid layout qualifier declarations.
TEST_F(GeometryShaderTest, invalidLayoutQualifiers)
{
    const std::string &shaderString1 =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, abc) in;\n"
        "layout (points, max_vertices = 2) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    const std::string &shaderString2 =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points, abc, max_vertices = 2) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    const std::string &shaderString3 =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points, xyz = 2) in;\n"
        "layout (points, max_vertices = 2) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    const std::string &shaderString4 =
        "#version 310 es\n"
        "#extension GL_OES_geometry_shader : require\n"
        "layout (points) in;\n"
        "layout (points) out;\n"
        "layout (max_vertices = 2, xyz = 3) out;\n"
        "void main()\n"
        "{\n"
        "}\n";

    if (compile(shaderString1) || compile(shaderString2) || compile(shaderString3) ||
        compile(shaderString4))
    {
        FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
    }
}


text:
package demoapp.dom.types.javalang.floats.vm;

import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Editing;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.Optionality;
import org.apache.causeway.applib.annotation.Property;
import org.apache.causeway.applib.annotation.PropertyLayout;
import org.apache.causeway.applib.annotation.Title;

import lombok.Getter;
import lombok.Setter;

import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import demoapp.dom.types.javalang.floats.holder.WrapperFloatHolder2;

/* This file was GENERATED by the showcase generator (tooling). Do NOT edit! */
//tag::class[]
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@Named("demo.WrapperFloatVm")
@DomainObject(
        nature=Nature.VIEW_MODEL)
@lombok.NoArgsConstructor                                                       // <.>
public class WrapperFloatVm
        implements HasAsciiDocDescription, WrapperFloatHolder2 {

//end::class[]
    public WrapperFloatVm(final java.lang.Float initialValue) {
        this.readOnlyProperty = initialValue;
        this.readWriteProperty = initialValue;
    }

//tag::class[]
    @Title(prepend = "java.lang.Float view model: ")
    @PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
    @XmlElement(required = true)                                                // <.>
    @Getter @Setter
    private java.lang.Float readOnlyProperty;

    @Property(editing = Editing.ENABLED)                                        // <.>
    @PropertyLayout(fieldSetId = "editable-properties", sequence = "1")
    @XmlElement(required = true)
    @Getter @Setter
    private java.lang.Float readWriteProperty;

    @Property(optionality = Optionality.OPTIONAL)                               // <.>
    @PropertyLayout(fieldSetId = "optional-properties", sequence = "1")
    @Getter @Setter
    private java.lang.Float readOnlyOptionalProperty;

    @Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
    @PropertyLayout(fieldSetId = "optional-properties", sequence = "2")
    @Getter @Setter
    private java.lang.Float readWriteOptionalProperty;

}
//end::class[]


text:
const DEFAULT_PLUGINS = require('../constants/defaultPlugins');
const sortDependencies = require('./sortDependencies');

/**
 * List all dependencies for a book, including default plugins.
 * It returns a concat with default plugins and remove disabled ones.
 *
 * @param {List<PluginDependency>} deps
 * @return {List<PluginDependency>}
 */
function listDependencies(deps) {
    // Extract list of plugins to disable (starting with -)
    const toRemove = deps
        .filter(function(plugin) {
            return !plugin.isEnabled();
        })
        .map(function(plugin) {
            return plugin.getName();
        });

    // Concat with default plugins
    deps = deps.concat(DEFAULT_PLUGINS);

    // Remove plugins
    deps = deps.filterNot(function(plugin) {
        return toRemove.includes(plugin.getName());
    });

    // Sort
    return sortDependencies(deps);
}

module.exports = listDependencies;


text:
package com.journeyapps.barcodescanner;

import android.os.Looper;

/**
 *
 */
public class Util {
    public static void validateMainThread() {
        if (Looper.getMainLooper() != Looper.myLooper()) {
            throw new IllegalStateException("Must be called from the main thread.");
        }
    }
}


text:
"use strict";

import Constants   from   "../constants";
import Dispatcher  from   "../dispatcher";

export default {

  addMessage(message){
    Dispatcher.dispatch({
      action: Constants.ADD_MESSAGE,
      data: message
    });
  }

};


text:
'use strict';

angular.module('test')
    .factory('openComputerGridFromUserAction', ['$location', 'locationUtils', 'locationService', function($location, locationUtils, locationService) {
        return function(parameters) {
            locationService.pushNewLocation('/computerGrid', locationUtils.fromObjectToSearch({openComputerGridFromUser: parameters}));
        }
    }])
;


text: <!DOCTYPE html>


text:
<?php

namespace Aws\S3\Iterator;

use Aws\Common\Iterator\AwsResourceIterator;
use Guzzle\Service\Resource\Model;

/**
 * Iterator for an S3 ListObjectVersions command
 *
 * This iterator includes the following additional options:
 *     - return_prefixes: Set to true to receive both prefixes and versions in results
 */
class ListObjectVersionsIterator extends AwsResourceIterator
{
    /**
     * {@inheritdoc}
     */
    protected function handleResults(Model $result)
    {
        // Get the list of object versions
        $versions = $result->get('Versions') ?: array();
        $deleteMarkers = $result->get('DeleteMarkers') ?: array();
        $versions = array_merge($versions, $deleteMarkers);

        // If there are prefixes and we want them, merge them in
        if ($this->get('return_prefixes') && $result->hasKey('CommonPrefixes')) {
            $versions = array_merge($versions, $result->get('CommonPrefixes'));
        }

        return $versions;
    }
}


text:
package org.hisp.dhis.programrule.hibernate;

import java.util.List;

import javax.persistence.criteria.CriteriaBuilder;

import org.hibernate.SessionFactory;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.programrule.ProgramRuleVariable;
import org.hisp.dhis.programrule.ProgramRuleVariableSourceType;
import org.hisp.dhis.programrule.ProgramRuleVariableStore;
import org.hisp.dhis.security.acl.AclService;
import org.hisp.dhis.user.CurrentUserService;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author markusbekken
 */
@Repository( "org.hisp.dhis.programrule.ProgramRuleVariableStore" )
public class HibernateProgramRuleVariableStore
    extends HibernateIdentifiableObjectStore<ProgramRuleVariable>
    implements ProgramRuleVariableStore
{
    public HibernateProgramRuleVariableStore( SessionFactory sessionFactory, JdbcTemplate jdbcTemplate,
        ApplicationEventPublisher publisher, CurrentUserService currentUserService, AclService aclService )
    {
        super( sessionFactory, jdbcTemplate, publisher, ProgramRuleVariable.class, currentUserService,
            aclService, false );
    }

    @Override
    public List<ProgramRuleVariable> get( Program program )
    {
        CriteriaBuilder builder = getCriteriaBuilder();

        return getList( builder, newJpaParameters()
            .addPredicate( root -> builder.equal( root.get( "program" ), program ) ) );
    }

    @Override
    public List<ProgramRuleVariable> getProgramVariables( Program program, DataElement dataElement )
    {
        CriteriaBuilder builder = getCriteriaBuilder();

        return getList( builder, newJpaParameters()
            .addPredicate( root -> builder.equal( root.get( "program" ), program ) )
            .addPredicate( root -> builder.equal( root.get( "dataElement" ), dataElement ) ) );
    }

    @Override
    public List<ProgramRuleVariable> getVariablesWithNoDataElement()
    {
        return getQuery(
            "FROM ProgramRuleVariable prv WHERE prv.sourceType IN ( :dataTypes ) AND prv.dataElement IS NULL" )
                .setParameter( "dataTypes", ProgramRuleVariableSourceType.getDataTypes() )
                .getResultList();
    }

    @Override
    public List<ProgramRuleVariable> getVariablesWithNoAttribute()
    {
        return getQuery(
            "FROM ProgramRuleVariable prv WHERE prv.sourceType IN ( :attributeTypes ) AND prv.attribute IS NULL" )
                .setParameter( "attributeTypes", ProgramRuleVariableSourceType.getAttributeTypes() )
                .getResultList();
    }
}


text:
#ifndef MIRTK_Matrix3x3_H
#define MIRTK_Matrix3x3_H

#include "mirtk/NumericsExport.h"

#include "mirtk/Vector3.h"

namespace mirtk {

// NOTE.  The (x,y,z) coordinate system is assumed to be right-handed.
// Coordinate axis rotation matrices are of the form
//   RX =    1       0       0
//           0     cos(t) -sin(t)
//           0     sin(t)  cos(t)
// where t > 0 indicates a counterclockwise rotation in the yz-plane
//   RY =  cos(t)    0     sin(t)
//           0       1       0
//        -sin(t)    0     cos(t)
// where t > 0 indicates a counterclockwise rotation in the zx-plane
//   RZ =  cos(t) -sin(t)    0
//         sin(t)  cos(t)    0
//           0       0       1
// where t > 0 indicates a counterclockwise rotation in the xy-plane.

class Matrix3x3
{
public:
  // construction
  Matrix3x3 ();
  Matrix3x3 (int);
  Matrix3x3 (double);
  Matrix3x3 (const double aafEntry[3][3]);
  Matrix3x3 (const Matrix3x3& rkMatrix);
  Matrix3x3 (double fEntry00, double fEntry01, double fEntry02,
             double fEntry10, double fEntry11, double fEntry12,
             double fEntry20, double fEntry21, double fEntry22);

  // member access, allows use of construct mat[r][c]
  double*       operator[] (int iRow);
  const double* operator[] (int iRow) const;
  operator double* ();
  Vector3 GetColumn (int iCol) const;

  // assignment and comparison
  Matrix3x3& operator= (const Matrix3x3& rkMatrix);
  Matrix3x3& operator= (double);
  bool operator== (const Matrix3x3& rkMatrix) const;
  bool operator!= (const Matrix3x3& rkMatrix) const;

  // arithmetic operations
  Matrix3x3 &operator+=(double);
  Matrix3x3 &operator-=(double);
  Matrix3x3 &operator*=(double);
  Matrix3x3 &operator/=(double);

  Matrix3x3 operator+ (double) const;
  Matrix3x3 operator- (double) const;
  Matrix3x3 operator* (double) const;
  Matrix3x3 operator/ (double) const;

  Matrix3x3 &operator+=(const Matrix3x3& rkMatrix);
  Matrix3x3 &operator-=(const Matrix3x3& rkMatrix);
  Matrix3x3 &operator*=(const Matrix3x3& rkMatrix);
  Matrix3x3 &operator/=(const Matrix3x3& rkMatrix);

  Matrix3x3 operator+ (const Matrix3x3& rkMatrix) const;
  Matrix3x3 operator- (const Matrix3x3& rkMatrix) const;
  Matrix3x3 operator* (const Matrix3x3& rkMatrix) const;
  Matrix3x3 operator/ (const Matrix3x3& rkMatrix) const;
  Matrix3x3 operator- () const;

  // matrix * vector [3x3 * 3x1 = 3x1]
  Vector3 operator* (const Vector3& rkVector) const;

  // vector * matrix [1x3 * 3x3 = 1x3]
  friend Vector3 operator* (const Vector3& rkVector,
                                const Matrix3x3& rkMatrix);

  // scalar * matrix
  friend Matrix3x3 operator* (double fScalar, const Matrix3x3& rkMatrix);

  // utilities
  Matrix3x3 Transpose () const;
  bool Inverse (Matrix3x3& rkInverse, double fTolerance = 1e-06) const;
  Matrix3x3 Inverse (double fTolerance = 1e-06) const;
  double Determinant () const;
  Matrix3x3 Adjoint() const;
  double Trace() const;

  // singular value decomposition
  void SingularValueDecomposition (Matrix3x3& rkL, Vector3& rkS,
                                   Matrix3x3& rkR) const;
  void SingularValueComposition (const Matrix3x3& rkL,
                                 const Vector3& rkS, const Matrix3x3& rkR);

  // Gram-Schmidt orthonormalization (applied to columns of rotation matrix)
  void Orthonormalize ();

  // orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12)
  void QDUDecomposition (Matrix3x3& rkQ, Vector3& rkD,
                         Vector3& rkU) const;

  double SpectralNorm () const;

  // matrix must be orthonormal
  void ToAxisAngle (Vector3& rkAxis, double& rfRadians) const;
  void FromAxisAngle (const Vector3& rkAxis, double fRadians);

  // The matrix must be orthonormal.  The decomposition is yaw*pitch*roll
  // where yaw is rotation about the Up vector, pitch is rotation about the
  // Right axis, and roll is rotation about the Direction axis.
  bool ToEulerAnglesXYZ (double& rfYAngle, double& rfPAngle, double& rfRAngle) const;
  bool ToEulerAnglesXZY (double& rfYAngle, double& rfPAngle, double& rfRAngle) const;
  bool ToEulerAnglesYXZ (double& rfYAngle, double& rfPAngle, double& rfRAngle) const;
  bool ToEulerAnglesYZX (double& rfYAngle, double& rfPAngle, double& rfRAngle) const;
  bool ToEulerAnglesZXY (double& rfYAngle, double& rfPAngle, double& rfRAngle) const;
  bool ToEulerAnglesZYX (double& rfYAngle, double& rfPAngle, double& rfRAngle) const;
  void FromEulerAnglesXYZ (double fYAngle, double fPAngle, double fRAngle);
  void FromEulerAnglesXZY (double fYAngle, double fPAngle, double fRAngle);
  void FromEulerAnglesYXZ (double fYAngle, double fPAngle, double fRAngle);
  void FromEulerAnglesYZX (double fYAngle, double fPAngle, double fRAngle);
  void FromEulerAnglesZXY (double fYAngle, double fPAngle, double fRAngle);
  void FromEulerAnglesZYX (double fYAngle, double fPAngle, double fRAngle);

  // eigensolver, matrix must be symmetric
  void EigenSolveSymmetric (double afEigenvalue[3],
                            Vector3 akEigenvector[3]) const;

  static void TensorProduct (const Vector3& rkU, const Vector3& rkV,
                             Matrix3x3& rkProduct);

  MIRTK_Numerics_EXPORT static const double EPSILON;
  MIRTK_Numerics_EXPORT static const Matrix3x3 ZERO;
  MIRTK_Numerics_EXPORT static const Matrix3x3 IDENTITY;

  // support for eigensolver
  void Tridiagonal(double afDiag[3], double afSubDiag[3]);
  bool QLAlgorithm(double afDiag[3], double afSubDiag[3]);

  // support for singular value decomposition
  MIRTK_Numerics_EXPORT static const double ms_fSvdEpsilon;
  MIRTK_Numerics_EXPORT static const int ms_iSvdMaxIterations;
  static void Bidiagonalize (Matrix3x3& kA, Matrix3x3& kL,
                             Matrix3x3& kR);
  static void GolubKahanStep (Matrix3x3& kA, Matrix3x3& kL,
                              Matrix3x3& kR);

  // support for spectral norm
  static double MaxCubicRoot (double afCoeff[3]);

protected:

  double m_aafEntry[3][3];
};

} // namespace mirtk

#endif // MIRTK_Matrix3x3_H