text:
<!DOCTYPE html>

	<meta charset="utf-8">

	<title>Class PVLog\Classes\Json\Instance | PV-Log JSON 1.1</title>

	<link rel="stylesheet" href="resources/style.css?c2f33731c1948fbed7c333554678bfa68d4817da">

		Overview

Namespaces

						PVLog

						Classes

						Json

Classes

BatteryChargeStatus

BatteryIn

BatteryOut

EnergyMeter

FeedIn

GridConsumption

Helper

Instance

Inverter

Irradiation

Json

Plant

PowerSensor

Properties

SelfConsumption

Set

Strings

Temperature

TotalConsumption

	<form id="search">
		<input type="hidden" name="cx" value="">
		<input type="hidden" name="ie" value="UTF-8">
		<input type="text" name="q" class="text" placeholder="Search">
	</form>

				Overview

				Namespace

Class

				Tree

						Todo

				Download

Class Instance

Top class for plant installation

			PVLog\Classes\Json\Json

PVLog\Classes\Json\Instance

		Namespace: PVLog\Classes\Json

				License:
				MIT License (MIT)

				Author:
				Knut Kohl kohl@top50-solar.de

				Version:
				PVLog JSON 1.1

				Since:
				2015-03-14

				Since:
				v1.0.0

			Located at Classes/Json/Instance.php

Methods summary

			 public static

		#
		fromJsonFile( string <var>$filename</var> )

Build an Instance from JSON file

Build an Instance from JSON file

Parameters

<var>$filename</var>

JSON file name to build from

Throws

					InvalidArgumentException
on missing JSON file

			 public static

		#
		fromJson( string <var>$json</var> )

Build an Instance from JSON string

Build an Instance from JSON string

Parameters

<var>$json</var>

JSON string to build from

Throws

					InvalidArgumentException
on invalid JSON

			 public

		#
		__construct( array <var>$data</var> = array() )

Class constructor

Class constructor

Parameters

<var>$data</var>

Data to build from

Overrides

PVLog\Classes\Json\Json::__construct()

			 public

			PVLog\Classes\Json\Instance

		#
		setCreator( string <var>$creator</var> )

Setter for creator, must be not empty

Setter for creator, must be not empty

Parameters

<var>$creator</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			string

		#
		getCreator( )

Getter for creator

Getter for creator

Returns

					string

			 public

			PVLog\Classes\Json\Instance

		#
		setTypeMinutes( )

Set file type to 'minutes'

Set file type to 'minutes'

Set also the correct datetime format for output:

Y-m-d H:i:s

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\Instance

		#
		setTypeDays( )

Set file type to 'days'

Set file type to 'days'

Set also the correct datetime format for output:

Y-m-d

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\Instance

		#
		setTypeMonths( )

Set file type to 'months'

Set file type to 'months'

Set also the correct datetime format for output:

Y-m

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			string

		#
		getType( )

Getter for file type

Getter for file type

Returns

					string

			 public

			PVLog\Classes\Json\Instance

		#
		setDeleteDayBeforeImport( integer <var>$delete</var> = 1 )

Setter for deleteDayBeforeImport

Setter for deleteDayBeforeImport

Parameters

<var>$delete</var>

Default 1

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			integer

		#
		getDeleteDayBeforeImport( )

Getter for deleteDayBeforeImport

Getter for deleteDayBeforeImport

Returns

					integer
(0|1)

			 public

			PVLog\Classes\Json\Instance

		#
		setPlant( PVLog\Classes\Json\Plant <var>$data</var> )

Setter for plant section

Setter for plant section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\Plant|null

		#
		getPlant( )

Getter for plant section

Getter for plant section

Returns

					PVLog\Classes\Json\Plant|null

			 public

			PVLog\Classes\Json\Instance

		#
		setFeedIn( PVLog\Classes\Json\FeedIn <var>$data</var> )

Setter for feed in section

Setter for feed in section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\FeedIn|null

		#
		getFeedIn( )

Getter for feed in section

Getter for feed in section

Returns

					PVLog\Classes\Json\FeedIn|null

			 public

			PVLog\Classes\Json\Instance

		#
		setGridConsumption( PVLog\Classes\Json\GridConsumption <var>$data</var> )

Setter for grid consumption section

Setter for grid consumption section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\GridConsumption|null

		#
		getGridConsumption( )

Getter for grid consumption section

Getter for grid consumption section

Returns

					PVLog\Classes\Json\GridConsumption|null

			 public

			PVLog\Classes\Json\Instance

		#
		setTotalConsumption( PVLog\Classes\Json\TotalConsumption <var>$data</var> )

Setter for total consumption section

Setter for total consumption section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\TotalConsumption|null

		#
		getTotalConsumption( )

Getter for grid consumption section

Getter for grid consumption section

Returns

					PVLog\Classes\Json\TotalConsumption|null

			 public

			PVLog\Classes\Json\Instance

		#
		setSelfConsumption( PVLog\Classes\Json\SelfConsumption <var>$data</var> )

Setter for self consumption section

Setter for self consumption section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\SelfConsumption|null

		#
		getSelfConsumption( )

Getter for self consumption section

Getter for self consumption section

Returns

					PVLog\Classes\Json\SelfConsumption|null

			 public

			PVLog\Classes\Json\Instance

		#
		setIrradiation( PVLog\Classes\Json\Irradiation <var>$data</var> )

Setter for Irradiation section

Setter for Irradiation section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\Irradiation|null

		#
		getIrradiation( )

Setter for Irradiation section

Setter for Irradiation section

Returns

					PVLog\Classes\Json\Irradiation|null

			 public

			PVLog\Classes\Json\Instance

		#
		setTemperature( PVLog\Classes\Json\Temperature <var>$data</var> )

Setter for temperature section

Setter for temperature section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\Temperature|null

		#
		getTemperature( )

Getter for temperature section

Getter for temperature section

Returns

					PVLog\Classes\Json\Temperature|null

			 public

			PVLog\Classes\Json\Instance

		#
		setBatteryIn( PVLog\Classes\Json\BatteryIn <var>$data</var> )

Setter for battery input section

Setter for battery input section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\BatteryIn|null

		#
		getBatteryIn( )

Getter for battery input section

Getter for battery input section

Returns

					PVLog\Classes\Json\BatteryIn|null

			 public

			PVLog\Classes\Json\Instance

		#
		setBatteryOut( PVLog\Classes\Json\BatteryOut <var>$data</var> )

Setter for battery output section

Setter for battery output section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\BatteryOut|null

		#
		getBatteryOut( )

Getter for battery output section

Getter for battery output section

Returns

					PVLog\Classes\Json\BatteryOut|null

			 public

			PVLog\Classes\Json\Instance

		#
		setBatteryChargeStatus( PVLog\Classes\Json\BatteryChargeStatus <var>$data</var> )

Setter for battery charge status section

Setter for battery charge status section

Parameters

<var>$data</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			PVLog\Classes\Json\BatteryChargeStatus|null

		#
		getBatteryChargeStatus( )

Getter for battery charge status section

Getter for battery charge status section

Returns

					PVLog\Classes\Json\BatteryChargeStatus|null

			 public

			PVLog\Classes\Json\Instance

		#
		setPrettyJson( boolean <var>$pretty</var> )

Setter for global pretty JSON flag

Setter for global pretty JSON flag

Parameters

<var>$pretty</var>

Returns

					PVLog\Classes\Json\Instance
For fluid interface

			 public

			string|false

		#
		asJson( boolean <var>$pretty</var> = null )

Return a JSON repesentation of the whole instance

Return a JSON repesentation of the whole instance

Parameters

<var>$pretty</var>

Pretty print JSON, if not provided fallback to $prettyJson

Returns

					string|false
Return FALSE on error encoding data to JSON

			 public

			string|false

		#
		asJsonRaw( boolean <var>$pretty</var> = null )

Return a JSON repesentation of the whole instance, not interpolated

Return a JSON repesentation of the whole instance, not interpolated

Parameters

<var>$pretty</var>

Pretty print JSON, if not provided fallback to $prettyJson

Returns

					string|false
Return FALSE on error encoding data to JSON

			 public

			integer

		#
		saveJsonToFile( string <var>$filename</var>, boolean <var>$pretty</var> = null )

Save the JSON representation to a file

Save the JSON representation to a file

Parameters

<var>$filename</var>

File name to save to

<var>$pretty</var>

Pretty print JSON

Returns

					integer
Bytes written to file

			 public

			integer

		#
		saveJsonRawToFile( string <var>$filename</var>, boolean <var>$pretty</var> = null )

Save the JSON representation to a file, not interpolated

Save the JSON representation to a file, not interpolated

Parameters

<var>$filename</var>

File name to save to

<var>$pretty</var>

Pretty print JSON

Returns

					integer
Bytes written to file

			 public

			string

		#
		__toString( )

Return the whole instance as JSON string for string type cast

Return the whole instance as JSON string for string type cast

Returns

					string

Example

$instance = new PVLog\Classes\Json\Instance;
echo $instance;

			 public

			array

		#
		asArray( integer <var>$flags</var> = 0 )

Return the whole data recursive as array

Return the whole data recursive as array

Parameters

<var>$flags</var>

Feature flags, see PVLog\JSON2 constants

Returns

					array

Overrides

PVLog\Classes\Json\Json::asArray()

			 public

			array

		#
		merge( PVLog\Classes\Json\Instance <var>$new</var> )

Merge delta data array into a given array

Merge delta data array into a given array

Parameters

<var>$new</var>

Data to merge

Returns

					array
Returns the merged data array

Throws

					InvalidArgumentException

Todo

						Respect deleteDayBeforeImport loads

Methods inherited from PVLog\Classes\Json\Json

			__get(),
			__set(),
			add(),
			get(),
			interpolate(),
			set()

Properties summary

			public static
			integer

				<var>$aggregation</var>

Aggregation level for data in seconds, issue #11

Aggregation level for data in seconds, issue #11

Data

							integer

				#
				300

			protected
			boolean

				<var>$prettyJson</var>

Export prettified JSON, only way to manipulate output via __toString()

Export prettified JSON, only way to manipulate output via __toString()

See

							PVLog\Classes\Json\Instance::__toString()

				#
				false

			protected
			array

				<var>$validSections</var>

Valid child property sections

Valid child property sections

				#
				array(
    Properties::PLANT,
    Properties::FEED_IN,
    Properties::GRID_CONSUMPTION,
    Properties::TOTAL_CONSUMPTION,
    Properties::SELF_CONSUMPTION,
    Properties::IRRADIATION,
    Properties::TEMPERATURE,
    Properties::BATTERY_IN,
    Properties::BATTERY_OUT,
    Properties::BATTERY_CHARGE_STATUS
)

		PV-Log JSON 1.1 API documentation generated by ApiGen


text:
var PlayMusic = require('playmusic');
var Promise = require("bluebird");
var sleep = require('sleep');
var dict = require('./dict');
var _ = require('lodash');

var pm = new PlayMusic();
var playlistName = 'VK Music';

function GMusicImport(tryConvertToEn, pm) {
  var convToLat = function (str) {
    return [].map.call(str, function (c) {
      return c in dict ? dict[c] : c;
    }).join('');
  };

  var fixName = function (str) {
    return str.replace(/\(.*?\)/g, '').replace(/\[.*?\]/g, '').trim();
  };

  var getTrackInfo = function (songQuery) {
    return new Promise(function (resolve, reject) {
      pm.search(songQuery, 1, function (err, data) {
        if (err) return reject(err);
        var res = null;

        if (data.entries) {
          var trackInfoArr = _.filter(data.entries, function (val) {
            return val.type === '1';
          });
          res = trackInfoArr.length === 0 ? null : trackInfoArr[0];
        }

        console.log(['Track: ', songQuery, ' - ', res ? 'Found' : 'Not found'].join(''));
        resolve(res ? res.track : null);
      })
    })
  };

  return {
    importMusic: function (vkMusicArr) {
      var playlistId;

      return new Promise(function (resolve, reject) {
        pm.addPlayList(playlistName, function (err) {
          if (err) return reject(err);
          resolve();
        })
      })
        .then(function () {
          return new Promise(function (resolve, reject) {
            pm.getPlayLists(function (err, body) {
              if (err) return reject(err);
              resolve(body.data.items);
            })
          })
        })
        .then(function (playlistList) {
          return new Promise(function (resolve, reject) {
            var playlists = playlistList.filter(function (playlist) {
              return playlist.name === playlistName;
            });
            if (playlists.length === 0)
              reject(new Error('Error while trying to create a playlist!'));

            playlistId = playlists[0].id;
            resolve(vkMusicArr);
          })
        })
        .map(function (song) {
          var query = fixName([song.artist, song.title].join(' - ').toLowerCase());
          if (tryConvertToEn)
            query = convToLat(query);

          sleep.sleep(1);

          return getTrackInfo(query);
        }, {concurrency: 1})
        .map(function (track) {
          return new Promise(function (resolve, reject) {
            if (!track)
              return resolve();
            console.log(['Add to the playlist:', track.artist, '-', track.title].join(' '));

            pm.addTrackToPlayList(track.nid, playlistId, function (err) {
              if (err) return reject(err);

              resolve();
            });
            sleep.sleep(1);
          })
        }, {concurrency: 1})

    }
  }
}

module.exports = function (email, password, androidId, tryConvertToEn) {
  var obj = {
    email: email,
    password: password
  };
  if (androidId && androidId !== '')
    obj.androidId = androidId;

  return new Promise(function (resolve, reject) {
    pm.login(obj, function (err, obj) {
      if (err) return reject(err);
      resolve(obj);
    })
  })
    .then(function (obj) {
      return new Promise(function (resolve, reject) {
        pm.init(obj, function () {
          resolve(pm);
        })
      })
    })
    .then(GMusicImport.bind(this, tryConvertToEn))
    .catch(console.error)
};

redpajama_set_name: RedPajamaGithub


text:
import { AbstractExtractor } from './abstract-extractor';
import { GarlandToolsService } from '../../../../core/api/garland-tools.service';
import { DataType } from '../data-type';
import { Item } from '../../../../model/garland-tools/item';
import { ItemData } from '../../../../model/garland-tools/item-data';
import { FateData } from '../../model/fate-data';
import { LazyDataService } from '../../../../core/data/lazy-data.service';

export class FatesExtractor extends AbstractExtractor<FateData[]> {
  constructor(gt: GarlandToolsService, private lazyData: LazyDataService) {
    super(gt);
  }

  getDataType(): DataType {
    return DataType.FATES;
  }

  isAsync(): boolean {
    return false;
  }

  protected canExtract(item: Item): boolean {
    return item.fates !== undefined;
  }

  protected doExtract(item: Item, itemData: ItemData): FateData[] {
    return item.fates.map(f => {
      const fateData = this.lazyData.fates[f.toString()];
      const fate: FateData = {
        id: f,
        level: fateData.level
      };
      if (fateData.position) {
        fate.zoneId = fateData.position.zoneid;
        fate.coords = {
          x: fateData.position.x,
          y: fateData.position.y
        };
      }
      return fate;
    });
  }
}


text:
package core.annotation;

import core.graph.Node;
import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

import static org.junit.Assert.assertEquals;

/**
 * Test suite for the Annotation Parser class.
 *
 */
public class AnnotationProcessorTest {

    public List<Annotation> annotations;
    public HashMap<Integer, Node> nodeMap;
    public AnnotationProcessor ap;

    /**
     * Sets up annotation and node data.
     */
    @Before
    public void setUp() {
        Node n1 = new Node(1, "abc", 1);
        Node n2 = new Node(2, "def", 4);
        Node n3 = new Node(2, "xyz", 20);

        n1.setGenomes(Collections.singletonList("test.ref"));

        nodeMap = new HashMap<>();
        nodeMap.put(1, n1);
        nodeMap.put(2, n2);
        nodeMap.put(3, n3);

        Annotation a = new Annotation();
        a.setSeqid("test");
        a.setStart(2);
        a.setEnd(5);

        annotations = new ArrayList<>();
        annotations.add(a);
        ap = new AnnotationProcessor(nodeMap, annotations);
    }

    /**
     * tests the determineNodeMapSize method.
     */
    @Test
    public void testDetermineNodeMapSize() {
        assertEquals(3, ap.determineNodeMapSize(nodeMap));
    }

    /**
     * tests the filterAnnotationsInNodeMap method.
     */
    @Test
    public void testFilterAnnotationsInNodeMap() {
        HashMap<Integer, Node> map = new HashMap<>();

        Node n1 = new Node(1, "", 1);
        Node n2 = new Node(2, "", 2);

        n1.setGenomes(Collections.singletonList("test.ref"));

        map.put(1, n1);
        map.put(2, n2);

        HashMap<Integer, Node> res = ap.filterAnnotationsInNodeMap(map);
        assertEquals(1, res.size());
        assertEquals(n1, res.get(1));
    }

    /**
     * Tests the findAnnotation method.
     *
     * @throws AnnotationProcessor.TooManyAnnotationsFoundException throw exception on too many
     * matching annotations.
     */
    @Test
    public void testFindAnnotation() throws AnnotationProcessor.TooManyAnnotationsFoundException {
        List<Annotation> annotationList = new ArrayList<>();
        Annotation a1 = new Annotation();
        Annotation a2 = new Annotation();

        a1.setDisplayNameAttr("test1");
        a2.setDisplayNameAttr("test2");

        annotationList.add(a1);
        annotationList.add(a2);

        try {
            assertEquals(a2, AnnotationProcessor.findAnnotation(annotationList, "test2"));
        } catch (AnnotationProcessor.NoAnnotationsFoundException e) {
            e.printStackTrace();
        }
    }

    /**
     * Tests the findAnnotation method with too many matching annotations.
     *
     * @throws AnnotationProcessor.TooManyAnnotationsFoundException throw exception on too many
     * matching annotations.
     */
    @Test(expected = AnnotationProcessor.TooManyAnnotationsFoundException.class)
    public void testFindAnnotationMultipleMatches()
            throws AnnotationProcessor.TooManyAnnotationsFoundException {
        List<Annotation> annotationList = new ArrayList<>();
        Annotation a1 = new Annotation();
        Annotation a2 = new Annotation();

        a1.setDisplayNameAttr("test");
        a2.setDisplayNameAttr("test");

        annotationList.add(a1);
        annotationList.add(a2);

        try {
            AnnotationProcessor.findAnnotation(annotationList, "test");
        } catch (AnnotationProcessor.NoAnnotationsFoundException e) {
            e.printStackTrace();
        }
    }

    /**
     * Tests the findAnnotation method with no matching annotations.
     *
     * @throws AnnotationProcessor.TooManyAnnotationsFoundException throw exception on too many
     * matching annotations.
     * @throws AnnotationProcessor.NoAnnotationsFoundException throw exception on no matchig annotations found.
     */
    @Test(expected = AnnotationProcessor.NoAnnotationsFoundException.class)
    public void testFindAnnotationNoMatch()
            throws AnnotationProcessor.TooManyAnnotationsFoundException,
            AnnotationProcessor.NoAnnotationsFoundException {
        List<Annotation> annotationList = new ArrayList<>();
        Annotation a1 = new Annotation();
        Annotation a2 = new Annotation();

        a1.setDisplayNameAttr("test1");
        a2.setDisplayNameAttr("test2");

        annotationList.add(a1);
        annotationList.add(a2);

        AnnotationProcessor.findAnnotation(annotationList, "abc");
    }

    /**
     * Tests the getAnnotations method.
     */
    @Test
    public void testGetAnnotations() {
        assertEquals(annotations, ap.getAnnotations());
    }

}


text: SNDBOX as a service


text:
/**
 * Returns the nearest power of 2 to the given `value`.
 *
 * @function Phaser.Math.Pow2.GetPowerOfTwo
 * @since 3.0.0
 *
 * @param {number} value - The value.
 *
 * @return {integer} The nearest power of 2 to `value`.
 */
var GetPowerOfTwo = function (value)
{
    var index = Math.log(value) / 0.6931471805599453;

    return (1 << Math.ceil(index));
};

module.exports = GetPowerOfTwo;


text:
Stepper Platforms in MPF
========================

The following platforms allow controlling steppers in MPF:

* :doc:`P3-Roc and P-Roc via PD-LED <multimorphic/steppers>`
* :doc:`Trinamics Steprocker <trinamics/index>`
* :doc:`StepStick Steppers <stepstick/index>`
* :doc:`Pololu Tic <pololu_tic/index>`

Overview video about :doc:`steppers </mechs/steppers/index>`:

.. youtube:: YaRNBU0OHGc


text:
package common.routes.frontend

import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route

class FrontendRoute {

  val routes: Route = (path("public" / Segment) & get) {
    str =>
      getFromResource(s"public/$str")
  }
}


text:
namespace LogicGraph
{
    /// <summary>
    /// A logic graph is a collection of nodes connected in an order
    /// wherein nodes have inputs and outputs.
    /// </summary>
    class LogicGraph
    {
        struct Node;

    public:

        typedef unsigned Key;
        typedef std::shared_ptr<Node> S_Ptr;
        typedef std::weak_ptr<Node> W_Ptr;
        typedef std::map<Key,S_Ptr> S_Map;
        typedef std::map<Key,W_Ptr> W_Map;
        typedef std::function<int(int,int)> Gate;
        typedef S_Ptr* S_Vec;
        typedef W_Ptr* W_Vec;
        typedef std::unordered_set<Key> Set;
        typedef char SByte;

    private:

        /// <summary>
        /// A node for a logic graph.
        /// </summary>
        struct Node : std::enable_shared_from_this<Node>
        {
        protected:

            Node() = delete;

            Node(Key k)
            {
                key = k;
            }

        public:

            /// <summary>
            /// Returns the output of the gate based on the inputs.
            /// </summary>
            /// <returns>
            ///  0: False
            ///  1: True
            /// -1: No inputs
            /// -2: A higher node returned an error
            /// </returns>
            virtual SByte output() = 0;

            /// <summary>
            /// Adds an input to the map of inputs.
            /// </summary>
            /// <returns>
            ///  0: Success
            ///  1: Input already exists
            ///  2: Given key is an output (recursion)
            ///  3: (for inverter) Already has an input
            /// -1: (for input) This is an input node, it cannot have an input added
            /// </returns>
            virtual SByte addInput(Key k,W_Ptr value) = 0;

            /// <summary>
            /// Removes an input from the map of inputs.
            /// </summary>
            /// <params>
            /// k: The key of the input to remove.
            /// remOut: Whether or not to remove this node from the outputs list of the input being removed.
            /// </params>
            /// <returns>
            ///  0: Success
            /// -1: Node has no inputs.
            /// -2: Passed key is not an input.
            /// -3: This gate is not an output to passed input.
            /// -4: (for input) This is an input node, it cannot have an input removed
            /// </returns>
            virtual SByte removeInput(Key k,bool remOut = true) = 0;

            /// <summary>
            /// Adds an output to the map of outputs.
            /// </summary>
            /// <returns>
            ///  0: Success
            /// </returns>
            SByte addOutput(Key k,W_Ptr value)
            {
                outputs[k] = value;

                return 0;
            }

            /// <summary>
            /// Removes an output from the map of outputs.
            /// </summary>
            /// <returns>
            ///  0: Success
            /// -1: No outputs
            /// -2: Output does not exist
            /// </returns>
            SByte removeOutput(Key k)
            {
                if(outputs.count(k) <= 0) return -2;

                if(outputs.size() == 0) return -1;

                outputs.erase(k);

                return 0;
            }

            /// <summary>
            /// Removes all inputs and all outputs.
            /// </summary>
            /// <returns>
            /// -2: An input does not list this as an output.
            /// -1: An output does not list this as an input.
            ///  0: Success
            /// </returns>
            virtual SByte disconnect()
            {
                SByte ret = 0;

                invalidateOutput();

                for(auto a : outputs){
                    auto p = a.second.lock();
                    SByte c = p->removeInput(key,false);

                    if(c == -1) ret = -1;
                }

                outputs.clear();

                return ret;
            }

            /// <summary>
            /// Returns the key of this gate.
            /// </summary>
            Key getKey() const
            {
                return key;
            }

            /// <summary>
            /// Invalidates any outputs.
            /// </summary>
            virtual void invalidateOutput()
            {
                for(auto a : outputs){

                    auto p = a.second.lock();
                    p->invalidateOutput();

                }
            }

        protected:

            W_Map outputs;

            Key key;

            /// <summary>
            /// Checks if any of the passed node is an output to any of the nodes along the tree.
            /// </summary>
            static bool isOutput(W_Ptr current,Key node)
            {
                auto p = current.lock();

                if(p->outputs.size() == 0) return false;

                if(p->outputs.count(node) > 0) return true;

                for(auto a : p->outputs){

                    if(isOutput(a.second,node)) return true;
                }

                return false;
            }
        };

        struct GateNode : Node
        {
            GateNode(Key k,Gate g) : Node(k)
            {
                gate = g;
            }

            SByte output()
            {
                if(inputs.begin() == inputs.end()){

                    return -1;//No inputs.
                }

                if(storedOutput == -1){

                    int Ts = 0;
                    int Fs = 0;

                    for(auto a : inputs){

                        auto p = a.second.lock();
                        SByte o = p->output();
                        if(o < 0) return o;
                        o ? ++Ts : ++Fs;
                    }

                    storedOutput = gate(Ts,Fs);
                }

                return storedOutput;
            }

            void invalidateOutput()
            {
                storedOutput = -1;

                Node::invalidateOutput();
            }

            SByte addInput(Key k,W_Ptr value)
            {
                if(inputs.count(k) > 0) return 1;
                else if(isOutput(shared_from_this(),k)) return 2;

                inputs[k] = value;

                value.lock()->addOutput(key,shared_from_this());

                invalidateOutput();

                return 0;
            }

            SByte removeInput(Key k,bool removeOut = true)
            {
                if(inputs.size() == 0) return -1;
                if(inputs.count(k) == 0) return -2;

                if(removeOut){
                    SByte c = inputs[k].lock()->removeOutput(key);
                    if(c < 0) return -3;
                }
                inputs.erase(k);

                invalidateOutput();

                return 0;
            }

            SByte disconnect()
            {
                std::list<Key>inputKs;
                for(auto a : inputs){
                    inputKs.push_back(a.first);
                }

                for(auto a : inputKs){
                    SByte c = inputs[a].lock()->removeOutput(key);

                    if(c < 0) return -2;
                }

                inputs.clear();

                return Node::disconnect();
            }

        private:

            SByte storedOutput;
            Gate gate;
            W_Map inputs;
        };

        struct InverterNode : Node
        {
            InverterNode(Key k) : Node(k)
            {
                input.reset();
            }

            SByte output()
            {
                auto ip = input.lock();

                if(ip == nullptr) return -1;

                SByte lastOut = ip->output();

                if(lastOut < 0) return lastOut;

                return lastOut == 0 ? 1 : 0;
            }

            SByte addInput(Key k,W_Ptr value)
            {
                auto ip = input.lock();
                auto iv = value.lock();
                if(input.lock() == value.lock()) return 1;
                if(isOutput(shared_from_this(),k)) return 2;
                if(ip != nullptr) return 3;
                input = value;
                iv->addOutput(key,shared_from_this());
                invalidateOutput();
                return 0;
            }

            SByte removeInput(Key k, bool remOut = true)
            {
                auto ip = input.lock();

                if(ip == nullptr) return -1;

                if(ip->getKey() == k){
                    if(remOut) ip->removeOutput(key);
                    input.reset();
                    return 0;
                }
                else return -2;
            }

            SByte disconnect()
            {
                auto ip = input.lock();

                if(ip != nullptr){

                    SByte c = ip->removeOutput(key);
                    if(c < 0) return -2;
                    input.reset();
                }

                return Node::disconnect();
            }

        private:

            W_Ptr input;
        };

        struct InputNode : Node
        {
            InputNode(Key k,unsigned i) : Node(k)
            {
                index = i;
                myVal = false;
            }

            void setVal(bool b)
            {
                if(myVal != b){
                    myVal = b;
                    invalidateOutput();
                }
            }

            SByte addInput(Key k,W_Ptr value)
            {
                return -1;
            }

            SByte removeInput(Key k,bool b)
            {
                return -3;
            }

            SByte output() { return myVal ? 1 : 0; }

            unsigned getIndex() const
            {
                return index;
            }

        private:

            bool myVal;
            unsigned index;
        };

    public:

        struct Gates
        {
            static Gate AND;

            static Gate OR;

            static Gate NAND;

            static Gate NOR;

            static Gate XOR;
        };

        LogicGraph() = delete;

        LogicGraph(unsigned inputCount,unsigned outputCount)
        {
            currentKey = 1;
            inputs = new S_Ptr[inputCount];

            for(unsigned i = 0; i < inputCount; ++i){

                Key k = currentKey++;
                auto point = std::make_shared<InputNode>(k,i);
                inputs[i] = point;
                nodes[k] = point;
                inKeys.insert(k);
            }

            outputs = new S_Ptr[outputCount];
        }

        ~LogicGraph()
        {
            if(inputs != nullptr) delete [] inputs;
            if(outputs != nullptr) delete [] outputs;
        }

        Key addGate(Gate gate)
        {
            Key k = currentKey++;

            nodes[k] = std::make_shared<GateNode>(k,gate);

            return k;
        }

        Key addInverter()
        {
            Key k = currentKey++;

            nodes[k] = std::make_shared<InverterNode>(k);

            return k;
        }

        SByte connectGates(Key gate,Key input)
        {
            return nodes[gate]->addInput(input,nodes[input]);
        }

        SByte disconnectGates(Key gate,Key input)
        {
            return nodes[gate]->removeInput(input);
        }

        /// <summary>
        /// Removes the gate from the graph.
        /// </summary>
        /// <returns>
        /// -3: That key does not exist.
        /// -2: An input does not list this as an output. (from Node.disconnect)
        /// -1: An output does not list this as an input. (from Node.disconnect)
        ///  0: Success
        /// </returns>
        SByte removeGate(Key gate)
        {
            if(inKeys.count(gate) > 0){

                return -3;
            }

            SByte c = nodes[gate]->disconnect();

            if(c < 0) return c;

            nodes.erase(gate);

            return 0;
        }

        Key getInputKey(unsigned index)
        {
            return inputs[index]->getKey();
        }

        Key createKey()
        {
            return currentKey++;
        }

        void setInputVal(unsigned index,bool val)
        {
            auto ptr = (InputNode*)(inputs[index].get());

            ptr->setVal(val);

            ptr->invalidateOutput();
        }

        void openOutput(Key gate,unsigned index)
        {
            outputs[index] = nodes[gate];
        }

        void closeOutput(unsigned index)
        {
            outputs[index] = nullptr;
        }

        /// <summary>
        /// Returns the output with the given index.
        /// </summary>
        /// <returns>
        ///  0: False
        ///  1: True
        /// -1: No inputs (from Node.output)
        /// -2: A higher node returned an error (from Node.output)
        /// -3: An output does not exist.
        /// </returns>
        SByte getOutput(unsigned index)
        {
            if(outputs[index] == nullptr) return -3;

            return outputs[index]->output();
        }

        /// <summary>
        /// Returns the output of the gate based on the inputs.
        /// </summary>
        /// <returns>
        ///  0: False
        ///  1: True
        /// -1: No inputs
        /// -2: A higher node returned an error
        /// </returns>
        SByte testOutput(Key gate)
        {
            return nodes[gate]->output();
        }

        SByte inputToGate(Key gate, unsigned index)
        {
            return connectGates(gate,getInputKey(index));
        }

        SByte removeInputToGate(Key gate,unsigned index)
        {
            return disconnectGates(gate,getInputKey(index));
        }

        SByte removeConnection(Key gate0,Key gate1)
        {
            SByte c = nodes[gate0]->removeInput(gate1);

            if(c < -1) c = nodes[gate1]->removeInput(gate0);

            return c;
        }

    private:

        S_Map nodes;
        S_Vec inputs;
        S_Vec outputs;
        Key currentKey;
        Set inKeys;
    };

    #define Gate_Sig [](int Ts, int Fs)->int

    LogicGraph::Gate LogicGraph::Gates::AND = Gate_Sig
    {
        return Ts > 0 && Fs == 0 ? 1 : 0;
    };

    LogicGraph::Gate LogicGraph::Gates::OR = Gate_Sig
    {
        return Ts > 0 ? 1 : 0;
    };

    LogicGraph::Gate LogicGraph::Gates::NAND = Gate_Sig
    {
        return Fs > 0 ? 1 : 0;
    };

    LogicGraph::Gate LogicGraph::Gates::NOR = Gate_Sig
    {
        return Ts == 0 ? 1 : 0;
    };

    LogicGraph::Gate LogicGraph::Gates::XOR = Gate_Sig
    {
        return Ts == 1 ? 1 : 0;
    };
}

#endif//LOGIC_GRAPH


text:
class Sketch < Cask
  url 'http://www.bohemiancoding.com/download/sketch.zip'
  homepage 'http://www.bohemiancoding.com/sketch/'
  version 'latest'
  no_checksum
  link 'Sketch.app'
end


text:
import math
import pymel.core as pm

def spherize():
    sel = pm.selected()
    if not sel:
        pm.warning('Nothing is Selected')
    verts = prepSelection(sel)
    points = [p.getPosition(space='world') for p in verts]
    center = getCenter(points)
    normals = [n.getNormal() for n in verts]
    normalPlane = averageVector(normals)

    pointsNew = [projectOrtho(center, normalPlane, p) for p in points]

    radius = getDist(center, pointsNew)
    for i in range(len(pointsNew)):
        pointsNew[i] = sphere(center, radius, pointsNew[i])

    for i in range(len(pointsNew)):
        pointsNew[i] = linePlaneInter(points[i], normals[i], pointsNew[i], normalPlane)

    for i in range(len(verts)):
        verts[i].setPosition(pointsNew[i], space='world')

def prepSelection(sel):
    verts = pm.filterExpand(sel, selectionMask=31)
    if verts:
        pm.polySelectConstraint(pp=3, type=0x0001)
        verts = pm.ls(sl=True, fl=True)
        return verts

    edge = pm.filterExpand(sel, selectionMask=32)
    if edge:
        verts = pm.polyListComponentConversion(edge, fromEdge=True, toVertex=True)
        return verts

def getCenter(points):
    pointSum = pm.dt.Point(0, 0, 0)
    for v in points:
        pointSum = pointSum + v
    return pointSum / len(points)

def averageVector(vecs):
    vecSum = pm.dt.Vector(0, 0, 0)
    for v in vecs:
        vecSum = vecSum + v
    vecSum = vecSum / len(vecs)
    return vecSum.normal()

def projectOrtho(ctr, pNrm, point):
    vec = point - ctr
    dist = vec * pNrm
    offset = pNrm * dist
    return point - offset

def getDist(ctr, nPoint):
    dist = 0
    for p in nPoint:
        dist += length(ctr, p)
    dist = dist / len(nPoint)
    return dist

def length(ctr, p):
    d = 0.0
    for i in range(len(ctr)):
        d += (ctr[i] - p[i]) * (ctr[i] - p[i])
    return math.sqrt(d)

def sphere(center, radius, point):
    vec = point - center
    vec.normalize()
    vec = vec * radius
    return vec + center

def linePlaneInter(points, normals, pointsNew, normalPlane):
    pointsNew = pointsNew - (normalPlane * 10000000)
    t = ((points - pointsNew) * normals) / (normals * normalPlane)
    intersection = (normalPlane * t) + pointsNew
    return intersection


text:
<title>Welcome to CodeIgniter</title>

Welcome to CodeIgniter!

The page you are looking at is being generated dynamically by CodeIgniter.

If you would like to edit this page you'll find it located at:

system/application/views/welcome_message.php

The corresponding controller for this page is found at:

system/application/controllers/welcome.php

If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.

Page rendered in {elapsed_time} seconds


text:
package org.argus.amandroid.core.parser

import java.io.InputStream

import org.argus.jawa.core.util._
import java.io.IOException

import javax.xml.parsers.ParserConfigurationException
import org.xml.sax.SAXException
import javax.xml.parsers.DocumentBuilderFactory
import org.w3c.dom.{Node, NodeList}
import brut.androlib.res.data.ResTypeSpec
import brut.androlib.res.data.ResResSpec
import brut.androlib.res.decoder.ARSCDecoder.ARSCData
import org.argus.amandroid.core.ApkGlobal
import org.argus.jawa.core.elements.JawaType
import org.argus.jawa.core.JawaClass

/**
 * Parser for analyzing the layout XML files inside an android application
 *
 * adapted from Steven Arzt
 *
 * @author Fengguo Wei
 * @author Sankardas Roy
 */
class LayoutFileParser(apk: ApkGlobal, packageName: String, arsc: ARSCFileParser_apktool) {
  final val TITLE = "LayoutFileParser"
  private final val DEBUG = false

  private final val userControls: MMap[Int, LayoutControl] = mmapEmpty
  private final val callbackMethods: MMap[String, MSet[String]] = mmapEmpty
  private final val includes: MMap[String, MSet[Int]] = mmapEmpty

  val data: ARSCData = arsc.getData
  val typs: MMap[String, ResTypeSpec] = mmapEmpty
  import collection.JavaConverters._
  data.getPackages foreach { pkg =>
    try {
      val f = pkg.getClass.getDeclaredField("mTypes")
      f.setAccessible(true)
      typs ++= f.get(pkg).asInstanceOf[java.util.LinkedHashMap[String, ResTypeSpec]].asScala
    } catch {
      case ie: InterruptedException => throw ie
      case _: Exception =>
    }
  }

//  private final val TYPE_NUMBER_VARIATION_PASSWORD = 0x00000010
//  private final val TYPE_TEXT_VARIATION_PASSWORD = 0x00000080
//  private final val TYPE_TEXT_VARIATION_VISIBLE_PASSWORD = 0x00000090
//  private final val TYPE_TEXT_VARIATION_WEB_PASSWORD = 0x000000e0

  private def getLayoutClass(className: String): Option[JawaClass] = {
    var ar: Option[JawaClass] = apk.getClazz(new JawaType(className))
    if(ar.isEmpty || !this.packageName.isEmpty)
      ar = apk.getClazz(new JawaType(packageName + "." + className))
    if(ar.isEmpty)
      ar = apk.getClazz(new JawaType("android.widget." + className))
    if(ar.isEmpty)
      ar = apk.getClazz(new JawaType("android.webkit." + className))
    if(ar.isEmpty)
      apk.reporter.echo(TITLE, "Could not find layout class " + className)
    ar
  }

  private def isLayoutClass(theClass: Option[JawaClass]): Boolean = {
    if (theClass.isEmpty)
      return false
    // To make sure that nothing all wonky is going on here, we
    // check the hierarchy to find the android view class
    var found = false
    apk.getClassHierarchy.getAllSuperClassesOf(theClass.get).foreach{
      su =>
        if(su.getName.equals("android.view.ViewGroup"))
          found = true
    }
    found
  }

  private def isViewClass(theClass: Option[JawaClass]): Boolean = {
    if (theClass.isEmpty)
      return false
    // To make sure that nothing all wonky is going on here, we
    // check the hierarchy to find the android view class
    apk.getClassHierarchy.getAllSuperClassesOf(theClass.get).foreach{ su =>
      if(su.getName.equals("android.view.View") || su.getName.equals("android.webkit.WebView"))
        return true
    }
    apk.reporter.echo(TITLE, "Layout class " + theClass + " is not derived from " + "android.view.View")
    false
  }

  /**
   * Checks whether this name is the name of a well-known Android listener
   * attribute. This is a function to allow for future extension.
   * @param name The attribute name to check. This name is guaranteed to
   * be in the android namespace.
   * @return True if the given attribute name corresponds to a listener,
   * otherwise false.
   */
  private def isActionListener(name: String): Boolean = name.endsWith("onClick")

  private def visitLayoutNode(fileName: String, n: Node): (Int, Boolean) = {
    var id: Int = -1
    var isSensitive = false
    try {
      val attrs = n.getAttributes
      for(i <- 0 until attrs.getLength) {
        val attr = attrs.item(i)
        val nname = attr.getNodeName
        val ntyp = attr.getNodeType
        val nobj = attr.getNodeValue
        val n = nname.trim
        if(n.endsWith(":id")) {
          val index = nobj.asInstanceOf[String]
          id = getID(index).getOrElse(-1)
        }
        else if(n.endsWith(":password"))
          isSensitive = nobj.asInstanceOf[Int] != 0; // -1 for true, 0 for false
        else if(!isSensitive && n.endsWith(":inputType")) {
          val tp = nobj
          isSensitive = tp.contains("Password")
        } else if(isActionListener(n) && nobj.isInstanceOf[String]) {
          callbackMethods.getOrElseUpdate(fileName, msetEmpty) += nobj
        } else if(n.endsWith(":layout") && ntyp == Node.ELEMENT_NODE) {
          this.includes.getOrElseUpdate(fileName, msetEmpty) += Integer.parseInt(nobj)
        }
      }
    } catch {
      case _: Exception =>
    }
    (id, isSensitive)
  }

  private def isIndex(str: String): Boolean = str.startsWith("@")

  private def getTypeAndSpec(str: String): (String, String) = {
    val strs = str.substring(1).split("/")
    (strs(0), strs(1))
  }

  private def getID(index: String): Option[Int] = {
    if(isIndex(index)) {
      val (typ, spec) = getTypeAndSpec(index)
      typs.get(typ) match {
        case Some(t) =>
          val f = t.getClass.getDeclaredField("mResSpecs")
          f.setAccessible(true)
          val specs = f.get(t).asInstanceOf[java.util.LinkedHashMap[String, ResResSpec]].asScala.toMap
          specs.get(spec) match {
            case Some(s) =>
              return Some(s.getId.id)
            case None =>
          }
        case None =>
      }
    }
    None
  }

  def loadLayoutFromTextXml(fileName: String, layout_in: InputStream): Unit = {
    try {
      val db = DocumentBuilderFactory.newInstance().newDocumentBuilder()
      val doc = db.parse(layout_in)
      val rootElement = doc.getDocumentElement
      val worklistAlgorithm = new WorklistAlgorithm[NodeList] {
        override def processElement(cns: NodeList): Unit = {
          for(i <- 0 until cns.getLength) {
            val cn = cns.item(i)
            val nname = cn.getNodeName
            val theClass =
              if (nname != null && !nname.startsWith("#")) {
                getLayoutClass(nname.trim())
              } else None
            if (isLayoutClass(theClass) || isViewClass(theClass)) {
              val (id, isSensitive) = visitLayoutNode(fileName, cn)
              if (id > 0)
                userControls += (id -> LayoutControl(id, theClass.get.getType, isSensitive))
            }
            worklist = worklist :+ cn.getChildNodes
          }
        }
      }
      worklistAlgorithm.run(worklistAlgorithm.worklist :+= rootElement.getChildNodes)
    } catch {
      case ex: IOException =>
        System.err.println("Could not parse layout: " + ex.getMessage)
        if(DEBUG)
          ex.printStackTrace()
      case ex: ParserConfigurationException =>
        System.err.println("Could not parse layout: " + ex.getMessage)
        if(DEBUG)
          ex.printStackTrace()
      case ex: SAXException =>
        System.err.println("Could not parse layout: " + ex.getMessage)
        if(DEBUG)
          ex.printStackTrace()
    }
  }

  /**
   * Gets the user controls found in the layout XML file. The result is a
   * mapping from the id to the respective layout control.
   * @return The layout controls found in the XML file.
   */
  def getUserControls: IMap[Int, LayoutControl] = this.userControls.toMap

  /**
   * Gets the callback methods found in the layout XML file. The result is a
   * mapping from the file name to the set of found callback methods.
   * @return The callback methods found in the XML file.
   */
  def getCallbackMethods: IMap[FileResourceUri, ISet[String]] = this.callbackMethods.map{case (k, vs) => k -> vs.toSet}.toMap

  def getIncludes: IMap[FileResourceUri, ISet[Int]] = this.includes.map{case (k, vs) => k -> vs.toSet}.toMap
}


text:
<?php

namespace Ekyna\Bundle\CommerceBundle\Form\Type\Supplier;

use Ekyna\Bundle\AdminBundle\Form\Type\ResourceFormType;
use Ekyna\Component\Commerce\Supplier\Util\SupplierUtil;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
 * Class SupplierDeliveryItemType
 * @package Ekyna\Bundle\CommerceBundle\Form\Type\Supplier
 * @author  Etienne Dauvergne <contact@ekyna.com>
 */
class SupplierDeliveryItemType extends ResourceFormType
{
    /**
     * @inheritdoc
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('quantity', NumberType::class, [
                'label'          => 'ekyna_core.field.quantity',
                'required'       => false,
                'attr'           => [
                    'class' => 'text-right',
                ],
                // TODO 'scale' => 2, // from packaging mode
                'error_bubbling' => true,
            ])
            ->add('geocode', TextType::class, [
                'label'          => 'ekyna_commerce.field.geocode',
                'required'       => false,
                'error_bubbling' => true,
                'attr' => [
                    'class' => 'geocode',
                ]
            ]);
    }

    /**
     * @inheritdoc
     */
    public function finishView(FormView $view, FormInterface $form, array $options)
    {
        /** @var \Ekyna\Component\Commerce\Supplier\Model\SupplierDeliveryItemInterface $deliveryItem */
        $deliveryItem = $form->getData();

        $view->vars['order_item'] = $deliveryItem->getOrderItem();
        // TODO min attribute (aka sold/shipped to customers quantity)
        $view->vars['remaining_quantity'] = SupplierUtil::calculateDeliveryRemainingQuantity($deliveryItem);
    }

    /**
     * @inheritDoc
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);

        $resolver->setDefault('error_bubbling', false);
    }

    /**
     * @inheritdoc
     */
    public function getBlockPrefix()
    {
        return 'ekyna_commerce_supplier_delivery_item';
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<SituationTemplate id="A0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="situation_template_draft01.xsd"
	name="SystemObservation">
		<operationNode id="A3" name="combine Sensors">
			<type>and</type>
			<parent parentID="A10"/>
			<negated>false</negated>
		</operationNode>
		<conditionNode id="A9" name="% CPU load">
			<type>type</type>
			<measureName>measureName</measureName>
			<opType>greaterThan</opType>
			<condValues>
				<value>0</value>
			</condValues>
			<parent parentID="A3"/>
		</conditionNode>
		<contextNode id="A7" type="watchdogSensor">
			<parent parentID="A9"/>
			<inputType>sensor</inputType>
		</contextNode>
		<situationNode name="machine_failed" id="A10"/>
</SituationTemplate>


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
Rear view, which contains an accept image view that will be animated upon
checking. The rear view represents the "checked" state.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/fcb__rear_color"
    android:padding="@dimen/fcb__rear_accept_image_padding" >

    <ImageView
        android:id="@+id/iv__card_back__accept"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@null"
        android:layout_gravity="center"
        android:gravity="center_horizontal"
        android:src="@drawable/ic_action_accept" />

</FrameLayout>


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

/**
 * @title Card with media size
 */
@Component({
  selector: 'card-media-size-example',
  templateUrl: 'card-media-size-example.html',
  styleUrls: ['card-media-size-example.css']
})
export class CardMediaSizeExample {
  longText = `The Shiba Inu is the smallest of the six original and distinct spitz breeds of dog
  from Japan. A small, agile dog that copes very well with mountainous terrain, the Shiba Inu was
  originally bred for hunting.`;
}


text:
            <fieldset>
                <legend>

                        What skill level are they?

                </legend>

                    <input id="skill-standard" type="radio" name="skill" value="standard" {{ checked if person.skill=="Standard" }}>
                    Standard

                    <input id="skill-neuro" type="radio" name="skill" value="neuro" {{ checked if person.skill=="Neuro" }}>
                    Neuro

                    <input id="skill-neuro" type="radio" name="skill" value="neuro" {{ checked if person.skill=="Complex Neuro" }}>
                    Complex Neuro

            </fieldset>

            <fieldset>
                <legend>

                        Are they qualified to complete scrutiny file work?

                </legend>

                    <input id="scrutiny-yes" type="radio" name="scrutiny" value="yes" {{ checked if person.scrutinyPaperwork and person.id }}>
                    Yes

                    <input id="scrutiny-no" type="radio" name="scrutiny" value="no" {{ checked if not person.scrutinyPaperwork and person.id }}>
                    No

            </fieldset>

        {% if person.id %}

Save

        {% else %}

Save

        {% endif %}


text:
<resources>
    <string name="app_name">Pretty-Zhihu</string>
    <string name="share">Share</string>
</resources>


text:
<!--
Expected timing:
speech1:start = 0
-->
<bml xmlns="http://www.bml-initiative.org/bml/bml-1.0"  id="bml2" composition="APPEND">
	<speech id="speech1">
  	<text>I've appended some speech here!</text>
  </speech>
</bml>


text:
<?php

namespace Connect\Command;

use Command\Abstraction\AbstractCommand;
use Google_Client;

class ConfirmApiBridge extends AbstractCommand
{
    /**
     * @var string
     */
    private $authCode;

    /**
     * @var array
     */
    private $tokens;

    /**
     * @var Google_Client
     */
    private $client;

    /**
     * @param Google_Client $client
     */
    function __construct(Google_Client $client)
    {
        $this->client = $client;
    }

    /**
     * @param string $authCode
     *
     * @return ConfirmApiBridge
     */
    public function setAuthCode($authCode)
    {
        $this->authCode = $authCode;

        return $this;
    }

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

    /**
     * Execute the command
     *
     * @return ConfirmApiBridge
     * @throws \RuntimeException
     */
    public function execute()
    {
        $client = $this->client;

        $tokens = json_decode(
            $client->authenticate($this->authCode),
            true
        );

        if (!isset($tokens['access_token'])) {
            throw new \RuntimeException('Unable to confirm link to google contacts. Please try again.');
        }

        $this->tokens = $tokens;
    }
}


text:
package com.baoyz.bigbang.core;

import android.content.Context;
import android.support.annotation.StringDef;

import com.baoyz.bigbang.core.action.Action;
import com.baoyz.bigbang.segment.NetworkParser;
import com.baoyz.bigbang.segment.SimpleParser;

import java.lang.annotation.Retention;
import java.util.HashMap;
import java.util.Map;

import static java.lang.annotation.RetentionPolicy.SOURCE;

/**
 * Created by baoyongzhang on 2016/10/26.
 */
public class BigBang {

    public static final String ACTION_SEARCH = "search";
    public static final String ACTION_SHARE = "share";
    public static final String ACTION_COPY = "copy";
    public static final String ACTION_BACK = "back";
    private static SimpleParser sParser;
    private static int sItemSpace;
    private static int sLineSpace;
    private static int sItemTextSize;

    public static void setStyle(int itemSpace, int lineSpace, int itemTextSize) {
        sItemSpace = itemSpace;
        sLineSpace = lineSpace;
        sItemTextSize = itemTextSize;
    }

    @StringDef({ACTION_SEARCH, ACTION_SHARE, ACTION_COPY, ACTION_BACK})
    @Retention(SOURCE)
    public @interface ActionType {

    }

    private static Map<String, Action> mActionMap = new HashMap<>();

    private BigBang() {
    }

    public static void registerAction(@ActionType String type, Action action) {
        mActionMap.put(type, action);
    }

    public static void unregisterAction(@ActionType String type) {
        mActionMap.remove(type);
    }

    public static Action getAction(@ActionType String type) {
        return mActionMap.get(type);
    }

    public static void startAction(Context context, @ActionType String type, String text) {
        Action action = BigBang.getAction(type);
        if (action != null) {
            action.start(context, text);
        }
    }

    public static SimpleParser getSegmentParser() {
        if (sParser == null) {
            // TODO Default parser
            sParser = new NetworkParser();
        }
        return sParser;
    }

    public static void setSegmentParser(SimpleParser parser) {
        sParser = parser;
    }

    public static int getItemSpace() {
        return sItemSpace;
    }

    public static int getLineSpace() {
        return sLineSpace;
    }

    public static int getItemTextSize() {
        return sItemTextSize;
    }
}


text:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

#include <jni.h>
#include <assert.h>
#include "Log.hpp"

#include "edu_wpi_first_wpilibj_hal_CounterJNI.h"

#include "HAL/Digital.hpp"
#include "HAL/Errors.hpp"
#include "HALUtil.h"

// set the logging level
TLogLevel counterJNILogLevel = logWARNING;

#define COUNTERJNI_LOG(level) \
    if (level > counterJNILogLevel) ; \
    else Log().Get(level)

extern "C" {

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    initializeCounter
 * Signature: (ILjava/nio/IntBuffer;)J
 */
JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_initializeCounter
  (JNIEnv * env, jclass, jint mode, jobject index)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI initializeCounter";
	COUNTERJNI_LOG(logDEBUG) << "Mode = " << mode;
	jint * indexPtr = (jint*)env->GetDirectBufferAddress(index);
	COUNTERJNI_LOG(logDEBUG) << "Index Ptr = " << (uint32_t*)indexPtr;
	int32_t status = 0;
	void* counter = initializeCounter((Mode)mode, (uint32_t*)indexPtr, &status);
	COUNTERJNI_LOG(logDEBUG) << "Index = " << *indexPtr;
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	COUNTERJNI_LOG(logDEBUG) << "COUNTER Ptr = " << counter;
	CheckStatus(env, status);
	return (jlong)counter;
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    freeCounter
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_freeCounter
  (JNIEnv * env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI freeCounter";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	freeCounter((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterAverageSize
 * Signature: (JI)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterAverageSize
  (JNIEnv * env, jclass, jlong id, jint value)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterAverageSize";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "AverageSize = " << value;
	int32_t status = 0;
	setCounterAverageSize((void*)id, value, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterUpSource
 * Signature: (JIZ)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSource
  (JNIEnv * env, jclass, jlong id, jint pin, jboolean analogTrigger)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSource";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "Pin = " << pin;
	COUNTERJNI_LOG(logDEBUG) << "AnalogTrigger = " << (jint)analogTrigger;
	int32_t status = 0;
	setCounterUpSource((void*)id, pin, analogTrigger, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterUpSourceEdge
 * Signature: (JZZ)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpSourceEdge
  (JNIEnv * env, jclass, jlong id, jboolean valueRise, jboolean valueFall)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpSourceEdge";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise;
	COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall;
	int32_t status = 0;
	setCounterUpSourceEdge((void*)id, valueRise, valueFall, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    clearCounterUpSource
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterUpSource
  (JNIEnv * env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterUpSource";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	clearCounterUpSource((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterDownSource
 * Signature: (JIZ)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSource
  (JNIEnv * env, jclass, jlong id, jint pin, jboolean analogTrigger)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSource";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "Pin = " << pin;
	COUNTERJNI_LOG(logDEBUG) << "AnalogTrigger = " << (jint)analogTrigger;
	int32_t status = 0;
	setCounterDownSource((void*)id, pin, analogTrigger, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	if (status == PARAMETER_OUT_OF_RANGE) {
		ThrowIllegalArgumentException(env, "Counter only supports DownSource in TwoPulse and ExternalDirection modes.");
		return;
	}
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterDownSourceEdge
 * Signature: (JZZ)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterDownSourceEdge
  (JNIEnv * env, jclass, jlong id, jboolean valueRise, jboolean valueFall)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterDownSourceEdge";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "Rise = " << (jint)valueRise;
	COUNTERJNI_LOG(logDEBUG) << "Fall = " << (jint)valueFall;
	int32_t status = 0;
	setCounterDownSourceEdge((void*)id, valueRise, valueFall, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    clearCounterDownSource
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_clearCounterDownSource
  (JNIEnv * env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI clearCounterDownSource";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	clearCounterDownSource((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterUpDownMode
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpDownMode
  (JNIEnv * env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterUpDownMode";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	setCounterUpDownMode((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterExternalDirectionMode
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterExternalDirectionMode
  (JNIEnv * env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterExternalDirectionMode";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	setCounterExternalDirectionMode((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterSemiPeriodMode
 * Signature: (JZ)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSemiPeriodMode
  (JNIEnv * env, jclass, jlong id, jboolean value)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSemiPeriodMode";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "SemiPeriodMode = " << (jint)value;
	int32_t status = 0;
	setCounterSemiPeriodMode((void*)id, value, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterPulseLengthMode
 * Signature: (JD)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterPulseLengthMode
  (JNIEnv * env, jclass, jlong id, jdouble value)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterPulseLengthMode";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "PulseLengthMode = " << value;
	int32_t status = 0;
	setCounterPulseLengthMode((void*)id, value, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    getCounterSamplesToAverage
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterSamplesToAverage
  (JNIEnv * env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterSamplesToAverage";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	jint returnValue = getCounterSamplesToAverage((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	COUNTERJNI_LOG(logDEBUG) << "getCounterSamplesToAverageResult = " << returnValue;
	CheckStatus(env, status);
	return returnValue;
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterSamplesToAverage
 * Signature: (JI)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSamplesToAverage
  (JNIEnv * env, jclass, jlong id, jint value)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterSamplesToAverage";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "SamplesToAverage = " << value;
	int32_t status = 0;
	setCounterSamplesToAverage((void*)id, value, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	if (status == PARAMETER_OUT_OF_RANGE) {
		ThrowBoundaryException(env, value, 1, 127);
		return;
	}
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    resetCounter
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_resetCounter
  (JNIEnv * env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI resetCounter";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	resetCounter((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    getCounter
 * Signature: (J)I
 */
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounter
  (JNIEnv * env, jclass, jlong id)
{
	//COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounter";
	//COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	jint returnValue = getCounter((void*)id, &status);
	//COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	//COUNTERJNI_LOG(logDEBUG) << "getCounterResult = " << returnValue;
	CheckStatus(env, status);
	return returnValue;
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    getCounterPeriod
 * Signature: (J)D
 */
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterPeriod
  (JNIEnv *env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterPeriod";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	jdouble returnValue = getCounterPeriod((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	COUNTERJNI_LOG(logDEBUG) << "getCounterPeriodResult = " << returnValue;
	CheckStatus(env, status);
	return returnValue;
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterMaxPeriod
 * Signature: (JD)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterMaxPeriod
  (JNIEnv * env, jclass, jlong id, jdouble value)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "MaxPeriod = " << value;
	int32_t status = 0;
	setCounterMaxPeriod((void*)id, value, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterUpdateWhenEmpty
 * Signature: (JZ)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterUpdateWhenEmpty
  (JNIEnv * env, jclass, jlong id, jboolean value)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterMaxPeriod";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "UpdateWhenEmpty = " << (jint)value;
	int32_t status = 0;
	setCounterUpdateWhenEmpty((void*)id, value, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    getCounterStopped
 * Signature: (J)Z
 */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterStopped
  (JNIEnv * env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterStopped";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	jboolean returnValue = getCounterStopped((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	COUNTERJNI_LOG(logDEBUG) << "getCounterStoppedResult = " << (jint)returnValue;
	CheckStatus(env, status);
	return returnValue;
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    getCounterDirection
 * Signature: (J)Z
 */
JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_getCounterDirection
  (JNIEnv * env, jclass, jlong id)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI getCounterDirection";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	int32_t status = 0;
	jboolean returnValue = getCounterDirection((void*)id, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	COUNTERJNI_LOG(logDEBUG) << "getCounterDirectionResult = " << (jint)returnValue;
	CheckStatus(env, status);
	return returnValue;
}

/*
 * Class:     edu_wpi_first_wpilibj_hal_CounterJNI
 * Method:    setCounterReverseDirection
 * Signature: (JZ)V
 */
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterReverseDirection
  (JNIEnv * env, jclass, jlong id, jboolean value)
{
	COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI setCounterReverseDirection";
	COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id;
	COUNTERJNI_LOG(logDEBUG) << "ReverseDirection = " << (jint)value;
	int32_t status = 0;
	setCounterReverseDirection((void*)id, value, &status);
	COUNTERJNI_LOG(logDEBUG) << "Status = " << status;
	CheckStatus(env, status);
}

}  // extern "C"


text:
package com.intellij.codeInsight.documentation;

import com.intellij.codeInsight.hint.HintManagerImpl.ActionToIgnore;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.util.concurrency.annotations.RequiresEdt;
import com.intellij.util.ui.EventListeners;
import org.jetbrains.annotations.ApiStatus.Internal;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;

import javax.swing.event.HyperlinkEvent;
import java.util.List;
import java.util.function.Consumer;

@Internal
public final class DocumentationLinkHandler {

  private final @NotNull DocumentationEditorPane myEditorPane;
  private final @NotNull Consumer<? super @NotNull String> myUrlConsumer;

  private int myHighlightedLink;

  private DocumentationLinkHandler(
    @NotNull DocumentationEditorPane pane,
    @NotNull Consumer<? super @NotNull String> urlConsumer
  ) {
    myEditorPane = pane;
    myUrlConsumer = urlConsumer;
    myHighlightedLink = -1;
  }

  @RequiresEdt
  public int getHighlightedLink() {
    return myHighlightedLink;
  }

  @RequiresEdt
  public void highlightLink(int n) {
    myHighlightedLink = n;
    myEditorPane.highlightLink(n);
  }

  private final class PreviousLinkAction extends AnAction implements ActionToIgnore {

    PreviousLinkAction() {
      setShortcutSet(CustomShortcutSet.fromString("shift TAB"));
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      int linkCount = myEditorPane.getLinkCount();
      if (linkCount <= 0) return;
      highlightLink(myHighlightedLink < 0 ? (linkCount - 1) : (myHighlightedLink + linkCount - 1) % linkCount);
    }
  }

  private final class NextLinkAction extends AnAction implements ActionToIgnore {

    NextLinkAction() {
      setShortcutSet(CustomShortcutSet.fromString("TAB"));
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      int linkCount = myEditorPane.getLinkCount();
      if (linkCount <= 0) return;
      highlightLink((myHighlightedLink + 1) % linkCount);
    }
  }

  private final class ActivateLinkAction extends AnAction implements ActionToIgnore {

    ActivateLinkAction() {
      setShortcutSet(CustomShortcutSet.fromString("ENTER"));
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      String href = myEditorPane.getLinkHref(myHighlightedLink);
      if (href != null) {
        myUrlConsumer.accept(href);
      }
    }
  }

  public @Unmodifiable @NotNull List<? extends @NotNull AnAction> createLinkActions() {
    return List.of(new PreviousLinkAction(), new NextLinkAction(), new ActivateLinkAction());
  }

  public static @NotNull DocumentationLinkHandler createAndRegister(
    @NotNull DocumentationEditorPane pane,
    @NotNull Disposable parent,
    @NotNull Consumer<? super @NotNull String> urlConsumer
  ) {
    EventListeners.addHyperLinkListener(pane, parent, e -> {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        urlConsumer.accept(e.getDescription());
      }
    });
    return new DocumentationLinkHandler(pane, urlConsumer);
  }
}


text:
PORTNAME=	System.Diagnostics.DiagnosticSource
PORTVERSION=	1.0.0.0

NET_DEPENDS+=	System.Diagnostics.Debug>=1.0:${PORTSDIR}/dotnet/System.Diagnostics.Debug

DOTNET_REFERENCES+=	${DOTNET_REF}:${DOTNET_PATH}/System.Diagnostics.Debug.dll

.include <../../dotnet/coreclr/corefx.common>


text:
/**************************************************************************/
/*!
    @file     Adafruit_BLE.c
    @author   hathach

    @section LICENSE

    Software License Agreement (BSD License)

    Copyright (c) 2014, Adafruit Industries (adafruit.com)
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:
    1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
    3. Neither the name of the copyright holders nor the
    names of its contributors may be used to endorse or promote products
    derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**************************************************************************/
#include "Adafruit_BLE.h"
#include "Adafruit_BLEMIDI.h"

#ifndef min
  #define min(a,b) ((a) < (b) ? (a) : (b))
#endif

enum {
  EVENT_SYSTEM_CONNECT     = 0,
  EVENT_SYSTEM_DISCONNECT  = 1,

  EVENT_SYSTEM_BLE_UART_RX = 8,
  // 9 reserved

  EVENT_SYSTEM_BLE_MIDI_RX = 10,
  //  11 reserved
};

enum {
  NVM_USERDATA_SIZE = 256
};

/******************************************************************************/
/*!
    @brief  Constructor
*/
/******************************************************************************/
Adafruit_BLE::Adafruit_BLE(void)
{
  _timeout = BLE_DEFAULT_TIMEOUT;

  _disconnect_callback  = NULL;
  _connect_callback     = NULL;
  _ble_uart_rx_callback = NULL;
  _ble_midi_rx_callback = NULL;
  _ble_gatt_rx_callback = NULL;
}

/******************************************************************************/
/*!
    @brief Helper to install callback
    @param
*/
/******************************************************************************/
void Adafruit_BLE::install_callback(bool enable, int8_t system_id, int8_t gatts_id)
{
  bool v = _verbose;
  _verbose = true;

  uint8_t current_mode = _mode;

  // switch mode if necessary to execute command
  if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_COMMAND);

  print( enable ?  F("AT+EVENTENABLE=0x") : F("AT+EVENTDISABLE=0x") );
  print( (system_id < 0) ? 0 : bit(system_id), HEX );

  if ( gatts_id >= 0 )
  {
    print( F(",0x") );
    println( bit(gatts_id), HEX );
  }

  println();

  waitForOK();

  // switch back if necessary
  if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_DATA);

  _verbose = v;
}

/******************************************************************************/
/*!
    @brief  Performs a system reset using AT command
*/
/******************************************************************************/
bool Adafruit_BLE::reset(void)
{
  bool isOK;
  // println();
  for (uint8_t t=0; t < 5; t++) {
    isOK = atcommand(F("ATZ"));

    if (isOK) break;
  }

  if (! isOK) {
    // ok we're going to get desperate
    delay(50);
    setMode(BLUEFRUIT_MODE_COMMAND);
    delay(50);

    for (uint8_t t=0; t < 5; t++) {
      isOK = atcommand(F("ATZ"));

      if (isOK) break;
    }

    if (!isOK) return false;
  }

  // Bluefruit need 1 second to reboot
  delay(1000);

  // flush all left over
  flush();

  return isOK;
}

/******************************************************************************/
/*!
    @brief  Performs a factory reset
*/
/******************************************************************************/
bool Adafruit_BLE::factoryReset(void)
{
  println( F("AT+FACTORYRESET") );
  bool isOK = waitForOK();

  // Bluefruit need 1 second to reboot
  delay(1000);

  // flush all left over
  flush();

  return isOK;
}

/******************************************************************************/
/*!
    @brief  Enable or disable AT Command echo from Bluefruit

    @parma[in] enable
               true to enable (default), false to disable
*/
/******************************************************************************/
bool Adafruit_BLE::echo(bool enable)
{
  return atcommand(F("ATE"), (int32_t) enable);
}

/******************************************************************************/
/*!
    @brief  Check connection state, returns true is connected!
*/
/******************************************************************************/
bool Adafruit_BLE::isConnected(void)
{
  int32_t connected = 0;
  atcommandIntReply(F("AT+GAPGETCONN"), &connected);
  return connected;
}

/******************************************************************************/
/*!
    @brief  Disconnect if currently connected
*/
/******************************************************************************/
void Adafruit_BLE::disconnect(void)
{
  atcommand( F("AT+GAPDISCONNECT") );
}

/******************************************************************************/
/*!
    @brief  Print Bluefruit's information retrieved by ATI command
*/
/******************************************************************************/
void Adafruit_BLE::info(void)
{
  uint8_t current_mode = _mode;

  bool v = _verbose;
  _verbose = false;

  SerialDebug.println(F("----------------"));

  // switch mode if necessary to execute command
  if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_COMMAND);

  println(F("ATI"));

  while ( readline() ) {
    if ( !strcmp(buffer, "OK") || !strcmp(buffer, "ERROR")  ) break;
    SerialDebug.println(buffer);
  }

  // switch back if necessary
  if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_DATA);

  SerialDebug.println(F("----------------"));

  _verbose = v;
}

/**************************************************************************/
/*!
    @brief  Checks if firmware is equal or later than specified version
*/
/**************************************************************************/
bool Adafruit_BLE::isVersionAtLeast(const char * versionString)
{
  uint8_t current_mode = _mode;

  // switch mode if necessary to execute command
  if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_COMMAND);

  // requesting version number
  println(F("ATI=4"));

  readline();
  bool result = ( strcmp(buffer, versionString) >= 0 );
  waitForOK();

  // switch back if necessary
  if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_DATA);

  return result;
}

/******************************************************************************/
/*!
    @brief  Get (multiple) lines of response data into internal buffer.

    @param[in] period_ms
               period in milliseconds between each event scanning
    @return    None
*/
/******************************************************************************/
void Adafruit_BLE::update(uint32_t period_ms)
{
  static TimeoutTimer tt;

  if ( tt.expired() )
  {
    tt.set(period_ms);

    bool v = _verbose;
    _verbose = false;

    uint8_t current_mode = _mode;

    // switch mode if necessary to execute command
    if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_COMMAND);

    println( F("AT+EVENTSTATUS") );
    readline();
    waitForOK();

    // parse event status system_event, gatts_event
    uint8_t tempbuf[BLE_BUFSIZE+1];
    uint32_t system_event, gatts_event;
    char * p_comma = NULL;

    system_event = strtoul(this->buffer, &p_comma, 16);
    gatts_event  = strtoul(p_comma+1, NULL, 16);

    //--------------------------------------------------------------------+
    // System Event
    //--------------------------------------------------------------------+
    if ( this->_connect_callback    && bitRead(system_event, EVENT_SYSTEM_CONNECT   ) ) this->_connect_callback();
    if ( this->_disconnect_callback && bitRead(system_event, EVENT_SYSTEM_DISCONNECT) ) this->_disconnect_callback();

    if ( this->_ble_uart_rx_callback && bitRead(system_event, EVENT_SYSTEM_BLE_UART_RX) )
    {
      // _verbose = true;
      println( F("AT+BLEUARTRX") );
      uint16_t len = readline(tempbuf, BLE_BUFSIZE);
      waitForOK();

      this->_ble_uart_rx_callback( (char*) tempbuf, len);
    }

    if ( this->_ble_midi_rx_callback && bitRead(system_event, EVENT_SYSTEM_BLE_MIDI_RX) )
    {
//      _verbose = true;
      while(1)
      {
        // use RAW command version
        println( F("AT+BLEMIDIRXRAW") );

        // readraw swallow OK/ERROR already
        uint16_t len = readraw();

        // break if there is no more MIDI event
        if ( len == 0 ) break;

        // copy to internal buffer for other usage !
        memcpy(tempbuf, this->buffer, len);

        Adafruit_BLEMIDI::processRxCallback(tempbuf, len, this->_ble_midi_rx_callback);
      }
    }

    //--------------------------------------------------------------------+
    // Gatt Event
    //--------------------------------------------------------------------+
    if ( this->_ble_gatt_rx_callback && gatts_event )
    {
//      _verbose = true;
      for(uint8_t charid=1; charid < 30; charid++)
      {
        if ( bitRead(gatts_event, charid-1) )
        {
          print( F("AT+GATTCHARRAW=") ); // use RAW command version
          println(charid);

          uint16_t len = readraw(); // readraw swallow OK/ERROR already
          memcpy(tempbuf, this->buffer, len);

          this->_ble_gatt_rx_callback(charid, tempbuf, len);
        }
      }
    }

    // switch back if necessary
    if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_DATA);

    _verbose = v;
  }
}

/******************************************************************************/
/*!
    @brief Set custom ADV data packet
    @param
*/
/******************************************************************************/
bool Adafruit_BLE::setAdvData(uint8_t advdata[], uint8_t size)
{
  return this->atcommand(F("AT+GAPSETADVDATA"), advdata, size);
}

/******************************************************************************/
/*!
    @brief Save user information to NVM section, current size limit is 256 bytes
    @param data buffer holding data
    @param size number of bytes
    @param offset relative offset in the NVM section
*/
/******************************************************************************/
bool Adafruit_BLE::writeNVM(uint16_t offset, uint8_t const data[], uint16_t size)
{
  VERIFY_(offset + size <= NVM_USERDATA_SIZE );

  uint16_t type[] = { AT_ARGTYPE_UINT16, AT_ARGTYPE_UINT8, AT_ARGTYPE_BYTEARRAY + size };
  uint32_t args[] = { offset, BLE_DATATYPE_BYTEARRAY, (uint32_t) data };

  return this->atcommand_full(F("AT+NVMWRITE"), NULL, 3, type, args);
}

/******************************************************************************/
/*!
    @brief Save String to NVM section, current size limit is 256 bytes
    @param data buffer holding data
    @param size number of bytes
    @param offset relative offset in the NVM section
*/
/******************************************************************************/
bool Adafruit_BLE::writeNVM(uint16_t offset, char const* str)
{
  VERIFY_(offset + strlen(str) <= NVM_USERDATA_SIZE );

  uint16_t type[] = { AT_ARGTYPE_UINT16, AT_ARGTYPE_UINT8, AT_ARGTYPE_STRING };
  uint32_t args[] = { offset, BLE_DATATYPE_STRING, (uint32_t) str };

  return this->atcommand_full(F("AT+NVMWRITE"), NULL, 3, type, args);
}

/******************************************************************************/
/*!
    @brief Save an 32-bit number to NVM
    @param number Number to be saved
    @param offset relative offset in the NVM section
*/
/******************************************************************************/
bool Adafruit_BLE::writeNVM(uint16_t offset, int32_t number)
{
  VERIFY_(offset + 4 <= NVM_USERDATA_SIZE );

  uint16_t type[] = { AT_ARGTYPE_UINT16, AT_ARGTYPE_UINT8, AT_ARGTYPE_INT32 };
  uint32_t args[] = { offset, BLE_DATATYPE_INTEGER, (uint32_t) number };

  return this->atcommand_full(F("AT+NVMWRITE"), NULL, 3, type, args);
}

/******************************************************************************/
/*!
    @brief Read an number of bytes from NVM at offset to buffer
    @param
*/
/******************************************************************************/
bool Adafruit_BLE::readNVM(uint16_t offset, uint8_t data[], uint16_t size)
{
  VERIFY_(offset < NVM_USERDATA_SIZE);

  uint8_t current_mode = _mode;

  // switch mode if necessary to execute command
  if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_COMMAND);

  // use RAW command version
  print( F("AT+NVMREADRAW=") );
  print(offset);

  print(',');
  println(size);

  uint16_t len = readraw(); // readraw swallow OK/ERROR already

  // skip if NULL is entered
  if (data) memcpy(data, this->buffer, min(size, BLE_BUFSIZE));

  // switch back if necessary
  if ( current_mode == BLUEFRUIT_MODE_DATA ) setMode(BLUEFRUIT_MODE_DATA);
}

/******************************************************************************/
/*!
    @brief Read a string from NVM at offset to buffer
    @param
*/
/******************************************************************************/
bool Adafruit_BLE::readNVM(uint16_t offset, char* str, uint16_t size)
{
  VERIFY_(offset < NVM_USERDATA_SIZE);

  uint16_t type[] = { AT_ARGTYPE_UINT16, AT_ARGTYPE_UINT16, AT_ARGTYPE_UINT8 };
  uint32_t args[] = { offset, size, BLE_DATATYPE_STRING};

  bool isOK =  this->atcommand_full(F("AT+NVMREAD"), NULL, 3, type, args);

  // skip if NULL is entered
  if ( isOK && str ) strncpy(str, this->buffer, min(size, BLE_BUFSIZE));

  return isOK;
}

/******************************************************************************/
/*!
    @brief Read an 32-bit number from NVM
    @param
*/
/******************************************************************************/
bool Adafruit_BLE::readNVM(uint16_t offset, int32_t* number)
{
  return this->readNVM(offset, (uint8_t*)number, 4);
}

/******************************************************************************/
/*!
    @brief  Set handle for connect callback

    @param[in] fp function pointer, NULL will discard callback
*/
/******************************************************************************/
void Adafruit_BLE::setConnectCallback( void (*fp) (void) )
{
  this->_connect_callback = fp;
  install_callback(fp != NULL, EVENT_SYSTEM_CONNECT, -1);
}

/******************************************************************************/
/*!
    @brief  Set handle for disconnection callback

    @param[in] fp function pointer, NULL will discard callback
*/
/******************************************************************************/
void Adafruit_BLE::setDisconnectCallback( void (*fp) (void) )
{
  this->_disconnect_callback = fp;
  install_callback(fp != NULL, EVENT_SYSTEM_DISCONNECT, -1);
}

/******************************************************************************/
/*!
    @brief  Set handle for BLE Uart Rx callback

    @param[in] fp function pointer, NULL will discard callback
*/
/******************************************************************************/
void Adafruit_BLE::setBleUartRxCallback( void (*fp) (char data[], uint16_t len) )
{
  this->_ble_uart_rx_callback = fp;
  install_callback(fp != NULL, EVENT_SYSTEM_BLE_UART_RX, -1);
}

/******************************************************************************/
/*!
    @brief  Set handle for BLE MIDI Rx callback

    @param[in] fp function pointer, NULL will discard callback
*/
/******************************************************************************/
void Adafruit_BLE::setBleMidiRxCallback( midiRxCallback_t fp )
{
  this->_ble_midi_rx_callback = fp;
  install_callback(fp != NULL, EVENT_SYSTEM_BLE_MIDI_RX, -1);
}

/******************************************************************************/
/*!
    @brief  Set handle for BLE Gatt Rx callback

    @param[in] fp function pointer, NULL will discard callback
*/
/******************************************************************************/
void Adafruit_BLE::setBleGattRxCallback(int32_t chars_idx,  void (*fp) (int32_t, uint8_t[], uint16_t) )
{
  if ( chars_idx == 0) return;

  this->_ble_gatt_rx_callback = fp;
  install_callback(fp != NULL, -1, chars_idx-1);
}