/*
kms-interface: Thrift interfaces for mediaserver
Copyright (C) 2013 Tikal Technologies

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3
as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

namespace java com.kurento.kms.api
namespace cpp kurento
namespace * Kurento

struct EndOfStreamEvent {
}

union PlayerEndPointEvent {
  1: optional EndOfStreamEvent eos;
}

struct ZBarEvent {
  1: string type;
  2: string value;
}

Add HttpEndpointEvent to notify when a request is done

/*
kms-interface: Thrift interfaces for mediaserver
Copyright (C) 2013 Tikal Technologies

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3
as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

namespace java com.kurento.kms.api
namespace cpp kurento
namespace * Kurento

struct EndOfStreamEvent {
}

union PlayerEndPointEvent {
  1: optional EndOfStreamEvent eos;
}

enum HttpEndPointRequestEvent {
  GET_REQUEST_EVENT,
  POST_REQUEST_EVENT
}

union HttpEndPointEvent {
  1: optional HttpEndPointRequestEvent request;
}

struct ZBarEvent {
  1: string type;
  2: string value;
}


/*
 * (C) Copyright 2013 Kurento (http://kurento.org/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */

namespace java com.kurento.kms.thrift.api
namespace cpp kurento
namespace * Kurento

/**
 * PlateDetectorFilter Extends KmsMediaObject
 *
 * Constructors:
 * PlateDetectorFilter (KmsMediaObjectConstructorParams);
 */
const string TYPE_NAME = "PlateDetectorFilter";

/* EVENTS */

/**
This event is generated when a license plate is detected.
This event has string data type indicating plate characters.
*/
const string EVENT_PLATE_DETECTED = "plate-detected";

/**
This event is generated when a detected license plate is no longer detected
This event has string data type indicating the plate no longer detected
*/
const string EVENT_PLATE_LOST = "plate-lost";

Delete plate lost event from thrift interface


Add a generic type to define a image region in the thrift interface

/*
 * (C) Copyright 2014 Kurento (http://kurento.org/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */

namespace java com.kurento.kms.thrift.api
namespace cpp kurento
namespace * Kurento

struct KmsMediaImagePoint {
  1: required i32 x,
  2: required i32 y
}

struct KmsMediaImageRegion {
  1: required KmsMediaImagePoint point,
  2: required i32 width,
  3: required i32 height
}


/*
 * (C) Copyright 2014 Kurento (http://kurento.org/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */

namespace java com.kurento.kms.thrift.api
namespace cpp kurento
namespace * Kurento

/**
 * CompositeMixer extends Mixer
 *
 * Constructors:
 * CompositeMixer ();
 */
const string TYPE_NAME = "CompositeMixer";


Create thrift interface for Pointerdetector events

/*
 * (C) Copyright 2013 Kurento (http://kurento.org/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */

namespace java com.kurento.kms.thrift.api
namespace cpp kurento
namespace * Kurento

/**
 * PointerDetectorFilter Extends KmsMediaObject
 *
 * Constructors:
 * PointerDetectorFilter (KmsMediaObjectConstructorParams);
 */
const string TYPE_NAME = "PointerDetectorFilter";

/* EVENTS */

/**
This event is generated when an object leaves a window.
This event has string data type indicated window id.
*/
const string EVENT_WINDOW_OUT = "window-out";
/**
This event is generated when an object enters in a window.
This event has string data type indicated window id.
*/
const string EVENT_WINDOW_IN = "window-in";


/*
 * (C) Copyright 2014 Kurento (http://kurento.org/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */

namespace java com.kurento.kms.thrift.api
namespace cpp kurento
namespace * Kurento

const string TYPE_NAME = "MixerEndPoint";


/*
 * (C) Copyright 2014 Kurento (http://kurento.org/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */

namespace java com.kurento.kms.thrift.api
namespace cpp kurento
namespace * Kurento

const string TYPE_NAME = "MainMixer";

/* METHODS */
/**
 * This method allows to set the main mixerEndPoint.
 * void setMainEndPoint (KmsMediaObjectRef mixerEndPoint);
 */
const string SET_MAIN_END_POINT = "setMainEndPoint";
const string SET_MAIN_END_POINT_PARAM_MIXER = "mixerEndPoint";
const string SET_MAIN_END_POINT_PARAM_MIXER_TYPE = "KmsMediaObjectRef";

/**
 * This method allows to unset the main mixerEndPoint.
 * void unsetMainEndPoint ();
 */
const string UNSET_MAIN_END_POINT = "unsetMainEndPoint";


namespace cpp2 carbon.thrift

/**
 * This is mirroring the mc_res_t enum from mcrouter/lib/mc/msg.h
 */
enum Result {
  mc_res_unknown = 0,
  mc_res_deleted = 1
  mc_res_touched = 2
  mc_res_found = 3
  mc_res_foundstale = 4 /* hot-miss w/ stale data */
  mc_res_notfound = 5
  mc_res_notfoundhot = 6 /* hot-miss w/o stale data */
  mc_res_notstored = 7
  mc_res_stalestored = 8
  mc_res_ok = 9
  mc_res_stored = 10
  mc_res_exists = 11
  /* soft errors -- */
  mc_res_ooo = 12 /* out of order (UDP) */
  mc_res_timeout = 13 /* request timeout (connection was already established) */
  mc_res_connect_timeout = 14
  mc_res_connect_error = 15
  mc_res_busy = 16 /* the request was refused for load shedding */
  mc_res_try_again = 17 /* this request was refused, but we should keep sending
                       requests to this box */
  mc_res_shutdown = 18 /* Server is shutting down. Use failover destination. */
  mc_res_tko = 19 /* total knock out - the peer is down for the count */
  /* hard errors -- */
  mc_res_bad_command = 20
  mc_res_bad_key = 21
  mc_res_bad_flags = 22
  mc_res_bad_exptime = 23
  mc_res_bad_lease_id = 24
  mc_res_bad_cas_id = 25
  mc_res_bad_value = 26
  mc_res_aborted = 27
  mc_res_client_error = 28
  mc_res_local_error = 29, /* an error internal to libmc */
  /* an error was reported by the remote server.

     TODO I think this can also be triggered by a communications problem or
     disconnect, but I think these should be separate errors. (fugalh) */
  mc_res_remote_error = 30
  /* in progress -- */
  mc_res_waiting = 31
  mc_nres = 32// placeholder
}


Add CrowdDetectorFilter to thrift interface

/*
 * (C) Copyright 2014 Kurento (http://kurento.org/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */

namespace java com.kurento.kms.thrift.api
namespace cpp kurento
namespace * Kurento

/**
 * CrowdDetectorFilter Extends KmsMediaObject
 *
 * Constructors:
 * CrowdDetectorFilter (KmsMediaObjectConstructorParams);
 */

const string TYPE_NAME = "CrowdDetectorFilter";


<meta name='layout' content='appinfo' />
<title>Memory</title>

Memory

			<appinfo:chart name='heapPoolGraph' height='300' width='350'
				stacked='${false}' title='Heap memory'
				barNames='${heapPoolNames}' sectionNames='${heapSectionNames}' data='${heapNumbers}' />

			<appinfo:chart name='nonheapPoolGraph' height='300' width='350'
				stacked='${false}' title='Non-heap memory'
				barNames='${nonheapPoolNames}' sectionNames='${nonheapSectionNames}' data='${nonheapNumbers}' />

			<appinfo:chart name='memoryGraph' height='300' width='300' title='Heap Usage'
				barNames='${memoryNames}' sectionNames='${memorySectionNames}' data='${memoryNumbers}' />

<g:link action='gc'>Garbage Collect</g:link>

Use secure Google jsapi if page is https

<meta name='layout' content='appinfo' />
<title>Memory</title>

<g:if test="${request.secure}">

</g:if>
<g:else>

</g:else>

Memory

			<appinfo:chart name='heapPoolGraph' height='300' width='350'
				stacked='${false}' title='Heap memory'
				barNames='${heapPoolNames}' sectionNames='${heapSectionNames}' data='${heapNumbers}' />

			<appinfo:chart name='nonheapPoolGraph' height='300' width='350'
				stacked='${false}' title='Non-heap memory'
				barNames='${nonheapPoolNames}' sectionNames='${nonheapSectionNames}' data='${nonheapNumbers}' />

			<appinfo:chart name='memoryGraph' height='300' width='300' title='Heap Usage'
				barNames='${memoryNames}' sectionNames='${memorySectionNames}' data='${memoryNumbers}' />

<g:link action='gc'>Garbage Collect</g:link>


<!DOCTYPE html>

  <meta name="layout" content="main"/>
  <title>Welcome NSL Services</title>

Welcome NSL Services

Click one of the search links in the menu above, e.g. APNI or APC to search the APNI database.

Adjust title and heading of home page - minor.

<!DOCTYPE html>

  <meta name="layout" content="main"/>
  <title>NSL Services</title>

Welcome to NSL Services

Click one of the search links in the menu above, e.g. APNI or APC to search the APNI database.


<%
    config.require("extension")
    config.require("contextModel")

    def applyMoustacheTemplate = { template, model ->
        model.each {
            template = template.replace("{{" + it.key + "}}", "" + it.value)
        }
        return template
    }
%>

<% if (config.extension.type == 'link') { %>
    <a href="/${ contextPath }/${ applyMoustacheTemplate(config.extension.url, config.contextModel) }">
        ${ config.extension.label }
    </a>
<% } %>

Support for setting the 'id' attribute of the <a> element

<%
    config.require("extension")
    config.require("contextModel")

    def applyMoustacheTemplate = { template, model ->
        model.each {
            template = template.replace("{{" + it.key + "}}", "" + it.value)
        }
        return template
    }
%>

<% if (config.extension.type == 'link') { %>
    <a href="/${ contextPath }/${ applyMoustacheTemplate(config.extension.url, config.contextModel) }"
        <% if (config.extension?.extensionParams?.linkId) { %> id="${ ui.escapeAttribute( config.extension.extensionParams.linkId) }" <% } %> >
        ${ ui.message(config.extension.label) }
    </a>
<% } %>


<%@ page import="streama.Settings" %>

      <g:imgSetting setting="${Settings.findByName('logo').value}"></g:imgSetting>
      <g:if test="${Settings.findByName('show_version_num').value == 'true'}">

v${grailsApplication.metadata.getApplicationVersion()}

      </g:if>

Remove version number from header_simple


<g:if test="${flash.error || flash.message || beanErrors || error || message}">
    <div id="error" class="alert alert-dismissable alert-danger">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <g:enc>${flash.error?: flash.message?: error ?: message}</g:enc>

        <g:if test="${beanErrors instanceof org.springframework.validation.Errors}">
            <g:renderErrors bean="${beanErrors}" as="list"/>
        </g:if>

    </div>
</g:if>

Update errorFragment for all possible error message output

<g:if test="${beanErrors || flash.errors || flash.error || request.error || request.errors || flash.errorCode || request.errorCode}">
    <div id="error" class="alert alert-dismissable alert-danger">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <g:render template="/common/messagesText"/>
    </div>
</g:if>


%{--
  - Copyright (C) 2013-2016 Université Toulouse 3 Paul Sabatier
  -
  -     This program is free software: you can redistribute it and/or modify
  -     it under the terms of the GNU Affero General Public License as published by
  -     the Free Software Foundation, either version 3 of the License, or
  -     (at your option) any later version.
  -
  -     This program is distributed in the hope that it will be useful,
  -     but WITHOUT ANY WARRANTY; without even the implied warranty of
  -     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  -     GNU Affero General Public License for more details.
  -
  -     You should have received a copy of the GNU Affero General Public License
  -     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  --}%

<g:each var="answer" in="${block.answerList}" status="i">
    <g:checkBox name="answers[ $ i]" value="${answer.identifier}"
                checked="${userAnswerBlock?.answerList?.contains(answer)}"/> ${answer.textValue}<br/>
</g:each>

Fix autoformat problem in one file

%{--
  - Copyright (C) 2013-2016 Université Toulouse 3 Paul Sabatier
  -
  -     This program is free software: you can redistribute it and/or modify
  -     it under the terms of the GNU Affero General Public License as published by
  -     the Free Software Foundation, either version 3 of the License, or
  -     (at your option) any later version.
  -
  -     This program is distributed in the hope that it will be useful,
  -     but WITHOUT ANY WARRANTY; without even the implied warranty of
  -     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  -     GNU Affero General Public License for more details.
  -
  -     You should have received a copy of the GNU Affero General Public License
  -     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  --}%

<g:each var="answer" in="${block.answerList}" status="i">
    <g:checkBox name="answers[${i}]" value="${answer.identifier}"
                checked="${userAnswerBlock?.answerList?.contains(answer)}"/> ${answer.textValue}<br/>
</g:each>


Fix open project in home project list - bis


  <meta name='layout' content='login' />
  <title>CollabNet Subversion Edge <g:message code="login.page.auth.title" /></title>

  <content tag="title">
    <g:message code="login.page.auth.title" />
  </content>

<g:message code="login.page.auth.title" />

        <form action='${postUrl}' method='post' id='loginForm'>
          <fieldset>

              <input type="text" name="j_username" id="j_username" placeholder="<g:message code="login.page.auth.username.label" />" />

              <input type="password" name="j_password" id="j_password" placeholder="<g:message code="login.page.auth.password.label" />" />

            <button class="btn btn-primary" value="Login" type="submit"><g:message code="login.page.auth.button.submit" /></button>
          </fieldset>
        </form>

Update look and feel of main application UI

  <meta name='layout' content='login' />
  <title>CollabNet Subversion Edge <g:message code="login.page.auth.title" /></title>

  <content tag="title">
    <g:message code="login.page.auth.title" />
  </content>

<g:message code="login.page.auth.title" />

        <form action='${postUrl}' method='post' id='loginForm'>
          <fieldset>

              <input type="text" name="j_username" id="j_username" placeholder="<g:message code="login.page.auth.username.label" />" />

              <input type="password" name="j_password" id="j_password" placeholder="<g:message code="login.page.auth.password.label" />" />

            <input class="btn btn-primary" value="<g:message code="login.page.auth.button.submit" />" type="submit"></input>
          </fieldset>
        </form>


<fr:isLoggedIn>
  Logged in as <fr:principalName /> ( TargetedID: <fr:principal /> )

</fr:isLoggedIn>
Federation Registry version <g:meta name="app.version"/>

Developed for the Australian Access Federation by Bradley Beddoes

Powered by Grails <g:meta name="app.grails.version"/>

<r:script>
  if(typeof Zenbox!=="undefined"){Zenbox.init({dropboxID:"6875",url:"australianaccessfederation.zendesk.com",tabID:"support",hide_tab:true})}
</r:script>

Remove Grails version from footer

<fr:isLoggedIn>
  Logged in as <fr:principalName /> ( TargetedID: <fr:principal /> )

</fr:isLoggedIn>
Federation Registry version <g:meta name="app.version"/>

Developed for the Australian Access Federation by Bradley Beddoes

<r:script>
  if(typeof Zenbox!=="undefined"){Zenbox.init({dropboxID:"6875",url:"australianaccessfederation.zendesk.com",tabID:"support",hide_tab:true})}
</r:script>


<div id="${containerId}" class="progressContainer small ${className} ${indefinite?'indefinite':''} ${(!completePercent || completePercent < 1 ) ? 'empty':''}" >
    <div
        id="${barId}"
        class="progressBar ${(!completePercent || completePercent < 1 ) ? 'empty':''} ${className} ${completePercent>=100?'full':''}"
        title="${title}"
        style="width:${completePercent>100?'100':completePercent}"
    >
<g:if test="${showpercent}">${completePercent>100?'100':completePercent}%</g:if>${completePercent<100||showOverrun?remaining:''}<g:if test="${indefinite||showOverrun&&completePercent>110}"> <g:img file="icon-tiny-disclosure-waiting.gif"/> </g:if>${innerContent}

Allow custom progress bar width

<g:set var="usewidth" value="${width?:100}"/>
<div id="${containerId}" class="progressContainer small ${className} ${indefinite?'indefinite':''} ${(!completePercent || completePercent < 1 ) ? 'empty':''}" style="width:${usewidth+9}px">
    <div
        id="${barId}"
        class="progressBar ${(!completePercent || completePercent < 1 ) ? 'empty':''} ${className} ${completePercent>=100?'full':''}"
        title="${title}"
        style="width:${completePercent>100? usewidth:completePercent}px"
    >
<g:if test="${showpercent}">${completePercent>100? usewidth:completePercent}%</g:if>${completePercent<100||showOverrun?remaining:''}<g:if test="${indefinite||showOverrun&&completePercent>110}"> <g:img file="icon-tiny-disclosure-waiting.gif"/> </g:if>${innerContent}


%{--
  - Copyright 2019 Rundeck, Inc. (http://rundeck.com)
  -
  - 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.
  --}%

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <meta name="skipPrototypeJs" content="true"/>
    <meta name="layout" content="base"/>
    <meta name="tabpage" content="projectHome"/>
    <title><g:appTitle/></title>
    <asset:stylesheet src="static/css/pages/webhooks.css"/>
    <g:templateExists name="prowebhooks">
        <g:render template="prowebhooks" />
    </g:templateExists>

<asset:javascript src="static/pages/webhooks.js"/>

Change tabpage for webhooks to be unique

%{--
  - Copyright 2019 Rundeck, Inc. (http://rundeck.com)
  -
  - 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.
  --}%

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <meta name="skipPrototypeJs" content="true"/>
    <meta name="layout" content="base"/>
    <meta name="tabpage" content="webhooks"/>
    <title><g:appTitle/></title>
    <asset:stylesheet src="static/css/pages/webhooks.css"/>
    <g:templateExists name="prowebhooks">
        <g:render template="prowebhooks" />
    </g:templateExists>

<asset:javascript src="static/pages/webhooks.js"/>


<!doctype html>

    <meta name="layout" content="main"/>
    <title>YARM</title>
    <asset:link rel="icon" href="favicon.ico" type="image/x-ico" />

          <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            ${current_user.displayName}
          </button>

Switch Dashboard Context

            <g:each in="${user_contexts}" var="u">

<g:link controller="directory" action="${u.type}Dash" id="${u.name}">${u.label}</g:link>

            </g:each>

<g:link controller="account" action="organisations" id="new">New Organisation</g:link>

Create new org restricted to admins now

<!doctype html>

    <meta name="layout" content="main"/>
    <title>YARM</title>
    <asset:link rel="icon" href="favicon.ico" type="image/x-ico" />

          <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            ${current_user.displayName}
          </button>

Switch Dashboard Context

            <g:each in="${user_contexts}" var="u">

<g:link controller="directory" action="${u.type}Dash" id="${u.name}">${u.label}</g:link>

            </g:each>
            <sec:ifAnyGranted roles="ROLE_ADMIN">

<g:link controller="account" action="organisations" id="new">New Organisation</g:link>

            </sec:ifAnyGranted>


<is:widget widgetDefinition="${widgetDefinition}">

        {{ ::project.name }}

            ${message(code: 'todo.is.ui.project.createNew')}

        <button class="btn btn-default"
                type="button"
                click-async="createSampleProject()">
            ${message(code: 'todo.is.ui.project.createSample')}
        </button>

</is:widget>

Fix layout create project buttons


  <meta name='layout' content='login' />
  <title>CollabNet Subversion Edge <g:message code="login.page.auth.title" /></title>

  <content tag="title">
    <g:message code="login.page.auth.title" />
  </content>

<g:message code="login.page.auth.title" />

        <form action='${postUrl}' method='post' id='loginForm'>
          <fieldset>

              <input type="text" name="j_username" id="j_username" placeholder="<g:message code="login.page.auth.username.label" />" />

              <input type="password" name="j_password" id="j_password" placeholder="<g:message code="login.page.auth.password.label" />" />

            <button class="btn btn-primary" type="submit"><g:message code="login.page.auth.button.submit" /></button>
          </fieldset>
        </form>

Update look and feel of main application UI

  <meta name='layout' content='login' />
  <title>CollabNet Subversion Edge <g:message code="login.page.auth.title" /></title>

  <content tag="title">
    <g:message code="login.page.auth.title" />
  </content>

<g:message code="login.page.auth.title" />

        <form action='${postUrl}' method='post' id='loginForm'>
          <fieldset>

              <input type="text" name="j_username" id="j_username" placeholder="<g:message code="login.page.auth.username.label" />" />

              <input type="password" name="j_password" id="j_password" placeholder="<g:message code="login.page.auth.password.label" />" />

            <button class="btn btn-primary" value="Login" type="submit"><g:message code="login.page.auth.button.submit" /></button>
          </fieldset>
        </form>


<g:set var="projectSet" value="${[]}"/>
<g:each in="${projects*.name.sort()}" var="proj">
    %{
        projectSet << ['key': proj, 'value': proj]
    }%
</g:each>
<auth:resourceAllowed action="create" kind="project" context="application">
    <g:if test="${!params.nocreate}">
        %{
            projectSet << [value: "Create new Project...", key: '-new-']
        }%
    </g:if>
</auth:resourceAllowed>
<g:select from="${projectSet}" optionKey='key' optionValue='value' name="${params.key ? params.key : 'projectSelect'}"
          onchange="${params.callback ? params.callback : 'selectProject'}(this.value);"
          value="${params.selected ? params.selected : project}"/>
<g:if test="${error}">
    ${error}
</g:if>

Remove error message in project select area


<g:set var="projectSet" value="${projects*.name.sort()}"/>
<g:set var="selectParams" value="${selectParams?:[:]}"/>

        Project: ${session.project}

<auth:resourceAllowed action="create" kind="project" context="application">
        <g:if test="${!params.nocreate}">

                <g:link controller="framework" action="createProject">
                    New Project

                </g:link>

        </g:if>
</auth:resourceAllowed>
        <g:each var="project" in="${projectSet}">

                <g:link controller="framework" action="selectProject" params="${[project: project] + selectParams}" >
                    ${project.encodeAsHTML()}
                </g:link>

        </g:each>

Add icon for projects menu

<g:set var="projectSet" value="${projects*.name.sort()}"/>
<g:set var="selectParams" value="${selectParams?:[:]}"/>

        ${session.project}

<auth:resourceAllowed action="create" kind="project" context="application">
        <g:if test="${!params.nocreate}">

                <g:link controller="framework" action="createProject">
                    New Project

                </g:link>

        </g:if>
</auth:resourceAllowed>
        <g:each var="project" in="${projectSet}">

                <g:link controller="framework" action="selectProject" params="${[project: project] + selectParams}" >

                    ${project.encodeAsHTML()}
                </g:link>

        </g:each>


    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main" />
    <title>CollabNet Subversion Edge <g:message code="statistics.page.index.title" /></title>

      <content tag="title">
        <g:message code="statistics.page.title" />
      </content>

        <g:render template="/server/leftNav"/>

      <g:render template="chart" />

        <g:each status="i" var="data" in="${statData}">
          <%-- hide empty stat group categories (eg, replica-only categories in standalone mode --%>
          <g:if test="${data.statgroups}">

${data.category}

            <g:each status="j" var="group" in="${data.statgroups}">

                ${group.statgroup}

                <g:each status="k" var="graph" in="${group.graphs}">

                         ${graph.graphName}

                </g:each>

            </g:each>

          </g:if>
        </g:each>

Fix the page title for Statistics page. Pointing to a non-existing resource.

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main" />
    <title>CollabNet Subversion Edge <g:message code="statistics.page.title" /></title>

      <content tag="title">
        <g:message code="statistics.page.title" />
      </content>

        <g:render template="/server/leftNav"/>

      <g:render template="chart" />

        <g:each status="i" var="data" in="${statData}">
          <%-- hide empty stat group categories (eg, replica-only categories in standalone mode --%>
          <g:if test="${data.statgroups}">

${data.category}

            <g:each status="j" var="group" in="${data.statgroups}">

                ${group.statgroup}

                <g:each status="k" var="graph" in="${group.graphs}">

                         ${graph.graphName}

                </g:each>

            </g:each>

          </g:if>
        </g:each>


<?php

// WAYF IDP Configuration File

// Generation: ${new Date()} by Federation Registry <g:meta name="app.version"/>
<g:each var="ot" in="${organizationTypes}">
$IDProviders['${ot.name}'] = array (
	'Name' => '${ot.description}',
	'Type' => 'category',
);
<g:each var="idp" in="${ot.idpList.sort { it.displayName }}">
$IDProviders['${idp.entityID}']['SSO'] = '${idp.location}';
$IDProviders['${idp.entityID}']['Name'] = '${idp.displayName}';
$IDProviders['${idp.entityID}']['Type'] = '${ot.name}';
</g:each>
</g:each>

?>

Correct WAYF ordering to be alphabetical on description.

<?php

// WAYF IDP Configuration File

// Generation: ${new Date()} by Federation Registry <g:meta name="app.version"/>
<g:each var="ot" in="${organizationTypes.sort{it.description}}">
$IDProviders['${ot.name}'] = array (
	'Name' => '${ot.description}',
	'Type' => 'category',
);
<g:each var="idp" in="${ot.idpList.sort { it.displayName }}">
$IDProviders['${idp.entityID}']['SSO'] = '${idp.location}';
$IDProviders['${idp.entityID}']['Name'] = '${idp.displayName}';
$IDProviders['${idp.entityID}']['Type'] = '${ot.name}';
</g:each>
</g:each>

?>


    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="base"/>
    <title>${flash.title ?: request.title ?: 'Error'}</title>

${flash.title?:request.title?:'Error'}

        <g:render template="/common/messagesText"/>

Allow title code, use in page body

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="base"/>
    <g:set var="pageTitle" value="${flash.title ?: request.title ?: request.titleCode ? g.message(code: request.titleCode) :
        g.message(code: 'request.error.title')}"/>
    <title>${pageTitle}</title>

${pageTitle}

        <g:render template="/common/messagesText"/>


<fr:isLoggedIn>
  Logged in as <fr:principalName /> ( TargetedID: <fr:principal /> )

</fr:isLoggedIn>
Federation Registry version <g:meta name="app.version"/>

Developed for the Australian Access Federation by Bradley Beddoes

<r:script>
  if(typeof Zenbox!=="undefined"){Zenbox.init({dropboxID:"6875",url:"australianaccessfederation.zendesk.com",tabID:"support",hide_tab:true})}
</r:script>

Clean up footer text for FR

<fr:isLoggedIn>
  Logged in as <fr:principalName /> ( TargetedID: <fr:principal /> )

</fr:isLoggedIn>
Federation Registry version <g:meta name="app.version"/>

Developed by the Australian Access Federation.

<r:script>
  if(typeof Zenbox!=="undefined"){Zenbox.init({dropboxID:"6875",url:"australianaccessfederation.zendesk.com",tabID:"support",hide_tab:true})}
</r:script>


<!DOCTYPE html>

        <meta charset="UTF-8">
        <title>iceScrum Service Swagger</title>
        <asset:stylesheet src="swagger-ui/swagger-ui.css"/>

        <asset:javascript src="swagger-ui/swagger-ui-standalone-preset.js"/>
        <asset:javascript src="swagger-ui/swagger-ui-bundle.js"/>

Remove topbar of swagger doc


    <g:render template="/common/errorFragment"/>
    <g:form controller="scheduledExecution" method="post" onsubmit="if(typeof(validateJobEditForm)=='function'){return validateJobEditForm(this);}">
        <g:render template="edit" model="[scheduledExecution:scheduledExecution, crontab:crontab, command:command,authorized:authorized]"/>

            <g:actionSubmit id="editFormCancelButton" value="Cancel"  onclick="if(typeof(jobEditCancelled)=='function'){jobEditCancelled();}"/>
            <g:actionSubmit value="Update"/>

    </g:form>

Remove border style from edit page


<!doctype html>

        <g:javascript library="jquery" />
        <r:layoutResources/>

        Get Last Changes

Index page updated using jsviews templating. Nice table and button to get last changes.

<!doctype html>

        <g:javascript library="jquery" />
        <r:layoutResources/>
        <link href="http://borismoore.github.com/jsviews/demos/resources/presentation.css" rel="stylesheet" type="text/css" />
        <link href="http://borismoore.github.com/jsviews/demos/resources/syntaxhighlighter.css" rel="stylesheet" type="text/css" />

    Get Last Changes

                Author
                Idenifier
                Date


<%--
 Copyright 2010 DTO Labs, Inc. (http://dtolabs.com)

 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.

 --%>
<%--
    _scriptDetailDisplay.gsp

    Author: Greg Schueler greg@dtosolutions.com
    Created: Jun 14, 2010 10:54:02 AM
    $Id$
 --%>
<g:set var="rkey" value="${g.rkey()}"/>
<g:expander key="${rkey}">${label?label:''}${script.split('(\r\n|[\r\n])').length} lines</g:expander>

${script.encodeAsHTML()}

Fix script workflow item display for windows

<%--
 Copyright 2010 DTO Labs, Inc. (http://dtolabs.com)

 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.

 --%>
<%--
    _scriptDetailDisplay.gsp

    Author: Greg Schueler greg@dtosolutions.com
    Created: Jun 14, 2010 10:54:02 AM
    $Id$
 --%>
<g:set var="rkey" value="${g.rkey()}"/>
<g:set var="split" value="${script.split('(\r?\n)') as List}"/>
<g:expander key="${rkey}">${label?label:''}${split.size()} lines</g:expander>
<g:set var="encoded" value="${split.collect{it.encodeAsHTML()}}"/>

${ encoded.join('
') }


final int screenWidth = 1366;
final int screenHeight = 768;
final color black = color(0, 0, 0);

Camera camera;
Mouse mouse;
Room room;

void setup() {
  size(screenWidth, screenHeight, P3D);
  noCursor();
  mouse = new Mouse();
  camera = new Camera(mouse, width, height);
  room = new Room(camera);
}

void draw() {
  background(black);
  if (mouse.centred()) mouse.moved();
  else mouse.centre();
  camera.set();
  room.draw();
}

void keyPressed() {
  switch (key) {
    case 'w':
      if (withinRoom(camera.simulateMoveForward())) camera.moveForward();
      break;
    case 'a':
      if (withinRoom(camera.simulateStrafeLeft())) camera.strafeLeft();
      break;
    case 's':
      if (withinRoom(camera.simulateMoveBackward())) camera.moveBackward();
      break;
    case 'd':
      if (withinRoom(camera.simulateStrafeRight())) camera.strafeRight();
      break;
    case 'q':
      exit();
      break;
  }
}

boolean withinRoom(float[] cameraPosition) {
  float x = cameraPosition[0];
  float z = cameraPosition[1];
  return (x > -100 && x < 100) && (z > -100 && z < 100);
}

Rename width and height variables

final int width = 1366;
final int height = 768;
final color black = color(0, 0, 0);

Camera camera;
Mouse mouse;
Room room;

void setup() {
  size(width, height, P3D);
  noCursor();
  mouse = new Mouse();
  camera = new Camera(mouse, width, height);
  room = new Room(camera);
}

void draw() {
  background(black);
  if (mouse.centred()) mouse.moved();
  else mouse.centre();
  camera.set();
  room.draw();
}

void keyPressed() {
  switch (key) {
    case 'w':
      if (withinRoom(camera.simulateMoveForward())) camera.moveForward();
      break;
    case 'a':
      if (withinRoom(camera.simulateStrafeLeft())) camera.strafeLeft();
      break;
    case 's':
      if (withinRoom(camera.simulateMoveBackward())) camera.moveBackward();
      break;
    case 'd':
      if (withinRoom(camera.simulateStrafeRight())) camera.strafeRight();
      break;
    case 'q':
      exit();
      break;
  }
}

boolean withinRoom(float[] cameraPosition) {
  float x = cameraPosition[0];
  float z = cameraPosition[1];
  return (x > -100 && x < 100) && (z > -100 && z < 100);
}


import wordcram.*;

size(600, 350);
background(255);

/*
 * There are a few different ways to load text.
 * WordCram will parse out the words, count them
 * up, and render more-frequent words bigger than
 * less-frequent ones.
 *
 * Try un-commenting some of the methods below.
 * (If more than one is uncommented, only the last
 * one will have an effect.)
 */

new WordCram(this)

  //.fromWebPage("http://en.wikipedia.org/wiki/Word_cloud")
  //.fromHtmlFile("../kari-the-elephant.html")
  .fromTextFile("../kari-the-elephant.txt")
  //.fromTextString(loadStrings("../kari-the-elephant.txt"))
  //.fromHtmlString(loadStrings("../kari-the-elephant.html"))

  .drawAll();

Update Wikipedia example sketch to use HTTPS.

import wordcram.*;

size(600, 350);
background(255);

/*
 * There are a few different ways to load text.
 * WordCram will parse out the words, count them
 * up, and render more-frequent words bigger than
 * less-frequent ones.
 *
 * Try un-commenting some of the methods below.
 * (If more than one is uncommented, only the last
 * one will have an effect.)
 */

new WordCram(this)

  //.fromWebPage("https://en.wikipedia.org/wiki/Word_cloud")
  //.fromHtmlFile("../kari-the-elephant.html")
  .fromTextFile("../kari-the-elephant.txt")
  //.fromTextString(loadStrings("../kari-the-elephant.txt"))
  //.fromHtmlString(loadStrings("../kari-the-elephant.html"))

  .drawAll();


/*
 *  Emulates being plugged into a live CAN network by output randomly valued
 *  JSON messages over USB.
 */

#include "WProgram.h"
#include "chipKITUSBDevice.h"
#include "usbutil.h"

#define SIGNAL_COUNT 6

char* SIGNALS[SIGNAL_COUNT] = {
    "vehicle_speed",
    "transmission_gear_position",
    "accelerator_pedal_position",
    "brake_pedal_status",
    "powertrain_torque",
    "parking_brake_status",
};

void setup() {
    Serial.begin(115200);
    randomSeed(analogRead(0));

    initializeUsb();
}

void loop() {
    while(1) {
        writeMeasurement(SIGNALS[random(SIGNAL_COUNT)],
                random(101) + random(100) * .1);
    }
}

void writeMeasurement(char* measurementName, float value) {
    int messageLength = NUMERICAL_MESSAGE_FORMAT_LENGTH +
        strlen(measurementName) + NUMERICAL_MESSAGE_VALUE_MAX_LENGTH;
    char message[messageLength];
    sprintf(message, NUMERICAL_MESSAGE_FORMAT, measurementName, value);

    sendMessage((uint8_t*) message, strlen(message));
}

Use measurements in emulator that are displayed on Vehicle Dashboard.

/*
 *  Emulates being plugged into a live CAN network by output randomly valued
 *  JSON messages over USB.
 */

#include "WProgram.h"
#include "chipKITUSBDevice.h"
#include "usbutil.h"

#define SIGNAL_COUNT 6

char* SIGNALS[SIGNAL_COUNT] = {
    "vehicle_speed",
    "transmission_gear_position",
    "accelerator_pedal_position",
    "windshield_wiper_speed",
    "steering_wheel_angle",
    "parking_brake_status",
};

void setup() {
    Serial.begin(115200);
    randomSeed(analogRead(0));

    initializeUsb();
}

void loop() {
    while(1) {
        writeMeasurement(SIGNALS[random(SIGNAL_COUNT)],
                random(101) + random(100) * .1);
    }
}

void writeMeasurement(char* measurementName, float value) {
    int messageLength = NUMERICAL_MESSAGE_FORMAT_LENGTH +
        strlen(measurementName) + NUMERICAL_MESSAGE_VALUE_MAX_LENGTH;
    char message[messageLength];
    sprintf(message, NUMERICAL_MESSAGE_FORMAT, measurementName, value);

    sendMessage((uint8_t*) message, strlen(message));
}


int border = 50;
int repetitions = 5;
int w = 100;
int h = 100;
int x = 0;
int y = 0;

void setup() {
  size(800,800);
  rectMode(CORNER);
  noStroke();
  frameRate(1);
}

void draw() {
  background(240);

  for (int i=0; i<repetitions; i++){
    for (int n=0; n<repetitions; n++) {
      int x = (int) random(-5, 5);
      int y = (int) random(-5, 5);

      fill(127,63,62,200);
      rect((width/2-(5*w/2))+(w*i)+x, (height/2-(5*h/2))+(h*n)+y, w, h);
    }
  }
}

//  background(255,237,0);
//  int num = (int) random(3, 12);   // select a random number of squares each frame
//  int gap = (int) random(5, 50); // select a random gap between each square
//
//  // calculate the size of each square for the given number of squares and gap between them
//  float cellsize = ( width - (num + 1) * gap ) / (float)num;
//
//  // print out the size of each square
//  println("cellsize = " + cellsize);
//
//    for (int i=0; i<num; i++) {
//      for (int j=0; j<num; j++) {
//
//        fill(255); // rectangle
//        rect(gap * (i+1) + cellsize * i, gap * (j+1) + cellsize * j, cellsize, cellsize);
//      }
//    }

Add random colour. Finished Vera.

int border = 50;
int repetitions = 5;
int w = 100;
int h = 100;
int x = 0;
int y = 0;
int c = 0;

void setup() {
  size(800,800);
  rectMode(CORNER);
  noStroke();
  frameRate(0.5);
}

void draw() {
  background(240);

  for (int i=0; i<repetitions; i++){
    for (int n=0; n<repetitions; n++) {
      int x = (int) random(-5, 5);
      int y = (int) random(-5, 5);
      int c = (int) random (0,5);

      if (c < 1) {
        fill(22,213,236,200);
      } else {
        fill(217,40,73,200);
      }

      rect((width/2-(5*w/2))+(w*i)+x, (height/2-(5*h/2))+(h*n)+y, w, h);

    }
  }
}


class Room {

  final float centreX = 0;
  final float centreY = 0;
  final float centreZ = 0;

  Camera camera;
  float wallSize;

  Room(Camera camera) {
    this.camera = camera;
    wallSize = 200;
  }

  void wall() {
    beginShape(QUADS);
    vertex(0, 0, 0);
    vertex(1, 0, 0);
    vertex(1, 1, 0);
    vertex(0, 1, 0);
    endShape(CLOSE);
  }

  void draw() {
    pushMatrix();
    translate(centreX - (wallSize / 2), centreY - (wallSize / 2), centreZ - wallSize);
    scale(wallSize);
    wall();
    popMatrix();
  }
}

Use box to make room

class Room {

  Camera camera;
  float width, height, depth;

  Room(Camera camera) {
    this.camera = camera;
    width = depth = 200;
    height = 100;
  }

  void draw() {
    pushMatrix();
    translate(0, 0, 0);
    box(width, height, depth);
    popMatrix();
  }
}


int i;
float border = 20;
float x1;
float y1;
float di;

void setup() {
 size(600,600);
 background(255);
 smooth();
 di = random(5,10);
 x1 = random(border,width-border);
 y1 = random(border,height-border);
 fill(random(0,200));
 noStroke();
 ellipse(x1,y1,di,di);
}

void draw() {
  if ( i < 49 ) {

    float x2 = random(border,width-border);
    float y2 = random(border,height-border);
    stroke(random(0,200));
    line (x1,y1,x2,y2);
    x1 = x2;
    y1 = y2;
    i = i+1;
    di = random(5,10);
    fill(random(0,250));
    noStroke();
    ellipse(x1,y1,di,di);
 }
}

ADD SOME COLOR EFFECT AND COMMENTS

int i;
float border = 15;  //MARGIN
float x1;
float y1;
float di;

//ADD THE VARIATION OF SHADE
float fiftyShadeOfGrey = random(0,50);
float alph = random(80,200);

void setup() {
 size(600,600);
 background(random(230,255));
 smooth();

 //DRAW THE FIRST POINT AT THE FIRST RANDOM POSITION
 di = random(5,15);
 x1 = random(border,width-border);
 y1 = random(border,height-border);
 fill(fiftyShadeOfGrey,fiftyShadeOfGrey,fiftyShadeOfGrey, alph);
 noStroke();
 ellipse(x1,y1,di,di);

}

void draw() {
  // CREATE OTHER 49 POINTS & CONNECTING LINE
  if ( i < 49 ) {
    // CREATE A NEW RANDOM POSITION
    float x2 = random(border,width-border);
    float y2 = random(border,height-border);

    // DRAW THE LINE FROM AN OLD POSITION TO A NEW POSITION
    stroke(fiftyShadeOfGrey,fiftyShadeOfGrey,fiftyShadeOfGrey, alph);
    line (x1,y1,x2,y2); // DRAW

    // NOW X1 and Y1 REFER TO THE NEW POSITION
    x1 = x2;
    y1 = y2;

    // DRAW THE NEW POINT AT THE NEW POSITION
    di = random(5,15);
    fiftyShadeOfGrey = random(0,50);
    alph = random(80,200);
    fill(fiftyShadeOfGrey,fiftyShadeOfGrey,fiftyShadeOfGrey, alph);
    noStroke();
    ellipse(x1,y1,di,di); // DRAW

    // NEXT
    i = i+1;
 }
}


#include <SoftPWM.h>

void setup()
{
  SoftPWMBegin();

  // Sets the PWM value to 0 for the built-in LED (WLED).
  SoftPWMSet(WLED, 0);

  // Sets the default fade time for WLED to
  // 100 ms fade-up and 550 ms to fade-down.
  SoftPWMSetFadeTime(WLED, 100, 550);
}

void loop()
{
  // Turn on WLED
  SoftPWMSet(WLED, 255);
  // Wait for the fade-up and some extra delay.
  delay(250);
  // Turn off WLED
  SoftPWMSet(WLED, 0);
  // Wait for the fade-down, and some extra delay.
  delay(650);
}

Use LED_BUILTIN instead of WLED when compiling on Arduino IDE

#include <SoftPWM.h>

#ifndef WLED
#define WLED LED_BUILTIN
#endif

void setup()
{
  SoftPWMBegin();

  // Sets the PWM value to 0 for the built-in LED (WLED).
  SoftPWMSet(WLED, 0);

  // Sets the default fade time for WLED to
  // 100 ms fade-up and 550 ms to fade-down.
  SoftPWMSetFadeTime(WLED, 100, 550);
}

void loop()
{
  // Turn on WLED
  SoftPWMSet(WLED, 255);
  // Wait for the fade-up and some extra delay.
  delay(250);
  // Turn off WLED
  SoftPWMSet(WLED, 0);
  // Wait for the fade-down, and some extra delay.
  delay(650);
}


final int screenWidth = 1366;
final int screenHeight = 768;
final color black = color(0, 0, 0);

Camera camera;
Room room;

void setup() {
  size(screenWidth, screenHeight, P3D);
  noCursor();
  camera = new Camera(width, height);
  room = new Room(camera);
}

void draw() {
  background(black);
  camera.set();
  room.draw();
}

void keyPressed() {
  switch (key) {
    case 'w':
      camera.moveForward();
      break;
    case 'a':
      camera.strafeLeft();
      break;
    case 's':
      camera.moveBackward();
      break;
    case 'd':
      camera.strafeRight();
      break;
    case 'q':
      exit();
      break;
  }
}

Use Robot class to set camera position to the center of the screen on startup

import java.awt.AWTException;
import java.awt.Robot;

final int screenWidth = 1366;
final int screenHeight = 768;
final color black = color(0, 0, 0);

Camera camera;
Robot robot;
Room room;

void setup() {
  size(screenWidth, screenHeight, P3D);
  noCursor();
  camera = new Camera(width, height);
  room = new Room(camera);
  try {
    robot = new Robot();
  } catch (AWTException e) {
    println("Unable to instantiate Robot");
    exit();
  }
  robot.mouseMove(width / 2, height / 2);
}

void draw() {
  background(black);
  camera.set();
  room.draw();
}

void keyPressed() {
  switch (key) {
    case 'w':
      camera.moveForward();
      break;
    case 'a':
      camera.strafeLeft();
      break;
    case 's':
      camera.moveBackward();
      break;
    case 'd':
      camera.strafeRight();
      break;
    case 'q':
      exit();
      break;
  }
}


BDIM flow;
Body body;
FloodPlot flood;

void setup(){
  size(800,800);         // display window size
  int n=(int)pow(2,7);   // number of grid points
  float L = n/8.;        // length-scale in grid units
  Window view = new Window(n,n);

  body = new CircleBody(n/3,n/2,L,view);     // define geom
  flow = new BDIM(n,n,1.5,body);             // solve for flow using BDIM
//  flow = new BDIM(n,n,0.,body,L/200,true);  // BDIM+QUICK
  flood = new FloodPlot(view);
  flood.setLegend("vorticity",-.5,.5);
}
void draw(){
  body.update();
  flow.update(body); flow.update2();
  flood.display(flow.u.vorticity());
  body.display();
}
void mousePressed(){body.mousePressed();}
void mouseReleased(){body.mouseReleased();}

Add comments to main page

/*********************************************************
                  Main Window!

Click the "Run" button to Run the simulation.

Change the geometry, flow conditions, numercial parameters
visualizations and measurments from this window.

*********************************************************/
BDIM flow;
Body body;
FloodPlot flood;

void setup(){
  size(800,800);         // display window size
  int n=(int)pow(2,7);   // number of grid points
  float L = n/8.;        // length-scale in grid units
  Window view = new Window(n,n);

  body = new CircleBody(n/3,n/2,L,view);     // define geom
  flow = new BDIM(n,n,1.5,body);             // solve for flow using BDIM
//  flow = new BDIM(n,n,0.,body,L/200,true);   // BDIM+QUICK
  flood = new FloodPlot(view);               // intialize...
  flood.setLegend("vorticity",-.5,.5);       // and label a flood plot
}
void draw(){
  body.update();                             // update the body
  flow.update(body); flow.update2();         // 2-step fluid update
  flood.display(flow.u.vorticity());         // compute and display vorticity
  body.display();                            // display the body
}
void mousePressed(){body.mousePressed();}    // user mouse...
void mouseReleased(){body.mouseReleased();}  // interaction methods


/*
 *  Emulates being plugged into a live CAN network by output randomly valued
 *  JSON messages over USB.
 */

#include "WProgram.h"
#include "chipKITUSBDevice.h"
#include "usbutil.h"

#define SIGNAL_COUNT 12

char* SIGNALS[SIGNAL_COUNT] = {
    "vehicle_speed",
    "transmission_gear_position",
    "accelerator_pedal_position",
    "windshield_wiper_speed",
    "steering_wheel_angle",
    "parking_brake_status",
    "brake_pedal_status",
    "engine_speed",
    "latitude",
    "longitude",
    "transmission_gear_pos",
    "veh_button_event",
};

void writeMeasurement(char* measurementName, float value) {
    int messageLength = NUMERICAL_MESSAGE_FORMAT_LENGTH +
        strlen(measurementName) + NUMERICAL_MESSAGE_VALUE_MAX_LENGTH;
    char message[messageLength];
    sprintf(message, NUMERICAL_MESSAGE_FORMAT, measurementName, value);

    sendMessage((uint8_t*) message, strlen(message));
}

void setup() {
    Serial.begin(115200);
    randomSeed(analogRead(0));

    initializeUsb();
}

void loop() {
    while(1) {
        writeMeasurement(SIGNALS[random(SIGNAL_COUNT)],
                random(101) + random(100) * .1);
    }
}

Remove button event from emulator - this one needs custom handling.

/*
 *  Emulates being plugged into a live CAN network by output randomly valued
 *  JSON messages over USB.
 */

#include "WProgram.h"
#include "chipKITUSBDevice.h"
#include "usbutil.h"

#define SIGNAL_COUNT 11

char* SIGNALS[SIGNAL_COUNT] = {
    "vehicle_speed",
    "transmission_gear_position",
    "accelerator_pedal_position",
    "windshield_wiper_speed",
    "steering_wheel_angle",
    "parking_brake_status",
    "brake_pedal_status",
    "engine_speed",
    "latitude",
    "longitude",
    "transmission_gear_pos",
};

void writeMeasurement(char* measurementName, float value) {
    int messageLength = NUMERICAL_MESSAGE_FORMAT_LENGTH +
        strlen(measurementName) + NUMERICAL_MESSAGE_VALUE_MAX_LENGTH;
    char message[messageLength];
    sprintf(message, NUMERICAL_MESSAGE_FORMAT, measurementName, value);

    sendMessage((uint8_t*) message, strlen(message));
}

void setup() {
    Serial.begin(115200);
    randomSeed(analogRead(0));

    initializeUsb();
}

void loop() {
    while(1) {
        writeMeasurement(SIGNALS[random(SIGNAL_COUNT)],
                random(101) + random(100) * .1);
    }
}


import java.util.*;
import java.text.*;
import java.nio.file.*;

class PrimitiveGroup {

  Primitive[] primitives = new Primitive[30];

  PrimitiveGroup() {

    // Populate the PrimitiveGroup with junk
    for (int i = 0; i < 30; i++) {
      PVector rand_loc = PVector.random3D();
      rand_loc.mult(100);

      int rand_size = int(random(10,45));

      if (i % 2 == 0) {
        primitives[i] = new PrimitiveSphere(rand_loc, rand_size);
      }
      else {
        primitives[i] = new PrimitiveCube(rand_loc, rand_size);
      }

    }
  }

  void update() {
    // Update every Primitive in the PrimitiveGroup
    for (int i = 0; i < primitives.length; i++) {
      primitives[i].update();
    }
  }

  void display() {
    // Update every Primitive in the PrimitiveGroup
    for (int i = 0; i < primitives.length; i++) {
      primitives[i].display();
    }
  }
}

Move test populate code to its own method.

import java.util.*;
import java.text.*;
import java.nio.file.*;

class PrimitiveGroup {

  Primitive[] primitives = new Primitive[30];

  PrimitiveGroup() {
    populate();
  }

  void update() {
    // Update every Primitive in the PrimitiveGroup
    for (int i = 0; i < primitives.length; i++) {
      primitives[i].update();
    }
  }

  void display() {
    // Update every Primitive in the PrimitiveGroup
    for (int i = 0; i < primitives.length; i++) {
      primitives[i].display();
    }
  }

  void populate() {
    // Populate the PrimitiveGroup with junk
    for (int i = 0; i < 30; i++) {
      PVector rand_loc = PVector.random3D();
      rand_loc.mult(100);

      int rand_size = int(random(10, 45));

      if (i % 2 == 0) {
        primitives[i] = new PrimitiveSphere(rand_loc, rand_size);
      } else {
        primitives[i] = new PrimitiveCube(rand_loc, rand_size);
      }
    }
  }
}


/**
 * textAnalyse_basic
 * by wrongPowder Library.
 *
 * Use wrongPowder.util.string package to analyze text.
 *
 * @author    Paul Vollmer
 * @modified  2011.10.31
 */

//import wrongPowder.util.string.TextAnalyse;

//TextAnalyse textAnalyse = new TextAnalyse();

void setup() {
  size(400, 400);
}

void draw() {
}

void keyPressed() {
  char letter = char(key);
  println("KEY\t[ ASCII DEC: "+(int)key+
          " Unicode: "+(int)key+
          " char: "+ letter +
          " end ]");
}

Delete old TextAnalyse file, changes at analyse example

/**
 * textAnalyse_basic
 * by wrongPowder Library.
 *
 * Use wrongPowder.util.string package to analyze text.
 *
 * @author    Paul Vollmer
 * @modified  2011.10.31
 */

import wrongPowder.util.string.*;
TextAnalyse textAnalyse = new TextAnalyse();

String[] text;

void setup() {
  size(400, 400);

  // Load a text file and initialize the string array.
  text = loadStrings("example.txt");
  //textAnalyse.init(text);
  //textAnalyse.analyse();
  textAnalyse.analyse("hello world abc 1");
  textAnalyse.totalWords();

}


class DelayButton extends Button {

  final color COLOR_WHITE = color(255);

  DelayButton(int x, int y, int w, int h) {
    super(x, y, w, h);
  }

  void drawMe(){
    super.drawMe();

    fill(COLOR_WHITE);
    textSize(buttonW/3);
    text("Delay", buttonX+buttonW/12, buttonY+buttonH*3/4);
  }

}

Change delay button text to string variable

class DelayButton extends Button {

  final color COLOR_WHITE = color(255);

  static final String TEXT_DELAY = "Delay";

  DelayButton(int x, int y, int w, int h) {
    super(x, y, w, h);
  }

  void drawMe(){
    super.drawMe();

    fill(COLOR_WHITE);
    textSize(buttonW/3);
    text(
      TEXT_DELAY,
      buttonX + buttonW/12,
      buttonY + buttonH*3/4
    );
  }

}


/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
 */

#include "WProgram.h"
#include "Wire.h"

void setup() {
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

Remove old WProgram.h import from test case.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
 */

#include "Wire.h"

void setup() {
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}


import wordcram.*;

void setup() {
  size(1000, 500);
  smooth();
  background(255);

  new WordCram(this)
    .fromWebPage("http://wordcram.org")
      .drawAll();
}

void wordsCounted(Word[] words) {
  println("counted " + words.length + " words!");
}

void beginDraw() {
  println("beginDraw: drawing the sketch...");
}

int wordsDrawn = 0;
void wordDrawn(Word word) {
  //println("drew this word! " + word.word);
  wordsDrawn++;
}

int wordsSkipped = 0;
void wordSkipped(Word word) {
  //println("skipped " + word.word + " because " + word.wasSkippedBecause());
  wordsSkipped++;
}

void endDraw() {
  println("endDraw!");
  println("- skipped: " + wordsSkipped);
  println("- drawn:   " + wordsDrawn);
}

Clean up callbacks example sketch

import wordcram.*;

void setup() {
  size(1000, 500);
  smooth();
  background(255);

  new WordCram(this)
    .fromTextFile("../kari-the-elephant.txt")
    .drawAll();
}

void wordsCounted(Word[] words) {
  println("counted " + words.length + " words!");
}

void beginDraw() {
  println("beginDraw: drawing the sketch...");
}

int wordsDrawn = 0;
void wordDrawn(Word word) {
  wordsDrawn++;
}

int wordsSkipped = 0;
void wordSkipped(Word word) {
  wordsSkipped++;
}

void endDraw() {
  println("endDraw!");
  println("- skipped: " + wordsSkipped);
  println("- drawn:   " + wordsDrawn);
}


// Checking int casting

// int -> int cast
int a = 40, b = 20;
int r1 = (int)a;
_checkEqual(r1, 40);

int r2 = (int)a + (int)b;
_checkEqual(r2, 60);

float c = 5.5, d = -5.5;
int r3 = (int)c;
_checkEqual(r3, 5);

int r3 = (int)d;
_checkEqual(r3, -5);

int r4 = 7 + (int)c;
_checkEqual(r4, 12);

int r5 = (int)d + 13;
_checkEqual(r5, 8);

float[] arr = { 1.2, 3.4 };
int r6 = 7 + (int)arr[1];
_checkEqual(r6, 10);

int r7 = (int)(d + 3);
_checkEqual(r7, -2);

class Obj1 {
  float run() { return -4.3; }
}

Obj1 obj = new Obj1();
int r8 = 4 * (4 + (int)obj. run() + 1);
_checkEqual(r8, 4);

Add test for negative with int casts.

// Checking int casting

// int -> int cast
int a = 40, b = 20;
int r1 = (int)a;
_checkEqual(r1, 40);

int r2 = (int)a + (int)b;
_checkEqual(r2, 60);

float c = 5.5, d = -5.5;
int r3 = (int)c;
_checkEqual(r3, 5);

int r3 = (int)d;
_checkEqual(r3, -5);

int r4 = 7 + (int)c;
_checkEqual(r4, 12);

int r5 = (int)d + 13;
_checkEqual(r5, 8);

float[] arr = { 1.2, 3.4 };
int r6 = 7 + (int)arr[1];
_checkEqual(r6, 10);

int r7 = (int)(d + 3);
_checkEqual(r7, -2);

class Obj1 {
  float run() { return -4.3; }
}

Obj1 obj = new Obj1();
int r8 = 4 * (4 + (int)obj. run() + 1);
_checkEqual(r8, 4);

int neg  = -(int)3.6;
int neg2 = (int)3.6;
_checkEqual(neg, -neg2);


// HeaterMeter Copyright 2011 Bryan Mayland <bmayland@capnbry.net>
#include <WProgram.h>
#include <ShiftRegLCD.h>
#include "hmcore.h"

// See hmcore.h for most options and tweaks

#ifdef HEATERMETER_NETWORKING
// these are redundant but if you don't include them, the Arduino build
// process won't include them to the temporary build location
#include <WiServer.h>
#include <dataflash.h>
#include "wishieldconf.h"
#endif /* HEATERMETER_NETWORKING */

#ifdef HEATERMETER_RFM12
#include <RF12.h>
#include <Ports.h>
#endif /* HEATERMETER_RFM12 */

void setup(void)
{
  hmcoreSetup();
}

void loop(void)
{
  hmcoreLoop();
}

Add int main(void) instead of using default Arduino

// HeaterMeter Copyright 2011 Bryan Mayland <bmayland@capnbry.net>
#include <WProgram.h>
#include <ShiftRegLCD.h>
#include "hmcore.h"

// See hmcore.h for most options and tweaks

#ifdef HEATERMETER_NETWORKING
// these are redundant but if you don't include them, the Arduino build
// process won't include them to the temporary build location
#include <WiServer.h>
#include <dataflash.h>
#include "wishieldconf.h"
#endif /* HEATERMETER_NETWORKING */

#ifdef HEATERMETER_RFM12
#include <RF12.h>
#include <Ports.h>
#endif /* HEATERMETER_RFM12 */

int main(void)
{
  init();
  hmcoreSetup();
  for (;;)
    hmcoreLoop();
  return 0;
}


import wordcram.*;
import java.awt.*;

void setup() {
  PImage image = loadImage("../heart.png");
  size(image.width, image.height);

  background(128);

  Shape imageShape = new ImageShaper().shape(image, #000000);
  ShapeBasedPlacer placer = new ShapeBasedPlacer(imageShape);

  new WordCram(this).
    fromTextFile("../kari-the-elephant.txt").
    withPlacer(placer).
    withNudger(placer).
    sizedByWeight(8, 40).
    withColor(#ffffff).
    drawAll();

  imageShape = new ImageShaper().shape(image, #ffffff);
  placer = new ShapeBasedPlacer(imageShape);

  new WordCram(this).
    fromTextFile("../kari-the-elephant.txt").
    withPlacer(placer).
    withNudger(placer).
    sizedByWeight(8, 40).
    withColor(#000000).
    drawAll();
}

Speed up image-mask example: smaller fonts

import wordcram.*;
import java.awt.*;

void setup() {
  PImage image = loadImage("../heart.png");
  size(image.width, image.height);

  background(128);

  Shape imageShape = new ImageShaper().shape(image, #000000);
  ShapeBasedPlacer placer = new ShapeBasedPlacer(imageShape);

  new WordCram(this).
    fromTextFile("../kari-the-elephant.txt").
    withPlacer(placer).
    withNudger(placer).
    sizedByWeight(7, 40).
    withColor(#ffffff).
    drawAll();

  imageShape = new ImageShaper().shape(image, #ffffff);
  placer = new ShapeBasedPlacer(imageShape);

  new WordCram(this).
    fromTextFile("../kari-the-elephant.txt").
    withPlacer(placer).
    withNudger(placer).
    sizedByWeight(7, 40).
    withColor(#000000).
    drawAll();
}


/*
 *  Emulates being plugged into a live CAN network by output randomly valued
 *  JSON messages over USB.
 */

#include "WProgram.h"
#include "chipKITUSBDevice.h"
#include "usbutil.h"

#define SIGNAL_COUNT 11

char* SIGNALS[SIGNAL_COUNT] = {
    "vehicle_speed",
    "transmission_gear_position",
    "accelerator_pedal_position",
    "windshield_wiper_speed",
    "steering_wheel_angle",
    "parking_brake_status",
    "brake_pedal_status",
    "engine_speed",
    "latitude",
    "longitude",
    "transmission_gear_pos",
};

void writeMeasurement(char* measurementName, float value) {
    int messageLength = NUMERICAL_MESSAGE_FORMAT_LENGTH +
        strlen(measurementName) + NUMERICAL_MESSAGE_VALUE_MAX_LENGTH;
    char message[messageLength];
    sprintf(message, NUMERICAL_MESSAGE_FORMAT, measurementName, value);

    sendMessage((uint8_t*) message, strlen(message));
}

void setup() {
    Serial.begin(115200);
    randomSeed(analogRead(0));

    initializeUsb();
}

void loop() {
    while(1) {
        writeMeasurement(SIGNALS[random(SIGNAL_COUNT)],
                random(101) + random(100) * .1);
    }
}

Remove gear position from emulator - requires custom handler.

/*
 *  Emulates being plugged into a live CAN network by output randomly valued
 *  JSON messages over USB.
 */

#include "WProgram.h"
#include "chipKITUSBDevice.h"
#include "usbutil.h"

#define SIGNAL_COUNT 9

char* SIGNALS[SIGNAL_COUNT] = {
    "vehicle_speed",
    "accelerator_pedal_position",
    "windshield_wiper_speed",
    "steering_wheel_angle",
    "parking_brake_status",
    "brake_pedal_status",
    "engine_speed",
    "latitude",
    "longitude",
};

void writeMeasurement(char* measurementName, float value) {
    int messageLength = NUMERICAL_MESSAGE_FORMAT_LENGTH +
        strlen(measurementName) + NUMERICAL_MESSAGE_VALUE_MAX_LENGTH;
    char message[messageLength];
    sprintf(message, NUMERICAL_MESSAGE_FORMAT, measurementName, value);

    sendMessage((uint8_t*) message, strlen(message));
}

void setup() {
    Serial.begin(115200);
    randomSeed(analogRead(0));

    initializeUsb();
}

void loop() {
    while(1) {
        writeMeasurement(SIGNALS[random(SIGNAL_COUNT)],
                random(101) + random(100) * .1);
    }
}


class WaveSequence {
  private Game game;

  private LinkedList<Wave> waves;
  private Path path;

  // TODO: Need to spawn initial wave's units first, then others at spawnsAt.

  WaveSequence(JSONArray wavedataArray, Path path, Game game) {
    this.waves = new LinkedList();
    for (int i = 0; i < wavedataArray.size(); i++) {
      this.waves.add(new Wave(wavedataArray.getJSONObject(i), path, game));
    }
  }
}

class Wave {

  private Game game;

  private LinkedList<Unit> creeps;
  private int spawnsAt;

  private Path path;

  Wave(JSONObject wavedata, Path path, Game game) {
    this.game = game;
    this.path = path;
    this.creeps = new LinkedList();

    // Parse "creeps" json object.
    JSONObject creepdata = wavedata.getJSONObject("creeps");
    Iterator creepdataKeys = creepdata.keys()
      .iterator();
    while(creepdataKeys.hasNext()){
      String id = (String) creepdataKeys.next();
      int amount = creepdata.getInt(id);

      for (int i = 0; i < amount; i++) {
        // TODO: Delay spawning by a few ms to add space
        this.creeps.add(
          new Creep(UnitUtils.stringToId(id), path.getSpawnpoint(), (CustomWorld) game)
        );
      }
    }

    this.spawnsAt = wavedata.getInt("spawnsAt");
  }
}

Rename CustomWorld to CWorld pt2

class WaveSequence {
  private Game game;

  private LinkedList<Wave> waves;
  private Path path;

  // TODO: Need to spawn initial wave's units first, then others at spawnsAt.

  WaveSequence(JSONArray wavedataArray, Path path, Game game) {
    this.waves = new LinkedList();
    for (int i = 0; i < wavedataArray.size(); i++) {
      this.waves.add(new Wave(wavedataArray.getJSONObject(i), path, game));
    }
  }
}

class Wave {

  private Game game;

  private LinkedList<Unit> creeps;
  private int spawnsAt;

  private Path path;

  Wave(JSONObject wavedata, Path path, Game game) {
    this.game = game;
    this.path = path;
    this.creeps = new LinkedList();

    // Parse "creeps" json object.
    JSONObject creepdata = wavedata.getJSONObject("creeps");
    Iterator creepdataKeys = creepdata.keys()
      .iterator();
    while(creepdataKeys.hasNext()){
      String id = (String) creepdataKeys.next();
      int amount = creepdata.getInt(id);

      for (int i = 0; i < amount; i++) {
        // TODO: Delay spawning by a few ms to add space
        this.creeps.add(
          new Creep(UnitUtils.stringToId(id), path.getSpawnpoint(), (CWorld) game)
        );
      }
    }

    this.spawnsAt = wavedata.getInt("spawnsAt");
  }
}


public class ThreadTask extends TimerTask {
 Thread thread;
 ThreadTask(Thread thread) {
	 this.thread = thread;
 }

 public void run() {
	 thread.setDaemon(true);
	 thread.start();
 }
}

Set daemon thread to be false

public class ThreadTask extends TimerTask {
 Thread thread;
 ThreadTask(Thread thread) {
	 this.thread = thread;
 }

 public void run() {
	 thread.setDaemon(false);
	 thread.start();
 }
}


/*
 * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
 * An IR LED must be connected to Arduino PWM pin 3.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */

#include <IRremote.h>

IRsend irsend;

void setup()
{
  Serial.begin(9600);
}

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
      irsend.sendSony(0xa90, 12); // Sony TV power code
      delay(100);
    }
  }
}

Reduce gap between Sony messages. This should work more reliably.

/*
 * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
 * An IR LED must be connected to Arduino PWM pin 3.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */

#include <IRremote.h>

IRsend irsend;

void setup()
{
  Serial.begin(9600);
}

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
      irsend.sendSony(0xa90, 12); // Sony TV power code
      delay(40);
    }
  }
}


final int width = 1366;
final int height = 768;
final color black = color(0, 0, 0);

Mouse mouse;
Camera camera;
Room room;

void setup() {
  size(width, height, P3D);
  noCursor();
  mouse = new Mouse();
  camera = new Camera(mouse, width, height);
  room = new Room();
}

void draw() {
  background(black);
  if (mouse.centred()) mouse.moved();
  else mouse.centre();
  camera.set();
  room.draw();
}

void keyPressed() {
  switch (key) {
    case 'w':
      if (withinRoom(camera.simulateMoveForward())) camera.moveForward();
      break;
    case 'a':
      if (withinRoom(camera.simulateStrafeLeft())) camera.strafeLeft();
      break;
    case 's':
      if (withinRoom(camera.simulateMoveBackward())) camera.moveBackward();
      break;
    case 'd':
      if (withinRoom(camera.simulateStrafeRight())) camera.strafeRight();
      break;
    case 'q':
      exit();
      break;
  }
}

boolean withinRoom(float[] cameraPosition) {
  float x = cameraPosition[0];
  float z = cameraPosition[1];
  return (x > -100 && x < 100) && (z > -100 && z < 100);
}

Use new Camera and Room methods

final int width = 1366;
final int height = 768;
final color black = color(0, 0, 0);

Mouse mouse;
Camera camera;
Room room;

void setup() {
  size(width, height, P3D);
  noCursor();
  mouse = new Mouse();
  camera = new Camera(mouse);
  room = new Room();
}

void draw() {
  background(black);
  if (mouse.centred()) mouse.moved();
  else mouse.centre();
  camera.set();
  room.draw();
}

void keyPressed() {
  switch (key) {
    case 'w':
      if (room.within(camera.forwardPosition())) {
        camera.moveForward();
      }
      break;
    case 'a':
      if (room.within(camera.leftPosition())) {
        camera.strafeLeft();
      }
      break;
    case 's':
      if (room.within(camera.backwardPosition())) {
        camera.moveBackward();
      }
      break;
    case 'd':
      if (room.within(camera.rightPosition())) {
        camera.strafeRight();
      }
      break;
    case 'q':
      exit();
      break;
  }
}


class Button {
  final int buttonX;
  final int buttonY;
  final int buttonW;
  final int buttonH;

  final color COLOR_BLACK = color(0);
  final color COLOR_GREY_DARK = color(51);
  final color COLOR_GREY = color(102);

  final color buttonColor = COLOR_BLACK;
  final color baseColor = COLOR_GREY;
  final color buttonHighlight = COLOR_GREY_DARK;
  final color currentColor = baseColor;

  boolean buttonOver;

  Button(int x, int y, int w, int h) {
    buttonX = x;
    buttonY = y;
    buttonW = w;
    buttonH = h;
    buttonOver = false;
  }

  void update(int x, int y) {
    buttonOver = overButton(buttonX, buttonY, buttonW, buttonH);
  }

  boolean overButton(int x, int y, int width, int height)  {
    return mouseX > x && mouseX < x+width &&
           mouseY > y && mouseY < y+height;
  }

  void drawMe () {
    if (buttonOver) {
      fill(buttonHighlight);
    }
    else {
      fill(buttonColor);
    }
    stroke(255);
    rect(buttonX, buttonY, buttonW, buttonH);
  }

}

Replace magic number for button outline color

class Button {
  final int buttonX;
  final int buttonY;
  final int buttonW;
  final int buttonH;

  final color COLOR_BLACK = color(0);
  final color COLOR_GREY_DARK = color(51);
  final color COLOR_GREY = color(102);
  final color COLOR_WHITE = color(255);

  final color buttonColor = COLOR_BLACK;
  final color baseColor = COLOR_GREY;
  final color buttonHighlight = COLOR_GREY_DARK;
  final color outlineColor = COLOR_WHITE;
  final color currentColor = baseColor;

  boolean buttonOver;

  Button(int x, int y, int w, int h) {
    buttonX = x;
    buttonY = y;
    buttonW = w;
    buttonH = h;
    buttonOver = false;
  }

  void update(int x, int y) {
    buttonOver = overButton(buttonX, buttonY, buttonW, buttonH);
  }

  boolean overButton(int x, int y, int width, int height)  {
    return mouseX > x && mouseX < x+width &&
           mouseY > y && mouseY < y+height;
  }

  void drawMe () {
    if (buttonOver) {
      fill(buttonHighlight);
    }
    else {
      fill(buttonColor);
    }
    stroke(outlineColor);
    rect(buttonX, buttonY, buttonW, buttonH);
  }

}


import java.awt.AWTException;
import java.awt.Robot;

class Mouse {

  Robot robot;
  int prevX;

  Mouse(int x) {
    try {
      robot = new Robot();
    } catch (AWTException e) {
      println("Unable to instantiate Robot");
      exit();
    }
    prevX = x;
  }

  int dx() {
    if (width % 2 == 0 && mouseX == 0) return 1 - prevX;
    return mouseX - prevX;
  }

  void move(int x, int y) {
    robot.mouseMove(x, y);
  }

  void moved() {
    if (width % 2 == 0 && mouseX == 0) prevX = 1;
    else prevX = mouseX;

    if (mouseX == width - 1) {
      robot.mouseMove(1, mouseY);
      prevX = 1;
    } else if ((width % 2 == 0 && mouseX == 1) || mouseX == 0) {
      robot.mouseMove(width - 1, mouseY);
      prevX = width - 1;
    }
  }
}

Store previous mouse location x-coordinate

import java.awt.AWTException;
import java.awt.Robot;

class Mouse {

  Robot robot;
  int prevX;

  Mouse(int x) {
    try {
      robot = new Robot();
    } catch (AWTException e) {
      println("Unable to instantiate Robot");
      exit();
    }
    prevX = x;
  }

  int dx() {
    if (width % 2 == 0 && mouseX == 0) return 1 - prevX;
    return mouseX - prevX;
  }

  void move(int x, int y) {
    robot.mouseMove(x, y);
  }

  void moved() {
    if (mouseX == width - 1) {
      robot.mouseMove(1, mouseY);
      prevX = 1;
    } else if ((width % 2 == 0 && mouseX == 1) || mouseX == 0) {
      robot.mouseMove(width - 1, mouseY);
      prevX = width - 1;
    } else {
      prevX = mouseX;
    }
  }
}


import java.awt.AWTException;
import java.awt.Robot;

class Mouse {

  Robot robot;
  boolean centred;
  int pass;

  Mouse() {
    try {
      robot = new Robot();
    } catch (AWTException e) {
      e.printStackTrace();
      exit();
    }
    centred = false;
    pass = 3;
  }

  boolean centred() {
    return centred;
  }

  int x() {
    return mouseX;
  }

  int y() {
    return mouseY - (height / 2);
  }

  void centre() {
    robot.mouseMove(width / 2, height / 2);
    if (--pass == 0) centred = true;
  }

  void move() {
    if (mouseX == width - 1) {
      robot.mouseMove(0, mouseY);
    } else if (mouseX == 0) {
      robot.mouseMove(width - 1, mouseY);
    }
  }
}

Rename pass field to attempt

import java.awt.AWTException;
import java.awt.Robot;

class Mouse {

  Robot robot;
  boolean centred;
  int attempt;

  Mouse() {
    try {
      robot = new Robot();
    } catch (AWTException e) {
      e.printStackTrace();
      exit();
    }
    centred = false;
    attempt = 3;
  }

  boolean centred() {
    return centred;
  }

  int x() {
    return mouseX;
  }

  int y() {
    return mouseY - (height / 2);
  }

  void centre() {
    robot.mouseMove(width / 2, height / 2);
    if (--attempt == 0) centred = true;
  }

  void move() {
    if (mouseX == width - 1) {
      robot.mouseMove(0, mouseY);
    } else if (mouseX == 0) {
      robot.mouseMove(width - 1, mouseY);
    }
  }
}


Add new sketch for olli: midieuclid, automagiccontroller, magic sysex page

#include <MidiClockPage.h>
#include <MidiEuclidSketch.h>
#include <AutoMidiController.h>

PitchEuclidSketch sketch;
AutoMidiControllerSketch sketch2;
SketchSwitchPage sketchSwitchPage(NULL, &sketch, &sketch2);

void setup() {
  sketch.setupMonster(true);
  sketch2.setupMonster(true);
  GUI.setSketch(&_defaultSketch);
  GUI.setPage(&sketchSwitchPage);
  GUI.addEventHandler(handleEvent);

  initClockPage();
}

bool handleEvent(gui_event_t *event) {
  return sketchSwitchPage.handleGlobalEvent(event);
}

void loop() {
}


Add another approach to a logview using processing 3

import hypermedia.net.*;
import java.util.*;

List<String> history = new ArrayList<String>();

int PORT_RX=4242;
String HOST_IP = "localhost";//IP Address of the PC in which this App is running
UDP udp;//Create UDP object for recieving

void setup(){
  udp= new UDP(this, PORT_RX, HOST_IP);
  udp.log(false);
  udp.listen(true);

  size(700, 400);

}

void draw(){
  background(0);

  int count = history.size();

  for(int i = count - 1; i >= 0; i--){
    int y_offset = i * 12;
    text(history.get(i), 10, y_offset);
  }

}

void receive(byte[] data, String HOST_IP, int PORT_RX){

  String value=new String(data);
  history.add(value);

}


Add blocking midi clock callback test sketch

#include <GUI.h>

class ClockCallbackTest : public ClockCallback {
  public:
  ClockCallbackTest() {
  }

  void onStartCallback() {
    GUI.flash_strings_fill("RECEIVED", "START");
  }

  void onStopCallback() {
    GUI.flash_strings_fill("RECEIVED", "STOP");
  }

  void onContinueCallback() {
    GUI.flash_strings_fill("RECEIVED", "CONTINUE");
  }

  void on32Callback(uint32_t pos) {
    if (BUTTON_DOWN(Buttons.BUTTON1)) {
      delay(100);
    }
    GUI.setLine(GUI.LINE2);
    GUI.put_value16(2, pos & 0xFFFF);
  }
};

ClockCallbackTest cbTest;

void setup() {
  GUI.flash_strings_fill("CLOCK CALLBACK", "TEST FIRMWARE");
//  MidiClock.addOn16Callback(&cbTest, (midi_clock_callback_ptr_t)&ClockCallbackTest::on16Callback);
  MidiClock.addOn32Callback(&cbTest, (midi_clock_callback_ptr_t)&ClockCallbackTest::on32Callback);
  MidiClock.addOnStartCallback(&cbTest, (midi_clock_callback_ptr0_t)&ClockCallbackTest::onStartCallback);
  MidiClock.addOnStopCallback(&cbTest, (midi_clock_callback_ptr0_t)&ClockCallbackTest::onStopCallback);
  MidiClock.addOnContinueCallback(&cbTest, (midi_clock_callback_ptr0_t)&ClockCallbackTest::onContinueCallback);
  MidiClock.useImmediateClock = true;
}


void setup()
{
  fullScreen();
  background(51);
}

void draw()
{
  int cx = width/2;
  int cy = height/2;

  noFill();
  stroke(0,255,255);
  strokeWeight(4);

  rectMode(CENTER);
  rect(cx, cy, (2 * cx) - 10 ,cx);

  float lines = cx/5;
  float startpoint = (height - cx) / 2;

  for( int i = 0; i < 5; i++)
  {
    strokeWeight(1);
    line(5, startpoint, width, startpoint);
    startpoint += lines;
  }

  fill(51);
  strokeWeight(4);
  ellipse(cx, cy, cx, cx);

  int y1 = cy + cx/2;
  float y2 = cy + cx/2;
  float cx2 = cx;

    strokeWeight(1);
    stroke(0,255,0);

    ellipse(cx, y2, 30, 30);
    y2 = y2 - 0.5;

}


void setup() {
  GUI.setLine(GUI.LINE1);
  GUI.put_string_fill("HELLO WORLD");
}

void handleEvent(gui_event_t *evt) {
  GUI.setLine(GUI.LINE2);
  for (uint8_t i = Buttons.BUTTON1; i <= Buttons.BUTTON4; i++) {
    if (EVENT_PRESSED(evt, i)) {
      GUI.flash_printf_fill("%b PRESSED", i);
    }
    else if (EVENT_RELEASED(evt, i)) {
      GUI.flash_printf_fill("%b RELEASED", i);
    }
  }
}


#include <MNM.h>

void setup() {

}

class DebugCallbacks : public MNMCallback {
public:
  DebugCallbacks() {
  }

  void onKitMessage() {
    MNM.kit.fromSysex(MidiSysex.data + 5, MidiSysex.recordLen - 5);
//    printf("got kit \"%s\"\n", kit.name);
  }
};

void loop() {
  uint8_t track = MNM.getCurrentTrack(1000);
  GUI.flash_p_strings_fill(PSTR("MNM KIT"), PSTR(""));
  GUI.setLine(GUI.LINE2);
  GUI.flash_put_value(0, track);
  delay(500);
}


#include <MNM.h>

class TestMNMSketch : public Sketch, MNMCallback {
public:
  EncoderPage page;

  TestMNMSketch() {
  }

  void setup() {
  }

  bool handleEvent(gui_event_t *event) {
    if (EVENT_PRESSED(event, Buttons.BUTTON1)) {
      GUI.setLine(GUI.LINE2);
      GUI.put_value(0, 0);
      uint8_t track = MNM.getCurrentTrack(1000);
      GUI.setLine(GUI.LINE1);
      GUI.put_p_string(PSTR("TRACK"));
      GUI.setLine(GUI.LINE2);
      GUI.put_value(0, track);
    }

    return false;
  }
};

TestMNMSketch sketch;

void setup() {
  MidiUart.sendString("HELLO");
  //  enableProfiling();
//  initMNMTask();
  sketch.setup();
  MNMSysexListener.setup();
  GUI.setSketch(&sketch);
}

void loop() {
}


#include <MD.h>

MDTempoEncoder foo("TMP", 130);
MDTrackFlashEncoder foo2("TRK", 0, true);
EncoderPage page(&foo, &foo2);

void setup() {
  GUI.setPage(&page);
}


Add Processing sketch for logging serial data

import processing.serial.*;

Serial serial;
PrintWriter out;

void setup() {
  serial = new Serial(this, "COM3", 115200);
  out = createWriter("data.txt");
}

void draw() {
  if (serial.available() > 0) {
    int data = serial.read();
    out.println(data);
  }
}

void keyPressed() {
  out.flush();
  out.close();
  exit();
}


#include "tst_fptrs.h"
#include "user_f.h"

#include <stdio.h>

void assign_cuda_ptr(fc2d_cuda_t* h_f, fc2d_cuda_t f)
{
    cudaError_t ce = cudaMemcpyFromSymbol(h_f, f, sizeof(fc2d_cuda_t));
    if(ce != cudaSuccess)
    {
        printf("ERROR: %s\n",cudaGetErrorString(ce));
        exit(0);
    }
    else
    {
        printf("Success!\n");
    }
}

__global__ void kernel(fc2d_cuda_t f,float x, float *y)
{
    *y = f(x);
    return;
}

int main()
{
    float x;
    float y, *y_dev;
    fc2d_assign_cuda_ptr_t f_assign_user;

    fc2d_cuda_t h_f;

    /* User definitions */
    x = 5;
    f_assign_user = assign_cuda_ptr2;  /* Function pointer stored in a v-table */

    /* Code */
    f_assign_user(&h_f);

    cudaMalloc((void**) &y_dev, sizeof(float));

    kernel<<<1,1>>>(h_f,x,y_dev);

    cudaMemcpy(&y, y_dev, sizeof(float), cudaMemcpyDeviceToHost);

    printf("x = %f; y = %f\n",x,y);

    return 0;
}

Update cuda snippet illustrating Cuda function pointers

#include "tst_fptrs.h"
#include "user_f.h"

#include <stdio.h>

__global__ void kernel(fc2d_cuda_t f,float x, float *y)
{
    *y = f(x);
    return;
}

int main()
{
    float x;
    float y, *y_dev;
    fc2d_assign_cuda_ptr_t f_assign_user;

    fc2d_cuda_t h_f;

    /* User definitions */
    x = 5;
    f_assign_user = assign_cuda_ptr2;  /* Function pointer stored in a v-table */

    /* Code */
    f_assign_user(&h_f);

    cudaMalloc((void**) &y_dev, sizeof(float));

    kernel<<<1,1>>>(h_f,x,y_dev);

    cudaMemcpy(&y, y_dev, sizeof(float), cudaMemcpyDeviceToHost);

    printf("x = %f; y = %f\n",x,y);

    return 0;
}


#include <iostream>
#include <string>
#include <gunrock/cuda/device_properties.hxx>

int main(int argc, char** argv) {
    using namespace std;
    using namespace gunrock::cuda;
    using namespace gunrock::cuda::properties;

    int cc_ver = (argc > 1) ? stoi(argv[1]) : 30;
    compute_capability_t cc = make_compute_capability(cc_ver);
    const char *arch = arch_name(cc);

    cout << "Compute Capability Version Major: " << cc.major << endl;
    cout << "Compute Capability Version Minor: " << cc.minor << endl;

    if (arch != nullptr)
        cout << "Compute Capability Architecture: " << arch << endl;

    cout << endl;
    cout << "cta_max_threads:           " << cta_max_threads() << endl;
    cout << "warp_max_threads:          " << warp_max_threads() << endl;
    cout << "sm_max_ctas:               " << sm_max_ctas(cc) << endl;
    cout << "sm_max_threads:            " << sm_max_threads(cc) << endl;
    cout << "sm_registers:              " << sm_registers(cc) << endl;
    cout << "sm_max_smem_bytes:         " << sm_max_smem_bytes(cc) << endl;
    cout << "shared_memory_banks:       " << shared_memory_banks() << endl;
    cout << "shared_memory_bank_stride: " << shared_memory_bank_stride() << endl;
}

Change indentation to 2 spaces


#include <unittest/unittest.h>
#include <thrust/system/cuda/memory.h>

template<typename T1, typename T2>
bool is_same(const T1 &, const T2 &)
{
  return false;
}

template<typename T>
bool is_same(const T &, const T &)
{
  return true;
}

void TestSelectSystemCudaToCpp()
{
  using thrust::system::detail::generic::select_system;

  // select_system(cuda::tag, cpp::tag) should return cuda_to_cpp
  bool is_cuda_to_cpp = is_same(thrust::system::cuda::detail::cuda_to_cpp(), select_system(thrust::cuda::tag(), thrust::cpp::tag()));
  ASSERT_EQUAL(true, is_cuda_to_cpp);
}
DECLARE_UNITTEST(TestSelectSystemCudaToCpp);

Test host_system_tag rather than cpp::tag

#include <unittest/unittest.h>
#include <thrust/system/cuda/memory.h>

template<typename T1, typename T2>
bool is_same(const T1 &, const T2 &)
{
  return false;
}

template<typename T>
bool is_same(const T &, const T &)
{
  return true;
}

void TestSelectSystemCudaToCpp()
{
  using thrust::system::detail::generic::select_system;

  // select_system(cuda::tag, thrust::host_system_tag) should return cuda_to_cpp
  bool is_cuda_to_cpp = is_same(thrust::system::cuda::detail::cuda_to_cpp(), select_system(thrust::cuda::tag(), thrust::host_system_tag()));
  ASSERT_EQUAL(true, is_cuda_to_cpp);
}
DECLARE_UNITTEST(TestSelectSystemCudaToCpp);


#include <agency/cuda/execution_policy.hpp>
#include <cstdio>

struct kernel
{
  __device__
  void operator()(agency::parallel_group<agency::cuda::concurrent_agent>& self)
  {
    printf("hello from {%d, %d}\n", (int)self.outer().index(), (int)self.inner().index());
  }
};

auto grid(size_t num_blocks, size_t num_threads)
  -> decltype(
       agency::cuda::par(num_blocks, agency::cuda::con(num_threads))
     )
{
  return agency::cuda::par(num_blocks, agency::cuda::con(num_threads));
}

int main()
{
  bulk_invoke(grid(2,32), kernel());

  return 0;
}

Implement 2-dimensional grids, but leave commented out

#include <agency/cuda/execution_policy.hpp>
#include <cstdio>

struct kernel
{
  __device__
  void operator()(agency::parallel_group<agency::cuda::concurrent_agent>& self)
  {
    printf("hello from {%d, %d}\n", (int)self.outer().index(), (int)self.inner().index());
  }

  __device__
  void operator()(agency::parallel_group_2d<agency::cuda::concurrent_agent_2d>& self)
  {
  }
};

auto grid(size_t num_blocks, size_t num_threads)
  -> decltype(
       agency::cuda::par(num_blocks, agency::cuda::con(num_threads))
     )
{
  return agency::cuda::par(num_blocks, agency::cuda::con(num_threads));
}

//using parallel_execution_policy_2d = agency::cuda::detail::basic_execution_policy<agency::cuda::parallel_agent_2d, agency::cuda::parallel_executor>;
//const parallel_execution_policy_2d par_2d{};
//
//using concurrent_execution_policy_2d = agency::cuda::detail::basic_execution_policy<agency::cuda::concurrent_agent_2d, agency::cuda::block_executor>;
//const concurrent_execution_policy_2d con_2d{};
//
//// XXX eliminate the need for these specializations
//namespace agency
//{
//
//template<>
//struct is_execution_policy<parallel_execution_policy_2d> : std::true_type {};
//
//template<>
//struct is_execution_policy<concurrent_execution_policy_2d> : std::true_type {};
//
//}
//
//
//auto grid(agency::size2 num_blocks, agency::size2 num_threads)
//  -> decltype(
//       par_2d(num_blocks, con_2d(num_threads))
//     )
//{
//  return par_2d(num_blocks, con_2d(num_threads));
//}

int main()
{
  bulk_invoke(grid(2,32), kernel());

  // XXX this takes too long to compile
  //agency::cuda::bulk_invoke(grid({1,2}, {1,32}), kernel());

  return 0;
}


#include "grid_gpu.cuh"
#include "halide_buf.h"

extern "C"
int nvGridder(const double _scale, const int32_t _grid_size, buffer_t *_vis_buffer, buffer_t *_gcf_buffer, buffer_t *_uvg_buffer){
  gridGPUc( _scale
          , reinterpret_cast<CmplxType*>(_uvg_buffer->host)
          , reinterpret_cast<combined*>(_vis_buffer->host)
          , _vis_buffer->extent[1]
          , _grid_size
          , reinterpret_cast<CmplxType*>(_gcf_buffer->host)
          );
  return 0;
}

Prepare NVidia gridder's Halide veneer to be used as drop-in replacement for the true Halide kernels.

#include "grid_gpu.cuh"
#include "halide_buf.h"

extern "C"
int nvGridder(const double _scale, const int32_t _grid_size, buffer_t *_vis_buffer, buffer_t *_gcf_buffer, buffer_t *_uvg_buffer){
  // FIXME: make gridGPUx respect buffers locations, i.e.
  // to check if they already are on GPU and skip allocation and marshaling then
  gridGPUc( _scale
          , reinterpret_cast<CmplxType*>(_uvg_buffer->host)
          , reinterpret_cast<combined*>(_vis_buffer->host)
          , _vis_buffer->extent[1]
          , _grid_size
          , reinterpret_cast<CmplxType*>(_gcf_buffer->host)
          );
  _vis_buffer->dev = 0;
  _vis_buffer->host_dirty = false;
  _gcf_buffer->dev = 0;
  _gcf_buffer->host_dirty = false;

  _uvg_buffer->dev = 0;
  _uvg_buffer->host_dirty = false;
  _uvg_buffer->dev_dirty = false;

  return 0;
}


/* rapt - RichieSam's Adventures in Path Tracing
 *
 * rapt is the legal property of Adrian Astley
 * Copyright Adrian Astley 2015
 */

#include "basic_path_tracer/path_trace.cuh"

uint32 WangHash(uint32 a) {
    a = (a ^ 61) ^ (a >> 16);
    a = a + (a << 3);
    a = a ^ (a >> 4);
    a = a * 0x27d4eb2d;
    a = a ^ (a >> 15);
    return a;
}

void PathTraceNextFrame(void *buffer, uint width, uint height, size_t pitch, DeviceCamera *camera, Scene::SceneObjects *sceneObjects, uint frameNumber) {
	cudaError_t error = cudaSuccess;

	dim3 Db = dim3(16, 16);   // block dimensions are fixed to be 256 threads
	dim3 Dg = dim3((width + Db.x - 1) / Db.x, (height + Db.y - 1) / Db.y);

	PathTraceKernel<<<Dg, Db>>>((unsigned char *)buffer, width, height, pitch, camera, sceneObjects, WangHash(frameNumber));

	error = cudaGetLastError();
	if (error != cudaSuccess) {
		//exit(error);
	}
}

Add comments to further explain the file arraignment of the kernel code

/* rapt - RichieSam's Adventures in Path Tracing
 *
 * rapt is the legal property of Adrian Astley
 * Copyright Adrian Astley 2015
 */

#include "basic_path_tracer/path_trace.cuh"

uint32 WangHash(uint32 a) {
    a = (a ^ 61) ^ (a >> 16);
    a = a + (a << 3);
    a = a ^ (a >> 4);
    a = a * 0x27d4eb2d;
    a = a ^ (a >> 15);
    return a;
}

/**
 * Any code that uses CUDA semantics has to be a .cu/.cuh file. Instead of forcing
 * the entire project to be .cu/.cuh files, we can just wrap each cuda kernel launch
 * in a function. We forward declare the function in other parts of the project and
 * implement the functions here, in this .cu file.
 */
void PathTraceNextFrame(void *buffer, uint width, uint height, size_t pitch, DeviceCamera *camera, Scene::SceneObjects *sceneObjects, uint frameNumber) {
	cudaError_t error = cudaSuccess;

	dim3 Db = dim3(16, 16);   // block dimensions are fixed to be 256 threads
	dim3 Dg = dim3((width + Db.x - 1) / Db.x, (height + Db.y - 1) / Db.y);

	// The actual kernel launch call
	PathTraceKernel<<<Dg, Db>>>((unsigned char *)buffer, width, height, pitch, camera, sceneObjects, WangHash(frameNumber));

	error = cudaGetLastError();
	if (error != cudaSuccess) {
		//exit(error);
	}
}


/* originally from http://people.maths.ox.ac.uk/gilesm/ and modified */

//
// include files
//

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

#include <cutil_inline.h>

#include "prac5.h"

//
// kernel routine
//

__global__ void my_first_kernel(float *x)
{
  int tid = threadIdx.x + blockDim.x*blockIdx.x;

  x[tid] = threadIdx.x;
}

//
// CUDA routine to be called by main code
//

int prac5(int nblocks, int nthreads)
{
  float *h_x, *d_x;
  int   nsize, n;

  // allocate memory for arrays

  nsize = nblocks*nthreads ;

  h_x = (float *)malloc(nsize*sizeof(float));
  cudaMalloc((void **)&d_x, nsize*sizeof(float));

  // execute kernel

  my_first_kernel<<<nblocks,nthreads>>>(d_x);

  // copy back results and print them out

  cudaMemcpy(h_x,d_x,nsize*sizeof(float),cudaMemcpyDeviceToHost);

  for (n=0; n<nsize; n++) printf(" n,  x  =  %d  %f \n",n,h_x[n]);

  // free memory

  cudaFree(d_x);
  free(h_x);

  return 0;
}

Remove dependence on the CUDA SDK

/* originally from http://people.maths.ox.ac.uk/gilesm/ and modified */

//
// include files
//

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

#include <cuda.h>
#include "prac5.h"

//
// kernel routine
//

__global__ void my_first_kernel(float *x)
{
  int tid = threadIdx.x + blockDim.x*blockIdx.x;

  x[tid] = threadIdx.x;
}

//
// CUDA routine to be called by main code
//

int prac5(int nblocks, int nthreads)
{
  float *h_x, *d_x;
  int   nsize, n;

  // allocate memory for arrays

  nsize = nblocks*nthreads ;

  h_x = (float *)malloc(nsize*sizeof(float));
  cudaMalloc((void **)&d_x, nsize*sizeof(float));

  // execute kernel

  my_first_kernel<<<nblocks,nthreads>>>(d_x);

  // copy back results and print them out

  cudaMemcpy(h_x,d_x,nsize*sizeof(float),cudaMemcpyDeviceToHost);

  for (n=0; n<nsize; n++) printf(" n,  x  =  %d  %f \n",n,h_x[n]);

  // free memory

  cudaFree(d_x);
  free(h_x);

  return 0;
}


// Copyright (c) 2009-2019 The Regents of the University of Michigan
// This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.

// Maintainer: dnlebard

#include "hoomd/ParticleData.cuh"
#include "hoomd/HOOMDMath.h"
#include "hoomd/BondedGroupData.cuh"

/*! \file HarmonicDihedralForceGPU.cuh
    \brief Declares GPU kernel code for calculating the harmonic dihedral forces. Used by HarmonicDihedralForceComputeGPU.
*/

#ifndef __HARMONICDIHEDRALFORCEGPU_CUH__
#define __HARMONICDIHEDRALFORCEGPU_CUH__

//! Kernel driver that computes harmonic dihedral forces for HarmonicDihedralForceComputeGPU
cudaError_t gpu_compute_harmonic_dihedral_forces(Scalar4* d_force,
                                                 Scalar* d_virial,
                                                 const unsigned int virial_pitch,
                                                 const unsigned int N,
                                                 const Scalar4 *d_pos,
                                                 const BoxDim& box,
                                                 const group_storage<4> *tlist,
                                                 const unsigned int *dihedral_ABCD,
                                                 const unsigned int pitch,
                                                 const unsigned int *n_dihedrals_list,
                                                 Scalar5 *d_params,
                                                 unsigned int n_dihedral_types,
                                                 int block_size);

#endif

Revert datatype for scalar d_params

// Copyright (c) 2009-2019 The Regents of the University of Michigan
// This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.

// Maintainer: dnlebard

#include "hoomd/ParticleData.cuh"
#include "hoomd/HOOMDMath.h"
#include "hoomd/BondedGroupData.cuh"

/*! \file HarmonicDihedralForceGPU.cuh
    \brief Declares GPU kernel code for calculating the harmonic dihedral forces. Used by HarmonicDihedralForceComputeGPU.
*/

#ifndef __HARMONICDIHEDRALFORCEGPU_CUH__
#define __HARMONICDIHEDRALFORCEGPU_CUH__

//! Kernel driver that computes harmonic dihedral forces for HarmonicDihedralForceComputeGPU
cudaError_t gpu_compute_harmonic_dihedral_forces(Scalar4* d_force,
                                                 Scalar* d_virial,
                                                 const unsigned int virial_pitch,
                                                 const unsigned int N,
                                                 const Scalar4 *d_pos,
                                                 const BoxDim& box,
                                                 const group_storage<4> *tlist,
                                                 const unsigned int *dihedral_ABCD,
                                                 const unsigned int pitch,
                                                 const unsigned int *n_dihedrals_list,
                                                 Scalar4 *d_params,
                                                 unsigned int n_dihedral_types,
                                                 int block_size);

#endif