register $JAR_PATH

DEFINE ReservoirSample datafu.pig.sampling.ReservoirSample('$RESERVOIR_SIZE');

/*
data = LOAD 'input' AS (A_id:chararray, B_id:chararray, C:int);
sampled = FILTER data BY SampleByKey(A_id);
STORE sampled INTO 'output';
*/

data = LOAD 'input' AS (A_id:chararray, B_id:chararray, C:int);
sampled = FOREACH (GROUP data ALL) GENERATE ReservoirSample(data) as sample_data;
sampled = FOREACH sampled GENERATE COUNT(sample_data) AS sample_count;
STORE sampled INTO 'output';

Remove comments in pig script

register $JAR_PATH

DEFINE ReservoirSample datafu.pig.sampling.ReservoirSample('$RESERVOIR_SIZE');

data = LOAD 'input' AS (A_id:chararray, B_id:chararray, C:int);
sampled = FOREACH (GROUP data ALL) GENERATE ReservoirSample(data) as sample_data;
sampled = FOREACH sampled GENERATE COUNT(sample_data) AS sample_count;
STORE sampled INTO 'output';


REGISTER '../../lib/piggybank-0.12.0.jar';

DEFINE ISOToDay org.apache.pig.piggybank.evaluation.datetime.truncate.ISOToDay();
DEFINE UnixToISO org.apache.pig.piggybank.evaluation.datetime.convert.UnixToISO();

set job.name 'isura_test';

reviews = load 'isura/in/reviews/{0001..0346}.tab' using PigStorage('\t') as (product_id:chararray, title:chararray, price:chararray, user_id:chararray, profile_name:chararray, helpfulness:chararray, score:int, time:long, summary:chararray, text:chararray);

scores = foreach reviews generate product_id, time * 1000 as timestamp:long, score;

store scores into 'isura/out/scores' using PigStorage('\t');

Change import to path relative to root project directory

REGISTER 'lib/piggybank-0.12.0.jar';

DEFINE ISOToDay org.apache.pig.piggybank.evaluation.datetime.truncate.ISOToDay();
DEFINE UnixToISO org.apache.pig.piggybank.evaluation.datetime.convert.UnixToISO();

set job.name 'isura_test';

reviews = load 'isura/in/reviews/{0001..0346}.tab' using PigStorage('\t') as (product_id:chararray, title:chararray, price:chararray, user_id:chararray, profile_name:chararray, helpfulness:chararray, score:int, time:long, summary:chararray, text:chararray);

scores = foreach reviews generate product_id, time * 1000 as timestamp:long, score;

store scores into 'isura/out/scores' using PigStorage('\t');


Add a script for getting large (>1MB) payloads.

register 'akela-0.5-SNAPSHOT.jar'
register 'fhr-toolbox-0.1-SNAPSHOT.jar'
register 'jackson-core-2.1.1.jar'
register 'jackson-databind-2.1.1.jar'
register 'jackson-annotations-2.1.1.jar'

SET pig.logfile fhr_get_large_payloads.log;
/* SET default_parallel 8; */
SET pig.tmpfilecompression true;
SET pig.tmpfilecompression.codec lzo;

raw = LOAD 'hbase://metrics' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('data:json','-loadKey=true -caching=100') AS
                                   (k:bytearray,json:chararray);
long_payloads = FILTER raw BY SIZE(json) > 1000000;

STORE long_payloads INTO 'fhr_long_payloads_out';


Add a pig script to export payload errors

register 'akela-0.5-SNAPSHOT.jar'
register 'fhr-toolbox-0.1-SNAPSHOT.jar'
register 'jackson-core-2.1.1.jar'
register 'jackson-databind-2.1.1.jar'
register 'jackson-annotations-2.1.1.jar'

SET pig.logfile fhr_payload_errors.log;
/* SET default_parallel 8; */
SET pig.tmpfilecompression true;
SET pig.tmpfilecompression.codec lzo;

define IsMap com.mozilla.pig.filter.map.IsMap();
define Size com.mozilla.pig.eval.Size();

raw = LOAD 'hbase://metrics' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('data:json','-loadKey=true -caching=100') AS
                                   (k:bytearray,json:chararray);
genmap = FOREACH raw GENERATE k, com.mozilla.pig.eval.json.JsonMap(json) AS json_map:map[];
filtered_genmap = FILTER genmap BY json_map#'errors' IS NOT NULL;
data = FOREACH filtered_genmap GENERATE json_map#'thisPingDate' AS submission_date:chararray, json_map#'errors' AS errs:chararray;

STORE data INTO 'fhr_payload_errors_out';


Add Pig example that calculates average size per content type.

-- The warcutils, jwat-common, jwat-gzip and jwat-warc jars need to be available for Pig.
-- You can put them in HDFS so you don't need to upload them every time.
REGISTER hdfs://namenode.hathi.surfsara.nl/user/nawardXX/*.jar;

DEFINE WarcFileLoader nl.surfsara.warcutils.pig.WarcSequenceFileLoader();

-- Load the data, here we use all the SequenceFiles from the TEST set.
in = LOAD '/data/public/common-crawl/crawl-data/CC-TEST-2014-10/*/*/seq/*' USING WarcFileLoader AS (url, length:int, type);

-- Remove all the records that have no length.
filtered = FILTER in BY length IS NOT NULL;

-- Group all the records for the same type together.
grouped = GROUP filtered BY type;

-- For every group we calculate the aver
averages = FOREACH grouped GENERATE group, AVG(filtered.length);

-- Write the results to the terminal. Use 'STORE' to write the output to to a file on HDFS.
DUMP averages;


[ f
    [ \ x : * ->
      g := ? : * ;
    ] ;
  a := ? : f.g ;
]

Test case for devload command bug


import 'recommenders.pig';

/**
 *  Generates artist recommendations based off of last.fm data provided by
 *  http://www.dtic.upf.edu/~ocelma/MusicRecommendationDataset/lastfm-360K.html
 */

raw_input  =    load '$INPUT_SIGNALS' using PigStorage(',')
                        as (user: chararray, item_id: chararray, item: chararray, weight: float);

user_signals = foreach raw_input generate user, item, weight;

user_signals = filter user_signals by user is not null and item is not null and weight is not null;

rmf $OUTPUT_PATH/user_signals;
store user_signals into '$OUTPUT_PATH/user_signals' using PigStorage();

Set DBMS input to be tab-delimited

import 'recommenders.pig';

/**
 *  Generates artist recommendations based off of last.fm data provided by
 *  http://www.dtic.upf.edu/~ocelma/MusicRecommendationDataset/lastfm-360K.html
 */

raw_input  =    load '$INPUT_SIGNALS' using PigStorage()
                        as (user: chararray, item_id: chararray, item: chararray, weight: float);

user_signals = foreach raw_input generate user, item, weight;

user_signals = filter user_signals by user is not null and item is not null and weight is not null;

rmf $OUTPUT_PATH/user_signals;
store user_signals into '$OUTPUT_PATH/user_signals' using PigStorage();


/**
 * <%= project_name %>
 *
 * Required parameters:
 *
 * -param INPUT_PATH Input path for script data (e.g. s3n://hawk-example-data/tutorial/excite.log.bz2)
 * -param OUTPUT_PATH Output path for script data (e.g. s3n://my-output-bucket/<%= project_name %>)
 */

/**
 * User-Defined Functions (UDFs)
 */
REGISTER '../udfs/python/<%= project_name %>.py' USING streaming_python AS <%= project_name %>;

-- This is an example of loading up input data
my_input_data = LOAD '$INPUT_PATH'
               USING PigStorage('\t')
                  AS (field0:chararray, field1:chararray, field2:chararray);

-- This is an example pig operation
filtered = FILTER my_input_data
               BY field0 IS NOT NULL;

-- This is an example call to a python user-defined function
with_udf_output = FOREACH filtered
                 GENERATE field0..field2,
                          <%= project_name %>.example_udf(field0) AS example_udf_field;

-- remove any existing data
rmf $OUTPUT_PATH;

-- store the results
STORE with_udf_output
 INTO '$OUTPUT_PATH'
USING PigStorage('\t');

Fix project template to not use invalid -param syntax.

/**
 * <%= project_name %>
 *
 * Required parameters:
 *
 * - INPUT_PATH Input path for script data (e.g. s3n://hawk-example-data/tutorial/excite.log.bz2)
 * - OUTPUT_PATH Output path for script data (e.g. s3n://my-output-bucket/<%= project_name %>)
 */

/**
 * User-Defined Functions (UDFs)
 */
REGISTER '../udfs/python/<%= project_name %>.py' USING streaming_python AS <%= project_name %>;

-- This is an example of loading up input data
my_input_data = LOAD '$INPUT_PATH'
               USING PigStorage('\t')
                  AS (field0:chararray, field1:chararray, field2:chararray);

-- This is an example pig operation
filtered = FILTER my_input_data
               BY field0 IS NOT NULL;

-- This is an example call to a python user-defined function
with_udf_output = FOREACH filtered
                 GENERATE field0..field2,
                          <%= project_name %>.example_udf(field0) AS example_udf_field;

-- remove any existing data
rmf $OUTPUT_PATH;

-- store the results
STORE with_udf_output
 INTO '$OUTPUT_PATH'
USING PigStorage('\t');


REGISTER 'lib/piggybank-0.12.0.jar';

DEFINE ISOToDay org.apache.pig.piggybank.evaluation.datetime.truncate.ISOToDay();
DEFINE UnixToISO org.apache.pig.piggybank.evaluation.datetime.convert.UnixToISO();

set job.name 'isura_test';

reviews = load 'isura/in/reviews/{0001..0346}.tab' using PigStorage('\t') as (product_id:chararray, title:chararray, price:chararray, user_id:chararray, profile_name:chararray, helpfulness:chararray, score:int, time:long, summary:chararray, text:chararray);

scores = foreach reviews generate product_id, time * 1000 as timestamp:long, score;

store scores into 'isura/out/scores' using PigStorage('\t');

Fix loading of all files in directory

REGISTER 'lib/piggybank-0.12.0.jar';

DEFINE ISOToDay org.apache.pig.piggybank.evaluation.datetime.truncate.ISOToDay();
DEFINE UnixToISO org.apache.pig.piggybank.evaluation.datetime.convert.UnixToISO();

set job.name 'isura_test';

reviews = load 'isura/in/reviews/*.tab' using PigStorage('\t') as (product_id:chararray, title:chararray, price:chararray, user_id:chararray, profile_name:chararray, helpfulness:chararray, score:int, time:long, summary:chararray, text:chararray);

scores = foreach reviews generate product_id, time * 1000 as timestamp:long, score;

store scores into 'isura/out/scores' using PigStorage('\t');


register 'akela-0.5-SNAPSHOT.jar'
register 'fhr-toolbox-0.1-SNAPSHOT.jar'
register 'jackson-core-2.1.1.jar'
register 'jackson-databind-2.1.1.jar'
register 'jackson-annotations-2.1.1.jar'

SET pig.logfile fhr_payload_errors.log;
/* SET default_parallel 8; */
SET pig.tmpfilecompression true;
SET pig.tmpfilecompression.codec lzo;

define IsMap com.mozilla.pig.filter.map.IsMap();
define Size com.mozilla.pig.eval.Size();

raw = LOAD 'hbase://metrics' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('data:json','-loadKey=true -caching=100') AS
                                   (k:bytearray,json:chararray);
genmap = FOREACH raw GENERATE k, com.mozilla.pig.eval.json.JsonMap(json) AS json_map:map[];
filtered_genmap = FILTER genmap BY json_map#'errors' IS NOT NULL;
data = FOREACH filtered_genmap GENERATE json_map#'thisPingDate' AS submission_date:chararray, json_map#'errors' AS errs:chararray;

STORE data INTO 'fhr_payload_errors_out';

Add build_id to payload errors output.

register 'akela-0.5-SNAPSHOT.jar'
register 'fhr-toolbox-0.1-SNAPSHOT.jar'
register 'jackson-core-2.1.1.jar'
register 'jackson-databind-2.1.1.jar'
register 'jackson-annotations-2.1.1.jar'

SET pig.logfile fhr_payload_errors.log;
/* SET default_parallel 8; */
SET pig.tmpfilecompression true;
SET pig.tmpfilecompression.codec lzo;

define IsMap com.mozilla.pig.filter.map.IsMap();
define Size com.mozilla.pig.eval.Size();

raw = LOAD 'hbase://metrics' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('data:json','-loadKey=true -caching=100') AS
                                   (k:bytearray,json:chararray);
genmap = FOREACH raw GENERATE k, com.mozilla.pig.eval.json.JsonMap(json) AS json_map:map[];
filtered_genmap = FILTER genmap BY json_map#'errors' IS NOT NULL;
data = FOREACH filtered_genmap GENERATE json_map#'thisPingDate' AS submission_date:chararray, json_map#'data'#'last'#'org.mozilla.appInfo.appinfo'#'appBuildID' as build_id:chararray, json_map#'errors' AS errs:chararray;

STORE data INTO 'fhr_payload_errors_out';


include "range/utils"
include "io"

function Main(_)
	let array = [11, 12, 13, 14, 15]
	let i = Range([array, 1, 4])
	Show("Range size: ")
	Show(ToString(i.size, 0))
	Show(".\n")

	while Next(i) do
		Show("#")
		Show(ToString(i.index, 0))
		Show(": ")
		Show(ToString(i.value, 1))
		if i.first then
			Show(" - it's first")
		else if i.last then
			Show(" - it's last")
		end
		Show(";\n")
	end
end

Correct and test array range module.

include "range/utils"
include "io"

function ShowRange(range)
	let msg = "size: "
	msg = Append(msg, ToString(range.size, 0))
	msg = Append(msg, "\n")
	Show(msg)

	while Next(range) do
		msg = "item #"
		msg = Append(msg, ToString(range.index, 0))
		msg = Append(msg, ": ")
		msg = Append(msg, ToString(range.value, 2))
		if range.first then
			msg = Append(msg, " <= it's first")
		else if range.last then
			msg = Append(msg, " <= it's last")
		end
		msg = Append(msg, "\n")
		Show(msg)
	end
end

function Main(_)
	let array = [10, 11, 12, 13, 14, 15]

	let range_1 = Range([array])
	ShowRange(range_1)

	let range_2 = Range([array, 2])
	Show("\n")
	ShowRange(range_2)

	let range_3 = Range([array, 1, 4])
	Show("\n")
	ShowRange(range_3)

	let range_4 = Range([array, 2, 2])
	Show("\n")
	ShowRange(range_4)

	let range_5 = Range([[]])
	Show("\n")
	ShowRange(range_5)

	let range_6 = Range([array, 1, 4, TRUE])
	Show("\n")
	ShowRange(range_6)

	let range_7 = Range([array, 0, GetSize(array), TRUE])
	Show("\n")
	ShowRange(range_7)

	let range_8 = Range([array, 2, 2, TRUE])
	Show("\n")
	ShowRange(range_8)

	let range_9 = Range([[], 0, 0, TRUE])
	Show("\n")
	ShowRange(range_9)
end


redo-ifchange config.sh
. ./config.sh
exec >$3
cat <<-EOF
	redo-ifchange \$1.c
	gcc -MD -MF \$3.deps.tmp -o \$3 -c \$1.c
	DEPS=\$(sed -e "s/^\$3://" -e 's/\\\\//g' <\$3.deps.tmp)
	rm -f \$3.deps.tmp
	redo-ifchange \$DEPS
EOF
chmod +x $3

Fix use of config.sh in example

redo-ifchange config.sh
. ./config.sh
exec >$3
cat <<-EOF
	redo-ifchange \$1.c
	gcc $CFLAGS -MD -MF \$3.deps.tmp -o \$3 -c \$1.c
	DEPS=\$(sed -e "s/^\$3://" -e 's/\\\\//g' <\$3.deps.tmp)
	rm -f \$3.deps.tmp
	redo-ifchange \$DEPS
EOF
chmod +x $3


BIND=../../bin

roms="numb/test/eitherHexOrDecimal.rom"
roms+=" numb/test/tryConversion.rom"
roms+=" numb/test/tryUnsignedNumber.rom"

roms+=" dict/test/compareNames.rom"
roms+=" dict/test/compareNamesUpToLength.rom"
roms+=" dict/test/findWord.rom"

roms+=" test/char.rom"
roms+=" test/dstk.rom"
roms+=" test/math.rom"
roms+=" test/oint.rom"
roms+=" test/scan.rom"

redo-ifchange $BIND/e
redo-ifchange $roms

for rom in $roms; do (e romfile $rom >&2); done

Include kernel tests in test suite

BIND=../../bin

roms="numb/test/eitherHexOrDecimal.rom"
roms+=" numb/test/tryConversion.rom"
roms+=" numb/test/tryUnsignedNumber.rom"

roms+=" dict/test/compareNames.rom"
roms+=" dict/test/compareNamesUpToLength.rom"
roms+=" dict/test/findWord.rom"

roms+=" kern/test/enqueue.rom"

roms+=" test/char.rom"
roms+=" test/dstk.rom"
roms+=" test/math.rom"
roms+=" test/oint.rom"
roms+=" test/scan.rom"

redo-ifchange $BIND/e
redo-ifchange $roms

for rom in $roms; do (e romfile $rom >&2); done


redo-ifchange ../src/vasm/*.f
redo-ifchange ../src/mlm/*.f ../src/mlm/*.asm ../src/mlm/*.i
sf ../src/mlm/mlm.f $3 >&2

Switch away from vasm to use a.py

redo-ifchange ../src/a/*.py
redo-ifchange ../src/mlm/mlm.asm
../src/a/a.py from ../src/mlm/mlm.asm to $3 quiet


// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

// dofile for LEC script rtl_diff

//-----------------------------------------------------------------
// read in golden and revised
//-----------------------------------------------------------------
read library -sv09 -f formal_0.scr

// read golden design
read design -golden -sv09 \
  ../../../../ip/prim/rtl/prim_assert.sv \
  ../../../../top_earlgrey/rtl/*_pkg.sv \
  ../../../../ip/*/rtl/*_pkg.sv \
  ../../../../vendor/*/src/*_pkg.sv \
  $LEC_GOLDEN

// read revised design
read design -revised -sv09 \
  ../../../../ip/prim/rtl/prim_assert.sv \
  ../../../../top_earlgrey/rtl/*_pkg.sv \
  ../../../../ip/*/rtl/*_pkg.sv \
  ../../../../vendor/*/src/*_pkg.sv \
  $LEC_REVISED

//-----------------------------------------------------------------
// pre-LEC reports
//-----------------------------------------------------------------
report design data
report black box
report module

//-----------------------------------------------------------------
// compare
//-----------------------------------------------------------------
set system mode lec
map key points
set parallel option -threads 4
analyze datapath -merge -verbose -effort ultra
add compare point -all
set compare effort ultra
compare -threads 4
analyze abort -compare

//-----------------------------------------------------------------
// reports
//-----------------------------------------------------------------
report compare data -class nonequivalent -class abort -class notcompared
report verification -verbose
report statistics
usage

exit -force

Update LEC script for vendor dirs


# Allows building ROMs even if bin isn't in path.
export PATH=$PATH:$(pwd)/bin

redo-ifchange bin/a
redo-ifchange bin/bspl.fs
redo-ifchange bin/e

redo-ifchange roms/mlm
redo-ifchange roms/ngaro

echo "Be sure to add bin/ to your \$PATH if you haven't already." >&2
echo "  export PATH=\$PATH:$(pwd)/bin" >&2

Include sdtest as ROM image.

# Allows building ROMs even if bin isn't in path.
export PATH=$PATH:$(pwd)/bin

redo-ifchange bin/a
redo-ifchange bin/bspl.fs
redo-ifchange bin/e

redo-ifchange roms/mlm
redo-ifchange roms/ngaro
redo-ifchange roms/sdtest

echo "Be sure to add bin/ to your \$PATH if you haven't already." >&2
echo "  export PATH=\$PATH:$(pwd)/bin" >&2


redo-ifchange gitvars.pre prodname

read PROD <prodname

# Fix each line from gitvars.pre where git may or may not have already
# substituted the variables.  If someone generated a tarball with 'git archive',
# then the data will have been substituted already.  If we're in a checkout of
# the git repo, then it won't, but we can just ask git to do the substitutions
# right now.
while read line; do
	# Lines *may* be of the form: $Format: ... $
	x=${line#\$Format:}  # remove prefix
	if [ "$x" != "$line" ]; then
		# git didn't substitute it
		x=${x%\$}  # remove trailing $
		if [ "$x" == "%d" ]; then
			tag=$(git describe --match="$PROD-*")
			x="(tag: $tag)"
		else
			x=$(git log -1 --pretty=format:"$x")
		fi
	fi
	echo "$x"
done <gitvars.pre

Fix another "==" -> "=" bashism.

redo-ifchange gitvars.pre prodname

read PROD <prodname

# Fix each line from gitvars.pre where git may or may not have already
# substituted the variables.  If someone generated a tarball with 'git archive',
# then the data will have been substituted already.  If we're in a checkout of
# the git repo, then it won't, but we can just ask git to do the substitutions
# right now.
while read line; do
	# Lines *may* be of the form: $Format: ... $
	x=${line#\$Format:}  # remove prefix
	if [ "$x" != "$line" ]; then
		# git didn't substitute it
		x=${x%\$}  # remove trailing $
		if [ "$x" = "%d" ]; then
			tag=$(git describe --match="$PROD-*")
			x="(tag: $tag)"
		else
			x=$(git log -1 --pretty=format:"$x")
		fi
	fi
	echo "$x"
done <gitvars.pre


umask 0022
redo mode1
MODE="$(ls -l mode1 | cut -d' ' -f1)"
[ "$MODE" = "-rw-r--r--" ] || exit 78

Fix t/130-mode: "ls -l" output is not always as expected

umask 0022
redo mode1
MODE=$(python -c 'import os; print oct(os.stat("mode1").st_mode & 07777)')
[ "$MODE" = "0644" ] || exit 78


# define all project wide variables

export ROOTDIR=$(pwd)
export SRCDIR=$ROOTDIR/src
export OUTDIR=$ROOTDIR/out
export VERSION="pre-0.01"

DESTDIR=${DESTDIR-/usr/local/bin}

if [ "$1" = "all" ]; then
	redo-ifchange "$OUTDIR/redo"
elif [ "$1" = "clean" ]; then
	rm -rf "$OUTDIR/*.tmp" "$OUTDIR/*.o" "$OUTDIR/redo" "$OUTDIR/CC"
	# autoconf stuff
	rm -rf autom4te.cache config.h.in configure config.status config.log config.h
elif [ "$1" = "install" ]; then
	redo-ifchange all
	mkdir -p "$DESTDIR"
	install "$OUTDIR/redo" "$DESTDIR"
	ln -sf "$DESTDIR/redo" "$DESTDIR/redo-ifchange"
	ln -sf "$DESTDIR/redo" "$DESTDIR/redo-ifcreate"
	ln -sf "$DESTDIR/redo" "$DESTDIR/redo-always"
	echo "Finished installing."
fi

Fix path quoting in the clean target

# define all project wide variables

export ROOTDIR=$(pwd)
export SRCDIR=$ROOTDIR/src
export OUTDIR=$ROOTDIR/out
export VERSION="pre-0.01"

DESTDIR=${DESTDIR-/usr/local/bin}

if [ "$1" = "all" ]; then
	redo-ifchange "$OUTDIR/redo"
elif [ "$1" = "clean" ]; then
	rm -rf "$OUTDIR"/*.tmp "$OUTDIR"/*.o "$OUTDIR"/redo "$OUTDIR"/CC
	# autoconf stuff
	rm -rf autom4te.cache config.h.in configure config.status config.log config.h
elif [ "$1" = "install" ]; then
	redo-ifchange all
	mkdir -p "$DESTDIR"
	install "$OUTDIR/redo" "$DESTDIR"
	ln -sf "$DESTDIR/redo" "$DESTDIR/redo-ifchange"
	ln -sf "$DESTDIR/redo" "$DESTDIR/redo-ifcreate"
	ln -sf "$DESTDIR/redo" "$DESTDIR/redo-always"
	echo "Finished installing."
fi


rm -f index.html
find build -type f ! -name 'do' ! -name '*.do' -mindepth 1 -maxdepth 1 -exec rm {} \;

Put find arguments in preferred order

rm -f index.html
find build -mindepth 1 -maxdepth 1 -type f ! -name 'do' ! -name '*.do' -exec rm {} \;


fun draggableList title items =
    itemSources <- List.mapM source items;
    draggingItem <- source None;
    return <xml>

Great {[title]}

        {List.mapX (fn itemSource => <xml>
          <li onmousedown={set draggingItem (Some itemSource)}
              onmouseup={set draggingItem None}
              onmouseover={di <- get draggingItem;
                           case di of
                               None => return ()
                             | Some di => original <- get di;
                               movedOver <- get itemSource;
                               set di movedOver;
                               set itemSource original;
                               set draggingItem (Some itemSource)}>
              <dyn signal={Monad.mp (fn s => <xml>{[s]}</xml>) (signal itemSource)}/>

</xml>) itemSources}

    </xml>

fun main () =
    bears <- draggableList "Bears" ("Pooh" :: "Paddington" :: "Rupert" :: "Edward" :: []);
    beers <- draggableList "Beers" ("Budvar" :: "Delirium Tremens" :: "Deuchars" :: []);
    boars <- draggableList "Boars" ("Sus scrofa scrofa"
                                        :: "Sus scrofa ussuricus"
                                        :: "Sus scrofa cristatus"
                                        :: "Sus scrofa taiwanus" :: []);
    return <xml>

        <link rel="stylesheet" type="text/css" href="../../dragList.css"/>

        {bears}
        {beers}
        {boars}

    </xml>

Use cdata for shorter Monad map

fun draggableList title items =
    itemSources <- List.mapM source items;
    draggingItem <- source None;
    return <xml>

Great {[title]}

        {List.mapX (fn itemSource => <xml>
          <li onmousedown={set draggingItem (Some itemSource)}
              onmouseup={set draggingItem None}
              onmouseover={di <- get draggingItem;
                           case di of
                               None => return ()
                             | Some di => original <- get di;
                               movedOver <- get itemSource;
                               set di movedOver;
                               set itemSource original;
                               set draggingItem (Some itemSource)}>
              <dyn signal={Monad.mp cdata (signal itemSource)}/>

</xml>) itemSources}

    </xml>

fun main () =
    bears <- draggableList "Bears" ("Pooh" :: "Paddington" :: "Rupert" :: "Edward" :: []);
    beers <- draggableList "Beers" ("Budvar" :: "Delirium Tremens" :: "Deuchars" :: []);
    boars <- draggableList "Boars" ("Sus scrofa scrofa"
                                        :: "Sus scrofa ussuricus"
                                        :: "Sus scrofa cristatus"
                                        :: "Sus scrofa taiwanus" :: []);
    return <xml>

        <link rel="stylesheet" type="text/css" href="../../dragList.css"/>

        {bears}
        {beers}
        {boars}

    </xml>


sequence s
table t : { Id : int, Parent : option int, Nam : string }
  PRIMARY KEY Id

open TreeFun.Make(struct
                      val tab = t
                  end)

fun row r = <xml>
  #{[r.Id]}: {[r.Nam]} [Delete]

  <form>
    Add child: <textbox{#Nam}/> <submit action={add (Some r.Id)}/>
  </form>
</xml>

and main () =
    xml <- tree row None;
    return <xml>
      {xml}

      <form>
        Add a top-level node: <textbox{#Nam}/> <submit action={add None}/>
      </form>
    </xml>

and add parent r =
    id <- nextval s;
    dml (INSERT INTO t (Id, Parent, Nam) VALUES ({[id]}, {[parent]}, {[r.Nam]}));
    main ()

and del id =
    dml (DELETE FROM t WHERE Id = {[id]});
    main ()

Use FOREIGN KEY in Tree demo

sequence s
table t : { Id : int, Parent : option int, Nam : string }
  PRIMARY KEY Id,
  CONSTRAINT F FOREIGN KEY Parent REFERENCES t (Id) ON DELETE CASCADE

open TreeFun.Make(struct
                      val tab = t
                  end)

fun row r = <xml>
  #{[r.Id]}: {[r.Nam]} [Delete]

  <form>
    Add child: <textbox{#Nam}/> <submit action={add (Some r.Id)}/>
  </form>
</xml>

and main () =
    xml <- tree row None;
    return <xml>
      {xml}

      <form>
        Add a top-level node: <textbox{#Nam}/> <submit action={add None}/>
      </form>
    </xml>

and add parent r =
    id <- nextval s;
    dml (INSERT INTO t (Id, Parent, Nam) VALUES ({[id]}, {[parent]}, {[r.Nam]}));
    main ()

and del id =
    dml (DELETE FROM t WHERE Id = {[id]});
    main ()


style inputs

structure U = OpenidUser.Make(struct
                                  con cols = [Nam = string]

                                  val sessionLifetime = 3600
                                  val afterLogout = bless "/main"
                                  val secureCookies = False
                                  val association = Openid.Stateful {AssociationType = Openid.HMAC_SHA256,
                                                                     AssociationSessionType = Openid.NoEncryption}
                                  val realm = None

                                  val creationState =
                                      n <- source "";
                                      return {Nam = n}

                                  fun render r = <xml>

 Name:	 <ctextbox source={r.Nam}/>

                                  </xml>

                                  fun ready _ = return True

                                  fun tabulate r =
                                      n <- signal r.Nam;
                                      return {Nam = n}

                                  fun choose _ r = return r

                                  val formClass = inputs

                                  val fakeId = None
                              end)

fun wrap title body =
    userStuff <- U.main wrap;
    return <xml>
      <title>{[title]}</title>

      {userStuff.Status}

      {userStuff.Other}

{[title]}

      {body}
    </xml>

fun main () =
    whoami <- U.current;
    wrap "Main page" (case whoami of
                          None => <xml>I don't think you're logged in.</xml>
                        | Some whoami => <xml>Apparently you are {[whoami]}!</xml>)

Fix Utest to track latest change

style inputs

structure U = OpenidUser.Make(struct
                                  con cols = [Nam = string]

                                  val sessionLifetime = 3600
                                  val afterLogout = bless "/main"
                                  val secureCookies = False
                                  val association = Openid.Stateful {AssociationType = Openid.HMAC_SHA256,
                                                                     AssociationSessionType = Openid.NoEncryption}
                                  val realm = None

                                  val creationState =
                                      n <- source "";
                                      return {Nam = n}

                                  fun render r = <xml>

 Name:	 <ctextbox source={r.Nam}/>

                                  </xml>

                                  fun ready _ = return True

                                  fun tabulate r =
                                      n <- signal r.Nam;
                                      return {Nam = n}

                                  fun choose _ r = return (OpenidUser.Success r)

                                  val formClass = inputs

                                  val fakeId = None
                              end)

fun wrap title body =
    userStuff <- U.main wrap;
    return <xml>
      <title>{[title]}</title>

      {userStuff.Status}

      {userStuff.Other}

{[title]}

      {body}
    </xml>

fun main () =
    whoami <- U.current;
    wrap "Main page" (case whoami of
                          None => <xml>I don't think you're logged in.</xml>
                        | Some whoami => <xml>Apparently you are {[whoami]}!</xml>)


#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"

#include <string.h>

MODULE = Path::Hilbert::XS		PACKAGE = Path::Hilbert::XS
PROTOTYPES: DISABLE

Add the C implementation for Hilbert curve

#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"

#include <math.h>

/* rotate/flip a quadrant appropriately */
static void rot(int n, int *x, int *y, int rx, int ry) {
  if (ry) {
    return;
  }

  if (rx) {
    *x = n - 1 - *x;
    *y = n - 1 - *y;
  }

  /* swap x and y, reusing ry shamelessly */
  ry  = *x;
  *x = *y;
  *y = ry;
}

static int valid_n(int side) {
  double rv = pow(2, (int) ((log(side) / log(2)) + 0.5));
  return (int) rv;
}

MODULE = Path::Hilbert::XS		PACKAGE = Path::Hilbert::XS
PROTOTYPES: DISABLE

# convert (x,y) to d
int
xy2d(int side, int x, int y)

  PREINIT:
    int n;
    int d;
    int s;

  CODE:
    n = valid_n(side);
    d = 0;

    for (s = n / 2; s > 0; s /= 2) {
      int rx = (x & s) > 0;
      int ry = (y & s) > 0;
      d += s * s * ((3 * rx) ^ ry);
      rot(s, &x, &y, rx, ry);
    }

    RETVAL = d * side / n;

  OUTPUT: RETVAL

# convert d to (x,y)
void
d2xy(int side, int d)

  PREINIT:
    int n;
    int t;
    int s;
    int x;
    int y;

  PPCODE:
    n = valid_n(side);
    t = d;
    x = y = 0;
    for (s = 1; s < n; s *= 2) {
      int rx = 1 & (t / 2);
      int ry = 1 & (t ^ rx);
      rot(s, &x, &y, rx, ry);
      x += s * rx;
      y += s * ry;
      t /= 4;
    }
    x *= side / n;
    y *= side / n;

    EXTEND(SP, 2);
    mPUSHi(x);
    mPUSHi(y);
    PUTBACK;


/* this must be first: */
#include "postgres.h"

/* perl stuff */
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"

#include "spi_internal.h"

MODULE = SPI PREFIX = spi_

PROTOTYPES: ENABLE
VERSIONCHECK: DISABLE

void
spi_elog(level, message)
	int level
	char* message
	CODE:
	elog(level, message);

int
spi_DEBUG()

int
spi_LOG()

int
spi_INFO()

int
spi_NOTICE()

int
spi_WARNING()

int
spi_ERROR()

SV*
spi_spi_exec_query(query, ...)
	char* query;
	PREINIT:
		HV *ret_hash;
		int limit=0;
	CODE:
			if (items>2) Perl_croak(aTHX_ "Usage: spi_exec_query(query, limit) or spi_exec_query(query)");
			if (items == 2) limit = SvIV(ST(1));
			ret_hash=plperl_spi_exec(query, limit);
		RETVAL = newRV_noinc((SV*)ret_hash);
	OUTPUT:
		RETVAL

Add PLperl workaround for Win32 to the *.xs file.

/* this must be first: */
#define PLPERL_HAVE_UID_GID
#include "postgres.h"

/* perl stuff */
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"

#include "spi_internal.h"

MODULE = SPI PREFIX = spi_

PROTOTYPES: ENABLE
VERSIONCHECK: DISABLE

void
spi_elog(level, message)
	int level
	char* message
	CODE:
	elog(level, message);

int
spi_DEBUG()

int
spi_LOG()

int
spi_INFO()

int
spi_NOTICE()

int
spi_WARNING()

int
spi_ERROR()

SV*
spi_spi_exec_query(query, ...)
	char* query;
	PREINIT:
		HV *ret_hash;
		int limit=0;
	CODE:
			if (items>2) Perl_croak(aTHX_ "Usage: spi_exec_query(query, limit) or spi_exec_query(query)");
			if (items == 2) limit = SvIV(ST(1));
			ret_hash=plperl_spi_exec(query, limit);
		RETVAL = newRV_noinc((SV*)ret_hash);
	OUTPUT:
		RETVAL


#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include <chipmunk.h>

MODULE = Chipmunk	PACKAGE = Chipmunk	PREFIX = cp_

cpFloat
cp_moment_for_circle(m, r1, r2, offset)
		cpFloat m
		cpFloat r1
		cpFloat r2
		cpVect offset
	CODE:
		RETVAL = cpMomentForCircle(m, r1, r2, offset);
	OUTPUT:
		RETVAL

cpFloat
cp_area_for_circle(r1, r2)
		cpFloat r1
		cpFloat r2
	CODE:
		RETVAL = cpAreaForCircle(r1, r2);
	OUTPUT:
		RETVAL

Add a couple more misc functions

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#include <chipmunk.h>

MODULE = Chipmunk	PACKAGE = Chipmunk	PREFIX = cp_

cpFloat
cp_moment_for_circle(m, r1, r2, offset)
		cpFloat m
		cpFloat r1
		cpFloat r2
		cpVect offset
	CODE:
		RETVAL = cpMomentForCircle(m, r1, r2, offset);
	OUTPUT:
		RETVAL

cpFloat
cp_area_for_circle(r1, r2)
		cpFloat r1
		cpFloat r2
	CODE:
		RETVAL = cpAreaForCircle(r1, r2);
	OUTPUT:
		RETVAL

cpFloat
cp_moment_for_segment(m, a, b)
		cpFloat m
		cpVect a
		cpVect b
	CODE:
		RETVAL = cpMomentForSegment(m, a, b);
	OUTPUT:
		RETVAL

cpFloat
cp_area_for_segment(a, b, r)
		cpVect a
		cpVect b
		cpFloat r
	CODE:
		RETVAL = cpAreaForSegment(a, b, r);
	OUTPUT:
		RETVAL


namespace Kernel

Main:
    AH = 14
    AL = 72
    //! int 0x10
    AL = 101
    //! int 0x10
    AL = 108
    //! int 0x10
    AL = 108
    //! int 0x10
    AL = 111
    //! int 0x10
    AL = 32
    //! int 0x10
    AL = 102
    //! int 0x10
    AL = 114
    //! int 0x10
    AL = 111
    //! int 0x10
    AL = 109
    //! int 0x10
    AL = 32
    //! int 0x10
    AL = 88
    //! int 0x10
    AL = 35
    //! int 0x10
Finished:
    goto Finished

Update hello world sample to use characters

namespace Kernel

Main:
    AH = 14
    AL = H
    //! int 0x10
    AL = e
    //! int 0x10
    AL = l
    //! int 0x10
    AL = l
    //! int 0x10
    AL = o
    //! int 0x10
    AL = 32
    //! int 0x10
    AL = f
    //! int 0x10
    AL = r
    //! int 0x10
    AL = o
    //! int 0x10
    AL = m
    //! int 0x10
    AL = 32
    //! int 0x10
    AL = X
    //! int 0x10
    AL = 35
    //! int 0x10
Finished:
    goto Finished


#include "champlain-perl.h"

MODULE = Champlain::View  PACKAGE = Champlain::View  PREFIX = champlain_view_

ClutterActor*
champlain_view_new (class)
	C_ARGS: /* No args */

void
champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitude)

void
champlain_view_set_size (ChamplainView *view, guint width, guint height)

void
champlain_view_zoom_in (ChamplainView *view)

void
champlain_view_zoom_out (ChamplainView *view)

void
champlain_view_add_layer (ChamplainView *view, ChamplainLayer *layer)

void
champlain_view_get_coords_from_event (ChamplainView *view, ClutterEvent *event, OUTLIST gdouble latitude, OUTLIST gdouble longitude)

void
champlain_view_set_zoom_level (ChamplainView *view, gint zoom_level)

void
champlain_view_set_map_source (ChamplainView *view, ChamplainMapSource *map_source);

#void
#champlain_view_tile_ready (ChamplainView *view, ChamplainZoomLevel *level, ChamplainTile *tile, gboolean animate);

void
champlain_view_go_to (ChamplainView *view, gdouble latitude, gdouble longitude)

void
champlain_view_stop_go_to (ChamplainView *view)

Remove the definition of champlain_view_tile_ready()

#include "champlain-perl.h"

MODULE = Champlain::View  PACKAGE = Champlain::View  PREFIX = champlain_view_

ClutterActor*
champlain_view_new (class)
	C_ARGS: /* No args */

void
champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitude)

void
champlain_view_set_size (ChamplainView *view, guint width, guint height)

void
champlain_view_zoom_in (ChamplainView *view)

void
champlain_view_zoom_out (ChamplainView *view)

void
champlain_view_add_layer (ChamplainView *view, ChamplainLayer *layer)

void
champlain_view_get_coords_from_event (ChamplainView *view, ClutterEvent *event, OUTLIST gdouble latitude, OUTLIST gdouble longitude)

void
champlain_view_set_zoom_level (ChamplainView *view, gint zoom_level)

void
champlain_view_set_map_source (ChamplainView *view, ChamplainMapSource *map_source);

void
champlain_view_go_to (ChamplainView *view, gdouble latitude, gdouble longitude)

void
champlain_view_stop_go_to (ChamplainView *view)


#include "champlain-perl.h"

MODULE = Gtk2::Champlain::ViewEmbed  PACKAGE = Gtk2::Champlain::ViewEmbed  PREFIX = champlain_view_embed_

PROTOTYPES: DISABLE

GtkWidget *
champlain_view_embed_new (class, ChamplainView *view)
	C_ARGS: view

ChamplainView *
champlain_view_embed_get_view (ChamplainViewEmbed *embed)

Return types are constistent with the existing XS

#include "champlain-perl.h"

MODULE = Gtk2::Champlain::ViewEmbed  PACKAGE = Gtk2::Champlain::ViewEmbed  PREFIX = champlain_view_embed_

PROTOTYPES: DISABLE

GtkWidget*
champlain_view_embed_new (class, ChamplainView *view)
	C_ARGS: view

ChamplainView*
champlain_view_embed_get_view (ChamplainViewEmbed *embed)


#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"

#include <dtrace.h>

/* C++ Functions */

MODULE = Devel::libdtrace              PACKAGE = Devel::libdtrace

# XS code

PROTOTYPES: ENABLED

SV *
new( const char *class )
  CODE:
    /* Create a hash */
    HV* hash = newHV();

    /* Create a reference to the hash */
    SV* const self = newRV_noinc( (SV *)hash );

    /* bless into the proper package */
    RETVAL = sv_bless( self, gv_stashpv( class, 0 ) );
  OUTPUT: RETVAL

const char *
version(SV *self)
  CODE:
    RETVAL = "0.0.1";
  OUTPUT: RETVAL


module netconf-node-inventory {
    namespace "urn:opendaylight:netconf-node-inventory";
    prefix "netinv";

    import opendaylight-inventory { prefix inv; revision-date "2013-08-19";}
    import yang-ext {prefix ext; revision-date "2013-07-09";}

    revision "2014-01-08" {
        description "Initial revision of Inventory model";
    }

    grouping netconf-node-fields {
        leaf connected {
            type boolean;
        }

        leaf-list initial-capability {
            type string;
        }

        leaf-list current-capability {
            type string;
        }
    }

    augment /inv:nodes/inv:node {
        ext:augment-identifier "netconf-node";

        uses netconf-node-fields;
    }
}

Add a container for pass-through netconf access

module netconf-node-inventory {
    namespace "urn:opendaylight:netconf-node-inventory";
    prefix "netinv";

    import opendaylight-inventory { prefix inv; revision-date "2013-08-19";}
    import yang-ext {prefix ext; revision-date "2013-07-09";}

    revision "2014-01-08" {
        description "Initial revision of Inventory model";
    }

    grouping netconf-node-fields {
        leaf connected {
            type boolean;
        }

        leaf-list initial-capability {
            type string;
        }

        leaf-list current-capability {
            type string;
        }

        container pass-through {
            when "../connected = true";
            description
                "When the underlying node is connected, its NETCONF context
                is available verbatim under this container through the
                mount extension.";
        }
    }

    augment /inv:nodes/inv:node {
        ext:augment-identifier "netconf-node";

        uses netconf-node-fields;
    }
}


module pcep-segment-routing-app-config {
    yang-version 1;
    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:segment-routing-app-config";
    prefix "pcep-segment-routing-app-config";

    description
      "Configuration for the PCEP segment routing extension.";

    revision "2016-07-07" {
        description
            "Initial revision.";
    }

    container pcep-segment-routing-config {
        leaf iana-sr-subobjects-type {
            description "If false (default) SR-ERO type (=5) and SR-RRO type (=6) is used,
                    else proposed type (36) is used for parsing/serialization";
            type boolean;
            default false;
        }

        leaf sr-capable {
            type boolean;
            default true;
        }
    }
}

Add description to pcep SR capability model

module pcep-segment-routing-app-config {
    yang-version 1;
    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:segment-routing-app-config";
    prefix "pcep-segment-routing-app-config";

    description
      "Configuration for the PCEP segment routing extension.";

    revision "2016-07-07" {
        description
            "Initial revision.";
    }

    container pcep-segment-routing-config {
        leaf iana-sr-subobjects-type {
            description "If false (default) SR-ERO type (=5) and SR-RRO type (=6) is used,
                    else proposed type (36) is used for parsing/serialization";
            type boolean;
            default false;
        }

        leaf sr-capable {
            description "Advertize segment-routing capability";
            type boolean;
            default true;
        }
    }
}


module opendaylight-mdsal-list-test {

    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:list";
    prefix list-test;

    description
        "This module contains a collection of YANG definitions used for
        some test cases.";

    revision 2014-07-01 {
        description
        "Test model for testing data broker with nested lists.";
    }

    grouping two-level-list {
        list top-level-list {
            description
                "Top Level List";
            key "name";
            leaf name {
                type string;
            }
            list nested-list {
                key "name";
                leaf name {
                    type string;
                }
                leaf type {
                    type string;
//                    mandatory true;
//                    description
//                        "Mandatory type of list.";
                }
                ordered-by user;
                description
                    "A list of service functions that compose the service chain";
            }
        }
    }

    container top {
        uses two-level-list;
    }

    notification two-level-list-changed {
        uses two-level-list;
    }

    rpc put-top {
        input {
            uses two-level-list;
        }
    }
}

Add get-top rpc with output to sal-test-model

module opendaylight-mdsal-list-test {

    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:list";
    prefix list-test;

    description
        "This module contains a collection of YANG definitions used for
        some test cases.";

    revision 2014-07-01 {
        description
        "Test model for testing data broker with nested lists.";
    }

    grouping two-level-list {
        list top-level-list {
            description
                "Top Level List";
            key "name";
            leaf name {
                type string;
            }
            list nested-list {
                key "name";
                leaf name {
                    type string;
                }
                leaf type {
                    type string;
//                    mandatory true;
//                    description
//                        "Mandatory type of list.";
                }
                ordered-by user;
                description
                    "A list of service functions that compose the service chain";
            }
        }
    }

    container top {
        uses two-level-list;
    }

    notification two-level-list-changed {
        uses two-level-list;
    }

    rpc put-top {
        input {
            uses two-level-list;
        }
    }

    rpc get-top {
        output {
            uses two-level-list;
        }
    }
}


module second-tape {

  namespace "http://example.com/turing-machine/tape2";

  prefix "t2";

  import turing-machine {
    prefix "tm";
  }

  augment "/tm:turing-machine" {
    description
      "State data for the second tape.";
    leaf head-position-2 {
      config "false";
      type tm:cell-index;
      description
        "Head position of the second tape.";
    }
    container tape-2 {
      description
        "Contents of the second tape.";
      config "false";
      uses tm:tape-cells;
    }
  }

  augment
    "/tm:turing-machine/tm:transition-function/tm:delta/tm:input" {
    description
      "A new input parameter.";
    leaf symbol-2 {
      type tm:tape-symbol;
      description
        "Symbol read from the second tape.";
    }
  }

  augment
    "/tm:turing-machine/tm:transition-function/tm:delta/tm:output" {
    description
      "New output parameters.";
    leaf symbol-2 {
      type tm:tape-symbol;
      description
        "Symbol to be written to the second tape.";
    }
    leaf head-move-2 {
      type tm:head-dir;
      description
        "Move the head on the second tape one cell to the left or
         right.";
    }
  }

  augment "/tm:initialize/tm:input" {
    description
      "A new RPC input parameter.";
    leaf tape-content-2 {
      type string;
      description
        "Initial content of the second tape.";
    }
  }
}

Modify namespace URI in the tutorial example.

module second-tape {

  namespace "http://example.net/turing-machine/tape-2";

  prefix "t2";

  import turing-machine {
    prefix "tm";
  }

  augment "/tm:turing-machine" {
    description
      "State data for the second tape.";
    leaf head-position-2 {
      config "false";
      type tm:cell-index;
      description
        "Head position of the second tape.";
    }
    container tape-2 {
      description
        "Contents of the second tape.";
      config "false";
      uses tm:tape-cells;
    }
  }

  augment
    "/tm:turing-machine/tm:transition-function/tm:delta/tm:input" {
    description
      "A new input parameter.";
    leaf symbol-2 {
      type tm:tape-symbol;
      description
        "Symbol read from the second tape.";
    }
  }

  augment
    "/tm:turing-machine/tm:transition-function/tm:delta/tm:output" {
    description
      "New output parameters.";
    leaf symbol-2 {
      type tm:tape-symbol;
      description
        "Symbol to be written to the second tape.";
    }
    leaf head-move-2 {
      type tm:head-dir;
      description
        "Move the head on the second tape one cell to the left or
         right.";
    }
  }

  augment "/tm:initialize/tm:input" {
    description
      "A new RPC input parameter.";
    leaf tape-content-2 {
      type string;
      description
        "Initial content of the second tape.";
    }
  }
}


module actor-system-provider-service {
    yang-version 1;
    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service";
    prefix "actor-system";

    import config { prefix config; revision-date 2013-04-05; }

    description "Akka actor system provider service definition";

    revision "2015-10-05" {
        description "Initial revision";
    }

    identity actor-system-provider-service {
        base "config:service-type";
        config:java-class  "org.opendaylight.controller.cluster.ActorSystemProvider";
    }
}

Modify config Module impls to co-exist with blueprint

module actor-system-provider-service {
    yang-version 1;
    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:service";
    prefix "actor-system";

    import config { prefix config; revision-date 2013-04-05; }

    description "Akka actor system provider service definition";

    revision "2015-10-05" {
        description "Initial revision";
    }

    identity actor-system-provider-service {
        base "config:service-type";
        config:java-class  "org.opendaylight.controller.cluster.ActorSystemProvider";
        config:disable-osgi-service-registration;
    }
}


module ietf-yang-metadata {

  namespace "urn:ietf:params:xml:ns:yang:ietf-yang-metadata";

  prefix "md";

  organization
    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

  contact
    "WG Web:   <https://datatracker.ietf.org/wg/netmod/>

     WG List:  <mailto:netmod@ietf.org>

     WG Chair: Lou Berger
               <mailto:lberger@labn.net>

     WG Chair: Kent Watsen
               <mailto:kwatsen@juniper.net>

     Editor:   Ladislav Lhotka
               <mailto:lhotka@nic.cz>";

  description
    "This YANG module defines an 'extension' statement that allows
     for defining metadata annotations.

     Copyright (c) 2016 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject to
     the license terms contained in, the Simplified BSD License set
     forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC 7952
     (http://www.rfc-editor.org/info/rfc7952); see the RFC itself
     for full legal notices.";

  revision 2016-08-05 {
    description
      "Initial revision.";
    reference
      "RFC 7952: Defining and Using Metadata with YANG";
  }

  extension annotation {
    argument name;
    description
      "This extension allows for defining metadata annotations in
       YANG modules.  The 'md:annotation' statement can appear only
       at the top level of a YANG module or submodule, i.e., it
       becomes a new alternative in the ABNF production rule for
       'body-stmts' (Section 14 in RFC 7950).

       The argument of the 'md:annotation' statement defines the name
       of the annotation.  Syntactically, it is a YANG identifier as
       defined in Section 6.2 of RFC 7950.

       An annotation defined with this 'extension' statement inherits
       the namespace and other context from the YANG module in which
       it is defined.

       The data type of the annotation value is specified in the same
       way as for a leaf data node using the 'type' statement.

       The semantics of the annotation and other documentation can be
       specified using the following standard YANG substatements (all
       are optional): 'description', 'if-feature', 'reference',
       'status', and 'units'.

       A server announces support for a particular annotation by
       including the module in which the annotation is defined among
       the advertised YANG modules, e.g., in a NETCONF <hello>
       message or in the YANG library (RFC 7950).  The annotation can
       then be attached to any instance of a data node defined in any
       YANG module that is advertised by the server.

       XML encoding and JSON encoding of annotations are defined in
       RFC 7952.";
  }
}


module Base.Change.Context
    {Type : Set}
    (ΔType : Type → Type) where

-- Transform a context of values into a context of values and
-- changes.

open import Base.Syntax.Context Type

ΔContext : Context → Context
ΔContext ∅ = ∅
ΔContext (τ • Γ) = ΔType τ • τ • ΔContext Γ

-- like ΔContext, but ΔType τ and τ are swapped
ΔContext′ : Context → Context
ΔContext′ ∅ = ∅
ΔContext′ (τ • Γ) = τ • ΔType τ • ΔContext′ Γ

Γ≼ΔΓ : ∀ {Γ} → Γ ≼ ΔContext Γ
Γ≼ΔΓ {∅} = ∅
Γ≼ΔΓ {τ • Γ} = drop ΔType τ • keep τ • Γ≼ΔΓ

Move function-specific comment right before function

module Base.Change.Context
    {Type : Set}
    (ΔType : Type → Type) where

open import Base.Syntax.Context Type

-- Transform a context of values into a context of values and
-- changes.

ΔContext : Context → Context
ΔContext ∅ = ∅
ΔContext (τ • Γ) = ΔType τ • τ • ΔContext Γ

-- like ΔContext, but ΔType τ and τ are swapped
ΔContext′ : Context → Context
ΔContext′ ∅ = ∅
ΔContext′ (τ • Γ) = τ • ΔType τ • ΔContext′ Γ

Γ≼ΔΓ : ∀ {Γ} → Γ ≼ ΔContext Γ
Γ≼ΔΓ {∅} = ∅
Γ≼ΔΓ {τ • Γ} = drop ΔType τ • keep τ • Γ≼ΔΓ


module meaning where

open import Level

record Meaning (Syntax : Set) {ℓ : Level} : Set (suc ℓ) where
  constructor
    meaning
  field
    {Semantics} : Set ℓ
    ⟦_⟧ : Syntax → Semantics

open Meaning {{...}} public

Improve printing of resolved overloading.

module meaning where

open import Level

record Meaning (Syntax : Set) {ℓ : Level} : Set (suc ℓ) where
  constructor
    meaning
  field
    {Semantics} : Set ℓ
    ⟨_⟩⟦_⟧ : Syntax → Semantics

open Meaning {{...}} public
  renaming (⟨_⟩⟦_⟧ to ⟦_⟧)

open Meaning public
  using (⟨_⟩⟦_⟧)


{-# OPTIONS --without-K #-}
open import Type hiding (★)

module Data.Tree.Binary where

data BinTree {a} (A : ★ a) : ★ a where
  empty : BinTree A
  leaf  : A → BinTree A
  fork  : (ℓ r : BinTree A) → BinTree A

Add Any predicate for binary tree

{-# OPTIONS --without-K #-}
open import Type hiding (★)

open import Level
open import Data.Zero
open import Data.Sum

module Data.Tree.Binary where

data BinTree {a} (A : ★ a) : ★ a where
  empty : BinTree A
  leaf  : A → BinTree A
  fork  : (ℓ r : BinTree A) → BinTree A

Any : ∀ {a p}{A : ★ a}(P : A → ★ p) → BinTree A → ★ p
Any P empty = Lift 𝟘
Any P (leaf x) = P x
Any P (fork ts ts₁) = Any P ts ⊎ Any P ts₁


{-# OPTIONS --without-K #-}
open import Type
open import Data.Product
open import Data.Bit

module Game.IND-CPA-alt
  (PubKey     : ★)
  (SecKey     : ★)
  (Message    : ★)
  (CipherText : ★)

  -- randomness supply for: encryption, key-generation, adversary, extensions
  (Rₑ Rₖ Rₐ : ★)

  (KeyGen : Rₖ → PubKey × SecKey)
  (Enc    : PubKey → Message → Rₑ → CipherText)

where

M² = Bit → Message

-- IND-CPA adversary in two parts
Adv : ★
Adv = Rₐ → PubKey → (M² × (CipherText → Bit))

-- IND-CPA randomness supply
R : ★
R = (Rₐ × Rₖ × Rₑ)

-- IND-CPA games:
--   * input: adversary and randomness supply
--   * output b: adversary claims we are in game ⅁ b
Game : ★
Game = Adv → R → Bit

-- The game step by step:
-- (pk) key-generation, only the public-key is needed
-- (mb) send randomness, public-key and bit
--      receive which message to encrypt
-- (c)  encrypt the message
-- (b′) send randomness, public-key and ciphertext
--      receive the guess from the adversary
⅁ : Bit → Game
⅁ b m (rₐ , rₖ , rₑ) = b′
  where
  pk = proj₁ (KeyGen rₖ)
  ad = m rₐ pk
  mb = proj₁ ad b
  c  = Enc pk mb rₑ
  b′ = proj₂ ad c

⅁₀ ⅁₁ : Game
⅁₀ = ⅁ 0b
⅁₁ = ⅁ 1b


Add incomplete note on co-inductive natural numbers.

------------------------------------------------------------------------------
-- Definition of FOTC Conat using Agda's co-inductive combinators
------------------------------------------------------------------------------

{-# OPTIONS --allow-unsolved-metas #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}

module FOT.FOTC.Data.Conat.ConatSL where

open import FOTC.Base
open import Coinduction

------------------------------------------------------------------------------

data Conat : D → Set where
  cozero : Conat zero
  cosucc : ∀ {n} → (∞ (Conat n)) → Conat (succ₁ n)

Conat-unf : ∀ {n} → Conat n → n ≡ zero ∨ (∃[ n' ] Conat n' ∧ n ≡ succ₁ n')
Conat-unf cozero = inj₁ refl
Conat-unf (cosucc {n} Cn) = inj₂ (n , ♭ Cn , refl)

Conat-pre-fixed : ∀ {n} →
                  (n ≡ zero ∨ (∃[ n' ] Conat n' ∧ n ≡ succ₁ n')) →
                  Conat n
Conat-pre-fixed (inj₁ h) = subst Conat (sym h) cozero
Conat-pre-fixed (inj₂ (n , Cn , h)) = subst Conat (sym h) (cosucc (♯ Cn))

Conat-coind : ∀ (A : D → Set) {n} →
              (A n → n ≡ zero ∨ (∃[ n' ] A n' ∧ n ≡ succ₁ n')) →
              A n → Conat n
Conat-coind A h An = {!!}


<cfscript>

	// Use this file to set variables for the Application.cfc's "this" scope.

	// Examples:
	// this.name = "MyAppName";
	// this.sessionTimeout = CreateTimeSpan(0,0,5,0);

	// Just to make our test suite pass for now.
	this.disableEngineCheck = true;

</cfscript>

Remove disableEngineCheck override for release.

<cfscript>

	// Use this file to set variables for the Application.cfc's "this" scope.

	// Examples:
	// this.name = "MyAppName";
	// this.sessionTimeout = CreateTimeSpan(0,0,5,0);

</cfscript>


<cftry>

<cfloop collection="#session.epos_archive#" item="key">
	<cfset ref = StructFind(session.epos_archive, key)>
	<cfset frame = StructCopy(ref)>
	<cfset StructDelete(session, "basket")>
	<cfset StructInsert(session, "basket", frame)>
	<cfset StructDelete(session.epos_archive, key)>
</cfloop>

<cfcatch type="any">
	<cfset writeDumpToFile(cfcatch)>
</cfcatch>
</cftry>

Fix basket total on resume basket

<cftry>

	<cfloop collection="#session.epos_archive#" item="key">
		<cfset ref = StructFind(session.epos_archive, key)>
		<cfset frame = StructCopy(ref)>
		<cfset StructDelete(session, "basket")>
		<cfset StructInsert(session, "basket", frame)>
		<cfset StructDelete(session.epos_archive, key)>
	</cfloop>
	<cfset session.till.isTranOpen = true>

<cfcatch type="any">
	<cfset writeDumpToFile(cfcatch)>
</cfcatch>
</cftry>


<cfoutput>

	<cfloop query="rc.breadcrumbs">

#rc.breadcrumbs.title# /

	</cfloop>

#rc.Page.getTitle()#

#rc.Page.getContent()#
</cfoutput>

Hide breadcrumbs on home page.

<cfoutput>
	<cfif !rc.Page.isRoot()>

			<cfloop query="rc.breadcrumbs">
#rc.breadcrumbs.title# /
</cfloop>

#rc.Page.getTitle()#

	</cfif>

	#rc.Page.getContent()#
</cfoutput>


<cfimport prefix="mp" taglib="../extensions/customtags/" />
<cfimport prefix="common" taglib="../../extensions/customtags/common" />

<cfif structkeyexists(url,"topcat_name_urlsafe")>
	<cfif variables.topcat.recordcount>
		<mp:nav>
			<mpx:foobar />
		</mp:nav_new>
	<cfelse>
		<cfinclude template="missing.cfm" />
	</cfif>
<cfelse>
	<cfinclude template="missing.cfm" />
	<foo:bar /><baz:smeg />

	<foo:barbaz />
</cfif>

Add a cfscript include statement to the test template

<cfimport prefix="mp" taglib="../extensions/customtags/" />
<cfimport prefix="common" taglib="../../extensions/customtags/common" />

<cfif structkeyexists(url,"topcat_name_urlsafe")>
	<cfif variables.topcat.recordcount>
		<mp:nav>
			<mpx:foobar />
		</mp:nav_new>
	<cfelse>
		<cfinclude template="missing.cfm" />
	</cfif>
<cfelse>
	<cfinclude template="missing.cfm" />
	<foo:bar /><baz:smeg />

	<foo:barbaz />
</cfif>

<cfscript>
include 'missing.cfm';
</cfscript>


<cfscript>
	loc.iList = StructKeyList(application.wheels.plugins);
	loc.iEnd = ListLen(loc.iList);
	for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
	{
		loc.iItem = ListGetAt(loc.iList, loc.i);
		loc.jList = StructKeyList(application.wheels.plugins[loc.iItem]);
		loc.jEnd = ListLen(loc.jList);
		for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
		{
			loc.jItem = ListGetAt(loc.jList, loc.j);
			if (!ListFindNoCase("init,version", loc.jItem))
			{
				variables[loc.jItem] = application.wheels.plugins[loc.iItem][loc.jItem];
				if (StructKeyExists(variables, loc.jItem))
					variables.core[loc.jItem] = variables[loc.jItem];
			}
		}
	}
</cfscript>

Fix for stack overflow error when injecting plugin methods.

<cfscript>
	loc.iList = StructKeyList(application.wheels.plugins);
	loc.iEnd = ListLen(loc.iList);
	for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
	{
		loc.iItem = ListGetAt(loc.iList, loc.i);
		loc.jList = StructKeyList(application.wheels.plugins[loc.iItem]);
		loc.jEnd = ListLen(loc.jList);
		for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
		{
			loc.jItem = ListGetAt(loc.jList, loc.j);
			if (!ListFindNoCase("init,version", loc.jItem))
			{
				if (StructKeyExists(variables, loc.jItem))
					variables.core[loc.jItem] = variables[loc.jItem];
				variables[loc.jItem] = application.wheels.plugins[loc.iItem][loc.jItem];
			}
		}
	}
</cfscript>


<cfquery datasource="testing">
	CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
       species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
</cfquery>
<cfscript>
	dump(getTimeZoneInfo());
	abort;
	o = getBeanFactory().getBean('commonService');
	results = o.getURL(sURL = request.sPHPURL & '/results/nfl');

	writeDump(DeserializeJSON(trim(results.fileContent)));

	return;

	o = getBeanFactory().getBean("weekService");
	writeDump(o.makeAutoPicks(181, 9));
	return;

	o = getBeanFactory().getBean("gameService");
	arWeek  = o.adminWeek(179)
	writeDump(o.getGameScores(arWeek));
	return;

	o = getBeanFactory().getBean("gameService");
	writeDump(o.callScoreAPI("Oklahoma State"));
	return;

	o = getBeanFactory().getBean("leagueGateway").get({ "sKey" = "NFLDog"});
	transaction{
		o.setSName("NFL Dog");
		o.setSKey("NFLDog");
		o.setBActive(1);
		o.save();
		transactionCommit();
	}
	return;
</cfscript>

Use new datasource to try and connect

<cfquery datasource="test2">
	CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
       species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
</cfquery>
<cfscript>
	dump(getTimeZoneInfo());
	abort;
	o = getBeanFactory().getBean('commonService');
	results = o.getURL(sURL = request.sPHPURL & '/results/nfl');

	writeDump(DeserializeJSON(trim(results.fileContent)));

	return;

	o = getBeanFactory().getBean("weekService");
	writeDump(o.makeAutoPicks(181, 9));
	return;

	o = getBeanFactory().getBean("gameService");
	arWeek  = o.adminWeek(179)
	writeDump(o.getGameScores(arWeek));
	return;

	o = getBeanFactory().getBean("gameService");
	writeDump(o.callScoreAPI("Oklahoma State"));
	return;

	o = getBeanFactory().getBean("leagueGateway").get({ "sKey" = "NFLDog"});
	transaction{
		o.setSName("NFL Dog");
		o.setSKey("NFLDog");
		o.setBActive(1);
		o.save();
		transactionCommit();
	}
	return;
</cfscript>


<cfoutput>

ContentBox Google Code Prettify

Paste your code so we can magically prettify it on your site.

	#html.startForm(name="codeForm")#
		#html.textarea(name="code", label="Code: ", class="textfield", required="true", rows="10")#

		#html.label(field="lineNumbers",content="Show Line Numbers:")#
		#html.radioButton(name="lineNumbers",value=true)# Yes
		#html.radioButton(name="lineNumbers",checked=true,value=false)# No
	#html.endForm()#

	<button class="button2" onclick="embedCode()"> Embed Code </button>
	<button class="buttonred" onclick="closeRemoteModal()"> Cancel </button>

</cfoutput>

Update Entry.cfm for bootstrap layout and styles

<cfoutput>

            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

ContentBox Google Code Prettify

Paste your code so we can magically prettify it on your site.

				#html.startForm( name="codeForm" )#

						#html.label( field="code", content="Code:" )#
						#html.textarea( name="code", class="textfield form-control", required="true", rows="10" )#

						#html.label( field="lineNumbers", content="Show Line Numbers:" )#
						#html.radioButton( name="lineNumbers", value=true )# Yes
						#html.radioButton( name="lineNumbers", checked=true, value=false )# No

				#html.endForm()#

				<button class="button2" onclick="embedCode()"> Embed Code </button>
				<button class="buttonred" onclick="closeRemoteModal()"> Cancel </button>

</cfoutput>


<cfscript>

	// Use this file to set variables for the Application.cfc's "this" scope.

	// Examples:
	// this.name = "MyAppName";
	// this.sessionTimeout = CreateTimeSpan(0,0,5,0);

</cfscript>

Add back the temporary disableEngineCheck so our test suite can run.

<cfscript>

	// Use this file to set variables for the Application.cfc's "this" scope.

	// Examples:
	// this.name = "MyAppName";
	// this.sessionTimeout = CreateTimeSpan(0,0,5,0);

	// Just to make our test suite pass for now.
 	this.disableEngineCheck = true;

</cfscript>


<cfscript>

	// Use this file to set variables for the Application.cfc's "this" scope.

	// Examples:
	// this.name = "MyAppName";
	// this.sessionTimeout = CreateTimeSpan(0,0,5,0);

</cfscript>

Add Back Disable Engine Check

<cfscript>

	// Use this file to set variables for the Application.cfc's "this" scope.

	// Examples:
	// this.name = "MyAppName";
	// this.sessionTimeout = CreateTimeSpan(0,0,5,0);

	// Just to make our test suite pass for now.
 	this.disableEngineCheck = true;
</cfscript>


<scm class="hudson.scm.SubversionSCM" plugin="subversion@@2.12.1">
  <locations>
    <hudson.scm.SubversionSCM_-ModuleLocation>
      <remote>@ESCAPE(remote)</remote>
@[if local]@
      <local>@ESCAPE(local)</local>
@[end if]@
      <depthOption>infinity</depthOption>
      <ignoreExternalsOption>false</ignoreExternalsOption>
    </hudson.scm.SubversionSCM_-ModuleLocation>
  </locations>
  <excludedRegions/>
  <includedRegions/>
  <excludedUsers/>
  <excludedRevprop/>
  <excludedCommitMessages/>
  <workspaceUpdater class="hudson.scm.subversion.UpdateUpdater"/>
  <ignoreDirPropChanges>false</ignoreDirPropChanges>
  <filterChangelog>false</filterChangelog>
</scm>

Update subversion plugin to version 2.13.1

<scm class="hudson.scm.SubversionSCM" plugin="subversion@@2.13.1">
  <locations>
    <hudson.scm.SubversionSCM_-ModuleLocation>
      <remote>@ESCAPE(remote)</remote>
@[if local]@
      <local>@ESCAPE(local)</local>
@[end if]@
      <depthOption>infinity</depthOption>
      <ignoreExternalsOption>false</ignoreExternalsOption>
    </hudson.scm.SubversionSCM_-ModuleLocation>
  </locations>
  <excludedRegions/>
  <includedRegions/>
  <excludedUsers/>
  <excludedRevprop/>
  <excludedCommitMessages/>
  <workspaceUpdater class="hudson.scm.subversion.UpdateUpdater"/>
  <ignoreDirPropChanges>false</ignoreDirPropChanges>
  <filterChangelog>false</filterChangelog>
</scm>


scope {
    l = 3
    l += (!foo.bar[2]((2 ** 2 // 2), foo, 4))[2:@foo]
    l -= 2
}

Clean up example to better test operator templating. At least for now..


# Copyright 2011 Google Inc. All Rights Reserved.
# This file is available under the Apache license.

/$/ {                                          # 4: match /$/
                                               # 5: jnm 9
  inc(line-count)                              # 6: inc line-count
}                                              # 7: ret true

Remove bogus comments regarding instructions.

# Copyright 2011 Google Inc. All Rights Reserved.
# This file is available under the Apache license.

/$/ {
  inc(line-count)
}


system.require('emUtil/util.em');

mTest = new UnitTest('connectionTest');

system.createPresence(
    {
        'space' : '12345678-1111-1111-1111-DEFA01759ACE',
        'pos' : <0, 0, 0>,
        'callback' : function() {
            mTest.success('Finished');
            system.killEntity();
        }
    }
);

Make basic proximity connection test check for expected result set count after connection.

system.require('emUtil/util.em');

mTest = new UnitTest('connectionTest');

var resultCount = function() {
    var set = system.getProxSet(system.self);
    var count = 0;
    for (var x in set)
        count++;
    return count;
};

system.createPresence(
    {
        'space' : '12345678-1111-1111-1111-DEFA01759ACE',
        'pos' : <0, 0, 0>,
        'callback' : function() {
            // Currently need this because system.getProxSet isn't valid in the
            // createPresence callback (see bug #506).
            system.event(
                function() {
                    if (resultCount() != 0)
                        mTest.fail('Incorrect number of result objects');

                    mTest.success('Finished');
                    system.killEntity();
                }
            );
        }
    }
);


${

# These sizes are copied from gtk2 rc files ...
if scaling == "100":
    icon_base = 11
else: # About 72% of the XO size, adjusted so that eg. toolbuttons work
    icon_base = 8               # 7.92

icon_small = icon_base * 3
icon_large = icon_base * 5

}

[Settings]
gtk-auto-mnemonics = 1
gtk-menu-images = 1
gtk-button-images = 1
gtk-toolbar-style = GTK_TOOLBAR_ICONS
gtk-cursor-theme-name = sugar

${
icon_small = icon_base * 3
icon_large = icon_base * 5

small_icons = [ "gtk-menu", "gtk-dnd", "gtk-small-toolbar", "gtk-button" ]
large_icons = [ "gtk-large-toolbar" ]

icon_sizes = []
for icon in small_icons:
    icon_sizes += [icon + "=" + str(icon_small) + ',' + str(icon_small)]
for icon in large_icons:
    icon_sizes += [icon + "=" + str(icon_large) + ',' + str(icon_large)]

icon_sizes = ":".join(icon_sizes)

}

gtk-icon-sizes = $icon_sizes

Add setting to invoke page up/page down on scrollbars clicks

${

# These sizes are copied from gtk2 rc files ...
if scaling == "100":
    icon_base = 11
else: # About 72% of the XO size, adjusted so that eg. toolbuttons work
    icon_base = 8               # 7.92

icon_small = icon_base * 3
icon_large = icon_base * 5

}

[Settings]
gtk-auto-mnemonics = 1
gtk-menu-images = 1
gtk-button-images = 1
gtk-toolbar-style = GTK_TOOLBAR_ICONS
gtk-cursor-theme-name = sugar
gtk-primary-button-warps-slider = 0

${
icon_small = icon_base * 3
icon_large = icon_base * 5

small_icons = [ "gtk-menu", "gtk-dnd", "gtk-small-toolbar", "gtk-button" ]
large_icons = [ "gtk-large-toolbar" ]

icon_sizes = []
for icon in small_icons:
    icon_sizes += [icon + "=" + str(icon_small) + ',' + str(icon_small)]
for icon in large_icons:
    icon_sizes += [icon + "=" + str(icon_large) + ',' + str(icon_large)]

icon_sizes = ":".join(icon_sizes)

}

gtk-icon-sizes = $icon_sizes


Test file to demonstrate that timer restore now works.

function funcCallback()
{
    system.print('\n\nI got timed out\n\n');
}

var a = system.timeout(5,funcCallback);

var aAllData = a.getAllData();

a.clear();

function recreateA()
{
    system.print('\n');
    system.print(aAllData);
    system.print('\n');
    // system.print(aAllData.period);
    // system.print('\n');
    // system.print(aAllData.contextId);
    // system.print('\n');
    // system.print(aAllData.timeRemaining);
    // system.print('\n');
    // system.print(aAllData.isSuspended);
    // system.print('\n');
    // system.print(aAllData.isCleared);
    // system.print('\n');

    var b = system.timeout(aAllData.period,
                           aAllData.cb,
                           aAllData.contextId,
                           aAllData.timeRemaining,
                           aAllData.isSuspended,
                           aAllData.isCleared
                          );
}

system.timeout(5, recreateA);


Add a default avatar script so its easy to get all the functionality provided by emerson without writing your own avatar script.

/*  Sirikata
 *  default.em
 *
 *  Copyright (c) 2011, Ewen Cheslack-Postava
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are
 *  met:
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * 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.
 *  * Neither the name of Sirikata 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 AND CONTRIBUTORS "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 OWNER
 * OR CONTRIBUTORS 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.
 */

// A sane, simple, default. Only includes functionality from libraries.
system.import('std/graphics/default.em');

system.onPresenceConnected(
    function(pres) {
        simulator = new std.graphics.DefaultGraphics(pres, 'ogregraphics');
    }
);


{layout $layout}

{var $entityClass = 'PAF\Modules\CommissionModule\Model\Commission'}

    {include #stamp, 'instant' => $logEvent->instant}
    {_$logEvent->type, ['actor' => $actor]}

    {foreach $parameters['changes'] ?? [] as $property => $change}
        {control $control:propertyDiff, $entityClass, $property, $change['newValue']??null, $change['oldValue']??null}
    {/foreach}

Fix audit cards for commission entity

{layout $layout}

{var $entityClass = 'pafCommissions.commission'}

    {include #stamp, 'instant' => $logEvent->instant}
    {_$logEvent->type, ['actor' => $actor]}

    {foreach $parameters['changes'] ?? [] as $property => $change}
        {control $control:propertyDiff, $entityClass, $property, $change['newValue']??null, $change['oldValue']??null}
    {/foreach}


{layout '../@layout.latte'}

{block #content}

Emails

List of layouts

            Add new email

    {control dataTableDefault}

Fix header for email templates

{layout '../@layout.latte'}

{block #content}

Emails

List of templates

            Add new email

    {control dataTableDefault}


{block content}

Obsah

{$songbook->title}

Add link to songbook detail

{block content}

Obsah

guid">{$songbook->title}


{contentType xml}
<SHOPITEM>
	<NAME>{$item->name}</NAME>
	<DESCRIPTION>{$item->description}</DESCRIPTION>
	<PRICE>{$item->price}</PRICE>
	<CATEGORY>{$item->category}</CATEGORY>
	<MANUFACTURER>{$item->manufacturer}</MANUFACTURER>
	<URL>{$item->url}</URL>

	<PICTURE>{$item->picture}</PICTURE>
	<SHOPPING>{$item->deliveryDate}</SHOPPING>
	<AVAILABILITY>{$item->availability}</AVAILABILITY>

	<ID n:if="$item->id">{$item->id}</ID>
	<EAN n:if="$item->ean">{$item->ean}</EAN>
	<PART_NUMBER n:if="$item->partNumber">{$item->partNumber}</PART_NUMBER>

	{if !empty($parameters = $item->parameters)}
		<PARAMS>
			<PARAM n:foreach="$parameters as $parameter">
				<PARAM_NAME>{$parameter->name}</PARAM_NAME>
				<VAL>{$parameter->value}</VAL>
			</PARAM>
		</PARAMS>
	{/if}
</SHOPITEM>

Fix pricemania export variable name

{contentType xml}
<SHOPITEM>
	<NAME>{$item->name}</NAME>
	<DESCRIPTION>{$item->description}</DESCRIPTION>
	<PRICE>{$item->price}</PRICE>
	<CATEGORY>{$item->category}</CATEGORY>
	<MANUFACTURER>{$item->manufacturer}</MANUFACTURER>
	<URL>{$item->url}</URL>

	<PICTURE>{$item->picture}</PICTURE>
	<SHOPPING>{$item->shipping}</SHOPPING>
	<AVAILABILITY>{$item->availability}</AVAILABILITY>

	<ID n:if="$item->id">{$item->id}</ID>
	<EAN n:if="$item->ean">{$item->ean}</EAN>
	<PART_NUMBER n:if="$item->partNumber">{$item->partNumber}</PART_NUMBER>

	{if !empty($parameters = $item->parameters)}
		<PARAMS>
			<PARAM n:foreach="$parameters as $parameter">
				<PARAM_NAME>{$parameter->name}</PARAM_NAME>
				<VAL>{$parameter->value}</VAL>
			</PARAM>
		</PARAMS>
	{/if}
</SHOPITEM>


<script src="{$src}?merchant={$config->merchantId}" {if $config->sandbox}data-env="sandbox"{/if} data-currency="{$config->currency}"  {!$pluginSettings}></script>

Fix JS path in template

<script src="{$basePath}/js/{$src}?merchant={$config->merchantId}" {if $config->sandbox}data-env="sandbox"{/if} data-currency="{$config->currency}"  {!$pluginSettings}></script>


{block nav}

active} class="active"{/if}>
                    {if $item->subItems}
                        linkPresenter}" data-toggle="collapse" aria-expanded="{$item->active ? 'true' : 'false'}" aria-controls="nav-{$item->linkPresenter}">{$item->name}

active ? ' show' : ''}" id="nav-{$item->linkPresenter}">

subItems as $subItem"{if $subItem->active} class="active"{/if}>
                                linkPresenter . ':' . $subItem->linkAction}">{$subItem->name}

                    {else}
                        linkPresenter . ':' . $item->linkAction}">{$item->name}
                    {/if}

{/block}

Bring back invitation package heart


{if $last}
	{snippet mailFormWrapper}

		    {control mailGeneratorForm}

		{include onChangeCallback, input => source_template_id, link => sourceTemplateChange}
	{/snippet}
{else}

You have to create source template for generator.

{/if}

{define onChangeCallback}

{/define}

Fix rendering of select picker after snippet redraw.


#!/usr/bin/env runhaskell
> import Distribution.Simple
> import System.Cmd
>
> testing _ _ _ _ = system "runhaskell tests/Properties.hs" >> return ()
>
> main = defaultMainWithHooks defaultUserHooks
>        {runTests=testing}

Switch from defaultUserHooks to simpleUserHooks

#!/usr/bin/env runhaskell
> import Distribution.Simple
> import System.Cmd
>
> testing _ _ _ _ = system "runhaskell tests/Properties.hs" >> return ()
>
> main = defaultMainWithHooks simpleUserHooks
>        {runTests=testing}


Some extra functions to extend Data.Map

\begin{code}
module FiniteMap (
        insertList,
        insertListWith,
        deleteList,
        foldRight, foldRightWithKey
    ) where

import Data.Map (Map)
import qualified Data.Map as Map

insertList :: Ord key => [(key,elt)] -> Map key elt -> Map key elt
insertList xs m = foldl (\m (k, v) -> Map.insert k v m) m xs

insertListWith :: Ord key
               => (elt -> elt -> elt)
               -> [(key,elt)]
               -> Map key elt
               -> Map key elt
insertListWith f xs m0 = foldl (\m (k, v) -> Map.insertWith f k v m) m0 xs

deleteList :: Ord key => [key] -> Map key elt -> Map key elt
deleteList ks m = foldl (flip Map.delete) m ks

foldRight        :: (elt -> a -> a) -> a -> Map key elt -> a
foldRight        = Map.fold
foldRightWithKey :: (key -> elt -> a -> a) -> a -> Map key elt -> a
#if (MIN_VERSION_containers(0,4,0))
foldRightWithKey = Map.foldrWithKey
#else
foldRightWithKey = Map.foldWithKey
#endif
\end{code}

Remove old workaround for containers <= 0.3

Some extra functions to extend Data.Map

\begin{code}
module FiniteMap (
        insertList,
        insertListWith,
        deleteList,
        foldRight, foldRightWithKey
    ) where

import Data.Map (Map)
import qualified Data.Map as Map

insertList :: Ord key => [(key,elt)] -> Map key elt -> Map key elt
insertList xs m = foldl (\m (k, v) -> Map.insert k v m) m xs

insertListWith :: Ord key
               => (elt -> elt -> elt)
               -> [(key,elt)]
               -> Map key elt
               -> Map key elt
insertListWith f xs m0 = foldl (\m (k, v) -> Map.insertWith f k v m) m0 xs

deleteList :: Ord key => [key] -> Map key elt -> Map key elt
deleteList ks m = foldl (flip Map.delete) m ks

foldRight        :: (elt -> a -> a) -> a -> Map key elt -> a
foldRight        = Map.fold
foldRightWithKey :: (key -> elt -> a -> a) -> a -> Map key elt -> a
foldRightWithKey = Map.foldrWithKey
\end{code}


BUG 331
%  Blah1
%  Blah2
%  Blah3

\begin{code}
module
\end{code}

Change a test output file to Unix


#!/usr/bin/env runhaskell

\begin{code}
import Distribution.PackageDescription
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Program
import qualified Distribution.Verbosity as Verbosity

main = defaultMainWithHooks defaultUserHooks {
         hookedPrograms = [pgConfigProgram],
         postConf=configure
       }

pgConfigProgram = (simpleProgram "pg_config") {
  programFindVersion = findProgramVersion "--version" $ \str ->
    -- Invoking "pg_config --version" gives a string like "PostgreSQL 8.0.13"
    case words str of
      (_:ver:_) ->
          -- Hack: drop off the "RC" bit since Cabal doesn't like it.
          takeWhile (/= 'R')
          ver
      _         -> ""
}

configure _ _ _ lbi = do
  mb_bi <- pgConfigBuildInfo Verbosity.normal lbi
  writeHookedBuildInfo "HDBC-postgresql.buildinfo" (mb_bi,[])
\end{code}

Populate BuildInfo using pg_config tool.
\begin{code}
pgConfigBuildInfo verbosity lbi = do
  (pgConfigProg, _) <- requireProgram verbosity pgConfigProgram
                       (orLaterVersion $ Version [8] []) (withPrograms lbi)
  let pg_config = rawSystemProgramStdout verbosity pgConfigProg
  libDir       <- pg_config ["--libdir"]
  incDir       <- pg_config ["--includedir"]
  return $ Just emptyBuildInfo {
    extraLibDirs = lines libDir,
    includeDirs  = lines incDir
  }
\end{code}

Patch to support GHC 6.8 and GHC 6.10 simultaneously

#!/usr/bin/env runhaskell

\begin{code}
import Distribution.Simple
import Distribution.PackageDescription
import Distribution.Version

import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Program
import Distribution.Verbosity

import Control.Monad

main = defaultMainWithHooks simpleUserHooks {
  hookedPrograms = [pgconfigProgram],

  confHook = \pkg flags -> do
    lbi <- confHook defaultUserHooks pkg flags
    bi <- psqlBuildInfo lbi
    return lbi {
      localPkgDescr = updatePackageDescription
                        (Just bi, []) (localPkgDescr lbi)
    }
}

pgconfigProgram = (simpleProgram "pgconfig") {
    programFindLocation = \verbosity -> do
      pgconfig  <- findProgramOnPath "pgconfig"  verbosity
      pg_config <- findProgramOnPath "pg_config" verbosity
      return (pgconfig `mplus` pg_config)
  }

psqlBuildInfo :: LocalBuildInfo -> IO BuildInfo
psqlBuildInfo lbi = do
  (pgconfigProg, _) <- requireProgram verbosity
                         pgconfigProgram AnyVersion (withPrograms lbi)
  let pgconfig = rawSystemProgramStdout verbosity pgconfigProg

  incDir <- pgconfig ["--includedir"]
  libDir <- pgconfig ["--libdir"]

  return emptyBuildInfo {
    extraLibDirs = [libDir],
    includeDirs  = [incDir]
  }
  where
    verbosity = normal -- honestly, this is a hack
\end{code}


> module Ives.SymbolicExecution.SymExEngine where

> import qualified Ives.SymbolicExecution.FnEnv as FnEnv
> import qualified Language.Haskell.Exts as Exts

The idea here is to inject functions in lambda form as inline functions in
order to simulate execution of the program while keeping track of path
constraints generated at logical branching points. Also Exts.Lambda is annoying
and we may want to make an auxilary function that reconverts [String]s to
[Pat]s. Ughhh.

> makePats :: [String] -> [Exts.Pat]
> makePats xs = map (\x -> Exts.PVar (Exts.Ident x)) xs

> makeLambda :: FnEnv.BasicFn -> Exts.Exp
> makeLambda (FnEnv.BasicFn i p b) =
>     Exts.Lambda (Exts.SrcLoc "n/a" 0 0) (makePats p) b

We want a function that is able to apply arguments to a BasicFn by replacing
all occurences of said bonud variables within that BasicFn. Old left new right.

> expReplace :: Exts.Exp -> [(String, String)] -> Exts.Exp
> expReplace (Exts.Var (Exts.UnQual (Exts.Ident old))) table =
>     let res = lookup old table
>     in case res of
>         Just new -> Exts.Var (Exts.UnQual (Exts.Ident new))
>         Nothing  -> Exts.Var (Exts.UnQual (Exts.Ident old))

> applyArgs :: FnEnv.BasicFn -> [String] -> Exts.Exp
> applyArgs (FnEnv.BasicFn i p b) args = expReplace b (zip p args)


> module Tests.MkRef where

> import Tm
> import Rules
> import Root
> import Rooty
> import BwdFwd
> import Control.Monad.Error

> import Debug.Trace

> testMkRef op = inCheck (check (opTy :>: (N $ P r))) (B0 :< ("tactics",0),0)
>     where r = mkRef op
>           opTy = pity $ opTyTel op

> main =
>     sequence_ $
>     map (putStrLn . show . testMkRef) operators


% Get coordinates of ith vertex
% i getvertex
/getvertex {
	% i on stack
	/theta exch 360 mul p div def
	theta cos radius mul ctr_x sum
	theta sin radius mul ctr_y sum
} def

% p center_x center_y radius drawpaley
/drawpaley {
	/radius exch def
	/ctr_y exch def
	/ctr_x exch def
	/p exch def

	% Define visited array to mark which edges have been drawn
	/visited p array def
	0 1 p {
		/row p array def
		0 1 p {
			row exch false put
		} for
		visited exch row put
	} for

	newpath

	0 1 p {
		/i exch def
		1 1 p 1 sub 2 idiv {
			/j exch 2 exp i sum p mod def
			visited i get j get {
				i getvertex moveto
				j getvertex lineto
				visited i get j true put
				visited j get i true put
			} if
		} for
	} for

	stroke

} def

17 306 396 100 drawpaley

showpage

Replace "sum" with the correct operator "add"

% Get coordinates of ith vertex
% i getvertex
/getvertex {
	% i on stack
	/theta exch 360 mul p div def
	theta cos radius mul ctr_x add
	theta sin radius mul ctr_y add
} def

% p center_x center_y radius drawpaley
/drawpaley {
	/radius exch def
	/ctr_y exch def
	/ctr_x exch def
	/p exch def

	% Define visited array to mark which edges have been drawn
	/visited p array def
	0 1 p 1 sub {
		/row p array def
		0 1 p 1 sub {
			row exch false put
		} for
		visited exch row put
	} for

	newpath

	0 1 p 1 sub {
		/i exch def
		1 1 p 1 sub 2 idiv {
			/j exch 2 exp i add p mod def
			visited i get j get {
				i getvertex moveto
				j getvertex lineto
				visited i get j true put
				visited j get i true put
			} if
		} for
	} for

	stroke

} def

17 306 396 100 drawpaley

showpage


/test-case {                    % <str> test-case
    print (\n) print
} def

/should {                       % <str> should
    pop
} def

/assert-equal {                 % <str> <any> <any> assert-equal
    pop pop pop
} def

/test-summary {	                % test-summary
    (.F\n) print
    (--------------------------------------------------\n) print
    (2 tests, 1 failed\n) print
    (\n) print
    (return-two\n) print
    (  should return 2\n) print
    (    expected: 2\n) print
    (    actual:   1\n) print
} def

Introduce loop to release all messages to output

/test-case {                    % <str> test-case mark
    print (\n) print

    % (*) mark the beginning of messages for the summary
    mark
} def

/should {                       % <str> should
    pop
} def

/assert-equal {                 % <str> <any> <any> assert-equal
    pop pop pop
} def

/test-summary {	                % test-summary
    (.F\n) print
    (--------------------------------------------------\n) print
    (2 tests, 1 failed\n) print
    (\n) print

    (return-two)
    (  should return 2)
    (    expected: 2)
    (    actual:   1)

    % release accumulated messages to stdout
    ] % (*) wrap up the array started in test-case
    {
        print (\n) print
    } forall
} def


(util.ps) runlibfile

/test-case {                    % <str> test-case mark
    print (\n) print

    % (*) create a package dict to count the tests
    3 dict begin
    /.test-total-count 0 def
    /.test-failed-count 0 def
    /.test-current-object null def

    % (**) mark the beginning of test results on the stack
    mark
} def

/should {                       % <str> should
    /.test-current-object exch def
} def

/test-summary {	                % mark <any*> test-summary
    (\n) print
    (--------------------------------------------------\n) print
    .test-total-count 5 string cvs print ( tests, ) print
    .test-failed-count 5 string cvs print ( failed\n\n) print

    % (*) now we printed them, we don't need the counts any longer
    end

    % (**) release accumulated messages to stdout
    ] {
	dup type /stringtype eq {
	    print
	} {
	    ==only
	} ifelse
    } forall
} def

/assert-equal {                 % <str> <any> <any> assert-equal
    /expected exch def
    /actual exch def
    /spec exch def

    /.test-total-count inc
    expected actual eq {
        (.) print
    } {
        (F) print
        .test-current-object (\n)
        (  should ) spec (\n)
        (    expected: ) expected (\n)
        (    actual:   ) actual (\n)
        /.test-failed-count inc
    } ifelse
} bind def

Normalize test-failed / test-passed before pulling them out

(util.ps) runlibfile

/test-case {                    % <str> test-case mark
    print (\n) print

    % (*) create a package dict to count the tests
    3 dict begin
    /.test-total-count 0 def
    /.test-failed-count 0 def
    /.test-current-object null def

    % (**) mark the beginning of test results on the stack
    mark
} def

/should {                       % <str> should
    /.test-current-object exch def
} def

/test-summary {	                % mark <any*> test-summary
    (\n) print
    (--------------------------------------------------\n) print
    .test-total-count 5 string cvs print ( tests, ) print
    .test-failed-count 5 string cvs print ( failed\n\n) print

    % (*) now we printed them, we don't need the counts any longer
    end

    % (**) release accumulated messages to stdout
    ] {
	dup type /stringtype eq {
	    print
	} {
	    ==only
	} ifelse
    } forall
} def

/assert-equal {                 % <str> <any> <any> assert-equal
    /expected exch def
    /actual exch def
    /spec exch def

    expected actual eq {
        /.test-total-count inc
        (.) print
    } {
        (F) print
        .test-current-object (\n)
        (  should ) spec (\n)
        (    expected: ) expected (\n)
        (    actual:   ) actual (\n)
        /.test-total-count inc
        /.test-failed-count inc
    } ifelse
} bind def


"$($env:PYTHON)/python.exe -m pytest --junixtml=TestResults.xml"

$client = New-Object "System.Net.WebClient"
$client.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path TestResults.xml))

Fix Appveyor test result reporting

python -m pytest --junixtml=TestResults.xml

$client = New-Object "System.Net.WebClient"
$client.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path TestResults.xml))


$resultXml = "TestResults.xml"
"$env:PYTHON/python.exe -m pytest --junixtml=$resultXml"

$client = New-Object "System.Net.WebClient"
$client.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $resultXml))

Fix Appveyor test result reporting

"$($env:PYTHON)/python.exe -m pytest --junixtml=TestResults.xml"

$client = New-Object "System.Net.WebClient"
$client.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path TestResults.xml))


% Get coordinates of ith vertex
% i getvertex
/getvertex {
	% i on stack
	/theta exch 360 mul p div def
	theta cos radius mul ctr_x add
	theta sin radius mul ctr_y add
} def

% p center_x center_y radius drawpaley
/drawpaley {
	/radius exch def
	/ctr_y exch def
	/ctr_x exch def
	/p exch def

	% Define visited array to mark which edges have been drawn
	/visited p array def
	0 1 p 1 sub {
		/row p array def
		0 1 p 1 sub {
			row exch false put
		} for
		visited exch row put
	} for

	newpath

	0 1 p 1 sub {
		/i exch def
		1 1 p 1 sub 2 idiv {
			/j exch 2 exp i add p mod def
			visited i get j get {
				i getvertex moveto
				j getvertex lineto
				visited i get j true put
				visited j get i true put
			} if
		} for
	} for

	stroke

} def

17 306 396 100 drawpaley

showpage

Fix typecheck error when using mod operator

% Get coordinates of ith vertex
% i getvertex
/getvertex {
	% i on stack
	/theta exch 360 mul p div def
	theta cos radius mul ctr_x add
	theta sin radius mul ctr_y add
} def

% p center_x center_y radius drawpaley
/drawpaley {
	/radius exch def
	/ctr_y exch def
	/ctr_x exch def
	/p exch def

	% Define visited array to mark which edges have been drawn
	/visited p array def
	0 1 p 1 sub {
		/row p array def
		0 1 p 1 sub {
			row exch false put
		} for
		visited exch row put
	} for

	newpath

	0 1 p 1 sub {
		/i exch def
		1 1 p 1 sub 2 idiv {
			/j exch dup mul i add p mod def
			visited i get j get {
				i getvertex moveto
				j getvertex lineto
				visited i get j true put
				visited j get i true put
			} if
		} for
	} for

	stroke

} def

17 306 396 100 drawpaley

showpage


$webConfigPath = Get-Location
cd dist
cd client
$sourcePath = Get-Location
cd ..
cd ..
mkdir deploy
cd deploy
$deployPath = Get-Location
git init
git config user.email "devops@flatthirteen.com"
git config user.name "DevOps"
git config core.safecrlf false
git remote add azure $(azure.remote)
git pull azure master --quiet
git rm -rf .
git clean -fxd
git reset
Copy-Item $webConfigPath\web.config $deployPath\web.config
Copy-Item $sourcePath\* $deployPath -Recurse
git add -A
git commit -m "Deploy"
git push azure master --porcelain 2>&1 | Write-Host


Add fake 'screensaver' written in PostScript.

realtime srand
{
  rand 255 mod 255 div
  rand 255 mod 255 div
  rand 255 mod 255 div
  setrgbcolor
  rand 600 mod
  rand 841 mod
  rand 60 mod
  0 360 arc fill
  % busy-waiting for some time
  20000 { 100
    30 { sqrt } repeat
    pop } repeat
} loop


(util.ps) runlibfile

/test-case {                    % <str> test-case mark
    print (\n) print

    /.test-total-count 0 def
    /.test-failed-count 0 def

    % (*) mark the beginning of messages for the summary
    mark
} def

/should {                       % <str> should
    pop
} def

/assert-equal {                 % <str> <any> <any> assert-equal
    /.test-total-count inc
    eq {
        pop (.) print
    } {
        pop (F) print
        /.test-failed-count inc
    } ifelse
} bind def

/test-summary {	                % test-summary
    (\n) print
    (--------------------------------------------------\n) print
    .test-total-count 5 string cvs print ( tests, ) print
    .test-failed-count 5 string cvs print ( failed\n\n) print

    (return-two)
    (  should return 2)
    (    expected: 2)
    (    actual:   1)

    % release accumulated messages to stdout
    ] % (*) wrap up the array started in test-case
    {
        print (\n) print
    } forall
} def

Fix global name space contamination

(util.ps) runlibfile

/test-case {                    % <str> test-case mark
    print (\n) print

    % (*) create a package dict to count the tests
    2 dict begin
    /.test-total-count 0 def
    /.test-failed-count 0 def

    % (**) mark the beginning of test results on the stack
    mark
} def

/should {                       % <str> should
    pop
} def

/assert-equal {                 % <str> <any> <any> assert-equal
    /.test-total-count inc
    eq {
        pop (.) print
    } {
        pop (F) print
        /.test-failed-count inc
    } ifelse
} bind def

/test-summary {	                % test-summary
    (\n) print
    (--------------------------------------------------\n) print
    .test-total-count 5 string cvs print ( tests, ) print
    .test-failed-count 5 string cvs print ( failed\n\n) print

    % (*) now we printed them, we don't need the counts any longer
    end

    (return-two)
    (  should return 2)
    (    expected: 2)
    (    actual:   1)

    % (**) release accumulated messages to stdout
    ] {
        print (\n) print
    } forall
} def


function fw_ver = mdaq_latest_fw()
    try
        getURL("raw.githubusercontent.com/microdaq/MLink/upgrade_test/LATEST", TMPDIR + filesep() + "LATEST");
    catch
        fw_ver = [];
        return
    end
    fw_ver = csvRead( TMPDIR + filesep() + "LATEST", " ");
endfunction

Fix for mdaq_upgrade - still test download location

function fw_ver = mdaq_latest_fw()
    try
        getURL("raw.githubusercontent.com/microdaq/Firmware/test/LATEST", TMPDIR + filesep() + "LATEST");
    catch
        fw_ver = [];
        return
    end
    fw_ver = csvRead( TMPDIR + filesep() + "LATEST", " ");
endfunction


function block=mdaq_pwm_sim(block,flag)
    global %microdaq;
    if %microdaq.dsp_loaded == %F then

        select flag
        case -5 // Error
        case 0 // Derivative State Update
        case 1 // Output Update
            if %microdaq.private.connection_id > -1 then
                mdaqPWMWrite(%microdaq.private.connection_id,..
                               block.ipar(1),..
                               block.inptr(1),..
                               block.inptr(2));
            end
        case 2 // State Update
        case 3 // OutputEventTiming
        case 4 // Initialization
            if %microdaq.private.connection_id > -1 then
                mdaqPWMInit(%microdaq.private.connection_id,..
                              block.ipar(1),..
                              block.ipar(2),..
                              block.ipar(3));
            end

        case 5 // Ending
            if %microdaq.private.connection_id > -1 then
                mdaqPWMWrite(%microdaq.private.connection_id,..
                               block.ipar(1), 0, 0);
            end
        case 6 // Re-Initialisation
        case 9 // ZeroCrossing
        else // Unknown flag
        end
    end
endfunction

Fix simulation mode in pwm block

function block=mdaq_pwm_sim(block,flag)
    global %microdaq;
    if %microdaq.dsp_loaded == %F then

        select flag
        case -5 // Error
        case 0 // Derivative State Update
        case 1 // Output Update
            if %microdaq.private.connection_id > -1 then
                mdaqPWMWrite(%microdaq.private.connection_id,..
                               block.ipar(1),..
                               block.inptr(1),..
                               block.inptr(2));
            end
        case 2 // State Update
        case 3 // OutputEventTiming
        case 4 // Initialization
            if %microdaq.private.connection_id > -1 then
                mdaqPWMInit(%microdaq.private.connection_id,..
                              block.ipar(1),..
                              block.ipar(2),..
                              block.ipar(3),..
                              block.inptr(1),..
                              block.inptr(2));
            end

        case 5 // Ending
            if %microdaq.private.connection_id > -1 then
                mdaqPWMWrite(%microdaq.private.connection_id,..
                               block.ipar(1), 0, 0);
            end
        case 6 // Re-Initialisation
        case 9 // ZeroCrossing
        else // Unknown flag
        end
    end
endfunction


clear();
clearglobal;

video_path = uigetfile("*.*","","Select Video data",%t);

drop = uigetdir();

for i = 1:size(video_path, 2)
    unix_s("mkdir -p " + drop + "/" + string(i) )
    unix_s("/usr/local/Cellar/ffmpeg/3.2/bin/ffmpeg -i " + video_path(i) + " -aspect 720:576 " + drop + "/" + string(i) + "/image%04d.png") // + "/" + string(i)
end

Change ffmpeg command to match movie aspect ratio

clear();
clearglobal;

video_path = uigetfile("*.*","","Select Video data",%t);

drop = uigetdir();

for i = 1:size(video_path, 2)
    unix_s("mkdir -p " + drop + "/" + string(i) )
    unix_s("/usr/local/Cellar/ffmpeg/3.2/bin/ffmpeg -i " + video_path(i) + " -r 50 -s 853x479 -aspect 853:479 -qscale 1 " + drop + "/" + string(i) + "/image%04d.png") // + "/" + string(i)
end


t = [0: 0.0000625: 0.02];
N = size(t, '*');
sin_100Hz = 2*sin(2*%pi*700*t);
sin_1000Hz = 2*sin(2*%pi*1000*t);
sin_5000Hz = 2*sin(2*%pi*5000*t);
testsign = sin_100Hz + sin_1000Hz + sin_5000Hz;
[LD_coeff, amplitude, frequentie] = wfir('bp',100,[800/16000, 2000/16000],'hm',[0 0]);
LD_polynoom = poly(LD_coeff, 'z', 'coeff');
LD_functie = horner(LD_polynoom, 1/%z);
LD_lineair_system = syslin('d', LD_functie);
LD_output = flts(testsign, LD_lineair_system);

Frequentie_FFT = abs(fft(testsign));
f = 16000 * (0:(N/2))/N;
n = size(f, '*');
figure;

subplot(311);
plot(f, Frequentie_FFT(1:n));
plot(frequentie*16000, amplitude*N, 'black');
subplot(312);
plot(t, LD_output, 'r');
subplot(313);
plot(t, testsign)
plot(t, LD_output, 'r');
plot(t, sin_5000Hz, 'g');

Read en write wav toegevoegd

[testsign,Fs,bits]=wavread("SCI/modules/sound/demos/filterTest2(anja).wav");
//[testsign,Fs,bits]=wavread("SCI/modules/sound/demos/filterTest1(H-style).wav");

testsign = testsign(1,:);
t = [1:1:length(testsign)]*1/Fs;

[LD_coeff, amplitude, frequentie] = wfir('bp',100,[800/16000, 2000/16000],'hm',[0 0]);
LD_polynoom = poly(LD_coeff, 'z', 'coeff');
LD_functie = horner(LD_polynoom, 1/%z);
LD_lineair_system = syslin('d', LD_functie);
LD_output = flts(testsign, LD_lineair_system);

plot(t, testsign)
plot(t, LD_output, 'r');

wavwrite(LD_output, 'SCI/modules/sound/demos/'+'yolo.wav');