text:
<?php namespace Services;

class CalendarEvents
{
    function getInterval($task){
        $frq = ($task->repeat_every > 1) ? $task->repeat_every : '';
        switch ($task->repeat) {
            case 'day' :
                $queryStr = 'next ' . $frq . ' days';
                break;
            case 'week' :
                $queryStr = 'next ' . $frq . ' weeks';
                break;
            case 'month' :
                $queryStr = 'next ' . $frq . ' months';
                break;
            case 'year' :
                $queryStr = 'next ' . $frq . ' years';
                break;
        }
        return \DateInterval::createFromDateString($queryStr);
    }

    function testWeekendDate($task,$date)
    {
        if (!$task->weekend && $date->isWeekend()) {
            \Carbon::setTestNow($date);
            $datex = new \Carbon('last friday');
            \Carbon::setTestNow();
            return $datex;
        } else {
            return $date;
        }
    }

    public static function addCalendarsOngoingDates()
    {
        $self = new self();
        foreach(['cleaning_schedules_tasks','check_list_tasks','compliance_diary_tasks'] as $table){
            switch($table){
                case 'cleaning_schedules_tasks' : $model = '\Model\CleaningSchedulesTasks'; break;
                case 'check_list_tasks' :         $model = '\Model\CheckListTasks'; break;
                case 'compliance_diary_tasks' :   $model = '\Model\ComplianceDiaryTasks'; break;
                default : $model = null; break;
            }
            if($model){
                $tasks = $model::all();
                foreach ($tasks as $task ){
                    $self->createTasksItems($task);
                }
            }
        }
    }

    public static function clearAndSubmitExpiredCalendarsTasksItems()
    {
        foreach(['cleaning_schedules_tasks','check_list_tasks','compliance_diary_tasks'] as $table){
            switch($table){
                case 'cleaning_schedules_tasks' :
                    $mTask = '\Model\CleaningSchedulesTasks';
                    $mItems = '\Model\CleaningSchedulesItems';
                    $mSubmit = '\Model\CleaningSchedulesSubmitted';
                    break;
                case 'check_list_tasks' :
                    $mTask = '\Model\CheckListTasks';
                    $mItems = '\Model\CheckListItems';
                    $mSubmit = '\Model\CheckListSubmitted';
                    break;
                case 'compliance_diary_tasks' :
                    $mTask = '\Model\ComplianceDiaryTasks';
                    $mItems = '\Model\ComplianceDiaryItems';
                    $mSubmit = '\Model\ComplianceDiarySubmitted';
                    break;
                default : $mTask = $mItems = $mSubmit = null; break;
            }
            if($mTask && $mItems && $mSubmit)
            {
                $mItems::where('start','>',\Carbon::now())->delete();
                $items = $mItems::where('end','<',\Carbon::now())->get();
                foreach($items as $item){
                    if ($item->getLastSubmitted()) {
                        $item->delete();
                        continue;
                    }
                    $data = $dataSub = [];
                    $task = $item->task;
                    if(!isset($concat[$task->id])) {
                        $concat[$task->id] = [];
                    }
                    $data['unit_id'] = $task->unit_id;
                    if ($task->staff) {
                        $data['staff_name'] = $task->staff->fullname();
                    }
                    if ($task->form) {
                        $data['form_name'] = $task->form->name;
                    }
                    $dataSub = array_merge($data,[
                            'title' => $task->title,
                            'task_id' => $task->id,
                            'description' => $task->description,
                            'completed' => 0,
                            'summary' => 'Task has expired and has not been completed.',
                            'tz' => $task->tz,
                            'all_day' => ($task->all_day == 'on') ? 1 : 0]
                    );
                    $submitted = $mSubmit::firstOrCreate($dataSub);
                    $startTs = \Carbon::parse($item->start)->timestamp;
                    $endTs = \Carbon::parse($item->end)->timestamp;
                    $concat[$task->id][] = ($startTs.':'.$endTs);
                    $expiredDates = ($submitted->expired_dates?($submitted->expired_dates.','):'').($startTs.':'.$endTs);
                    $submitted -> update(['expired_dates'=>$expiredDates]);
                    $item->delete();
                }
            }
        }
    }

    public static function removeCalendarsExpiredTasks()
    {
        foreach(['cleaning_schedules_tasks','check_list_tasks','compliance_diary_tasks'] as $table){
            switch($table){
                case 'cleaning_schedules_tasks' : $model = '\Model\CleaningSchedulesTasks'; break;
                case 'check_list_tasks' :         $model = '\Model\CheckListTasks'; break;
                case 'compliance_diary_tasks' :   $model = '\Model\ComplianceDiaryTasks'; break;
                default : $model = null; break;
            }
            if($model){
                $tasks = $model::all();
                foreach ($tasks as $task){
                    if(!$task->is_repeatable){
                        $end = \Carbon::parse($task->end,'UTC');
                        if($end->isPast()){
                            $task->delete();
                        }
                    }else{
                        $repeatUntil = \Carbon::parse($task->repeat_until,'UTC');
                        if($repeatUntil->isPast()){
                            $task->delete();
                        }
                    }
                }
            }
        }
    }

    public static function createTasksItems($task)
    {
        $self = new self();

        $startRef = \Carbon::parse($task->start, 'UTC')->timezone($task->tz);
        $endRef   = \Carbon::parse($task->end, 'UTC')->timezone($task->tz);
        $diffSecs = $startRef->diffInSeconds($endRef);

        if (in_array($task->repeat, ['day', 'week', 'month', 'year'])){
            $interval = $self->getInterval($task);
            $periodStr = new \DatePeriod($startRef, $interval, \Carbon::now($task->tz)->endOfDay());
            foreach ($periodStr as $dt)
            {
                $dt    = \Carbon::instance($dt, $task->tz);
                $start = $self->testWeekendDate($task,$dt);
                $end   = $self->testWeekendDate($task,$dt->copy()->addSeconds($diffSecs));
                $self->saveToday($task,$start,$end);
            }
        }
        else{
            $self->saveToday($task,$startRef,$endRef);
        }
        return $task->items;
    }

    function addDate($task,$start,$end)
    {
        switch($task->getTable()){
            case 'cleaning_schedules_tasks' :
            case 'cleaning_schedules_submitted' :
                $section = 'cleaning-schedule';
            break;
            case 'check_list_tasks' :
            case 'check_list_submitted' :
                $section = 'check-list';
            break;
            case 'compliance_diary_tasks' :
            case 'compliance_diary_submitted' :
                $section = 'compliance-diary';
            break;
        }
        return [
            'task_id'       => $task->id,
            'start'         => $start->toAtomString(),
            'end'           => $end->toAtomString(),
            'title'         => $task->title,
            'color'         => $task->task_color,
            'section'       => $section,
            'editable'      => false
        ];
    }

    public static function ongoingTasks($task)
    {
        $dates = [];
        $self = new self();
        $ongoings = $task->items;

        switch($task->getTable()){
            case 'cleaning_schedules_tasks' : $sig = 'cs-'; break;
            case 'check_list_tasks' : $sig = 'cl-'; break;
            case 'compliance_diary_tasks' : $sig = 'cd-'; break;
        }

        foreach($ongoings as $ongoing){
            $startO = \Carbon::parse($ongoing->start,'UTC')->timezone($task->tz);
            $endO   = \Carbon::parse($ongoing->end,'UTC')->timezone($task->tz);
            $dates[$sig.'o'.$task->id][$startO->timestamp] = ($self->addDate($task, $startO, $endO)+['task_status'=>1,'item_id'=>$ongoing->id]);
        }
        return $dates;
    }

    function isOngoing($task,$start,$end)
    {
        switch($task->getTable()){
            case 'cleaning_schedules_tasks' : $model = '\Model\CleaningSchedulesItems'; break;
            case 'check_list_tasks' : $model = '\Model\CheckListItems'; break;
            case 'compliance_diary_tasks' : $model = '\Model\ComplianceDiaryItems'; break;
        }
        $data = [
            'unit_id' => $task->unit_id,
            'task_id' => $task->id,
            'start'   => $start->toDatetimeString(),
            'end'     => $end->toDatetimeString(),
        ];
        return $model::where($data)->first();
    }

    function saveToday($task,$start,$end)
    {
        switch($task->getTable()){
            case 'cleaning_schedules_tasks' : $model = '\Model\CleaningSchedulesItems'; break;
            case 'check_list_tasks' : $model = '\Model\CheckListItems'; break;
            case 'compliance_diary_tasks' : $model = '\Model\ComplianceDiaryItems'; break;
        }
        if (isset($model) && $start->isToday() || $end->isToday() || (($start->isToday() || $start->isPast()) && !$end->isPast()))
        {
            $data = [
                'unit_id' => $task->unit_id,
                'task_id' => $task->id,
                'start'   => $start->copy()->timezone('UTC')->toDatetimeString(),
                'end'     => $end->copy()->timezone('UTC')->toDatetimeString(),
            ];
            return $model::firstOrCreate($data);
        }
        return null;
    }
}


text:
package com.leeovo.listdemo.widgets;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.daimajia.slider.library.SliderTypes.BaseSliderView;
import com.leeovo.listdemo.R;

/**
 * Created by leeovo on 2015/11/30.
 */
public class ImageSliderView extends BaseSliderView {

    public ImageSliderView (Context context){
        super(context);

    }

    @Override
    public View getView() {

        View localView = LayoutInflater.from(getContext()).inflate(R.layout.fragment_near, null);
        bindEventAndShow(localView, (ImageView) localView);
        return localView;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.rhinoforms.util;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class URIUtil {

	final Logger logger = LoggerFactory.getLogger(URIUtil.class);
	private static final String UTF8 = "UTF-8";

	public Map<String, String> paramsStringToMap(String params) {
		Map<String, String> paramsMap = new HashMap<String, String>();
		if (params != null) {
			StringTokenizer st = new StringTokenizer(params, "&");
			String paramValue = null;
			try {
				while (st.hasMoreTokens()) {
					String token = st.nextToken();
					if (token.indexOf("=") > -1) {
						String paramName = token.substring(0, token.indexOf("="));
						paramValue = token.substring(token.indexOf("=") + 1);
						paramValue = URLDecoder.decode(paramValue, UTF8);
						paramsMap.put(paramName, paramValue);
					}
				}
			} catch (UnsupportedEncodingException e) {
				logger.warn("UnsupportedEncodingException while decoding paramValue:'{}', using " + UTF8, paramValue, e);
			}
		}
		return paramsMap;
	}

	public String paramsMapToString(Map<String, String> params) {
		StringBuilder builder = new StringBuilder();
		boolean first = true;
		String paramKey = null;
		String paramValue = null;
		try {
			for (String key : params.keySet()) {
				if (first) {
					first = false;
				} else {
					builder.append("&");
				}
				paramKey = key;
				paramValue = params.get(key);
				builder.append(URLEncoder.encode(key, UTF8)).append("=").append(URLEncoder.encode(paramValue, UTF8));
			}
		} catch (UnsupportedEncodingException e) {
			logger.warn("UnsupportedEncodingException while encoding paramKey:'{}', paramValue:'{}', using {}", new String[] {paramKey, paramValue, UTF8});
		}
		return builder.toString();
	}

}


text:
	<title>Simon Glendinning's panel show appearances</title>

	<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>

Simon Glendinning's panel show appearances

Simon Glendinning has appeared in 1 episodes between 2015-2015.  Simon Glendinning on Wikipedia.

2015

2015-01-22 / In Our Time


text:
package io.parallec.core.actor;

import io.parallec.core.actor.message.ResponseOnSingeRequest;
import io.parallec.core.actor.message.type.RequestWorkerMsgType;
import io.parallec.core.bean.ssh.SshMeta;
import io.parallec.core.commander.workflow.ssh.SshProvider;
import io.parallec.core.config.ParallecGlobalConfig;
import io.parallec.core.exception.ActorMessageTypeInvalidException;
import io.parallec.core.resources.TcpUdpSshPingResourceStore;
import io.parallec.core.util.PcConstants;
import io.parallec.core.util.PcDateUtils;
import io.parallec.core.util.PcErrorMsgUtils;
import io.parallec.core.util.PcStringUtils;

import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import scala.concurrent.duration.Duration;
import scala.concurrent.duration.FiniteDuration;
import akka.actor.ActorRef;
import akka.actor.Cancellable;
//import akka.actor.PoisonPill;
import akka.actor.UntypedActor;

/**
 *
 * Using callable to start a new thread to run the SSH execution task (which
 * make take minutes). Check if future is read every 0.5seconds Make sure the
 * message are handled async. Note that a blocking message will block all
 * subsequent messages.
 *
 *
 * @author Yuanteng (Jeff) Pei
 */
public class SshWorker extends UntypedActor {

    /** The logger. */
    private static Logger logger = LoggerFactory.getLogger(SshWorker.class);

    /** The actor max operation timeout sec. */
    private int actorMaxOperationTimeoutSec;

    /** The sender. */
    private ActorRef sender = null;

    /** The cause. */
    private Throwable cause;

    /** The try count. */
    private int tryCount = 0;

    /** The timeout message cancellable. */
    private Cancellable timeoutMessageCancellable = null;

    /** The timeout duration. */
    private FiniteDuration timeoutDuration = null;

    /** The sent reply. */
    private boolean sentReply = false;

    /** The ssh meta. */
    private SshMeta sshMeta;

    /** The target host. */
    private String targetHost;

    /** The response future. */
    private Future<ResponseOnSingeRequest> responseFuture;

    /**
     * Instantiates a new ssh worker.
     *
     * @param actorMaxOperationTimeoutSec the actor max operation timeout sec
     * @param sshMeta the ssh meta
     * @param targetHost the target host
     */
    public SshWorker(int actorMaxOperationTimeoutSec, SshMeta sshMeta,
            String targetHost) {
        super();
        this.actorMaxOperationTimeoutSec = actorMaxOperationTimeoutSec;
        this.sshMeta = sshMeta;
        this.targetHost = targetHost;
    }

    /*
     * (non-Javadoc)
     *
     * @see akka.actor.UntypedActor#onReceive(java.lang.Object)
     */
    @Override
    public void onReceive(Object message) throws Exception {
        try {
            if (message instanceof RequestWorkerMsgType) {
                switch ((RequestWorkerMsgType) message) {
                case PROCESS_REQUEST:
                    tryCount++;

                    if (tryCount == 1) {
                        sender = getSender();
                        timeoutDuration = Duration.create(
                                actorMaxOperationTimeoutSec, TimeUnit.SECONDS);
                        timeoutMessageCancellable = getContext()
                                .system()
                                .scheduler()
                                .scheduleOnce(
                                        timeoutDuration,
                                        getSelf(),
                                        RequestWorkerMsgType.PROCESS_ON_TIMEOUT,
                                        getContext().system().dispatcher(),
                                        getSelf());

                        SshTask sshTask = new SshTask(sshMeta, targetHost);
                        setResponseFuture(TcpUdpSshPingResourceStore.getInstance()
                                .getThreadPoolForSshPing().submit(sshTask));

                        getContext()
                                .system()
                                .scheduler()
                                .scheduleOnce(
                                        (FiniteDuration) Duration.create(0.5,
                                                TimeUnit.SECONDS),
                                        new Runnable() {
                                            @Override
                                            public void run() {
                                                getSelf()
                                                        .tell(RequestWorkerMsgType.CHECK_FUTURE_STATE,
                                                                getSelf());
                                            }
                                        }, getContext().system().dispatcher());

                    } else {
                        getLogger().error(
                                "duplicated PROCESS_REQUEST msg. ignore...");
                    }

                    break;

                case CHECK_FUTURE_STATE:
                    getLogger().debug(
                            "checking if SSH callable future completed... for "
                                    + targetHost);
                    if (getResponseFuture().isDone()) {
                        getLogger().debug(
                                "SSH Provider callable returned. for "
                                        + targetHost);
                        ResponseOnSingeRequest sshResponse = getResponseFuture()
                                .get();
                        onComplete(sshResponse);
                        break;
                    } else {
                        // schedule again
                        getContext()
                                .system()
                                .scheduler()
                                .scheduleOnce(
                                        (FiniteDuration) Duration.create(
                                                ParallecGlobalConfig.sshFutureCheckIntervalSec,
                                                TimeUnit.SECONDS),
                                        new Runnable() {
                                            @Override
                                            public void run() {
                                                getSelf()
                                                        .tell(RequestWorkerMsgType.CHECK_FUTURE_STATE,
                                                                getSelf());
                                            }
                                        }, getContext().system().dispatcher());

                    }
                    break;
                case CANCEL:
                    getLogger()
                            .info("Request was CANCELLED.................on SSH host {}",
                                    targetHost);
                    cancelCancellable();
                    if (sender == null)
                        sender = getSender();
                    reply(null, true, PcConstants.REQUEST_CANCELED,
                            PcConstants.REQUEST_CANCELED, PcConstants.NA,
                            PcConstants.NA_INT);
                    break;

                case PROCESS_ON_EXCEPTION:

                    String displayError = PcErrorMsgUtils.replaceErrorMsg(cause
                            .toString());

                    String stackTrace = PcStringUtils.printStackTrace(cause);

                    cancelCancellable();
                    reply(null, true, displayError, stackTrace, PcConstants.NA,
                            PcConstants.NA_INT);

                    break;

                case PROCESS_ON_TIMEOUT:
                    getLogger().error(
                            "Inside PROCESS_ON_TIMEOUT.................target: "
                                    + this.targetHost + "......... at "
                                    + PcDateUtils.getNowDateTimeStrStandard());
                    cancelCancellable();

                    String errorMsg = String
                            .format("SshWorker Timedout after %d SEC (no response but no exception catched). Details more info",
                                    actorMaxOperationTimeoutSec);
                    reply(null, true, errorMsg, errorMsg, PcConstants.NA,
                            PcConstants.NA_INT);
                    break;

                default:
                    break;
                }
            } else {
                unhandled(message);
                this.cause = new ActorMessageTypeInvalidException(
                        "ActorMessageTypeInvalidException error for host "
                                + this.targetHost);
                getSelf().tell(RequestWorkerMsgType.PROCESS_ON_EXCEPTION,
                        getSelf());
            }
        } catch (Exception e) {
            this.cause = e;
            getSelf()
                    .tell(RequestWorkerMsgType.PROCESS_ON_EXCEPTION, getSelf());
        }
    }

    /**
     * On complete.
     *
     * @param sshResponse
     *            the ssh response
     */
    public void onComplete(ResponseOnSingeRequest sshResponse) {
        cancelCancellable();
        reply(sshResponse.getResponseBody(),
                sshResponse.isFailObtainResponse(),
                sshResponse.getErrorMessage(), null,
                sshResponse.getStatusCode(), sshResponse.getStatusCodeInt());
    }

    /**
     * Cancel cancellable.
     */
    public void cancelCancellable() {

        if (timeoutMessageCancellable != null) {
            timeoutMessageCancellable.cancel();
        }
        if (getResponseFuture() != null && !getResponseFuture().isDone()) {
            getResponseFuture().cancel(true);
        }
    }

    /**
     * Reply.
     *
     * @param response
     *            the response
     * @param failObtainResponse
     *            the fail obtain response
     * @param errorMessage
     *            the error message
     * @param stackTrace
     *            the stack trace
     * @param statusCode
     *            the status code
     * @param statusCodeInt
     *            the status code int
     */
    private void reply(final String response, final boolean failObtainResponse,
            final String errorMessage, final String stackTrace,
            final String statusCode, final int statusCodeInt) {

        /**
         * this is needed if NIO has not even send out! MEMROY LEAK if not.
         * double check
         */

        if (!isSentReply()) {
            //must update sentReply first to avoid duplicated msg.
            sentReply = true;
            final ResponseOnSingeRequest res = new ResponseOnSingeRequest(
                    response, failObtainResponse, errorMessage, stackTrace,
                    statusCode, statusCodeInt,
                    PcDateUtils.getNowDateTimeStrStandard(), null);

            if (!getContext().system().deadLetters().equals(sender)) {
                sender.tell(res, getSelf());
            }

            getLogger().debug(
                    "DEBUG: real response: " + response + " err: "
                            + errorMessage);
            if (getContext() != null) {
                getContext().stop(getSelf());
            }
        }
    }

    /**
     * Checks if is sent reply.
     *
     * @return true, if is sent reply
     */
    public boolean isSentReply() {
        return sentReply;
    }

    /**
     * Sets the sent reply.
     *
     * @param sentReply
     *            the new sent reply
     */
    public void setSentReply(boolean sentReply) {
        this.sentReply = sentReply;
    }

    /**
     * Gets the response future.
     *
     * @return the response future
     */
    public Future<ResponseOnSingeRequest> getResponseFuture() {
        return responseFuture;
    }

    /**
     * Sets the response future.
     *
     * @param responseFuture
     *            the new response future
     */
    public void setResponseFuture(Future<ResponseOnSingeRequest> responseFuture) {
        this.responseFuture = responseFuture;
    }

    /**
     * Gets the logger.
     *
     * @return the logger
     */
    public static Logger getLogger() {
        return logger;
    }

    /**
     * Sets the logger.
     *
     * @param logger
     *            the new logger
     */
    public static void setLogger(Logger logger) {
        SshWorker.logger = logger;
    }

    /**
     * thread to return the future.
     *
     * @author Yuanteng (Jeff) Pei
     */
    private static class SshTask implements Callable<ResponseOnSingeRequest> {

        /** The ssh meta. */
        private SshMeta sshMeta;

        /** The target host. */
        private String targetHost;

        /**
         * Instantiates a new ssh task.
         *
         * @param sshMeta
         *            the ssh meta
         * @param targetHost
         *            the target host
         */
        public SshTask(SshMeta sshMeta, String targetHost) {
            this.sshMeta = sshMeta;
            this.targetHost = targetHost;
        }

        /*
         * (non-Javadoc)
         *
         * @see java.util.concurrent.Callable#call()
         */
        @Override
        public ResponseOnSingeRequest call() throws Exception {
            SshProvider sshProvider = new SshProvider(sshMeta, targetHost);
            return sshProvider.executeSshCommand();
        }
    }// end class

}


text:
<?php

namespace ZendPdf\Exception;

/**
 * Exception interface for Zend\Pdf.
 *
 * @category   Zend
 * @package    Zend_PDF
 * @subpackage Zend_PDF_Exception
 */
interface ExceptionInterface
{
}


text:
.secret-header {
  border: 1px solid #ccc;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  background: #f9f9f9;
  background: var(--input-hidden-password-bg-color);
  display: flex;
  justify-content: space-around;
}

.secret-header:not(:only-child) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.secret-header > div {
  flex-grow: 1;
  display: inline-flex;
  align-items: center;
  padding: 1.5em 1.75em;
}

.secret-legend > svg {
  margin-right: 1em;
}

.secret-update {
  justify-content: flex-end;
}

.secret-input {
  border: solid 1px #ccc;
  border: solid 1px var(--input-border);
  border-top: none;
  border-radius: 0 0 3px 3px;
}

.secret-input textarea {
  width: 100%;
  font-family: monospace;
  border: none;
  padding: 1em;
}

.secret input[type="button"] {
  background: #4b99d0;
  background: var(--btn-primary-bg);
  color: #fff;
  color: var(--btn-text-color);
  border-radius: 4px;
  border: none;
  padding: 1em 2em;
}

.secret input[type="button"]:hover {
  background: #5092be;
  cursor: pointer;
}


text:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <QuartzCore/QuartzCore.h>

#include <gst/gst.h>

#include "vkwindow_ios.h"
#include "vkdisplay_ios.h"

#include "vkios_utils.h"

#define GST_VULKAN_WINDOW_IOS_GET_PRIVATE(o)  \
  (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_VULKAN_WINDOW_IOS, GstVulkanWindowIosPrivate))

#define GST_CAT_DEFAULT gst_vulkan_window_ios_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);

static void
_init_debug (void)
{
  static volatile gsize _init = 0;

  if (g_once_init_enter (&_init)) {
    GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "vulkanwindowios", 0,
        "Vulkan iOS Window");
    g_once_init_leave (&_init, 1);
  }
}

enum
{
  PROP_0,
};

struct _GstVulkanWindowIosPrivate
{
  gpointer internal_view;
  gpointer external_view;

  gint preferred_width;
  gint preferred_height;
};

#define gst_vulkan_window_ios_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanWindowIos, gst_vulkan_window_ios,
    GST_TYPE_VULKAN_WINDOW, G_ADD_PRIVATE (GstVulkanWindowIos) _init_debug ());

static VkSurfaceKHR gst_vulkan_window_ios_get_surface (GstVulkanWindow * window,
    GError ** error);
static gboolean gst_vulkan_window_ios_get_presentation_support (GstVulkanWindow
    * window, GstVulkanDevice * device, guint32 queue_family_idx);
static gboolean gst_vulkan_window_ios_open (GstVulkanWindow * window,
    GError ** error);
static void gst_vulkan_window_ios_close (GstVulkanWindow * window);
static void gst_vulkan_window_ios_set_window_handle (GstVulkanWindow * window,
    guintptr window_handle);

static void
gst_vulkan_window_ios_finalize (GObject * object)
{
  G_OBJECT_CLASS (parent_class)->finalize (object);
}

static void
gst_vulkan_window_ios_class_init (GstVulkanWindowIosClass * klass)
{
  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
  GstVulkanWindowClass *window_class = (GstVulkanWindowClass *) klass;

  obj_class->finalize = gst_vulkan_window_ios_finalize;

  window_class->open = GST_DEBUG_FUNCPTR (gst_vulkan_window_ios_open);
  window_class->close = GST_DEBUG_FUNCPTR (gst_vulkan_window_ios_close);
  window_class->get_surface = gst_vulkan_window_ios_get_surface;
  window_class->get_presentation_support =
      gst_vulkan_window_ios_get_presentation_support;
  window_class->set_window_handle =
      gst_vulkan_window_ios_set_window_handle;
}

static void
gst_vulkan_window_ios_init (GstVulkanWindowIos * window)
{
  window->priv = gst_vulkan_window_ios_get_instance_private (window);

  window->priv->preferred_width = 320;
  window->priv->preferred_height = 240;
}

/* Must be called in the gl thread */
GstVulkanWindowIos *
gst_vulkan_window_ios_new (GstVulkanDisplay * display)
{
  GstVulkanWindowIos *window;

  _init_debug ();

  if ((gst_vulkan_display_get_handle_type (display) &
          GST_VULKAN_DISPLAY_TYPE_IOS)
      == GST_VULKAN_DISPLAY_TYPE_NONE) {
    GST_INFO ("Wrong display type %u for this window type %u", display->type,
        GST_VULKAN_DISPLAY_TYPE_IOS);
    return NULL;
  }

  window = g_object_new (GST_TYPE_VULKAN_WINDOW_IOS, NULL);
  gst_object_ref_sink (window);

  return window;
}

static void
_create_window (GstVulkanWindowIos * window_ios)
{
  GstVulkanWindowIosPrivate *priv = window_ios->priv;
  CGRect rect = CGRectMake (0, 0, priv->preferred_width, priv->preferred_height);
  UIView *external_view = (__bridge UIView *) priv->external_view;
  GstVulkanUIView *view;

  view = [[GstVulkanUIView alloc] initWithFrame:rect];
  view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

  priv->internal_view = (__bridge_retained gpointer)view;
  [external_view addSubview:view];
}

gboolean
gst_vulkan_window_ios_create_window (GstVulkanWindowIos * window_ios)
{
  if (!window_ios->priv->external_view) {
    GST_WARNING_OBJECT(window_ios, "No external UIView provided");
    return FALSE;
  }

  _invoke_on_main ((GstVulkanWindowFunc) _create_window,
      gst_object_ref (window_ios), gst_object_unref);

  return TRUE;
}

static VkSurfaceKHR
gst_vulkan_window_ios_get_surface (GstVulkanWindow * window, GError ** error)
{
  GstVulkanWindowIos *window_ios = GST_VULKAN_WINDOW_IOS (window);
  VkIOSSurfaceCreateInfoMVK info = { 0, };
  VkSurfaceKHR ret;
  VkResult err;

  info.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK;
  info.pNext = NULL;
  info.flags = 0;
  info.pView = window_ios->priv->internal_view;

  if (!window_ios->CreateIOSSurface)
    window_ios->CreateIOSSurface =
        gst_vulkan_instance_get_proc_address (window->display->instance,
        "vkCreateIOSSurfaceMVK");
  if (!window_ios->CreateIOSSurface) {
    g_set_error_literal (error, GST_VULKAN_ERROR, VK_ERROR_FEATURE_NOT_PRESENT,
        "Could not retrieve \"vkCreateIOSSurfaceMVK\" function pointer");
    return 0;
  }

  err =
      window_ios->CreateIOSSurface (window->display->instance->instance, &info,
      NULL, &ret);
  if (gst_vulkan_error_to_g_error (err, error, "vkCreateIOSSurfaceMVK") < 0)
    return 0;

  return ret;
}

static gboolean
gst_vulkan_window_ios_get_presentation_support (GstVulkanWindow * window,
    GstVulkanDevice * device, guint32 queue_family_idx)
{
  return TRUE;
}

static gboolean
gst_vulkan_window_ios_open (GstVulkanWindow * window, GError ** error)
{
  GstVulkanWindowIos *window_ios = GST_VULKAN_WINDOW_IOS (window);

  if (!GST_VULKAN_WINDOW_CLASS (parent_class)->open (window, error))
    return FALSE;

  return gst_vulkan_window_ios_create_window (window_ios);
}

static void
gst_vulkan_window_ios_close (GstVulkanWindow * window)
{
  GstVulkanWindowIos *window_ios = GST_VULKAN_WINDOW_IOS (window);

  CFBridgingRelease (window_ios->priv->internal_view);
  window_ios->priv->internal_view = NULL;

  GST_VULKAN_WINDOW_CLASS (parent_class)->close (window);
}

static void
gst_vulkan_window_ios_set_window_handle (GstVulkanWindow * window,
    guintptr window_handle)
{
  GstVulkanWindowIos *window_ios = GST_VULKAN_WINDOW_IOS (window);
  gpointer view = (gpointer) window_handle;

  g_return_if_fail (view != NULL);

  if (window_ios->priv->external_view && window_ios->priv->external_view != view) {
    GST_FIXME_OBJECT (window_ios, "View changes are not implemented");
    return;
  }

  window_ios->priv->external_view = view;
}

@implementation GstVulkanUIView

+(Class) layerClass
{
  return [CAMetalLayer class];
}

@end

void
_invoke_on_main (GstVulkanWindowFunc func, gpointer data, GDestroyNotify notify)
{
  if ([NSThread isMainThread]) {
    func (data);
    if (notify)
      notify (data);
  } else {
    dispatch_async (dispatch_get_main_queue (), ^{
      func (data);
      if (notify)
        notify (data);
    });
  }
}


text:
package com.webtrekk.webtrekksdk;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.test.AndroidTestCase;

import static org.mockito.Mockito.*;

import com.webtrekk.webtrekksdk.Modules.Campaign;
import com.webtrekk.webtrekksdk.Request.RequestFactory;
import com.webtrekk.webtrekksdk.Request.RequestUrlStore;
import com.webtrekk.webtrekksdk.Request.TrackingRequest;
import com.webtrekk.webtrekksdk.TrackingParameter.Parameter;
import com.webtrekk.webtrekksdk.Configuration.ActivityConfiguration;
import com.webtrekk.webtrekksdk.Utils.ActivityListener;
import com.webtrekk.webtrekksdk.Utils.HelperFunctions;
import com.webtrekk.webtrekksdk.Configuration.TrackingConfiguration;

import java.util.HashMap;

public class WebtrekkTests extends AndroidTestCase {

    Webtrekk webtrekk;

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        // android bug workaround: 308
        System.setProperty("dexmaker.dexcache", getContext().getCacheDir().toString());

        webtrekk = new Webtrekk();
        SharedPreferences.Editor editor = HelperFunctions.getWebTrekkSharedPreference(getContext()).edit();
        editor.clear();
        editor.apply();

        Campaign.getFirstStartInitiated(getContext(), true);
        editor.putBoolean("CAMPAIGN_PROCESS_FINISHED", true).apply();
    }

    @Override
    protected void tearDown() throws Exception {
        RequestUrlStore request = new RequestUrlStore(getContext());
        request.deleteRequestsFile();
        super.tearDown();
    }

    public void testGetInstance() {
        Webtrekk webtrekk = Webtrekk.getInstance();
        assertNotNull(webtrekk);
        // make shure it always returns the same object
        assertSame(webtrekk, Webtrekk.getInstance());
    }

    public void testInitWebtrekk() {
        try {
            webtrekk.initWebtrekk(null);
            fail("null context, IllegalArgumentException");
        } catch (IllegalArgumentException e){

        }

        webtrekk.initWebtrekk(getContext());
        ActivityListener callbacks = new ActivityListener(webtrekk);
        assertNotNull(webtrekk.getTrackingConfiguration());
        assertNotNull(webtrekk.getContext());
        assertNotNull(webtrekk.getRequestFactory().getRequestUrlStore());
        assertNotNull(webtrekk.getRequestFactory().getWebtrekkParameter());
        assertEquals(0, callbacks.getCurrentActivitiesCount());
        // make shure it fails when init is called twice
//        try {
//            webtrekk.initWebtrekk(getContext());
//            fail("already initalized, IllegalStateException");
//        } catch (IllegalStateException e) {
//
//        }

    }

    public void testInitTrackingConfiguration() {
        webtrekk.setContext(getContext());
        webtrekk.initTrackingConfiguration(R.raw.webtrekk_config);
        assertNotNull(webtrekk.getTrackingConfiguration());
        assertEquals(webtrekk.getTrackingConfiguration().getTrackId(), "1111111111112");
        assertEquals(webtrekk.getTrackingConfiguration().getTrackDomain(), "http://trackingtest.nglab.org");
        assertEquals(webtrekk.getTrackingConfiguration().getSendDelay(), 30);
        assertEquals(webtrekk.getTrackingConfiguration().getMaxRequests(), 4000);
        assertEquals(webtrekk.getTrackingConfiguration().getVersion(), 3);

    }
    public void testInitWebtrekkParameter() {
        // make sure the default params have valid values
        webtrekk.setContext(getContext());
        webtrekk.initTrackingConfiguration(R.raw.webtrekk_config);
        webtrekk.getRequestFactory().init(mContext, webtrekk.getTrackingConfiguration(), webtrekk);
        assertEquals(6, webtrekk.getRequestFactory().getWebtrekkParameter().size());
    }

    public void testUpdateDynamicParameter() {
        // make sure that the values which change with every request are inserted as well
        webtrekk.setContext(getContext());
        webtrekk.initTrackingConfiguration(R.raw.webtrekk_config);
        webtrekk.getRequestFactory().init(mContext, webtrekk.getTrackingConfiguration(), webtrekk);

        RequestUrlStore requestUrlStore = mock(RequestUrlStore.class);
        webtrekk.getRequestFactory().setRequestUrlStore(requestUrlStore);
        when(requestUrlStore.size()).thenReturn(55);

        //set some different default values
        webtrekk.getCustomParameter().put("screenOrientation", "stttr");
        webtrekk.getCustomParameter().put("connectionType", "offline");

        webtrekk.getRequestFactory().updateDynamicParameter();
        assertEquals(7, webtrekk.getRequestFactory().getWebtrekkParameter().size());
        assertTrue(webtrekk.getRequestFactory().getAutoCustomParameter().get("screenOrientation").matches("(portrait|landscape)"));
        String connectionType = webtrekk.getCustomParameter().get("connectionType");
        assertTrue(connectionType.equals("WIFI") || connectionType.equals("offline"));
        assertEquals("55", webtrekk.getRequestFactory().getAutoCustomParameter().get("requestUrlStoreSize"));
    }

    public void testInitCustomParameter() {
        // make sure that the values which change with every request are inserted as well
        webtrekk.setContext(getContext());
        webtrekk.initTrackingConfiguration(R.raw.webtrekk_config);
        webtrekk.getRequestFactory().init(mContext, webtrekk.getTrackingConfiguration(), webtrekk);

        assertTrue(webtrekk.getRequestFactory().getAutoCustomParameter().toString(), webtrekk.getRequestFactory().getAutoCustomParameter().size()>0);
    }

    public void testTrack() {
//        try {
//            webtrekk.track();
//            fail("not initalized, IllegalStateException");
//        } catch (IllegalStateException e) {
//
//        }
        webtrekk.initWebtrekk(getContext());
//        try {
//            webtrekk.track();
//            fail("startActivity not called, IllegalStateException");
//        } catch (IllegalStateException e) {
//
//        }
//        try {
//            webtrekk.track(null);
//            fail("trackingparams is null, IllegalStateException");
//        } catch (IllegalStateException e) {
//
//        }
        ActivityListener lifecycleCallbacks = new ActivityListener(webtrekk);

        SecondActivity activity = mock(SecondActivity.class);

        when(activity.getResources()).thenReturn(mContext.getResources());
        lifecycleCallbacks.onActivityCreated(activity, null);
        lifecycleCallbacks.onActivityStarted(activity);
        assertEquals(1, webtrekk.getRequestFactory().getRequestUrlStore().size());
        assertTrue(webtrekk.getRequestFactory().getRequestUrlStore().peek().contains("SecondActivity_Proxy,"));
    }

    public static class SecondActivity extends Activity{};

    public void testStartStopActivity() {

        ActivityListener callbacks = new ActivityListener(webtrekk);
        webtrekk.initWebtrekk(getContext());

        Activity activity = mock(Activity.class);
        SecondActivity secondActivity = mock(SecondActivity.class);

        when(activity.getResources()).thenReturn(mContext.getResources());
        when(secondActivity.getResources()).thenReturn(mContext.getResources());

        callbacks.onActivityStarted(activity);

        assertEquals("Activity_Proxy", webtrekk.getCurrentActivityName());
        assertEquals(1, callbacks.getCurrentActivitiesCount());

        // second call
        callbacks.onActivityCreated(secondActivity, null);
        callbacks.onActivityStarted(secondActivity);
        callbacks.onActivityStopped(activity);
        assertEquals(2, callbacks.getCurrentActivitiesCount());
        callbacks.onActivityStopped(secondActivity);
        assertEquals(2, callbacks.getCurrentActivitiesCount());
        when(secondActivity.isFinishing()).thenReturn(true);
        callbacks.onActivityStopped(secondActivity);
        assertEquals(1, callbacks.getCurrentActivitiesCount());
    }

    public void testOnSendIntervalOver() {
        webtrekk.initWebtrekk(getContext());
        ActivityListener callbacks = new ActivityListener(webtrekk);
        RequestUrlStore requestUrlStore = mock(RequestUrlStore.class);
        webtrekk.getRequestFactory().setRequestUrlStore(requestUrlStore);
        webtrekk.getRequestFactory().onSendIntervalOver();

        when(requestUrlStore.size()).thenReturn(5).thenReturn(4).thenReturn(3).thenReturn(2).thenReturn(1).thenReturn(0);
        webtrekk.getRequestFactory().onSendIntervalOver();
    }

    public void testSetOptOut() {
        webtrekk.initWebtrekk(getContext());
        SharedPreferences preferences = getContext().getSharedPreferences(Webtrekk.PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);

        webtrekk.setOptout(true);
        assertTrue(webtrekk.isOptout());
        assertTrue(preferences.getBoolean(RequestFactory.PREFERENCE_KEY_OPTED_OUT, false));

        webtrekk.setOptout(false);
        assertFalse(preferences.getBoolean(RequestFactory.PREFERENCE_KEY_OPTED_OUT, true));
        assertFalse(webtrekk.isOptout());

    }

    public void testInitSamplingNull() {
        webtrekk.initWebtrekk(getContext());
        SharedPreferences preferences = getContext().getSharedPreferences(Webtrekk.PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);

        webtrekk.getTrackingConfiguration().setSampling(0);
        webtrekk.getRequestFactory().init(mContext, webtrekk.getTrackingConfiguration(), webtrekk);
        assertFalse(webtrekk.isSampling());
        assertFalse(preferences.getBoolean(RequestFactory.PREFERENCE_KEY_IS_SAMPLING, true));
        assertEquals(0, preferences.getInt(RequestFactory.PREFERENCE_KEY_SAMPLING, -1));
    }

    public void testInitSamplingNotNull() {
        webtrekk.initWebtrekk(getContext());
        SharedPreferences preferences = getContext().getSharedPreferences(Webtrekk.PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);

        webtrekk.getTrackingConfiguration().setSampling(10);
        webtrekk.getRequestFactory().init(mContext, webtrekk.getTrackingConfiguration(), webtrekk);
        assertEquals(10, preferences.getInt(RequestFactory.PREFERENCE_KEY_SAMPLING, -1));
        // also make sure the value is reinitalized after change
        webtrekk.getTrackingConfiguration().setSampling(20);
        webtrekk.getRequestFactory().init(mContext, webtrekk.getTrackingConfiguration(), webtrekk);
        assertEquals(20, preferences.getInt(RequestFactory.PREFERENCE_KEY_SAMPLING, -1));
    }

    public void testFnsParameter() {
        // make shure fns gets send once and only once when a new session starts
        webtrekk.initWebtrekk(getContext());
        SharedPreferences preferences = getContext().getSharedPreferences(Webtrekk.PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);
        ActivityListener lifecycleCallbacks = new ActivityListener(webtrekk);
        Activity activity = mock(Activity.class);

        when(activity.getResources()).thenReturn(mContext.getResources());

        lifecycleCallbacks.onActivityCreated(activity, null);
        lifecycleCallbacks.onActivityStarted(activity);
        //assertEquals(webtrekk.getRequestUrlStore().get(0), "test");
        assertTrue(webtrekk.getRequestFactory().getRequestUrlStore().peek().contains("&fns=1"));
        webtrekk.track();
        assertEquals(webtrekk.getRequestFactory().getInternalParameter().getDefaultParameter().get(Parameter.FORCE_NEW_SESSION), "0");
        webtrekk.getRequestFactory().getRequestUrlStore().removeLastURL();
        assertTrue(webtrekk.getRequestFactory().getRequestUrlStore().peek().contains("&fns=0"));
    }

    public void testFirstParameter() {
        // make shure one gets send once and only once when a new session starts
        SharedPreferences preferences = getContext().getSharedPreferences(Webtrekk.PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);
        preferences.edit().remove(Webtrekk.PREFERENCE_KEY_EVER_ID).commit();
        webtrekk.initWebtrekk(getContext());
        ActivityListener lifecycleCallbacks = new ActivityListener(webtrekk);

        Activity activity = mock(Activity.class);

        when(activity.getResources()).thenReturn(mContext.getResources());

        lifecycleCallbacks.onActivityCreated(activity, null);
        lifecycleCallbacks.onActivityStarted(activity);
        //assertEquals(webtrekk.getRequestUrlStore().get(0), "test");
        assertTrue(webtrekk.getRequestFactory().getRequestUrlStore().peek().contains("&one=1"));

        //webtrekk.initInternalParameter();
        webtrekk.track();
        assertEquals(webtrekk.getRequestFactory().getInternalParameter().getDefaultParameter().get(Parameter.APP_FIRST_START), "0");
        webtrekk.getRequestFactory().getRequestUrlStore().removeLastURL();
        assertTrue(webtrekk.getRequestFactory().getRequestUrlStore().peek().contains("&one=0"));
    }

    public void testUpdated() {
        webtrekk.initWebtrekk(getContext());
        assertEquals(webtrekk.getRequestFactory().getAutoCustomParameter().get("appUpdated"), "1");
        SharedPreferences preferences = getContext().getSharedPreferences(Webtrekk.PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);
        preferences.edit().remove(Webtrekk.PREFERENCE_APP_VERSIONCODE).commit();
        assertEquals(preferences.getInt(Webtrekk.PREFERENCE_APP_VERSIONCODE, -1), -1);
        ActivityListener lifecycleCallbacks = new ActivityListener(webtrekk);
        Activity activity = mock(Activity.class);

        when(activity.getResources()).thenReturn(mContext.getResources());
        lifecycleCallbacks.onActivityCreated(activity, null);
        lifecycleCallbacks.onActivityStarted(activity);
        webtrekk.track();
        assertEquals(HelperFunctions.getAppVersionCode(getContext()), 0);
        assertEquals(webtrekk.getRequestFactory().getAutoCustomParameter().get("appUpdated"), "0");

        assertEquals(HelperFunctions.updated(getContext(), 5), true);
        assertEquals(preferences.getInt(Webtrekk.PREFERENCE_APP_VERSIONCODE, 0), 5);
    }

    public void testCreateTrackingRequest() {
        TrackingParameter globalTp = new TrackingParameter();
        globalTp.add(Parameter.ACTIVITY_NAME, "testtestact");
        webtrekk.initWebtrekk(getContext());
        TrackingParameter tp = new TrackingParameter();
        webtrekk.setGlobalTrackingParameter(globalTp);
        TrackingRequest tr = webtrekk.getRequestFactory().createTrackingRequest(tp);
        ActivityListener lifecycleCallbacks = new ActivityListener(webtrekk);

        Activity activity = mock(Activity.class);

        when(activity.getResources()).thenReturn(mContext.getResources());
        lifecycleCallbacks.onActivityCreated(activity, null);
        lifecycleCallbacks.onActivityStarted(activity);
        //verify override
        assertEquals(webtrekk.getRequestFactory().getGlobalTrackingParameter().getDefaultParameter().get(Parameter.ACTIVITY_NAME), "testtestact");

    }

    /**
     * verify that when a global tracking parameter was set, that it appears in the url
     */
    public void testGlobalTrackingParameter() {
        // set a global tracking param
        TrackingParameter constGlobalTp = new TrackingParameter();
        constGlobalTp.add(Parameter.ECOM, "4", "testecomparam");
        webtrekk.initWebtrekk(getContext());
        TrackingParameter tp = new TrackingParameter();
        webtrekk.setConstGlobalTrackingParameter(constGlobalTp);
        TrackingRequest tr = webtrekk.getRequestFactory().createTrackingRequest(tp);
        //assertTrue(tp.getEcomParameter().get("1").contains("testecomparam"));
        assertTrue("url string does not contain value: " + tr.getUrlString(), tr.getUrlString().contains("&cb4=testecomparam"));
    }

    /**
     * make sure that an activity only gets tracked when auto tracking is enabled globally or for the specific application
     */
    public void testAutoTrackSettings() {

        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
            return;
        }

        TrackingConfiguration configuration = new TrackingConfiguration();
        // auto tracking globally enabled
        configuration.setAutoTracked(true);

        // auto tracking true
        ActivityConfiguration act1 = new ActivityConfiguration("act1", "mapping.act1", true, new TrackingParameter(), new TrackingParameter());
        // auto tracking false just for this activity
        ActivityConfiguration act2 = new ActivityConfiguration("act2", "mapping.act2", false, new TrackingParameter(), new TrackingParameter());
        HashMap<String, ActivityConfiguration> actConfigurations = new HashMap<>();
        actConfigurations.put("act1", act1);
        actConfigurations.put("act2", act2);
        configuration.setActivityConfigurations(actConfigurations);

        webtrekk.setTrackingConfiguration(configuration);

        Webtrekk webtrekkSpy = spy(webtrekk);
        doNothing().when(webtrekkSpy).track();

        webtrekkSpy.setCurrentActivityName("act1");
        webtrekkSpy.autoTrackActivity();

        verify(webtrekkSpy, times(1)).track();

        // make sure track is not called when the activity overrides the global autotracking settings
        // so times is still 1
        webtrekkSpy.setCurrentActivityName("act2");
        webtrekkSpy.autoTrackActivity();

        verify(webtrekkSpy, times(1)).track();

    }

}


text:
include_recipe 'qt5-default::webkit'

package 'qt5-default'


text:
/*
 * $Id: Win32TransService.hpp 191054 2005-06-17 02:56:35Z jberry $
 */

#ifndef WIN32TRANSSERVICE_HPP
#define WIN32TRANSSERVICE_HPP

#include <xercesc/util/TransService.hpp>
#include <xercesc/util/RefHashTableOf.hpp>
#include <windows.h>

XERCES_CPP_NAMESPACE_BEGIN

class CPMapEntry;

//---------------------------------------------------------------------------
//
//  class Win32TransService
//
//---------------------------------------------------------------------------
class XMLUTIL_EXPORT Win32TransService : public XMLTransService
{
public :
    // -----------------------------------------------------------------------
    //  Constructors and Destructor
    // -----------------------------------------------------------------------
    Win32TransService();
    virtual ~Win32TransService();

    // -----------------------------------------------------------------------
    //  Implementation of the virtual transcoding service API
    // -----------------------------------------------------------------------
    virtual int compareIString
    (
        const   XMLCh* const    comp1
        , const XMLCh* const    comp2
    );

    virtual int compareNIString
    (
        const   XMLCh* const    comp1
        , const XMLCh* const    comp2
        , const unsigned int    maxChars
    );

    virtual const XMLCh* getId() const;

    virtual bool isSpace(const XMLCh toCheck) const;

    virtual XMLLCPTranscoder* makeNewLCPTranscoder();

    virtual bool supportsSrcOfs() const;

    virtual void upperCase(XMLCh* const toUpperCase) const;
    virtual void lowerCase(XMLCh* const toLowerCase) const;

protected :
    // -----------------------------------------------------------------------
    //  Protected virtual methods, implemented in Win32TransService2.cpp
    // -----------------------------------------------------------------------
    virtual XMLTranscoder* makeNewXMLTranscoder
    (
        const   XMLCh* const            encodingName
        ,       XMLTransService::Codes& resValue
        , const unsigned int            blockSize
        ,       MemoryManager* const    manager
    );

private :
    // -----------------------------------------------------------------------
    //  Unimplemented constructors and operators
    // -----------------------------------------------------------------------
    Win32TransService(const Win32TransService&);
    Win32TransService& operator=(const Win32TransService&);

    //      This is a hash table of entries which map encoding names to their
    //      Windows specific code pages. The code page allows us to create
    //      transcoders for those encodings. The encoding names come from XML
    //      files.
    //
    //      This map is shared unsynchronized among all threads of the process,
    //      which is cool since it will be read only once its initialized.

    static bool isAlias(const   HKEY            encodingKey
                    ,       char* const     aliasBuf = 0
                    , const unsigned int    nameBufSz = 0);

    RefHashTableOf<CPMapEntry>    *fCPMap;
};

//---------------------------------------------------------------------------
//
//  class Win32Transcoder
//
//---------------------------------------------------------------------------

class XMLUTIL_EXPORT Win32Transcoder : public XMLTranscoder
{
public :
    // -----------------------------------------------------------------------
    //  Constructors and Destructor
    // -----------------------------------------------------------------------
    Win32Transcoder
    (
        const   XMLCh* const    encodingName
        , const unsigned int    winCP
        , const unsigned int    ieCP
        , const unsigned int    blockSize
        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager);
    ~Win32Transcoder();

    // -----------------------------------------------------------------------
    //  Implementation of the virtual transcoder interface
    // -----------------------------------------------------------------------
    virtual unsigned int transcodeFrom
    (
        const   XMLByte* const          srcData
        , const unsigned int            srcCount
        ,       XMLCh* const            toFill
        , const unsigned int            maxChars
        ,       unsigned int&           bytesEaten
        ,       unsigned char* const    charSizes
    );

    virtual unsigned int transcodeTo
    (
        const   XMLCh* const    srcData
        , const unsigned int    srcCount
        ,       XMLByte* const  toFill
        , const unsigned int    maxBytes
        ,       unsigned int&   charsEaten
        , const UnRepOpts       options
    );

    virtual bool canTranscodeTo
    (
        const   unsigned int    toCheck
    )   const;

private :
    // -----------------------------------------------------------------------
    //  Unimplemented constructors and operators
    // -----------------------------------------------------------------------
    Win32Transcoder(const Win32Transcoder&);
    Win32Transcoder& operator=(const Win32Transcoder&);

    // -----------------------------------------------------------------------
    //  Private data members
    //
    //  fIECP
    //      This is the internet explorer code page for this encoding.
    //
    //  fWinCP
    //      This is the windows code page for this encoding.
    // -----------------------------------------------------------------------
    unsigned int    fIECP;
    unsigned int    fWinCP;
};

//---------------------------------------------------------------------------
//
//  class Win32LCPTranscoder
//
//---------------------------------------------------------------------------
class XMLUTIL_EXPORT Win32LCPTranscoder : public XMLLCPTranscoder
{
public :
    // -----------------------------------------------------------------------
    //  Constructors and Destructor
    // -----------------------------------------------------------------------
    Win32LCPTranscoder();
    ~Win32LCPTranscoder();

    // -----------------------------------------------------------------------
    //  Implementation of the virtual transcoder interface
    // -----------------------------------------------------------------------
    virtual unsigned int calcRequiredSize(const char* const srcText
        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);

    virtual unsigned int calcRequiredSize(const XMLCh* const srcText
        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);

    virtual char* transcode(const XMLCh* const toTranscode);
    virtual char* transcode(const XMLCh* const toTranscode,
                            MemoryManager* const manager);

    virtual XMLCh* transcode(const char* const toTranscode);
    virtual XMLCh* transcode(const char* const toTranscode,
                             MemoryManager* const manager);

    virtual bool transcode
    (
        const   char* const     toTranscode
        ,       XMLCh* const    toFill
        , const unsigned int    maxChars
        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
    );

    virtual bool transcode
    (
        const   XMLCh* const    toTranscode
        ,       char* const     toFill
        , const unsigned int    maxChars
        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
    );

private :
    // -----------------------------------------------------------------------
    //  Unimplemented constructors and operators
    // -----------------------------------------------------------------------
    Win32LCPTranscoder(const Win32LCPTranscoder&);
    Win32LCPTranscoder& operator=(const Win32LCPTranscoder&);
};

XERCES_CPP_NAMESPACE_END

#endif


text:
<!DOCTYPE html>
<html>
  <head>
    <title>Audio Output Devices</title>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
  </head>
  <body>
    <script>
      // TODO(guidou): Add more tests with nonempty src once a MockWebMediaPlayer
      // is available int the test runner. See crbug.com/546566.

      // Tests that the API is available.
      test(function() {
        var audio = document.createElement('audio');
        assert_not_equals(audio, null);
        assert_idl_attribute(audio, 'setSinkId');
        assert_equals(typeof audio.setSinkId, 'function');
        assert_idl_attribute(audio, 'sinkId');
        assert_equals(audio.sinkId, '');
      }, 'Basic API test');

      // Tests that setting the sink to the default device succeeds.
      promise_test(function() {
        var audio = document.createElement('audio');
        return audio.setSinkId('')
      }, 'setSinkId("")');

      // Tests that setting the sink to a valid device succeeds.
      // Note: 'valid' is the name of a valid device in the test runner.
      promise_test(function() {
        var audio = document.createElement('audio');
        var p = audio.setSinkId('valid')
          .then(function() {
            assert_equals(audio.sinkId, 'valid');
          });
        assert_equals(audio.sinkId, '');  // sinkId not updated yet
        return p;
      }, 'setSinkId("valid")');

      // Test that changing the src on an element and calling setSinkId() works
      promise_test(function() {
        var audio = document.createElement('audio');
        audio.src = '../content/test.oga';
        return audio.setSinkId('');

      }, 'change src, then setSinkId("")');

      // Tests that setting the sink to an unauthorized device fails.
      // Note: 'unauthorized' is the name of an unauthorized device in the test runner.
      promise_test(function() {
        var audio = document.createElement('audio');
        return promise_rejects_dom(this, 'SecurityError', audio.setSinkId('unauthorized'));
      }, 'setSinkId("unauthorized")' );

      // Test that setting the sink to a nonexistent device fails
      promise_test(function() {
        var audio = document.createElement('audio');
        return promise_rejects_dom(this, 'NotFoundError', audio.setSinkId('nonexistent'));
      }, 'setSinkId("nonexistent")');

      // Tests that changing the sink twice succeeds
      promise_test(function() {
        var audio = document.createElement('audio');
        return audio.setSinkId('valid')
          .then(function() {
            assert_equals(audio.sinkId, 'valid');
            return audio.setSinkId('')
              .then(function() {
                assert_equals(audio.sinkId, '');
              });
          });
      }, 'setSinkId("valid") followed by setSinkId("").');

    </script>
  </body>
</html>


text:
package org.apache.camel.component.undertow;

import java.net.URI;
import io.undertow.Undertow;
import io.undertow.server.HttpHandler;
import org.apache.camel.component.undertow.handlers.CamelRootHandler;
import org.apache.camel.component.undertow.handlers.NotFoundHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * The default UndertowHost which manages standalone Undertow server.
 */
public class DefaultUndertowHost implements UndertowHost {
    private static final Logger LOG = LoggerFactory.getLogger(DefaultUndertowHost.class);

    private UndertowHostKey key;
    private CamelRootHandler rootHandler;
    private Undertow undertow;
    private String hostString;

    public DefaultUndertowHost(UndertowHostKey key) {
        this.key = key;
        rootHandler = new CamelRootHandler(new NotFoundHandler());
    }

    @Override
    public void validateEndpointURI(URI httpURI) {
        // all URIs are good
    }

    @Override
    public synchronized void registerHandler(HttpHandlerRegistrationInfo registrationInfo, HttpHandler handler) {
        if (undertow == null) {
            Undertow.Builder builder = Undertow.builder();
            if (key.getSslContext() != null) {
                builder.addHttpsListener(key.getPort(), key.getHost(), key.getSslContext());
            } else {
                builder.addHttpListener(key.getPort(), key.getHost());
            }

            undertow = builder.setHandler(rootHandler).build();
            LOG.info("Starting Undertow server on {}://{}:{}", key.getSslContext() != null ? "https" : "http", key.getHost(), key.getPort());
            undertow.start();
        }

        String path = registrationInfo.getUri().getPath();
        String methods = registrationInfo.getMethodRestrict();
        boolean prefixMatch = registrationInfo.isMatchOnUriPrefix();
        rootHandler.add(path, methods != null ? methods.split(",") : null, prefixMatch, handler);
    }

    @Override
    public synchronized void unregisterHandler(HttpHandlerRegistrationInfo registrationInfo) {
        if (undertow == null) {
            return;
        }

        String path = registrationInfo.getUri().getPath();
        String methods = registrationInfo.getMethodRestrict();
        boolean prefixMatch = registrationInfo.isMatchOnUriPrefix();
        rootHandler.remove(path, methods != null ? methods.split(",") : null, prefixMatch);

        if (rootHandler.isEmpty()) {
            LOG.info("Stopping Undertow server on {}://{}:{}", key.getSslContext() != null ? "https" : "http", key.getHost(), key.getPort());
            undertow.stop();
            undertow = null;
        }
    }

    public String toString() {
        if (hostString == null) {
            hostString = String.format("DefaultUndertowHost[%s://%s:%s]", key.getSslContext() != null ? "https" : "http", key.getHost(), key.getPort());
        }
        return hostString;
    }
}


text:
package criteria

// ChildExpression represents the child operator
type ChildExpression struct {
	binaryExpression
}

// Ensure ChildExpression implements the Expression interface
var _ Expression = &ChildExpression{}
var _ Expression = (*ChildExpression)(nil)

// Accept implements ExpressionVisitor
func (t *ChildExpression) Accept(visitor ExpressionVisitor) interface{} {
	return visitor.Child(t)
}

// Child constructs a ChildExpression
func Child(left Expression, right Expression) Expression {
	return reparent(&ChildExpression{binaryExpression{expression{}, left, right}})
}


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.camunda.bpm.engine.rest.impl.application;

import org.camunda.bpm.BpmPlatform;
import org.camunda.bpm.ProcessEngineService;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngines;
import org.camunda.bpm.engine.rest.spi.ProcessEngineProvider;

import java.util.Set;

/**
 *
Uses the {@link ProcessEngineService} and exposes the default process engine

 *
 * @author Daniel Meyer
 */
public class ContainerManagedProcessEngineProvider implements ProcessEngineProvider {

  @Override
  public ProcessEngine getDefaultProcessEngine() {
    ProcessEngine defaultProcessEngine = BpmPlatform.getDefaultProcessEngine();
    if(defaultProcessEngine != null) {
      return defaultProcessEngine;
    } else {
      return ProcessEngines.getDefaultProcessEngine(false);
    }
  }

  @Override
  public ProcessEngine getProcessEngine(String name) {
    return ProcessEngines.getProcessEngine(name);
  }

  @Override
  public Set<String> getProcessEngineNames() {
    return ProcessEngines.getProcessEngines().keySet();
  }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>TypeSizes (apache-cassandra API)</title>
<meta name="date" content="2015-06-05">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.cassandra.db

Class TypeSizes

java.lang.Object

org.apache.cassandra.db.TypeSizes

Direct Known Subclasses:

TypeSizes.NativeDBTypeSizes, TypeSizes.VIntEncodedTypeSizes

public abstract class TypeSizes
extends java.lang.Object

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

static class
TypeSizes.NativeDBTypeSizes

static class
TypeSizes.VIntEncodedTypeSizes

Field Summary

Fields

Modifier and Type
Field and Description

static TypeSizes
NATIVE

static TypeSizes
VINT

Constructor Summary

Constructors

Constructor and Description

TypeSizes()

Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods

Modifier and Type
Method and Description

static int
encodedUTF8Length(java.lang.String st)

abstract int
sizeof(boolean value)

abstract int
sizeof(int value)

abstract int
sizeof(long value)

abstract int
sizeof(short value)

int
sizeof(java.lang.String value)

assumes UTF8

abstract int
sizeof(java.util.UUID value)

int
sizeofWithLength(java.nio.ByteBuffer value)

int
sizeofWithShortLength(java.nio.ByteBuffer value)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

NATIVE

public static final TypeSizes NATIVE

VINT

public static final TypeSizes VINT

Constructor Detail

TypeSizes

public TypeSizes()

Method Detail

sizeof

public abstract int sizeof(boolean value)

sizeof

public abstract int sizeof(short value)

sizeof

public abstract int sizeof(int value)

sizeof

public abstract int sizeof(long value)

sizeof

public abstract int sizeof(java.util.UUID value)

sizeof

public int sizeof(java.lang.String value)

assumes UTF8

encodedUTF8Length

public static int encodedUTF8Length(java.lang.String st)

sizeofWithShortLength

public int sizeofWithShortLength(java.nio.ByteBuffer value)

sizeofWithLength

public int sizeofWithLength(java.nio.ByteBuffer value)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2015 The Apache Software Foundation


text:
/* Automatically generated code, don't edit ! */

package org.urish.gwtit.titanium.ui.events;

/**
 *
 */
public interface TextAreaBlurHandler {

	public void onTextAreaBlur(TextAreaBlurEvent event);

}


text:
import {
    Tracer,
    BatchRecorder,
    jsonEncoder,
} from 'zipkin';

import CLSContext = require('zipkin-context-cls');
import { HttpLogger } from 'zipkin-transport-http';

// Setup the tracer to use http and implicit trace context
const tracer = new Tracer({
    ctxImpl: new CLSContext('zipkin'),
    recorder: new BatchRecorder({
        logger: new HttpLogger({
            endpoint: 'http://localhost:9411/api/v2/spans',
            jsonEncoder: jsonEncoder.JSON_V2
        })
    }),
    localServiceName: 'service-a'
});


text:
<?php

namespace AncaRebeca\FullCalendarBundle\Model;

use Doctrine\ORM\Mapping as ORM;

class Event extends FullCalendarEvent
{
    /**
     * @var integer
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
    /**
     * @var string
     * @ORM\Column(type="string", length=255, name="title",  nullable = true)
     */
    protected $title;
    /**
     * @var boolean
     * @ORM\Column(type="boolean", name="allDay", nullable = true)
     */
    protected $allDay;
    /**
     * @var \DateTime
     * @ORM\Column(type="datetime", name="event_start")
     */
    protected $startDate;
    /**
     * @var \DateTime
     * @ORM\Column(type="datetime", name="event_end")
     */
    protected $endDate;
    /**
     * @var string
     * @ORM\Column(type="string", length=255, name="url", nullable = true)
     */
    protected $url;
    /**
     * @var string
     * @ORM\Column(type="string", length=255, name="className", nullable = true)
     */
    protected $className;
    /**
     * @var boolean
     * @ORM\Column(type="boolean", name="editable", nullable = true)
     */
    protected $editable = true;
    /**
     * @var boolean
     * @ORM\Column(type="boolean", name="strartEditable", nullable = true)
     */
    protected $startEditable = true;
    /**
     * @var boolean
     * @ORM\Column(type="boolean", name="durationEditable", nullable = true)
     */
    protected $durationEditable = true;
    /**
     * @var string
     * @ORM\Column(type="string", length=255, name="rendering", nullable = true)
     */
    protected $rendering;
    /**
     * @var boolean
     * @ORM\Column(type="boolean", name="overlap", nullable = true)
     */
    protected $overlap = true;
    /**
     * @var integer
     * @ORM\Column(type="integer", name="event_constraint", nullable = true)
     */
    protected $constraint;
    /**
     * @var string
     * @ORM\Column(type="string", length=255, name="event_source", nullable = true)
     */
    protected $source;
    /**
     * @var string
     * @ORM\Column(type="string", length=255, name="color", nullable = true)
     */
    protected $color;
    /**
     * @var string
     * @ORM\Column(type="string", length=255, name="backgroundColor", nullable = true)
     */
    protected $backgroundColor;
    /**
     * @var string
     * @ORM\Column(type="string", length=255, name="textColor", nullable = true)
     */
    protected $textColor;
    /**
     * @var array
     * @ORM\Column(type="array", name="customFields", nullable = true)
     */
    protected $customFields = [];

    /**
     * @param string $title
     * @param \DateTime $start
     */
   /* public function __construct($title, \DateTime $start)
    {
        parent::__construct($title, $start);
        $this->title = $title;
        $this->startDate = $start;
    }*/

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param int $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * @param string $title
     */
    public function setTitle($title)
    {
        $this->title = $title;
    }

    /**
     * @return boolean
     */
    public function isAllDay()
    {
        return $this->allDay;
    }

    /**
     * @param boolean $allDay
     */
    public function setAllDay($allDay)
    {
        $this->allDay = $allDay;
    }

    /**
     * @return \DateTime
     */
    public function getStartDate()
    {
        return $this->startDate;
    }

    /**
     * @param \DateTime $startDate
     */
    public function setStartDate(\DateTime $startDate)
    {
        $this->startDate = $startDate;
    }

    /**
     * @return \DateTime
     */
    public function getEndDate()
    {
        return $this->endDate;
    }

    /**
     * @param \DateTime $endDate
     */
    public function setEndDate(\DateTime $endDate)
    {
        $this->endDate = $endDate;
    }

    /**
     * @return string
     */
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * @param string $url
     */
    public function setUrl($url)
    {
        $this->url = $url;
    }

    /**
     * @return string
     */
    public function getClassName()
    {
        return $this->className;
    }

    /**
     * @param string $className
     */
    public function setClassName($className)
    {
        $this->className = $className;
    }

    /**
     * @return boolean
     */
    public function isEditable()
    {
        return $this->editable;
    }

    /**
     * @param boolean $editable
     */
    public function setEditable($editable)
    {
        $this->editable = $editable;
    }

    /**
     * @return boolean
     */
    public function isStartEditable()
    {
        return $this->startEditable;
    }

    /**
     * @param boolean $startEditable
     */
    public function setStartEditable($startEditable)
    {
        $this->startEditable = $startEditable;
    }

    /**
     * @return boolean
     */
    public function isDurationEditable()
    {
        return $this->durationEditable;
    }

    /**
     * @param boolean $durationEditable
     */
    public function setDurationEditable($durationEditable)
    {
        $this->durationEditable = $durationEditable;
    }

    /**
     * @return string
     */
    public function getRendering()
    {
        return $this->rendering;
    }

    /**
     * @param string $rendering
     */
    public function setRendering($rendering)
    {
        $this->rendering = $rendering;
    }

    /**
     * @return boolean
     */
    public function isOverlap()
    {
        return $this->overlap;
    }

    /**
     * @param boolean $overlap
     */
    public function setOverlap($overlap)
    {
        $this->overlap = $overlap;
    }

    /**
     * @return int
     */
    public function getConstraint()
    {
        return $this->constraint;
    }

    /**
     * @param int $constraint
     */
    public function setConstraint($constraint)
    {
        $this->constraint = $constraint;
    }

    /**
     * @return string
     */
    public function getSource()
    {
        return $this->source;
    }

    /**
     * @param string $source
     */
    public function setSource($source)
    {
        $this->source = $source;
    }

    /**
     * @return string
     */
    public function getColor()
    {
        return $this->color;
    }

    /**
     * @param string $color
     */
    public function setColor($color)
    {
        $this->color = $color;
    }

    /**
     * @return string
     */
    public function getBackgroundColor()
    {
        return $this->backgroundColor;
    }

    /**
     * @param string $backgroundColor
     */
    public function setBackgroundColor($backgroundColor)
    {
        $this->backgroundColor = $backgroundColor;
    }

    /**
     * @return string
     */
    public function getTextColor()
    {
        return $this->textColor;
    }

    /**
     * @param string $textColor
     */
    public function setTextColor($textColor)
    {
        $this->textColor = $textColor;
    }

    /**
     * @param $name
     * @param $value
     *
     * @return mixed
     */
    public function setCustomField($name, $value)
    {
        $this->customFields[$name] = $value;
    }

    /**
     * @param $name
     *
     * @return mixed
     */
    public function getCustomFieldValue($name)
    {
        return $this->customFields[$name];
    }

    /**
     * @return array
     */
    public function getCustomFields()
    {
        return $this->customFields;
    }

    /**
     * @param $name
     *
     * @return mixed
     */
    public function removeCustomField($name)
    {
        if (!isset($this->customFields[$name]) && !array_key_exists($name, $this->customFields)) {
            return null;
        }

        $removed = $this->customFields[$name];
        unset($this->customFields[$name]);

        return $removed;
    }

    /**
     * @return array
     */
    public function toArray()
    {
        $event = [];
        if (null !== $this->getId()) {
            $event['id'] = $this->getId();
        }
        $event['title']             = $this->getTitle();
        $event['allDay']            = $this->isAllDay();
        $event['start']             = $this->getStartDate()->format('Y-m-d\TH:i:s');
        if (null !== $this->getEndDate()) {
            $event['end'] = $this->getEndDate()->format('Y-m-d\TH:i:s');
        }
        $event['commentaire'] = $this->getCommentaire();
        $event['chargeRecrutement'] = $this->getChargeRecrutement();

        /*if (null !== $this->getChargeRecrutement()) {
            $event['chargeRecrutement'] = $this->getChargeRecrutement();
        }*/
        $event['editable']          = $this->isEditable();
        $event['startEditable']     = $this->isStartEditable();
        $event['durationEditable']  = $this->isDurationEditable();
        $event['overlap']           = $this->isOverlap();

        if (null !== $this->getUrl()) {
            $event['url'] = $this->getUrl();
        }

        if (null !== $this->getBackgroundColor()) {
            $event['backgroundColor'] = $this->getBackgroundColor();
        }

        if (null !== $this->getTextColor()) {
            $event['textColor'] = $this->getTextColor();
        }

        if (null !== $this->getClassName()) {
            $event['className'] = $this->getClassName();
        }

        if (null !== $this->getRendering()) {
            $event['rendering'] = $this->getRendering();
        }

        if (null !== $this->getConstraint()) {
            $event['constraint'] = $this->getConstraint();
        }

        if (null !== $this->getSource()) {
            $event['source'] = $this->getSource();
        }

        if (null !== $this->getColor()) {
            $event['color'] = $this->getColor();
        }

        if (!empty($this->getCustomFields()))
        {
            foreach ($this->getCustomFields() as $field => $value) {
                $event[$field] = $value;
            }
        }

        return $event;
    }
}


text:
package org.xtreemfs.foundation.monitoring;

/**
 * The class provides the ability to monitor numeric data. It also provides methods some methods for special
 * cases than only overwriting the old value.

 * NOTE: This class is thread-safe.

 * 22.07.2009
 */
public class NumberMonitoring extends Monitoring<Double> {
    /**
     * Saves the value only if the new value is smaller than the old one.
     *
     * @param key
     * @param value
     * @return
     */
    public Double putSmaller(String key, Double value) {
        Double oldValue = super.get(key);
        if (oldValue != null) {
            if (oldValue > value)
                return super.put(key, value);
            else
                return value;
        } else
            return super.put(key, value);
    }

    /**
     * Saves the value only if the new value is larger than the old one.
     *
     * @param key
     * @param value
     * @return
     */
    public Double putLarger(String key, Double value) {
        Double oldValue = super.get(key);
        if (oldValue != null) {
            if (oldValue < value)
                return super.put(key, value);
            else
                return value;
        } else
            return super.put(key, value);
    }

    /**
     * Saves the average of the old and new value.
     *
     * @param key
     * @param value
     * @return
     */
    public Double putAverage(String key, Double value) {
        Double oldValue = super.get(key);
        if (oldValue != null) {
            return super.put(key, (oldValue + value) / 2);
        } else
            return super.put(key, value);
    }

    /**
     * Increases the old value about new value.
     *
     * @param key
     * @param value
     * @return
     */
    public Double putIncreaseFor(String key, Double value) {
        Double oldValue = super.get(key);
        if (oldValue != null) {
            return super.put(key, oldValue + value);
        } else
            return super.put(key, value);
    }

    /**
     * Decreases the old value about new value.
     *
     * @param key
     * @param value
     * @return
     */
    public Double putDecreaseFor(String key, Double value) {
        Double oldValue = super.get(key);
        if (oldValue != null) {
            return super.put(key, oldValue - value);
        } else
            return super.put(key, value);
    }

    /**
     * Special method for Longs.
     *
     * @see org.xtreemfs.foundation.monitoring.Monitoring#put(java.lang.String, java.lang.Object)
     * @param key
     * @param value
     * @return
     */
    public Long putLong(String key, Long value) {
        Double oldValue = super.put(key, value.doubleValue());
        return (oldValue == null) ? null : oldValue.longValue();
    }

    /**
     * Special method for Longs. Saves the value only if the new value is smaller than the old one.
     *
     * @see org.xtreemfs.foundation.monitoring.NumberMonitoring#putSmaller(java.lang.String, java.lang.Double)
     * @param key
     * @param value
     * @return
     */
    public Long putSmallerLong(String key, Long value) {
        Double oldValue = this.putSmaller(key, value.doubleValue());
        return (oldValue == null) ? null : oldValue.longValue();
    }

    /**
     * Special method for Longs. Saves the value only if the new value is larger than the old one.
     *
     * @see org.xtreemfs.foundation.monitoring.NumberMonitoring#putLarger(java.lang.String, java.lang.Double)
     * @param key
     * @param value
     * @return
     */
    public Long putLargerLong(String key, Long value) {
        Double oldValue = this.putLarger(key, value.doubleValue());
        return (oldValue == null) ? null : oldValue.longValue();
    }

    /**
     * Special method for Longs. Saves the average of the old and new value.
     *
     * @param key
     * @param value
     * @return
     */
    public Long putAverageLong(String key, Long value) {
        Double oldValue = super.get(key);
        if (oldValue != null) {
            this.put(key, (oldValue + value) / 2d).longValue();
            return oldValue.longValue();
        } else
            return this.putLong(key, value);
    }

    /**
     * Increases the old value about new value.
     *
     * @param key
     * @param value
     * @return
     */
    public Long putIncreaseForLong(String key, Long value) {
        Double oldValue = this.putIncreaseFor(key, value.doubleValue());
        return (oldValue == null) ? null : oldValue.longValue();
    }

    /**
     * Decreases the old value about new value.
     *
     * @param key
     * @param value
     * @return
     */
    public Long putDecreaseForLong(String key, Long value) {
        Double oldValue = this.putDecreaseFor(key, value.doubleValue());
        return (oldValue == null) ? null : oldValue.longValue();
    }

    /**
     *
     * @param key
     * @return
     */
    public Long getLong(String key) {
        Double value = super.get(key);
        return (value == null) ? null : value.longValue();
    }
}


text:
package com.amazonaws.services.sagemaker.model.transform;

import java.util.List;
import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.sagemaker.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * AlgorithmValidationSpecificationMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class AlgorithmValidationSpecificationMarshaller {

    private static final MarshallingInfo<String> VALIDATIONROLE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ValidationRole").build();
    private static final MarshallingInfo<List> VALIDATIONPROFILES_BINDING = MarshallingInfo.builder(MarshallingType.LIST)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ValidationProfiles").build();

    private static final AlgorithmValidationSpecificationMarshaller instance = new AlgorithmValidationSpecificationMarshaller();

    public static AlgorithmValidationSpecificationMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(AlgorithmValidationSpecification algorithmValidationSpecification, ProtocolMarshaller protocolMarshaller) {

        if (algorithmValidationSpecification == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(algorithmValidationSpecification.getValidationRole(), VALIDATIONROLE_BINDING);
            protocolMarshaller.marshall(algorithmValidationSpecification.getValidationProfiles(), VALIDATIONPROFILES_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
Using the Kafka Data Store Programmatically
===========================================

Creating a Data Store
---------------------

An instance of a Kafka data store can be obtained through the normal GeoTools discovery methods,
assuming that the GeoMesa code is on the classpath. To create a ``KafkaDataStore`` there are two
required properties, one for the Apache Kafka connection, ``kafka.brokers``, and one for the Apache
Zookeeper connection, ``kafka.zookeepers``. An optional parameter, ``kafka.zk.path`` is
used to specify a path in Zookeeper under which schemas are stored. If no zk path is specified then
a default path will be used. Configuration parameters are described fully below.

.. code-block:: java

    import org.geotools.data.DataStore;
    import org.geotools.data.DataStoreFinder;

    Map<String, Serializable> parameters = new HashMap<>();
    parameters.put("kafka.zookeepers", "localhost:2181");
    parameters.put("kafka.brokers", "localhost:9092");
    DataStore dataStore = DataStoreFinder.getDataStore(parameters);

.. _kafka_parameters:

Kafka Data Store Parameters
---------------------------

The Kafka data store differs from most data stores in that the data set is kept entirely in memory. Because of this,
the in-memory indexing can be configured at runtime through data store parameters. See :ref:`kafka_index_config` for
more information on the available indexing options.

Because configuration options can reference attributes from a particular SimpleFeatureType, it may be necessary to
create multiple Kafka data store instances when dealing with multiple schemas.

The Kafka data store accepts the following parameters (required parameters are marked with ``*``):

==================================== ======= ====================================================================================================
Parameter                            Type    Description
==================================== ======= ====================================================================================================
``kafka.brokers *``                  String  Kafka brokers, e.g. "localhost:9092"
``kafka.zookeepers *``               String  Kafka zookeepers, e.g "localhost:2181"
``kafka.zk.path``                    String  Zookeeper discoverable path, can be used to effectively namespace feature types
``kafka.producer.config``            String  Configuration options for kafka producer, in Java properties
                                             format. See `Producer Configs <http://kafka.apache.org/documentation.html#producerconfigs>`_
``kafka.producer.clear``             Boolean Send a 'clear' message on startup. This will cause clients to ignore any data that was in the
                                             topic prior to startup
``kafka.consumer.config``            String  Configuration options for kafka consumer, in Java properties
                                             format. See `New Consumer Configs <http://kafka.apache.org/documentation.html#newconsumerconfigs>`_
``kafka.consumer.read-back``         String  On start up, read messages that were written within this time frame (vs ignore old messages), e.g.
                                             '1 hour'. Use 'Inf' to read all messages. If enabled, features will not be available for query until
                                             all existing messages are processed. However, feature listeners will still be invoked as normal.
                                             See :ref:`kafka_initial_load`
``kafka.consumer.count``             Integer Number of kafka consumers used per feature type. Set to 0 to disable consuming (i.e. producer only)
``kafka.consumer.start-on-demand``   Boolean Start consuming a topic only when that feature type is first requested. This can reduce load if some
                                             layers are never queried
``kafka.topic.partitions``           Integer Number of partitions to use in new kafka topics
``kafka.topic.replication``          Integer Replication factor to use in new kafka topics
``kafka.serialization.type``         String  Internal serialization format to use for kafka messages. Must be one of ``kryo`` or ``avro``
``kafka.cache.expiry``               String  Expire features from in-memory cache after this delay, e.g. "10 minutes". See :ref:`kafka_expiry`
``kafka.cache.event-time``           String  Instead of message time, determine expiry based on feature data. See :ref:`kafka_event_time`
``kafka.cache.event-time.ordering``  Boolean Instead of message time, determine feature ordering based on the feature event time.
                                             See :ref:`kafka_event_time`
``kafka.index.cqengine``             String  Use CQEngine-based attribute indices for the in-memory feature cache. See :ref:`kafka_cqengine`
``kafka.index.resolution.x``         Integer Number of bins in the x-dimension of the spatial index, by default 360. See
                                             :ref:`kafka_index_resolution`
``kafka.index.resolution.y``         Integer Number of bins in the y-dimension of the spatial index, by default 180. See
                                             :ref:`kafka_index_resolution`
``kafka.index.tiers``                String  Number and size of tiers used for indexing geometries with extents, in the form ``x1:y1,x2:y2``.
                                             See :ref:`kafka_ssi`
``kafka.serialization.lazy``         Boolean Use lazy deserialization of features. This may improve processing load at
                                             the expense of slightly slower query times
``geomesa.query.loose-bounding-box`` Boolean Use loose bounding boxes, which offer improved performance but are not exact
``geomesa.query.audit``              Boolean Audit incoming queries. By default audits are written to a log file
``geomesa.security.auths``           String  Default authorizations used to query data, comma-separated
==================================== ======= ====================================================================================================

More information on using GeoTools can be found in the `GeoTools user guide
<http://docs.geotools.org/stable/userguide/>`__.


text:
B3 (BlaBlaBlog) is a PHP blog system built upon the [Lumen](http://lumen.laravel.com) micro-framework.

The package is available on [Packagist](https://packagist.org/packages/eivindarvesen/b3)

### WORK IN PROGRESS
This project is very much under active development, and while it is usable in its current state, the documentation is yet to be written.
In fact - this readme is not even necessarily up to date.

At present, B3 supports all major browser, including IE >= 9.

<!--
[![Build Status](https://travis-ci.org/eivindarvesen/b3.svg)](https://travis-ci.org/laravel/lumen-framework)
[![Total Downloads](https://poser.pugx.org/eivindarvesen/b3/downloads.svg)](https://packagist.org/packages/eivindarvesen/b3)
[![Latest Stable Version](https://poser.pugx.org/eivindarvesen/b3/v/stable.svg)](https://packagist.org/packages/eivindarvesen/b3)
[![Latest Unstable Version](https://poser.pugx.org/eivindarvesen/b3/v/unstable.svg)](https://packagist.org/packages/eivindarvesen/b3)
[![License](https://poser.pugx.org/eivindarvesen/b3/license.svg)](https://packagist.org/packages/eivindarvesen/b3)
-->

## About
Blog posts are written in Markdown in your favourite editor, and pushed via git.
Posts are validated upon git-commit.
A database of data/metadata is built or updated on git-pull.
Pages are rendered serverside.
Blablablog is themeable; the default theme is built upon Bootstrap 3.
You set your usersettings in dotenv (do not track this in vcs).

## Installation
To install B3, run
```shell
composer create-project eivindarvesen/b3 <SITE> *@dev --prefer-dist
```
or run `installB3.sh` in the scripts-directory.

The webroot must be set to 'b3/public'

BlaBlaBlog also needs a database, the connection to which is specified in the dotenv-file in the project root.

To automatically set up your site, run the `setupB3.sh` script in the scripts-directory.

## Development

To set up your developer-environment:
```shell
composer install
bower install
npm install
```

<!--
## Official Documentation

Documentation for BlaBlaBlog can be found [here](https://b3.readthedocs.org).
-->

### License

The BlaBlaBlog PHP Blog System is open-source software licensed under the [The BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)


text:
This Button add-in, when clicked, calls a Python script, reads the text stream output from the script and uses it. From simplicity, output text is sent to windows messagebox.
However, you can execute complex Python code in the Python script and call the script from within the button.

View it live

```
Language:              C#
Subject:               Geoprocessing
Contributor:           ArcGIS Pro SDK Team <arcgisprosdk@esri.com>
Organization:          Esri, https://www.esri.com
Date:                  06/10/2022
ArcGIS Pro:            3.0
Visual Studio:         2022
.NET Target Framework: net6.0-windows
```

## Resources

[Community Sample Resources](https://github.com/Esri/arcgis-pro-sdk-community-samples#resources)

### Samples Data

* Sample data for ArcGIS Pro SDK Community Samples can be downloaded from the [Releases](https://github.com/Esri/arcgis-pro-sdk-community-samples/releases) page.

## How to use the sample

1. This solution file includes an example python script named test1.py
1. This sample also requires that you install the recommended version of Python for ArcGIS Pro and add python.exe to you path.
1. For help in installing a Python command line option for ArcGIS Pro see (Install Python for ArcGIS Pro)[https://pro.arcgis.com/en/pro-app/arcpy/get-started/installing-python-for-arcgis-pro.htm]
![UI](Screenshots/Python.png)

1. Open the 'RunPyScriptButton' class and update the path to test1.py to point to the sample script file in your solution
1. Build the solution - make sure it compiles successfully.
1. Open ArcGIS Pro - go to the ADD-IN Tab, find RunPyScriptButton in Group 1 group.
1. Click on the button - wait few seconds - a message box will show up with a message of "Hello - this message is from a TEST Python script"
![UI](Screenshots/Screen.png)

[Home](https://github.com/Esri/arcgis-pro-sdk/wiki) | API Reference | [Requirements](https://github.com/Esri/arcgis-pro-sdk/wiki#requirements) | [Download](https://github.com/Esri/arcgis-pro-sdk/wiki#installing-arcgis-pro-sdk-for-net) | Samples


text:
using System;

namespace MvcJsonBootstrapMenu
{
	public static class ListItemBuilder
	{
		private const string Template = @"
{1}
";
		public static String MenuItem(MenuItem item)
		{
			return string.Format(Template, item.CssClass, LinkBuilder.LinkItem(item));
		}

		public static string DividerItem()
		{
			return @"

";
		}
	}
}