text:
/**
 * generated by Xtext 2.17.1
 */
package com.specmate.objectif.internal.dSL.impl;

import com.specmate.objectif.internal.dSL.BusinessRule;
import com.specmate.objectif.internal.dSL.DSLPackage;
import com.specmate.objectif.internal.dSL.OR_Node;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 *
 * An implementation of the model object 'Business Rule'.
 *
 *

 * The following features are implemented:
 *

 *

 *
{@link com.specmate.objectif.dSL.impl.BusinessRuleImpl#getCause Cause}

 *
{@link com.specmate.objectif.dSL.impl.BusinessRuleImpl#getEffect Effect}

 *
{@link com.specmate.objectif.dSL.impl.BusinessRuleImpl#getAlternative Alternative}

 *

 *
 * @generated
 */
public class BusinessRuleImpl extends MinimalEObjectImpl.Container implements BusinessRule
{
  /**
   * The cached value of the '{@link #getCause() Cause}' containment reference.
   *
   *
   * @see #getCause()
   * @generated
   * @ordered
   */
  protected OR_Node cause;

  /**
   * The cached value of the '{@link #getEffect() Effect}' containment reference.
   *
   *
   * @see #getEffect()
   * @generated
   * @ordered
   */
  protected EObject effect;

  /**
   * The cached value of the '{@link #getAlternative() Alternative}' containment reference.
   *
   *
   * @see #getAlternative()
   * @generated
   * @ordered
   */
  protected EObject alternative;

  /**
   *
   *
   * @generated
   */
  protected BusinessRuleImpl()
  {
    super();
  }

  /**
   *
   *
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return DSLPackage.Literals.BUSINESS_RULE;
  }

  /**
   *
   *
   * @generated
   */
  public OR_Node getCause()
  {
    return cause;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetCause(OR_Node newCause, NotificationChain msgs)
  {
    OR_Node oldCause = cause;
    cause = newCause;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DSLPackage.BUSINESS_RULE__CAUSE, oldCause, newCause);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setCause(OR_Node newCause)
  {
    if (newCause != cause)
    {
      NotificationChain msgs = null;
      if (cause != null)
        msgs = ((InternalEObject)cause).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DSLPackage.BUSINESS_RULE__CAUSE, null, msgs);
      if (newCause != null)
        msgs = ((InternalEObject)newCause).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DSLPackage.BUSINESS_RULE__CAUSE, null, msgs);
      msgs = basicSetCause(newCause, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, DSLPackage.BUSINESS_RULE__CAUSE, newCause, newCause));
  }

  /**
   *
   *
   * @generated
   */
  public EObject getEffect()
  {
    return effect;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetEffect(EObject newEffect, NotificationChain msgs)
  {
    EObject oldEffect = effect;
    effect = newEffect;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DSLPackage.BUSINESS_RULE__EFFECT, oldEffect, newEffect);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setEffect(EObject newEffect)
  {
    if (newEffect != effect)
    {
      NotificationChain msgs = null;
      if (effect != null)
        msgs = ((InternalEObject)effect).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DSLPackage.BUSINESS_RULE__EFFECT, null, msgs);
      if (newEffect != null)
        msgs = ((InternalEObject)newEffect).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DSLPackage.BUSINESS_RULE__EFFECT, null, msgs);
      msgs = basicSetEffect(newEffect, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, DSLPackage.BUSINESS_RULE__EFFECT, newEffect, newEffect));
  }

  /**
   *
   *
   * @generated
   */
  public EObject getAlternative()
  {
    return alternative;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetAlternative(EObject newAlternative, NotificationChain msgs)
  {
    EObject oldAlternative = alternative;
    alternative = newAlternative;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DSLPackage.BUSINESS_RULE__ALTERNATIVE, oldAlternative, newAlternative);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setAlternative(EObject newAlternative)
  {
    if (newAlternative != alternative)
    {
      NotificationChain msgs = null;
      if (alternative != null)
        msgs = ((InternalEObject)alternative).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DSLPackage.BUSINESS_RULE__ALTERNATIVE, null, msgs);
      if (newAlternative != null)
        msgs = ((InternalEObject)newAlternative).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DSLPackage.BUSINESS_RULE__ALTERNATIVE, null, msgs);
      msgs = basicSetAlternative(newAlternative, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, DSLPackage.BUSINESS_RULE__ALTERNATIVE, newAlternative, newAlternative));
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case DSLPackage.BUSINESS_RULE__CAUSE:
        return basicSetCause(null, msgs);
      case DSLPackage.BUSINESS_RULE__EFFECT:
        return basicSetEffect(null, msgs);
      case DSLPackage.BUSINESS_RULE__ALTERNATIVE:
        return basicSetAlternative(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case DSLPackage.BUSINESS_RULE__CAUSE:
        return getCause();
      case DSLPackage.BUSINESS_RULE__EFFECT:
        return getEffect();
      case DSLPackage.BUSINESS_RULE__ALTERNATIVE:
        return getAlternative();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case DSLPackage.BUSINESS_RULE__CAUSE:
        setCause((OR_Node)newValue);
        return;
      case DSLPackage.BUSINESS_RULE__EFFECT:
        setEffect((EObject)newValue);
        return;
      case DSLPackage.BUSINESS_RULE__ALTERNATIVE:
        setAlternative((EObject)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case DSLPackage.BUSINESS_RULE__CAUSE:
        setCause((OR_Node)null);
        return;
      case DSLPackage.BUSINESS_RULE__EFFECT:
        setEffect((EObject)null);
        return;
      case DSLPackage.BUSINESS_RULE__ALTERNATIVE:
        setAlternative((EObject)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case DSLPackage.BUSINESS_RULE__CAUSE:
        return cause != null;
      case DSLPackage.BUSINESS_RULE__EFFECT:
        return effect != null;
      case DSLPackage.BUSINESS_RULE__ALTERNATIVE:
        return alternative != null;
    }
    return super.eIsSet(featureID);
  }

} //BusinessRuleImpl


text:
package gou

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"log"
	"net"
	"net/http"
	"os"
	"path"
	"path/filepath"
	"strconv"
	"time"

	"golang.org/x/net/netutil"

	"github.com/shingetsu-gou/shingetsu-gou/cfg"
	"github.com/shingetsu-gou/shingetsu-gou/cgi"
	"github.com/shingetsu-gou/shingetsu-gou/cgi/admin"
	"github.com/shingetsu-gou/shingetsu-gou/cgi/gateway"
	"github.com/shingetsu-gou/shingetsu-gou/cgi/mch"
	"github.com/shingetsu-gou/shingetsu-gou/cgi/server"
	"github.com/shingetsu-gou/shingetsu-gou/cgi/thread"
	"github.com/shingetsu-gou/shingetsu-gou/util"
)

//StartDaemon setups saves pid, start cron job and a http server.
func StartDaemon() (net.Listener, chan error) {
	p := os.Getpid()
	err := ioutil.WriteFile(cfg.PID(), []byte(strconv.Itoa(p)), 0666)
	if err != nil {
		log.Fatal(err)
	}

	h := fmt.Sprintf("0.0.0.0:%d", cfg.DefaultPort)
	listener, err := net.Listen("tcp", h)
	if err != nil {
		log.Fatalln(err)
	}
	limitListener := netutil.LimitListener(listener, cfg.MaxConnection)
	sm := cgi.NewLoggingServeMux()
	s := &http.Server{
		Addr:           h,
		Handler:        sm,
		ReadTimeout:    3 * time.Minute,
		WriteTimeout:   3 * time.Minute,
		MaxHeaderBytes: 1 << 20,
	}

	go cron()

	admin.Setup(sm)
	server.Setup(sm)
	gateway.Setup(sm)
	thread.Setup(sm)

	if cfg.Enable2ch {
		fmt.Println("started 2ch interface...")
		mch.Setup(sm)
	}
	if cfg.EnableProf {
		sm.RegisterPprof()
	}
	sm.RegistCompressHandler("/", handleRoot())
	fmt.Println("started daemon and http server...")
	ch := make(chan error)
	go func() {
		ch <- s.Serve(limitListener)
	}()
	return limitListener, ch
}

//handleRoot return handler that handles url not defined other handlers.
//if root, print titles of threads. if not, serve files on disk.
func handleRoot() func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		if r.URL.Path == "/" {
			gateway.PrintTitle(w, r)
			return
		}
		pathOnDisk := filepath.Join(cfg.Docroot, r.URL.Path)

		if util.IsFile(pathOnDisk) {
			http.ServeFile(w, r, pathOnDisk)
			return
		}
		pathOnAsset := path.Join("www", r.URL.Path)
		if c, err := util.Asset(pathOnAsset); err == nil {
			i, err := util.AssetInfo(pathOnAsset)
			if err != nil {
				log.Fatal(err)
			}
			reader := bytes.NewReader(c)
			http.ServeContent(w, r, path.Base(r.URL.Path), i.ModTime(), reader)
			return
		}

		log.Println("not found", r.URL.Path)
		http.NotFound(w, r)
	}
}

redpajama_set_name: RedPajamaGithub


text: This repo is a sandbox I use to test GitHub workflows and tools and otherwise mess around.


text:
case "$TEST_TEE_STARTED, $* " in
done,*)
	# do not redirect again
	;;
*' --tee '*|*' --va'*)
	mkdir -p test-results
	BASE=test-results/$(basename "$0" .sh)
	(TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1;
	 echo $? > $BASE.exit) | tee $BASE.out
	test "$(cat $BASE.exit)" = 0
	exit
	;;
esac

# Keep the original TERM for say_color
ORIGINAL_TERM=$TERM

# For repeatability, reset the environment to known value.
LANG=C
LC_ALL=C
PAGER=cat
TZ=UTC
TERM=dumb
export LANG LC_ALL PAGER TERM TZ
EDITOR=:
VISUAL=:

# Protect ourselves from common misconfiguration to export
# CDPATH into the environment
unset CDPATH

# Protect ourselves from using predefined TODOTXT_CFG_FILE
unset TODOTXT_CFG_FILE $(set|sed '/^TODOTXT_/!d;s/=.*//')
# To prevent any damage if someone has still those exported somehow in his env:
unset TODO_FILE DONE_FILE REPORT_FILE TMP_FILE

# Each test should start with something like this, after copyright notices:
#
# test_description='Description of this test...
# This test checks if command xyzzy does the right thing...
# '
# . ./test-lib.sh
[ "x$ORIGINAL_TERM" != "xdumb" ] && (
		TERM=$ORIGINAL_TERM &&
		export TERM &&
		[ -t 1 ] &&
		tput bold >/dev/null 2>&1 &&
		tput setaf 1 >/dev/null 2>&1 &&
		tput sgr0 >/dev/null 2>&1
	) &&
	color=t

while test "$#" -ne 0
do
	case "$1" in
	-d|--d|--de|--deb|--debu|--debug)
		debug=t; shift ;;
	-i|--i|--im|--imm|--imme|--immed|--immedi|--immedia|--immediat|--immediate)
		immediate=t; shift ;;
	-l|--l|--lo|--lon|--long|--long-|--long-t|--long-te|--long-tes|--long-test|--long-tests)
		TODOTXT_TEST_LONG=t; export TODOTXT_TEST_LONG; shift ;;
	-h|--h|--he|--hel|--help)
		help=t; shift ;;
	-v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
		verbose=t; shift ;;
	-q|--q|--qu|--qui|--quie|--quiet)
		quiet=t; shift ;;
	--no-color)
		color=; shift ;;
	--no-python)
		# noop now...
		shift ;;
	--tee)
		shift ;; # was handled already
	*)
		break ;;
	esac
done

if test -n "$color"; then
	say_color () {
		(
		TERM=$ORIGINAL_TERM
		export TERM
		case "$1" in
			error) tput bold; tput setaf 1;; # bold red
			skip)  tput bold; tput setaf 2;; # bold green
			pass)  tput setaf 2;;            # green
			info)  tput setaf 3;;            # brown
			*) test -n "$quiet" && return;;
		esac
		shift
		printf "* %s" "$*"
		tput sgr0
		echo
		)
	}
else
	say_color() {
		test -z "$1" && test -n "$quiet" && return
		shift
		echo "* $*"
	}
fi

error () {
	say_color error "error: $*"
	trap - EXIT
	exit 1
}

say () {
	say_color info "$*"
}

test "${test_description}" != "" ||
error "Test script did not set test_description."

if test "$help" = "t"
then
	echo "$test_description"
	exit 0
fi

exec 5>&1
if test "$verbose" = "t"
then
	exec 4>&2 3>&1
else
	exec 4>/dev/null 3>/dev/null
fi

test_failure=0
test_count=0
test_fixed=0
test_broken=0
test_success=0

die () {
	echo >&5 "FATAL: Unexpected exit with code $?"
	exit 1
}

trap 'die' EXIT

# The semantics of the editor variables are that of invoking
# sh -c "$EDITOR \"$@\"" files ...
#
# If our trash directory contains shell metacharacters, they will be
# interpreted if we just set $EDITOR directly, so do a little dance with
# environment variables to work around this.
#
# In particular, quoting isn't enough, as the path may contain the same quote
# that we're using.
test_set_editor () {
	FAKE_EDITOR="$1"
	export FAKE_EDITOR
	VISUAL='"$FAKE_EDITOR"'
	export VISUAL
}

# You are not expected to call test_ok_ and test_failure_ directly, use
# the text_expect_* functions instead.

test_ok_ () {
	test_success=$(($test_success + 1))
	say_color "" "  ok $test_count: $@"
}

test_failure_ () {
	test_failure=$(($test_failure + 1))
	say_color error "FAIL $test_count: $1"
	shift
	echo "$@" | sed -e 's/^/	/'
	test "$immediate" = "" || { trap - EXIT; exit 1; }
}

test_known_broken_ok_ () {
	test_fixed=$(($test_fixed+1))
	say_color "" "  FIXED $test_count: $@"
}

test_known_broken_failure_ () {
	test_broken=$(($test_broken+1))
	say_color skip "  still broken $test_count: $@"
}

test_debug () {
	test "$debug" = "" || eval "$1"
}

test_run_ () {
	eval >&3 2>&4 "$1"
	eval_ret="$?"
	return 0
}

test_skip () {
	test_count=$(($test_count+1))
	to_skip=
	for skp in $SKIP_TESTS
	do
		case $this_test.$test_count in
		$skp)
			to_skip=t
		esac
	done
	case "$to_skip" in
	t)
		say_color skip >&3 "skipping test: $@"
		say_color skip "skip $test_count: $1"
		: true
		;;
	*)
		false
		;;
	esac
}

test_expect_failure () {
	test "$#" = 2 ||
	error "bug in the test script: not 2 parameters to test-expect-failure"
	if ! test_skip "$@"
	then
		say >&3 "checking known breakage: $2"
		test_run_ "$2"
		if [ "$?" = 0 -a "$eval_ret" = 0 ]
		then
			test_known_broken_ok_ "$1"
		else
		    test_known_broken_failure_ "$1"
		fi
	fi
	echo >&3 ""
}

test_expect_success () {
	test "$#" = 2 ||
	error "bug in the test script: not 2 parameters to test-expect-success"
	if ! test_skip "$@"
	then
		say >&3 "expecting success: $2"
		test_run_ "$2"
		if [ "$?" = 0 -a "$eval_ret" = 0 ]
		then
			test_ok_ "$1"
		else
			test_failure_ "$@"
		fi
	fi
	echo >&3 ""
}

test_expect_code () {
	test "$#" = 3 ||
	error "bug in the test script: not 3 parameters to test-expect-code"
	if ! test_skip "$@"
	then
		say >&3 "expecting exit code $1: $3"
		test_run_ "$3"
		if [ "$?" = 0 -a "$eval_ret" = "$1" ]
		then
			test_ok_ "$2"
		else
			test_failure_ "$@"
		fi
	fi
	echo >&3 ""
}

# test_external runs external test scripts that provide continuous
# test output about their progress, and succeeds/fails on
# zero/non-zero exit code.  It outputs the test output on stdout even
# in non-verbose mode, and announces the external script with "* run
# <n>: ..." before running it.  When providing relative paths, keep in
# mind that all scripts run in "trash directory".
# Usage: test_external description command arguments...
# Example: test_external 'Perl API' perl ../path/to/test.pl
test_external () {
	test "$#" -eq 3 ||
	error >&5 "bug in the test script: not 3 parameters to test_external"
	descr="$1"
	shift
	if ! test_skip "$descr" "$@"
	then
		# Announce the script to reduce confusion about the
		# test output that follows.
		say_color "" " run $test_count: $descr ($*)"
		# Run command; redirect its stderr to &4 as in
		# test_run_, but keep its stdout on our stdout even in
		# non-verbose mode.
		"$@" 2>&4
		if [ "$?" = 0 ]
		then
			test_ok_ "$descr"
		else
			test_failure_ "$descr" "$@"
		fi
	fi
}

# Like test_external, but in addition tests that the command generated
# no output on stderr.
test_external_without_stderr () {
	# The temporary file has no (and must have no) security
	# implications.
	tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
	stderr="$tmp/todotxt-external-stderr.$$.tmp"
	test_external "$@" 4> "$stderr"
	[ -f "$stderr" ] || error "Internal error: $stderr disappeared."
	descr="no stderr: $1"
	shift
	say >&3 "expecting no stderr from previous command"
	if [ ! -s "$stderr" ]; then
		rm "$stderr"
		test_ok_ "$descr"
	else
		if [ "$verbose" = t ]; then
			output=`echo; echo Stderr is:; cat "$stderr"`
		else
			output=
		fi
		# rm first in case test_failure exits.
		rm "$stderr"
		test_failure_ "$descr" "$@" "$output"
	fi
}

# This is not among top-level (test_expect_success | test_expect_failure)
# but is a prefix that can be used in the test script, like:
#
#	test_expect_success 'complain and die' '
#           do something &&
#           do something else &&
#	    test_must_fail git checkout ../outerspace
#	'
#
# Writing this as "! git checkout ../outerspace" is wrong, because
# the failure could be due to a segv.  We want a controlled failure.

test_must_fail () {
	"$@"
	test $? -gt 0 -a $? -le 129 -o $? -gt 192
}

# test_cmp is a helper function to compare actual and expected output.
# You can use it like:
#
#	test_expect_success 'foo works' '
#		echo expected >expected &&
#		foo >actual &&
#		test_cmp expected actual
#	'
#
# This could be written as either "cmp" or "diff -u", but:
# - cmp's output is not nearly as easy to read as diff -u
# - not all diff versions understand "-u"

test_cmp() {
	diff -u "$@"
}

test_done () {
	trap - EXIT
	test_results_dir="$TEST_DIRECTORY/test-results"
	mkdir -p "$test_results_dir"
	test_results_path="$test_results_dir/${0%.sh}-$$"

	echo "total $test_count" >> $test_results_path
	echo "success $test_success" >> $test_results_path
	echo "fixed $test_fixed" >> $test_results_path
	echo "broken $test_broken" >> $test_results_path
	echo "failed $test_failure" >> $test_results_path
	echo "" >> $test_results_path

	if test "$test_fixed" != 0
	then
		say_color pass "fixed $test_fixed known breakage(s)"
	fi
	if test "$test_broken" != 0
	then
		say_color error "still have $test_broken known breakage(s)"
		msg="remaining $(($test_count-$test_broken)) test(s)"
	else
		msg="$test_count test(s)"
	fi
	case "$test_failure" in
	0)
		say_color pass "passed all $msg"

                # Clean up this test.
		test -d "$remove_trash" &&
		cd "$(dirname "$remove_trash")" &&
		rm -rf "$(basename "$remove_trash")"

		exit 0 ;;

	*)
		say_color error "failed $test_failure among $msg"
		exit 1 ;;

	esac
}

# Use -P to resolve symlinks in our working directory so that the pwd
# in subprocesses equals our $PWD (for pathname comparisons).
cd -P .

# Record our location for reference.
TEST_DIRECTORY=$(pwd)

# Test repository
#test="trash directory.$(basename "$0" .sh)" # RK CHANGED
test="trashdirectory.$(basename "$0" .sh)"
test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test"
rm -fr "$test" || {
	trap - EXIT
	echo >&5 "FATAL: Cannot prepare test area"
	exit 1
}

# Most tests can use the created repository, but some may need to create more.
# Usage: test_init_todo <directory>
test_init_todo () {
	test "$#" = 1 ||
	error "bug in the test script: not 1 parameter to test_init_todo"
	owd=`pwd`
	root="$1"
	mkdir -p "$root"
	cd "$root" || error "Cannot setup todo dir in $root"
        # Initialize the configuration file. Carefully quoted.
        #sed -e 's|TODO_DIR=.*$|TODO_DIR="'"$TEST_DIRECTORY/$test"'"|' $TEST_DIRECTORY/../todo.cfg > todo.cfg

	# Install latest todo.sh
	mkdir bin
        # TODO: XXX
	#ln -s "$TEST_DIRECTORY/../todoapp.sh" bin/todoapp.sh
	ln -s ~/bin/todorb bin/todorb
#	ln -s ../../../lib/subcommand.rb bin/subcommand.rb

	# Initialize a hack date script
	TODO_TEST_REAL_DATE=$(which date)
	TODO_TEST_TIME=1234500000
	export PATH TODO_TEST_REAL_DATE TODO_TEST_TIME

	# Trying to detect the version of "date" on current system
	DATE_STYLE=unknown
	# on GNU systems (versions may vary):
	#date --version
	#date (GNU coreutils) 6.10
	#...
	if date --version 2>&1 | grep -q "GNU"; then
		DATE_STYLE=GNU
	# on Mac OS X 10.5:
	#date --version
	#date: illegal option -- -
	#usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
	#[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
	elif date --version 2>&1 | grep -q -e "-jnu"; then
		DATE_STYLE=Mac10.5
	# on Mac OS X 10.4:
	#date --version
	#date: illegal option -- -
	#usage: date [-nu] [-r seconds] [+format]
	#       date [[[[[cc]yy]mm]dd]hh]mm[.ss]
	elif date --version 2>&1 | grep -q -e "-nu"; then
		DATE_STYLE=Mac10.4
	fi

	case $DATE_STYLE in
		GNU)
			cat > bin/date <<-EOF
			#!/bin/sh
			exec "$TODO_TEST_REAL_DATE" -d @\$TODO_TEST_TIME \$@
			EOF
			chmod 755 bin/date
		;;
		Mac10.5)
			cat > bin/date <<-EOF
			#!/bin/sh
			exec "$TODO_TEST_REAL_DATE" -j -f %s \$TODO_TEST_TIME \$@
			EOF
			chmod 755 bin/date
		;;
		Mac10.4)
			cat > bin/date <<-EOF
			#!/bin/sh
			exec "$TODO_TEST_REAL_DATE" -r \$TODO_TEST_TIME \$@
			EOF
			chmod 755 bin/date
		;;
		*)
			echo "WARNING: Current date executable not recognized"
			echo "So today date will be used, expect false negative tests..."
		;;
	esac

	# Ensure a correct PATH for testing.
	PATH=$owd/$root/bin:$PATH
	export PATH

	cd "$owd"
}

# Usage: test_tick [increment]
test_tick () {
	TODO_TEST_TIME=$(($TODO_TEST_TIME + ${1:-86400}))
}

# Generate and run a series of tests based on a transcript.
# Usage: test_todo_session "description" <<EOF
# >>> command
# output1
# output2
# >>> command
# === exit status
# output3
# output4
# EOF
test_todo_session () {
    test "$#" = 1 ||
    error "bug in the test script: extra args to test_todo_session"
    subnum=1
    cmd=""
    status=0
    > expect
    #while read  line
    # earlier the program would stop expect on a blank line which is unacceptable
    # i pass an explicit end, since my output does have blank lines
    while IFS='' read line
    do
	case $line in
        ">>> end")
	    if [ ! -z "$cmd" ]; then
		if [ $status = 0 ]; then
		    test_expect_success "$1 $subnum" "$cmd > output && test_cmp expect output"
		else
		    #test_expect_success "$1 $subnum" "$cmd > output || test $? = $status && test_cmp expect output"
		    test_expect_success "$1 $subnum" "$cmd > output 2>&1 || test $? = $status && test_cmp expect output"
		fi

		subnum=$(($subnum + 1))
		cmd=""
		status=0
		> expect
	    fi
	    ;;
	">>> "*)
	    test -z "$cmd" || error "bug in the test script: missing blank line separator in test_todo_session"
	    cmd=${line#>>> }
	    ;;
	"=== "*)
	    status=${line#=== }
	    ;;
	*)
        # WARNING please NOTE XXX that a blank line in output terminates what goes into expect !!!  See above
	    echo "$line" >> expect
	    ;;
	esac
    done
    if [ ! -z "$cmd" ]; then
	if [ $status = 0 ]; then
	    test_expect_success "$1 $subnum" "$cmd > output && test_cmp expect output"
	else
	    test_expect_success "$1 $subnum" "$cmd > output || test $? = $status && test_cmp expect output"
	fi
    fi
}

test_shell () {
	trap - EXIT
	export PS1='$(ret_val=$?; [ "$ret_val" != "0" ] && echo -e "=== $ret_val\n\n>>> "||echo "\n>>> ")'
	cat <<EOF
Do your tests session here and
don't forget to replace the hardcoded path with \$HOME in the transcript:
$HOME/todo.txt => \$HOME/todo.txt
EOF
	bash --noprofile --norc
	exit 0
}

test_init_todo "$test"
# Use -P to resolve symlinks in our working directory so that the pwd
# in subprocesses equals our $PWD (for pathname comparisons).
cd -P "$test" || exit 1

# Since todo.sh refers to the home directory often,
# make sure we don't accidentally grab the tester's config
# but use something specified by the framework.
HOME=$(pwd)
export HOME

this_test=${0##*/}
this_test=${this_test%%-*}
for skp in $SKIP_TESTS
do
	to_skip=
	for skp in $SKIP_TESTS
	do
		case "$this_test" in
		$skp)
			to_skip=t
		esac
	done
	case "$to_skip" in
	t)
		say_color skip >&3 "skipping test $this_test altogether"
		say_color skip "skip all tests in $this_test"
		test_done
	esac
done


text:
#ifndef __OPENCC_TYPES_H_
#define __OPENCC_TYPES_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>
#include <stdint.h>

    typedef void * opencc_t;

    typedef uint32_t ucs4_t;

    enum _opencc_error
    {
        OPENCC_ERROR_VOID,
        OPENCC_ERROR_DICTLOAD,
        OPENCC_ERROR_CONFIG,
        OPENCC_ERROR_ENCODIND,
        OPENCC_ERROR_CONVERTER,
    };
    typedef enum _opencc_error opencc_error;

    enum _opencc_dictionary_type
    {
        OPENCC_DICTIONARY_TYPE_TEXT,
        OPENCC_DICTIONARY_TYPE_DATRIE,
    };
    typedef enum _opencc_dictionary_type opencc_dictionary_type;

    enum _opencc_conversion_mode
    {
        OPENCC_CONVERSION_FAST,
        OPENCC_CONVERSION_SEGMENT_ONLY,
        OPENCC_CONVERSION_LIST_CANDIDATES,
    };
    typedef enum _opencc_conversion_mode opencc_conversion_mode;

#define PKGDATADIR "db/icwb/utf8/opencc"

#ifdef __cplusplus
};
#endif

#endif /* __OPENCC_TYPES_H_ */


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>What is Rails?</title>
  <link rel="stylesheet" type="text/css" href="../stylesheets/default.css">
 <link href='http://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
  <link href='http://fonts.googleapis.com/css?family=PT+Serif' rel='stylesheet' type='text/css'>

Matt Leo

        Home
        About
        Resume
        Projects
        Blog
        Contact

What is Rails?

8/29/15

Rails is a framework what functions as a software library. The Rails framework is a platform that allows Ruby, HTML, CSS, and JavaScript to interact with eachother conveniently. Ruby on Rails developers claim that rails enables its user to create web applications in less time by writing less code when compared to other languages/frameworks. Rails is "opinionated software" which means it makes assumptions about the best way to approach a problem. These assumptions will assist the user by creating things in less time.

This is an example of what working with Rails might look like. Your library of files are on the left side of the screen which helps organize your application.


text:
![tv Logo](https://raw.github.com/hapijs/tv/master/images/tv.png)

TV is an interactive debug console plugin for [**hapi**](https://github.com/hapijs/hapi)

[![Build Status](https://secure.travis-ci.org/hapijs/tv.png)](http://travis-ci.org/hapijs/tv)

Lead Maintainer: [Wyatt Preul](https://github.com/wpreul)

TV is a simple web page in which developers can view server logs for their requests. Optionally, they can also filter the server logs to just their requests by attaching a unique client id to each request. The server will use WebSocket to stream the logs to the web application in real-time.

Here's what it looks like in action:

![TV interactive debug console](https://raw.github.com/hapijs/tv/master/images/tv-screenshot.png)

### Using TV in Your Application

To enable TV in a **hapi** application, install **tv** and register it.  Below is an example of registering the **tv** plugin:

```javascript
var Hapi = require('hapi');
var Tv = require('tv');

var server = new Hapi.Server();

server.register(Tv, function (err) {

    if (!err) {
        server.start();
    }
});
```

In applications using multiple server instances, only one server can enable the debug interface using the default port.

### Options

Below are the options available to be passed into the **tv** plugin:

- `host` - the hostname, IP address, or path to UNIX domain socket the WebSocket connection is bound to. Defaults to _undefined_ and therefore `0.0.0.0`
   which means any available network interface(see hapi `new Server()`).
- `port` - the port used by the WebSocket connection. Defaults to _0_ and therefore an ephemeral port (see hapi `new Server()`).
- `endpoint` - the debug console request path added to the server routes. Defaults to _'/debug/console'_.
- `queryKey` - the name or the request query parameter used to mark requests being debugged. Defaults to _debug_.
- `template` - the name of the template to use for the debug console.  Defaults to _index_.
- `authenticateEndpoint` - set this to true to use auth schemes for TVs main- and file delivering routes (defaults to false)

Below is an example of registering the tv plugin with some options:

```javascript
var options = {endpoint: '/awesome'};

server.register({register: Tv, options: options}, function (err) {
    ...
});
```


text:
package de.sekmi.li2b2.services.impl.pm;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;

import de.sekmi.li2b2.api.pm.Parameter;
import de.sekmi.li2b2.api.pm.Project;
import de.sekmi.li2b2.api.pm.User;
import de.sekmi.li2b2.services.PMService;

/**
 * Implementation of li2b2 user.
 * Two users are equal, if their login and domain match.
 *
 * @author R.W.Majeed
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
public class UserImpl implements User {

	@XmlTransient
	ProjectManagerImpl pm;
	private String login;
	private String password;
	private Map<String,String> properties;
	private List<ParamImpl> params;

	private UserImpl() {
		// empty constructor for JAXB
		this.properties = new HashMap<>();
		this.params = new ArrayList<>();
	}
	public UserImpl(ProjectManagerImpl pm, String login){
		this();
		this.pm = pm;
		this.login = login;
		//this.domain = domain;
	}
	@Override
	public String getName() {
		return login;
	}
	protected void setName(String login) {
		this.login = login;
	}

	@Override
	public String getFullName() {
		return properties.get(PMService.USER_FULLNAME);
	}

	@Override
	public boolean isAdmin() {
		String admin = getProperty(PMService.USER_ISADMIN);
		return admin != null && admin.contentEquals(Boolean.TRUE.toString());
	}

	@Override
	public Iterable<Project> getProjects() {
		return pm.getUserProjects(this);
	}

	@Override
	public boolean hasPassword(char[] password) {
		if( this.password == null ){
			// no password, cannot login
			return false;
		}
		return this.password.equals(calculatePasswordDigest(password));
	}

	/**
	 * Calculate the message digest for the given password.
	 * To prevent rainbow table attacks, the user name is added to the digest input.
	 * @param password password
	 * @return message digest output
	 */
	private String calculatePasswordDigest(char[] password) {
		MessageDigest md;
		try {
			md = MessageDigest.getInstance(pm.getPasswordDigestAlgorithm());
		} catch (NoSuchAlgorithmException e) {
			throw new IllegalStateException("Unsupported password digest algorithm "+pm.getPasswordDigestAlgorithm());
		}
		CharBuffer in = CharBuffer.allocate(login.length()+password.length);
		in.append(login);
		in.append(CharBuffer.wrap(password));
		in.flip();
		ByteBuffer bytes = StandardCharsets.UTF_8.encode(in);
		byte[] b = new byte[bytes.remaining()];
		bytes.get(b);

		b = md.digest(b);
		String result = Base64.getEncoder().encodeToString(b);
		return result;
	}
	@Override
	public void setPassword(char[] newPassword) {

		this.password = calculatePasswordDigest(newPassword);
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((properties == null) ? 0 : properties.hashCode());
		result = prime * result + login.hashCode();
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserImpl other = (UserImpl) obj;
		if (properties == null) {
			if (other.properties != null)
				return false;
		} else if (!properties.equals(other.properties))
			return false;

		if (!login.equals(other.login))
			return false;
		return true;
	}

	@Override
	public void setAdmin(boolean admin) {
		if( admin == false ) {
			properties.remove(PMService.USER_ISADMIN);
		}else {
			setProperty(PMService.USER_ISADMIN, Boolean.TRUE.toString());
		}
	}
	@Override
	public Map<String, String> getProperties() {
		return this.properties;
	}
	@Override
	public String getProperty(String key) {
		return properties.get(key);
	}
	@Override
	public void setProperty(String key, String value) {
		properties.put(key, value);
	}
	@Override
	public List<ParamImpl> getParameters() {
		return this.params;
	}
	@Override
	public ParamImpl addParameter(String name, String datatype, String value) {
		ParamImpl param = new ParamImpl(name,datatype,value);
		this.params.add(param);
		return param;
	}
	@Override
	public Parameter updateParameter(int index, String name, String datatype, String value) {
		ParamImpl param = new ParamImpl(name,datatype,value);
		return this.params.set(index, param);
	}
}


text:
module ApplicationHelper
	#Removes blank spaces from html
	def spaceless(&block)
	  contents = capture(&block)
	  contents.strip.gsub(/>\s+</, '><').html_safe
	end
	# Randomize background image
	def randomized_background_image
	  images = ["ballons-sum.jpg", "balloons-sky.jpg", "balloons-paradise.jpg"]
	  images[rand(images.size)]
	end
end


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { IssueFormComponent } from './issue-form.component';

describe('IssueFormComponent', () => {
  let component: IssueFormComponent;
  let fixture: ComponentFixture<IssueFormComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ IssueFormComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(IssueFormComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should be created', () => {
    expect(component).toBeTruthy();
  });
});


text:
#ifndef __OPENCV_CUDASTEREO_HPP__
#define __OPENCV_CUDASTEREO_HPP__

#ifndef __cplusplus
#  error cudastereo.hpp header must be compiled as C++
#endif

#include BLIK_OPENCV_U_opencv2__core__cuda_hpp //original-code:"opencv2/core/cuda.hpp"
#include BLIK_OPENCV_U_opencv2__calib3d_hpp //original-code:"opencv2/calib3d.hpp"

/**
  @addtogroup cuda
  @{
    @defgroup cudastereo Stereo Correspondence
  @}
 */

namespace cv { namespace cuda {

//! @addtogroup cudastereo
//! @{

/////////////////////////////////////////
// StereoBM

/** @brief Class computing stereo correspondence (disparity map) using the block matching algorithm. :

@sa StereoBM
 */
class CV_EXPORTS StereoBM : public cv::StereoBM
{
public:
    using cv::StereoBM::compute;

    virtual void compute(InputArray left, InputArray right, OutputArray disparity, Stream& stream) = 0;
};

/** @brief Creates StereoBM object.

@param numDisparities the disparity search range. For each pixel algorithm will find the best
disparity from 0 (default minimum disparity) to numDisparities. The search range can then be
shifted by changing the minimum disparity.
@param blockSize the linear size of the blocks compared by the algorithm. The size should be odd
(as the block is centered at the current pixel). Larger block size implies smoother, though less
accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher
chance for algorithm to find a wrong correspondence.
 */
CV_EXPORTS Ptr<cuda::StereoBM> createStereoBM(int numDisparities = 64, int blockSize = 19);

/////////////////////////////////////////
// StereoBeliefPropagation

/** @brief Class computing stereo correspondence using the belief propagation algorithm. :

The class implements algorithm described in @cite Felzenszwalb2006 . It can compute own data cost
(using a truncated linear model) or use a user-provided data cost.

@note
   StereoBeliefPropagation requires a lot of memory for message storage:

    \f[width \_ step  \cdot height  \cdot ndisp  \cdot 4  \cdot (1 + 0.25)\f]

    and for data cost storage:

    \f[width\_step \cdot height \cdot ndisp \cdot (1 + 0.25 + 0.0625 +  \dotsm + \frac{1}{4^{levels}})\f]

    width_step is the number of bytes in a line including padding.

StereoBeliefPropagation uses a truncated linear model for the data cost and discontinuity terms:

\f[DataCost = data \_ weight  \cdot \min ( \lvert Img_Left(x,y)-Img_Right(x-d,y)  \rvert , max \_ data \_ term)\f]

\f[DiscTerm =  \min (disc \_ single \_ jump  \cdot \lvert f_1-f_2  \rvert , max \_ disc \_ term)\f]

For more details, see @cite Felzenszwalb2006 .

By default, StereoBeliefPropagation uses floating-point arithmetics and the CV_32FC1 type for
messages. But it can also use fixed-point arithmetics and the CV_16SC1 message type for better
performance. To avoid an overflow in this case, the parameters must satisfy the following
requirement:

\f[10  \cdot 2^{levels-1}  \cdot max \_ data \_ term < SHRT \_ MAX\f]

@sa StereoMatcher
 */
class CV_EXPORTS StereoBeliefPropagation : public cv::StereoMatcher
{
public:
    using cv::StereoMatcher::compute;

    /** @overload */
    virtual void compute(InputArray left, InputArray right, OutputArray disparity, Stream& stream) = 0;

    /** @brief Enables the stereo correspondence operator that finds the disparity for the specified data cost.

    @param data User-specified data cost, a matrix of msg_type type and
    Size(\<image columns\>\*ndisp, \<image rows\>) size.
    @param disparity Output disparity map. If disparity is empty, the output type is CV_16SC1 .
    Otherwise, the type is retained. In 16-bit signed format, the disparity values do not have
    fractional bits.
    @param stream Stream for the asynchronous version.
     */
    virtual void compute(InputArray data, OutputArray disparity, Stream& stream = Stream::Null()) = 0;

    //! number of BP iterations on each level
    virtual int getNumIters() const = 0;
    virtual void setNumIters(int iters) = 0;

    //! number of levels
    virtual int getNumLevels() const = 0;
    virtual void setNumLevels(int levels) = 0;

    //! truncation of data cost
    virtual double getMaxDataTerm() const = 0;
    virtual void setMaxDataTerm(double max_data_term) = 0;

    //! data weight
    virtual double getDataWeight() const = 0;
    virtual void setDataWeight(double data_weight) = 0;

    //! truncation of discontinuity cost
    virtual double getMaxDiscTerm() const = 0;
    virtual void setMaxDiscTerm(double max_disc_term) = 0;

    //! discontinuity single jump
    virtual double getDiscSingleJump() const = 0;
    virtual void setDiscSingleJump(double disc_single_jump) = 0;

    //! type for messages (CV_16SC1 or CV_32FC1)
    virtual int getMsgType() const = 0;
    virtual void setMsgType(int msg_type) = 0;

    /** @brief Uses a heuristic method to compute the recommended parameters ( ndisp, iters and levels ) for the
    specified image size ( width and height ).
     */
    static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels);
};

/** @brief Creates StereoBeliefPropagation object.

@param ndisp Number of disparities.
@param iters Number of BP iterations on each level.
@param levels Number of levels.
@param msg_type Type for messages. CV_16SC1 and CV_32FC1 types are supported.
 */
CV_EXPORTS Ptr<cuda::StereoBeliefPropagation>
    createStereoBeliefPropagation(int ndisp = 64, int iters = 5, int levels = 5, int msg_type = CV_32F);

/////////////////////////////////////////
// StereoConstantSpaceBP

/** @brief Class computing stereo correspondence using the constant space belief propagation algorithm. :

The class implements algorithm described in @cite Yang2010 . StereoConstantSpaceBP supports both local
minimum and global minimum data cost initialization algorithms. For more details, see the paper
mentioned above. By default, a local algorithm is used. To enable a global algorithm, set
use_local_init_data_cost to false .

StereoConstantSpaceBP uses a truncated linear model for the data cost and discontinuity terms:

\f[DataCost = data \_ weight  \cdot \min ( \lvert I_2-I_1  \rvert , max \_ data \_ term)\f]

\f[DiscTerm =  \min (disc \_ single \_ jump  \cdot \lvert f_1-f_2  \rvert , max \_ disc \_ term)\f]

For more details, see @cite Yang2010 .

By default, StereoConstantSpaceBP uses floating-point arithmetics and the CV_32FC1 type for
messages. But it can also use fixed-point arithmetics and the CV_16SC1 message type for better
performance. To avoid an overflow in this case, the parameters must satisfy the following
requirement:

\f[10  \cdot 2^{levels-1}  \cdot max \_ data \_ term < SHRT \_ MAX\f]

 */
class CV_EXPORTS StereoConstantSpaceBP : public cuda::StereoBeliefPropagation
{
public:
    //! number of active disparity on the first level
    virtual int getNrPlane() const = 0;
    virtual void setNrPlane(int nr_plane) = 0;

    virtual bool getUseLocalInitDataCost() const = 0;
    virtual void setUseLocalInitDataCost(bool use_local_init_data_cost) = 0;

    /** @brief Uses a heuristic method to compute parameters (ndisp, iters, levelsand nrplane) for the specified
    image size (widthand height).
     */
    static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels, int& nr_plane);
};

/** @brief Creates StereoConstantSpaceBP object.

@param ndisp Number of disparities.
@param iters Number of BP iterations on each level.
@param levels Number of levels.
@param nr_plane Number of disparity levels on the first level.
@param msg_type Type for messages. CV_16SC1 and CV_32FC1 types are supported.
 */
CV_EXPORTS Ptr<cuda::StereoConstantSpaceBP>
    createStereoConstantSpaceBP(int ndisp = 128, int iters = 8, int levels = 4, int nr_plane = 4, int msg_type = CV_32F);

/////////////////////////////////////////
// DisparityBilateralFilter

/** @brief Class refining a disparity map using joint bilateral filtering. :

The class implements @cite Yang2010 algorithm.
 */
class CV_EXPORTS DisparityBilateralFilter : public cv::Algorithm
{
public:
    /** @brief Refines a disparity map using joint bilateral filtering.

    @param disparity Input disparity map. CV_8UC1 and CV_16SC1 types are supported.
    @param image Input image. CV_8UC1 and CV_8UC3 types are supported.
    @param dst Destination disparity map. It has the same size and type as disparity .
    @param stream Stream for the asynchronous version.
     */
    virtual void apply(InputArray disparity, InputArray image, OutputArray dst, Stream& stream = Stream::Null()) = 0;

    virtual int getNumDisparities() const = 0;
    virtual void setNumDisparities(int numDisparities) = 0;

    virtual int getRadius() const = 0;
    virtual void setRadius(int radius) = 0;

    virtual int getNumIters() const = 0;
    virtual void setNumIters(int iters) = 0;

    //! truncation of data continuity
    virtual double getEdgeThreshold() const = 0;
    virtual void setEdgeThreshold(double edge_threshold) = 0;

    //! truncation of disparity continuity
    virtual double getMaxDiscThreshold() const = 0;
    virtual void setMaxDiscThreshold(double max_disc_threshold) = 0;

    //! filter range sigma
    virtual double getSigmaRange() const = 0;
    virtual void setSigmaRange(double sigma_range) = 0;
};

/** @brief Creates DisparityBilateralFilter object.

@param ndisp Number of disparities.
@param radius Filter radius.
@param iters Number of iterations.
 */
CV_EXPORTS Ptr<cuda::DisparityBilateralFilter>
    createDisparityBilateralFilter(int ndisp = 64, int radius = 3, int iters = 1);

/////////////////////////////////////////
// Utility

/** @brief Reprojects a disparity image to 3D space.

@param disp Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
floating-point disparity image. If 16-bit signed format is used, the values are assumed to have no
fractional bits.
@param xyzw Output 3- or 4-channel floating-point image of the same size as disp . Each element of
xyzw(x,y) contains 3D coordinates (x,y,z) or (x,y,z,1) of the point (x,y) , computed from the
disparity map.
@param Q \f$4 \times 4\f$ perspective transformation matrix that can be obtained via stereoRectify .
@param dst_cn The number of channels for output image. Can be 3 or 4.
@param stream Stream for the asynchronous version.

@sa reprojectImageTo3D
 */
CV_EXPORTS void reprojectImageTo3D(InputArray disp, OutputArray xyzw, InputArray Q, int dst_cn = 4, Stream& stream = Stream::Null());

/** @brief Colors a disparity image.

@param src_disp Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
floating-point disparity image. If 16-bit signed format is used, the values are assumed to have no
fractional bits.
@param dst_disp Output disparity image. It has the same size as src_disp. The type is CV_8UC4
in BGRA format (alpha = 255).
@param ndisp Number of disparities.
@param stream Stream for the asynchronous version.

This function draws a colored disparity map by converting disparity values from [0..ndisp) interval
first to HSV color space (where different disparity values correspond to different hues) and then
converting the pixels to RGB for visualization.
 */
CV_EXPORTS void drawColorDisp(InputArray src_disp, OutputArray dst_disp, int ndisp, Stream& stream = Stream::Null());

//! @}

}} // namespace cv { namespace cuda {

#endif /* __OPENCV_CUDASTEREO_HPP__ */


text:
<!DOCTYPE html>
<html>
<head>
    <script>
        window.isOnErrorTest = true;
    </script>
    <script src="../../resources/js-test.js"></script>
    <script src="resources/onerror-test.js"></script>
</head>
<body>
    <button onclick="%">Button.</button>
    <script>
        description("This test should trigger 'window.onerror' for the syntax error in the attribute handler, regardless of how it's set.");

        function callback(errorsHandled) {
            if (errorsHandled === 3)
                finishJSTest();
        }

        dumpOnErrorArgumentValuesAndReturn(true, callback);

        document.write('<button onclick="%">Button 2</button>\n');

        var button3 = document.createElement("button");
        button3.textContent = "Button 3";
        button3.setAttribute("onclick", "%");
        document.body.appendChild(button3);

        var buttons = document.querySelectorAll('button');
        for (var i = 0; i < buttons.length; ++i) {
            buttons[i].click();
        }
    </script>
</body>
</html>


text:
/**
 * @file
 * @brief
 *
 * @date 01.08.2013
 * @author Andrey Gazukin
 */

#ifndef	_LINUX_RBTREE_H
#define	_LINUX_RBTREE_H

struct rb_node {
	struct rb_node *rb_left;	/* left element */
	struct rb_node *rb_right;	/* right element */
	struct rb_node *rb_parent;	/* parent element */
	int rb_color;			/* node color */
};

struct rb_root {
	struct rb_node *rb_node; /* root of the tree */
};
#define NULL ((void *)0)
#define RB_ROOT ((struct rb_root){NULL})
#define rb_entry(p, container, field)		\
	((container *) ((char *)p - ((char *)&(((container *)0)->field))))

#define RB_BLACK	0
#define RB_RED		1

extern void rb_insert_color(struct rb_node *, struct rb_root *);
extern void rb_erase(struct rb_node *, struct rb_root *);

/* Find logical next and previous nodes in a tree */
extern struct rb_node *rb_next(struct rb_node *);
extern struct rb_node *rb_prev(struct rb_node *);
extern struct rb_node *rb_first(struct rb_root *);

/* Fast replacement of a single node without remove/rebalance/add/rebalance */
extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
			    struct rb_root *root);

static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
				struct rb_node ** rb_link)
{
	node->rb_parent = parent;
	node->rb_color = RB_RED;
	node->rb_left = node->rb_right = NULL;

	*rb_link = node;
}

#endif	/* _LINUX_RBTREE_H */


text:
/**
 * Composes list of string modifiers, in order
 *
 * @param {...function(string): string} modifiers Modifiers to compose
 * @returns {function(string): string} Composition of modifiers
 */
function composeModifiers(...modifiers) {
  return function (text) {
    return modifiers.reduce((result, next) => next(result), text);
  }
}

export default composeModifiers;


text:
"""
Gentoo packages
===============

This module provides high-level tools for managing Gentoo packages
and repositories using the Portage_ package manager.

.. _Portage: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1

"""

from fabtools.portage import (
    install,
    is_installed,
    uninstall,
    update_index,
)

def package(pkg_name, update=False):
    """
    Require a Portage package to be installed.

    Example::

        from fabtools import require

        require.portage.package('foo')
    """
    if not is_installed(pkg_name):
        install(pkg_name, update)

def packages(pkg_list, update=False):
    """
    Require several Portage packages to be installed.

    Example::

        from fabtools import require

        require.portage.packages([
            'foo',
            'bar',
            'baz',
        ])
    """
    pkg_list = [pkg for pkg in pkg_list if not is_installed(pkg)]
    if pkg_list:
        install(pkg_list, update)

def nopackage(pkg_name):
    """
    Require a Portage package to be uninstalled.

    Example::

        from fabtools import require

        require.portage.nopackage('apache2')
    """
    if is_installed(pkg_name):
        uninstall(pkg_name)

def nopackages(pkg_list):
    """
    Require several Portage packages to be uninstalled.

    Example::

        from fabtools import require

        require.portage.nopackages([
            'perl',
            'php5',
            'ruby',
        ])
    """
    pkg_list = [pkg for pkg in pkg_list if is_installed(pkg)]
    if pkg_list:
        uninstall(pkg_list)


text:
NSString * JSQMessagesLoadEarlierHeaderViewToggleActivitNotification = @"JSQMessagesLoadEarlierHeaderViewToggleActivitNotification";
NSString * JSQMessagesLoadEarlierHeaderViewToggleActivityNotificationStateKey = @"JSQMessagesLoadEarlierHeaderViewToggleActivityNotificationStateKey";
NSString * JSQMessagesLoadEarlierHeaderViewToggleActivityNotificationContextKey = @"JSQMessagesLoadEarlierHeaderViewToggleActivityNotificationContextKey";

const CGFloat kJSQMessagesLoadEarlierHeaderViewHeight = 32.0f;

@interface JSQMessagesLoadEarlierHeaderView ()

@property (weak, nonatomic) IBOutlet UIButton *loadButton;
@property (nonatomic, weak) IBOutlet UIImageView *spinnerImageView;

- (IBAction)loadButtonPressed:(UIButton *)sender;

@end

@implementation JSQMessagesLoadEarlierHeaderView

#pragma mark - Class methods

+ (UINib *)nib
{
    return [UINib nibWithNibName:NSStringFromClass([JSQMessagesLoadEarlierHeaderView class])
                          bundle:[NSBundle bundleForClass:[JSQMessagesLoadEarlierHeaderView class]]];
}

+ (NSString *)headerReuseIdentifier
{
    return NSStringFromClass([JSQMessagesLoadEarlierHeaderView class]);
}

#pragma mark - Initialization

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self setTranslatesAutoresizingMaskIntoConstraints:NO];

    self.backgroundColor = [UIColor clearColor];

    [self.spinnerImageView addSpinnerAnimation];

    [self.loadButton setTitle:[NSBundle jsq_localizedStringForKey:@"load_earlier_messages"] forState:UIControlStateNormal];
//    self.loadButton.titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(handleLoadingSpinnerStateNotification:)
                                                 name:JSQMessagesLoadEarlierHeaderViewToggleActivitNotification
                                               object:nil];
}

- (void)dealloc
{
    _loadButton = nil;
    _delegate = nil;

    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

#pragma mark - Reusable view

- (void)setBackgroundColor:(UIColor *)backgroundColor
{
    [super setBackgroundColor:backgroundColor];
    self.loadButton.backgroundColor = backgroundColor;
}

#pragma mark - Actions

- (IBAction)loadButtonPressed:(UIButton *)sender
{
    [self.delegate headerView:self didPressLoadButton:sender];
}

- (void)handleLoadingSpinnerStateNotification:(NSNotification *)notification {
    NSValue *contextValue = notification.userInfo[JSQMessagesLoadEarlierHeaderViewToggleActivityNotificationContextKey];
    void *context = [contextValue pointerValue];

    if (context == self.loadingSpinnerContext) {
        NSNumber *state = notification.userInfo[JSQMessagesLoadEarlierHeaderViewToggleActivityNotificationStateKey];
        BOOL on = state.boolValue;

        self.loadButton.hidden = on;
        self.spinnerImageView.hidden = !on;
    }
}

@end


text:
package com.breakidea.noah.common.service;

import java.util.List;

import com.breakidea.noah.common.exception.ServiceException;
import com.breakidea.noah.common.parameter.UserParameter;
import com.breakidea.noah.common.vo.UserVO;

public interface UserService {

    List<UserVO> queryList(UserParameter param) throws ServiceException;

    void add(UserParameter param) throws ServiceException;

    void update(UserParameter param) throws ServiceException;

    void delete(UserParameter param) throws ServiceException;
}


text:
import logging
from kubernetes import client
from docker.utils.config import find_config_file
from base64 import b64encode

from kubeflow.fairing.constants import constants

logger = logging.getLogger(__name__)

def get_docker_secret():
    try:
        docker_config_file = find_config_file(config_path=None)
        with open(docker_config_file, 'r') as f:
            data = f.read()
            data = {".dockerconfigjson": b64encode(
                data.encode('utf-8')).decode("utf-8")}
        docker_secret = client.V1Secret(
            metadata=client.V1ObjectMeta(name=constants.DOCKER_CREDS_SECRET_NAME),
            data=data,
            kind="Secret",
            type="kubernetes.io/dockerconfigjson"
        )
        return docker_secret
    except Exception as e:
        logger.warning("could not get docker secret: {}".format(e))
    return None

def create_docker_secret(kube_manager, namespace):
    try:
        docker_secret = get_docker_secret()
        if docker_secret:
            kube_manager.create_secret(namespace, docker_secret)
    except Exception as e:
        logger.warning("could not create docker secret: {}".format(e))

def add_docker_credentials_if_exists(kube_manager, pod_spec, namespace):
    secret_name = constants.DOCKER_CREDS_SECRET_NAME
    try:
        if not kube_manager.secret_exists(secret_name, namespace):
            create_docker_secret(kube_manager, namespace)
        if kube_manager.secret_exists(secret_name, namespace):
            add_docker_credentials(kube_manager, pod_spec, namespace)
        else:
            logger.warning("Not able to find docker credentials secret: {}".format(secret_name))
    except Exception as e:
        logger.warning("could not check for secret: {}".format(e))

def add_docker_credentials(kube_manager, pod_spec, namespace):
    secret_name = constants.DOCKER_CREDS_SECRET_NAME
    if not kube_manager.secret_exists(secret_name, namespace):
        raise ValueError("Not able to find docker credentials secret: {}".format(secret_name))
    pod_spec.image_pull_secrets = [client.V1LocalObjectReference(secret_name)]


text:
package internalversion

import (
	rest "k8s.io/client-go/rest"
	"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/scheme"
)

type TestgroupInterface interface {
	RESTClient() rest.Interface
	TestTypesGetter
}

// TestgroupClient is used to interact with features provided by the testgroup.k8s.io group.
type TestgroupClient struct {
	restClient rest.Interface
}

func (c *TestgroupClient) TestTypes(namespace string) TestTypeInterface {
	return newTestTypes(c, namespace)
}

// NewForConfig creates a new TestgroupClient for the given config.
func NewForConfig(c *rest.Config) (*TestgroupClient, error) {
	config := *c
	if err := setConfigDefaults(&config); err != nil {
		return nil, err
	}
	client, err := rest.RESTClientFor(&config)
	if err != nil {
		return nil, err
	}
	return &TestgroupClient{client}, nil
}

// NewForConfigOrDie creates a new TestgroupClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *TestgroupClient {
	client, err := NewForConfig(c)
	if err != nil {
		panic(err)
	}
	return client
}

// New creates a new TestgroupClient for the given RESTClient.
func New(c rest.Interface) *TestgroupClient {
	return &TestgroupClient{c}
}

func setConfigDefaults(config *rest.Config) error {
	g, err := scheme.Registry.Group("testgroup.k8s.io")
	if err != nil {
		return err
	}

	config.APIPath = "/apis"
	if config.UserAgent == "" {
		config.UserAgent = rest.DefaultKubernetesUserAgent()
	}
	if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group {
		gv := g.GroupVersion
		config.GroupVersion = &gv
	}
	config.NegotiatedSerializer = scheme.Codecs

	if config.QPS == 0 {
		config.QPS = 5
	}
	if config.Burst == 0 {
		config.Burst = 10
	}

	return nil
}

// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *TestgroupClient) RESTClient() rest.Interface {
	if c == nil {
		return nil
	}
	return c.restClient
}


text:
require 'shoulda-matchers'

module Shoulda
  module Matchers
    module ActiveModel
      def require_a_valid_host_name(attribute = :host_name)
        RequireAValidHostNameMatcher.new(attribute)
      end

      class RequireAValidHostNameMatcher < ValidationMatcher
        def description
          "require #{@attribute} to be a valid host name"
        end

        def matches?(subject)
          super(subject)

          disallows_invalid_value && allows_valid_value
        end

        private

        def disallows_invalid_value
          disallows_value_of('1bd')
        end

        def allows_valid_value
          allows_value_of('bd01')
        end
      end
    end
  end
end


text:
package net.glowstone.generator.decorators.nether;

import net.glowstone.GlowWorld;
import net.glowstone.block.GlowBlock;
import net.glowstone.generator.decorators.BlockDecorator;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;

import java.util.Random;

public class LavaDecorator extends BlockDecorator {

    private static final BlockFace[] SIDES = new BlockFace[]{BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST, BlockFace.DOWN};

    private boolean flowing;

    public LavaDecorator() {
        this(false);
    }

    public LavaDecorator(boolean flowing) {
        this.flowing = flowing;
    }

    @Override
    public void decorate(World world, Random random, Chunk source) {
        int sourceX = (source.getX() << 4) + random.nextInt(16);
        int sourceZ = (source.getZ() << 4) + random.nextInt(16);
        int sourceY = flowing ? 4 + random.nextInt(120) : 10 + random.nextInt(108);

        Block block = world.getBlockAt(sourceX, sourceY, sourceZ);
        if ((block.getType() == Material.NETHERRACK || block.isEmpty()) &&
                block.getRelative(BlockFace.UP).getType() == Material.NETHERRACK) {
            int netherrackBlockCount = 0;
            for (BlockFace face : SIDES) {
                if (block.getRelative(face).getType() == Material.NETHERRACK) {
                    netherrackBlockCount++;
                }
            }
            int airBlockCount = 0;
            for (BlockFace face : SIDES) {
                if (block.getRelative(face).isEmpty()) {
                    airBlockCount++;
                }
            }

            if (netherrackBlockCount == 5 || flowing && airBlockCount == 1 && netherrackBlockCount == 4) {
                BlockState state = block.getState();
                state.setType(Material.LAVA);
                state.update(true);
                // 10 instead of the default 5 because lava should flow faster in the nether
                ((GlowWorld) block.getWorld()).requestPulse((GlowBlock) block, 10);
            }
        }
    }
}


text:
<?php

abstract class Wpsqt_Export {

	/**
	 * The data to be exported.
	 *
	 * @var array
	 * @since 2.0
	 */
	protected $_data = array();

	/**
	 * Takes the input and puts it in $this->_data.
	 *
	 * @param array $input The data to be exported.
	 * @since 2.0
	 */
	public function input( array $input ){
		$this->_data = $input;
		return $this;
	}

	/**
	 * Returns the data in an export fashion.
	 *
	 * @since 2.0
	 */
	abstract public function output();

	/**
	 * Returns the object based on $type.
	 *
	 * @since 2.0
	 */
	public static function getObject($type){

		$className = "Wpsqt_Export_".ucfirst(strtolower($type));

		if ( !file_exists(WPSQT_DIR."lib/Wpsqt/Export/".ucfirst(strtolower($type)).".php") ) {
			wp_die("File doesn't exist");
		}

		require_once(WPSQT_DIR."lib/Wpsqt/Export/".ucfirst(strtolower($type)).".php");

		if ( !class_exists($className) ) {
			wp_die($className." Class doesn't exist");
		}

		return new $className;

	}

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href='/css/styles.css' rel='stylesheet' type='text/css' />
    <link href='/images/favicon.png' rel='shortcut icon' />

    <meta content='width=device-width, minimum-scale=1.0, maximum-scale=1.0' name='viewport' />
    <title>redis - 命令</title>
	<meta http-equiv="description" content="redis中文资料站,下载安装redis,查找redis常用命令(commands),选择适合的redis客户端方式,配置redis主从(master-slave),阅读redis官方文档,社区里了解更多redis信息,提交redis的bug。" />

加入版本 。

时间复杂度: O(log(N)+M) N是有序集合中元素个数,M是返回的结果集中元素如果M是常量(比如,用LIMIT总是请求前10个元素),你可以认为是O(log(N))。

		返回key的有序集合中的分数在max和min之间的所有元素(包括分数等于max或者min的元素)。与有序集合的默认排序相反,对于这个命令,元素被认为是从高分到低具有相同分数的元素按字典反序。

除了反序之外, ng, ZREVRANGEBYSCORE 和ZRANGEBYSCORE类似。

返回值

Multi-bulk reply: 指定分数范围的元素列表(也可以返回他们的分数)。

例子

          redis>
          ZADD myzset 1 "one"

(integer) 1

          redis>
          ZADD myzset 2 "two"

(integer) 1

          redis>
          ZADD myzset 3 "three"

(integer) 1

          redis>
          ZREVRANGEBYSCORE myzset +inf -inf

1) "three"
2) "two"
3) "one"

          redis>
          ZREVRANGEBYSCORE myzset 2 1

1) "two"
2) "one"

          redis>
          ZREVRANGEBYSCORE myzset 2 (1

1) "two"

          redis>
          ZREVRANGEBYSCORE myzset (2 (1

(empty list or set)
<form>
            redis>
            <input autocomplete='off' name='command' spellcheck='false' type='text' />
          </form>

        Comments powered by

          Disqus


text:
#include <miopen/batchnorm/solvers.hpp>

#include <miopen/batchnorm/invoke_params.hpp>
#include <miopen/batchnorm/problem_description.hpp>
#include <miopen/batch_norm.hpp>
#include <miopen/stringutils.hpp>
#include <miopen/visit_float.hpp>
#include <miopen/kernel_build_params.hpp>

#define WORKAROUND_SWDEV_253606 1

namespace miopen {

namespace solver {

namespace batchnorm {

bool BnFwdTrainingSpatialMultiple::IsApplicable(
    const ExecutionContext& context, const miopen::batchnorm::ProblemDescription& problem) const
{
    if(problem.GetDirection() != miopen::batchnorm::Direction::ForwardTraining ||
       problem.GetMode() != miopenBNSpatial)
        return false;

    return !BnFwdTrainingSpatialSingle{}.IsApplicable(context, problem);
}

ConvSolution BnFwdTrainingSpatialMultiple::GetSolution(
    const ExecutionContext& context, const miopen::batchnorm::ProblemDescription& problem) const
{
    const auto& handle                 = context.GetStream();
    const auto& xDesc                  = problem.GetXDesc();
    const auto& bnScaleBiasMeanVarDesc = problem.GetBnScaleBiasMeanVarDesc();

    int n, c, h, w;
    std::tie(n, c, h, w) = tien<4>(xDesc.GetLengths());

    unsigned int in_cstride = h * w;
    unsigned int in_nstride = c * in_cstride;
    unsigned int in_nhw     = n * in_cstride;
    unsigned int in_nchw    = n * in_nstride;
    auto inhw               = float(1.0 / in_nhw);

    size_t xlocalsize = 1024;
    if(((in_cstride < 256) && (n < 256)) || ((in_cstride < 100) && (n <= 256)))
        xlocalsize = 256;

    size_t ylocalsize = 1;

    size_t xgridsize = c * xlocalsize;
    size_t ygridsize = 1;

    bool bfpmixparm = false;
    bool bfp16parm  = false;
    bool bfp32parm  = true;
    if(xDesc.GetType() == miopenHalf && bnScaleBiasMeanVarDesc.GetType() == miopenHalf)
    {
        bfp16parm = true;
        bfp32parm = false;
    }
    else if(xDesc.GetType() == miopenHalf && bnScaleBiasMeanVarDesc.GetType() == miopenFloat)
    {
        bfpmixparm = true;
        bfp32parm  = false;
    }

    int variant           = 1;
    unsigned int ldsgcn   = xlocalsize / 64;
    unsigned int ldsnogcn = xlocalsize;

    if(!problem.IsLayoutNHWC())
    {
#if(WORKAROUND_SWDEV_253606 == 0)
        if(n < 3)
        {
            variant    = 4;
            xlocalsize = 256;
            xgridsize  = c * xlocalsize;
            ylocalsize = 1;
            ygridsize  = 1;
            ldsgcn     = xlocalsize / 64;
            ldsnogcn   = xlocalsize;
        }
        else
#endif

            // clang-format off
        if((in_nhw < 33554432 && in_cstride > 1024) ||
            ((n >= 256) && (in_cstride > 60) && bfpmixparm) ||
            ((in_cstride > 512) && bfpmixparm))
        {
            variant = 1;
        }
        else if(in_cstride <= 512)
        {
            variant = 0;
        }
        else
        {
            variant      = 2;
            xlocalsize   = 1;
            ylocalsize   = 1024;
            auto segment = int(std::ceil(double(in_cstride) / double(ylocalsize)));
            xgridsize    = c;
            ygridsize    = segment * ylocalsize;
            ldsgcn       = ylocalsize / 64;
            ldsnogcn     = ylocalsize;
        }
        // clang-format on

        if((n > 768) && (in_cstride > 150) && bfp32parm)
        {
            variant      = 2;
            xlocalsize   = 1;
            ylocalsize   = 1024;
            auto segment = int(std::ceil(double(in_cstride) / double(ylocalsize)));
            xgridsize    = c;
            ygridsize    = segment * ylocalsize;
            ldsgcn       = ylocalsize / 64;
            ldsnogcn     = ylocalsize;
        }
    }

    auto result = ConvSolution{miopenStatusSuccess};

    {
        auto kernel = KernelInfo{};

        kernel.kernel_name = "MIOpenBatchNormFwdTrainSpatial";
        kernel.kernel_file = "MIOpenBatchNormFwdTrainSpatial.cl";

        size_t zlocalsize = 1;
        size_t zgridsize  = 1;

        auto build_params = KernelBuildParameters{
            {"MIOPEN_USE_FP16", static_cast<int>(bfp16parm)},
            {"MIOPEN_USE_FP32", static_cast<int>(bfp32parm)},
            {"MIOPEN_USE_FPMIX", static_cast<int>(bfpmixparm)},
            {"MIO_SAVE_MEAN_VARIANCE", static_cast<int>(problem.GetResultSave())},
            {"MIO_RUNNING_RESULT", static_cast<int>(problem.GetResultRunning())},
            {"MIO_BN_N", n},
            {"MIO_BN_C", c},
            {"MIO_BN_HW", in_cstride},
            {"MIO_BN_NHW", in_nhw},
            {"MIO_BN_CHW", in_nstride},
            {"MIO_BN_NCHW", in_nchw},
            {"MIO_BN_NGRPS", int(std::ceil(float(ygridsize) / ylocalsize))},
            {"MIO_BN_LDS_SIZE", ldsnogcn},
            {"MIO_BN_LDSGCN_SIZE", ldsgcn},
            {"MIO_BN_VARIANT", variant},
            {"MIO_BN_GRP0", xlocalsize},
            {"MIO_BN_GRP1", ylocalsize},
            {"MIO_BN_GRP2", zlocalsize},
            {"MIO_BN_GFX103X", (StartsWith(handle.GetDeviceName(), "gfx103") ? "1" : "0")},
            {"MIO_LAYOUT_NHWC", static_cast<int>(problem.IsLayoutNHWC())},
        };

        kernel.comp_options = build_params.GenerateFor(kbp::OpenCL{});

        kernel.l_wk.push_back(xlocalsize);
        kernel.l_wk.push_back(ylocalsize);
        kernel.l_wk.push_back(zlocalsize);

        kernel.g_wk.push_back(xgridsize);
        kernel.g_wk.push_back(ygridsize);
        kernel.g_wk.push_back(zgridsize);

        auto copy        = kernel;
        copy.kernel_name = kernel.kernel_name + "MeanVariance";
        result.construction_params.push_back(copy);

        copy.kernel_name = kernel.kernel_name + "FinalMeanVariance";
        result.construction_params.push_back(copy);

        copy.kernel_name = kernel.kernel_name + "Norm";
        result.construction_params.push_back(copy);
    }

    const auto dtype = bnScaleBiasMeanVarDesc.GetType();

    result.invoker_factory = [=](const std::vector<Kernel>& kernels) {
        return [=](const Handle& handle_, const AnyInvokeParams& raw_params) {
            decltype(auto) kernel = handle_.Run(kernels.front());
            decltype(auto) params = raw_params.CastTo<miopen::batchnorm::InvokeParams>();
            const auto resultsave =
                params.resultSaveMean != nullptr && params.resultSaveInvVariance != nullptr;
            const auto resultrunning =
                params.resultRunningMean != nullptr && params.resultRunningVariance != nullptr;

            float ctime = 0.;
            visit_float(dtype, [&](auto as_float) {
                handle_.Run(kernels[0])(params.x, params.y);
                profileSequence(handle_, 0, &ctime);

                if(resultsave && resultrunning)
                {
                    handle_.Run(kernels[1])(params.y,
                                            as_float(inhw),
                                            params.expAvgFactor,
                                            params.resultRunningMean,
                                            params.resultRunningVariance,
                                            params.epsilon,
                                            params.resultSaveMean,
                                            params.resultSaveInvVariance);
                }
                else if(resultsave)
                {
                    handle_.Run(kernels[1])(params.y,
                                            as_float(inhw),
                                            params.epsilon,
                                            params.resultSaveMean,
                                            params.resultSaveInvVariance);
                }
                else if(resultrunning)
                {
                    handle_.Run(kernels[1])(params.y,
                                            as_float(inhw),
                                            params.expAvgFactor,
                                            params.resultRunningMean,
                                            params.resultRunningVariance,
                                            params.epsilon);
                }
                else
                {
                    handle_.Run(kernels[1])(params.y, as_float(inhw), params.epsilon);
                }

                profileSequence(handle_, 1, &ctime);

                handle_.Run(kernels[2])(params.x, params.y, params.bnScale, params.bnBias);
                profileSequence(handle_, 2, &ctime);
            });
        };
    };

    return result;
}

} // namespace batchnorm

} // namespace solver

} // namespace miopen


text:
.container .article-placeholder { background-color: #e3e3e3; border-radius: 6px; padding: 1em 0; box-shadow: 2px 2px 2px #434343;}
.container article { padding-left: 2em; padding-bottom: 1em; border-bottom: 1px dotted #434343; }

.messages ul { list-style: none; margin: 0 0; font-weight: bolder; font-size: 18px; }

.paginationControl { text-align: center; }

form .errors { color: #b94a48; font-weight: bolder; padding-left: 1em; }
form input, form textarea { margin-bottom: 0px !important; width: 50%; }
form textarea { height: 150px; }


text:
<?php

namespace Biopen\GeoDirectoryBundle\Document;

use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use JMS\Serializer\Annotation\Expose;

/** @MongoDB\EmbeddedDocument */
class DailyTimeSlot
{
	/**
    * @Expose
    * @MongoDB\Field(type="date") */
    private $slot1start;
    /**
    * @Expose
    * @MongoDB\Field(type="date") */
    private $slot1end;
    /**
    * @Expose
    * @MongoDB\Field(type="date") */
	private $slot2start;
    /**
    * @Expose
    * @MongoDB\Field(type="date") */
    private $slot2end;

	public function __construct()
	{

	}

    public function toJson()
    {
        $result = '"';
        if ($this->slot1start && $this->slot1end) $result .= date_format($this->slot1start, 'H:i') .'-' . date_format($this->slot1end, 'H:i');
        if ($this->slot2start && $this->slot2end) $result .= ',' . date_format($this->slot2start, 'H:i') .'-' . date_format($this->slot2end, 'H:i');
        $result .= '"';
        return $result;
    }

    public function getSlot1Start()
    {
        //return date_format($this->slot1start, 'H:i');
        return $this->slot1start;
    }

    public function getSlot2Start()
    {
        //return date_format($this->slot2start, 'H:i');
        return $this->slot2start;
    }

    public function getSlot1End()
    {
        //return date_format($this->slot1end, 'H:i');
        return $this->slot1end;
    }

    public function getSlot2End()
    {
        //return date_format($this->slot2Fin, 'H:i');
        return $this->slot2end;
    }

    // seters

    public function setSlot1Start($slot)
    {
        $this->slot1start = $slot;
        return $this;
    }

    public function setSlot2Start($slot)
    {
        $this->slot2start = $slot;
        return $this;
    }

    public function setSlot1End($slot)
    {
        $this->slot1end = $slot;
        return $this;
    }

    public function setSlot2End($slot)
    {
        $this->slot2end = $slot;
        return $this;
    }
}


text:
package com.github.dannil.scbjavaclient.client.environment.landuse;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.Locale;

import com.github.dannil.scbjavaclient.client.environment.landuse.buildings.EnvironmentLandUseBuildingsClient;
import com.github.dannil.scbjavaclient.client.environment.landuse.infrastructurefortransport.EnvironmentLandUseInfrastructureForTransportClient;
import com.github.dannil.scbjavaclient.client.environment.landuse.planning.EnvironmentLandUsePlanningClient;
import com.github.dannil.scbjavaclient.client.environment.landuse.usage.EnvironmentLandUseUsageClient;
import com.github.dannil.scbjavaclient.communication.URLEndpoint;
import com.github.dannil.scbjavaclient.test.extensions.Suite;

import org.junit.jupiter.api.Test;

@Suite
public class EnvironmentLandUseClientTest {

    @Test
    public void createWithLocaleConstructor() {
        Locale locale = new Locale("sv", "SE");
        EnvironmentLandUseClient client = new EnvironmentLandUseClient(locale);

        assertEquals(locale, client.getLocale());
    }

    @Test
    public void buildingsClient() {
        EnvironmentLandUseClient client = new EnvironmentLandUseClient();

        assertEquals(EnvironmentLandUseBuildingsClient.class, client.buildings().getClass());
    }

    @Test
    public void infrastructureForTransport() {
        EnvironmentLandUseClient client = new EnvironmentLandUseClient();

        assertEquals(EnvironmentLandUseInfrastructureForTransportClient.class,
                client.infrastructureForTransport().getClass());
    }

    @Test
    public void planningClient() {
        EnvironmentLandUseClient client = new EnvironmentLandUseClient();

        assertEquals(EnvironmentLandUsePlanningClient.class, client.planning().getClass());
    }

    @Test
    public void usageClient() {
        EnvironmentLandUseClient client = new EnvironmentLandUseClient();

        assertEquals(EnvironmentLandUseUsageClient.class, client.usage().getClass());
    }

    @Test
    public void getUrl() {
        // Check with a locale that isn't the fallback locale; results in a more specific
        // test with harder constraints
        Locale locale = new Locale("en", "US");
        EnvironmentLandUseClient client = new EnvironmentLandUseClient(locale);

        assertEquals(URLEndpoint.getRootUrl(locale).append("MI/MI0803/"), client.getUrl());
    }

}


text:
package xyz.aornice.tofq.util;

import sun.misc.Unsafe;

import java.lang.reflect.Field;
import java.util.concurrent.atomic.AtomicLong;

/**
 * Operating low-level memory with Unsafe
 *
 * @see sun.misc.Unsafe
 * warning: Unsafe is internal proprietary API and may be removed in a future release
 * <p>
 * Created by drfish on 10/04/2017.
 */
public enum UnsafeMemory implements Memory {
    INSTANCE;

    private static final Unsafe UNSAFE;
    private final AtomicLong nativeMemoryUsed = new AtomicLong();
    /**
     * @see java.nio.Bits#UNSAFE_COPY_THRESHOLD
     * This number limits the number of bytes to copy per call to Unsafe's
     * copyMemory method. A limit is imposed to allow for safepoint polling
     * during a large copy
     */
    private static long UNSAFE_COPY_THRESHOLD = 1024L * 1024L;

    static {
        try {
            Field unsafe = Jvm.getField(Unsafe.class, "theUnsafe");
            UNSAFE = (Unsafe) unsafe.get(null);
        } catch (IllegalAccessException e) {
            throw new AssertionError(e);
        }
    }

    @Override
    public int pageSize() {
        return UNSAFE.pageSize();
    }

    @Override
    public void setMemory(long address, long size, byte b) {
        UNSAFE.setMemory(address, size, b);
    }

    @Override
    public void freeMemory(long address, long size) {
        if (address != 0) {
            UNSAFE.freeMemory(address);
        }
        nativeMemoryUsed.addAndGet(-size);
    }

    @Override
    public long allocate(long capacity) throws IllegalArgumentException, OutOfMemoryError {
        if (capacity <= 0) {
            throw new IllegalArgumentException("Invalid native memory capacity: " + capacity);
        }
        long address = UNSAFE.allocateMemory(capacity);
        if (address == 0) {
            throw new OutOfMemoryError("Not enough free native memory, capacity tried: " + capacity);
        }
        nativeMemoryUsed.addAndGet(capacity);
        return address;
    }

    @Override
    public long nativeMemoryUsed() {
        return nativeMemoryUsed.get();
    }

    @Override
    public byte readByte(Object object, long offset) {
        return UNSAFE.getByte(object, offset);
    }

    @Override
    public byte readByte(long address) {
        return UNSAFE.getByte(address);
    }

    @Override
    public void writeByte(Object object, long offset, byte i8) {
        UNSAFE.putByte(object, offset, i8);
    }

    @Override
    public void writeByte(long address, byte i8) {
        UNSAFE.putByte(address, i8);
    }

    @Override
    public short readShort(Object object, long offset) {
        return UNSAFE.getShort(object, offset);
    }

    @Override
    public short readShort(long address) {
        return UNSAFE.getShort(address);
    }

    @Override
    public void writeShort(Object object, long offset, short i16) {
        UNSAFE.putShort(object, offset, i16);
    }

    @Override
    public void writeShort(long address, short i16) {
        UNSAFE.putShort(address, i16);
    }

    @Override
    public int readInt(long address) {
        return UNSAFE.getInt(address);
    }

    @Override
    public int readInt(Object object, long offset) {
        return UNSAFE.getInt(object, offset);
    }

    @Override
    public void writeInt(long address, int i32) {
        UNSAFE.putInt(address, i32);
    }

    @Override
    public void writeInt(Object object, long offset, int i32) {
        UNSAFE.putInt(object, offset, i32);
    }

    @Override
    public void writeOrderedInt(long offset, int i32) {
        UNSAFE.putOrderedInt(null, offset, i32);
    }

    @Override
    public void writeOrderedInt(Object object, long offset, int i32) {
        UNSAFE.putOrderedInt(object, offset, i32);
    }

    @Override
    public long readLong(long address) {
        return UNSAFE.getLong(address);
    }

    @Override
    public long readLong(Object object, long offset) {
        return UNSAFE.getLong(object, offset);
    }

    @Override
    public void writeLong(long address, long i64) {
        UNSAFE.putLong(address, i64);
    }

    @Override
    public void writeLong(Object object, long offset, long i64) {
        UNSAFE.putLong(object, offset, i64);
    }

    @Override
    public float readFloat(long address) {
        return UNSAFE.getFloat(address);
    }

    @Override
    public float readFloat(Object object, long offset) {
        return UNSAFE.getFloat(object, offset);
    }

    @Override
    public void writeFloat(long address, float f) {
        UNSAFE.putFloat(address, f);
    }

    @Override
    public void writeFloat(Object object, long offset, float f) {
        UNSAFE.putFloat(object, offset, f);
    }

    @Override
    public double readDouble(long address) {
        return UNSAFE.getDouble(address);
    }

    @Override
    public double readDouble(Object object, long offset) {
        return UNSAFE.getDouble(object, offset);
    }

    @Override
    public void writeDouble(long address, double d) {
        UNSAFE.putDouble(address, d);
    }

    @Override
    public void writeDouble(Object object, long offset, double d) {
        UNSAFE.putDouble(object, offset, d);
    }

    @Override
    public byte readVolatileByte(long address) {
        return UNSAFE.getByteVolatile(null, address);
    }

    @Override
    public byte readVolatileByte(Object object, long offset) {
        return UNSAFE.getByteVolatile(object, offset);
    }

    @Override
    public short readVolatileShort(long address) {
        return UNSAFE.getShortVolatile(null, address);
    }

    @Override
    public short readVolatileShort(Object object, long offset) {
        return UNSAFE.getShortVolatile(object, offset);
    }

    @Override
    public int readVolatileInt(long address) {
        return UNSAFE.getIntVolatile(null, address);
    }

    @Override
    public int readVolatileInt(Object object, long offset) {
        return UNSAFE.getIntVolatile(object, offset);
    }

    @Override
    public float readVolatileFloat(long address) {
        return UNSAFE.getFloatVolatile(null, address);
    }

    @Override
    public float readVolatileFloat(Object object, long offset) {
        return UNSAFE.getFloatVolatile(object, offset);
    }

    @Override
    public long readVolatileLong(long address) {
        return UNSAFE.getLongVolatile(null, address);
    }

    @Override
    public long readVolatileLong(Object object, long offset) {
        return UNSAFE.getLongVolatile(object, offset);
    }

    @Override
    public double readVolatileDouble(long address) {
        return UNSAFE.getLongVolatile(null, address);
    }

    @Override
    public double readVolatileDouble(Object object, long offset) {
        return UNSAFE.getDoubleVolatile(object, offset);
    }

    @Override
    public void writeVolatileByte(long address, byte i8) {
        UNSAFE.putByteVolatile(null, address, i8);
    }

    @Override
    public void writeVolatileByte(Object object, long offset, byte i8) {
        UNSAFE.putByteVolatile(object, offset, i8);
    }

    @Override
    public void writeVolatileShort(long address, short i16) {
        UNSAFE.putShortVolatile(null, address, i16);
    }

    @Override
    public void writeVolatileShort(Object object, long offset, short i16) {
        UNSAFE.putShortVolatile(object, offset, i16);
    }

    @Override
    public void writeVolatileInt(long address, int i32) {
        UNSAFE.putIntVolatile(null, address, i32);
    }

    @Override
    public void writeVolatileInt(Object object, long offset, int i32) {
        UNSAFE.putIntVolatile(object, offset, i32);
    }

    @Override
    public void writeVolatileFloat(long address, float f) {
        UNSAFE.putFloatVolatile(null, address, f);
    }

    @Override
    public void writeVolatileFloat(Object object, long offset, float f) {
        UNSAFE.putFloatVolatile(object, offset, f);
    }

    @Override
    public void writeVolatileLong(long address, long i64) {
        UNSAFE.putLongVolatile(null, address, i64);
    }

    @Override
    public void writeVolatileLong(Object object, long offset, long i64) {
        UNSAFE.putLongVolatile(object, offset, i64);
    }

    @Override
    public void writeVolatileDouble(long address, double d) {
        UNSAFE.putDoubleVolatile(null, address, d);
    }

    @Override
    public void writeVolatileDouble(Object object, long offset, double d) {
        UNSAFE.putDoubleVolatile(object, offset, d);
    }

    @Override
    public int addInt(long address, int increment) {
        return UNSAFE.getAndAddInt(null, address, increment) + increment;
    }

    @Override
    public int addInt(Object object, long offset, int increment) {
        return UNSAFE.getAndAddInt(object, offset, increment) + increment;
    }

    @Override
    public long addLong(long address, long increment) {
        return UNSAFE.getAndAddLong(null, address, increment) + increment;
    }

    @Override
    public long addLong(Object object, long offset, long increment) {
        return UNSAFE.getAndAddLong(object, offset, increment) + increment;
    }

    @Override
    public boolean compareAndSwapInt(long address, int expected, int value) {
        return UNSAFE.compareAndSwapInt(null, address, expected, value);
    }

    @Override
    public boolean compareAndSwapInt(Object object, long offset, int expected, int value) {
        return UNSAFE.compareAndSwapInt(object, offset, expected, value);
    }

    @Override
    public boolean compareAndSwapLong(long address, long expected, long value) {
        return UNSAFE.compareAndSwapLong(null, address, expected, value);
    }

    @Override
    public boolean compareAndSwapLong(Object object, long offset, long expected, long value) {
        return UNSAFE.compareAndSwapLong(object, offset, expected, value);
    }

    @Override
    public <E> E allocateInstance(Class<E> clazz) throws InstantiationException {
        return (E) UNSAFE.allocateInstance(clazz);
    }

    @Override
    public long getFieldOffset(Field field) {
        return UNSAFE.objectFieldOffset(field);
    }

    @Override
    public <T> T getObject(Object o, long offset) {
        return (T) UNSAFE.getObject(o, offset);
    }

    @Override
    public void copyMemory(byte[] bytes, int offset, long address, int length) {
        copyMemory(bytes, offset, null, address, length);
    }

    @Override
    public void copyMemory(long fromAddress, long address, long length) {
        copyMemory0(null, fromAddress, null, address, length);
    }

    @Override
    public void copyMemory(byte[] bytes, int offset, Object obj2, long offset2, int length) {
        copyMemory0(bytes, Unsafe.ARRAY_BYTE_BASE_OFFSET + offset, obj2, offset2, length);
    }

    @Override
    public void copyMemory(long fromAddress, Object obj2, long offset2, int length) {
        copyMemory0(null, fromAddress, obj2, offset2, length);
    }

    private void copyMemory0(Object from, long fromOffset, Object to, long toOffset, long length) {
        // use a loop to ensure there is a safe point every so often.
        while (length > 0) {
            long size = Math.min(length, UNSAFE_COPY_THRESHOLD);
            UNSAFE.copyMemory(from, fromOffset, to, toOffset, size);
            length -= size;
            fromOffset += size;
            toOffset += size;
        }
    }
}


text:
@interface NSStringFromAnyObjectAppTests : XCTestCase

@end

@implementation NSStringFromAnyObjectAppTests

#pragma mark - NSStringFromAnyObject

- (void)test_NSStringFromAnyObject {
    NSString *objectRepresentation, *output;

#pragma mark Objective-C

    objectRepresentation = NSStringFromAnyObject( nil );
    XCTAssertTrue([objectRepresentation isEqualToString:@"nil/NULL"]);

    objectRepresentation = NSStringFromAnyObject( @[ @(1) ] );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(__NSArrayI)(\n    1\n)"]);

    objectRepresentation = NSStringFromAnyObject( @(1) );
    XCTAssertTrue([objectRepresentation isEqualToString:@"@(1)"]);

    objectRepresentation = NSStringFromAnyObject( [@(1) class] );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(Class)__NSCFNumber"]);

    objectRepresentation = NSStringFromAnyObject( @selector(main) );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(SEL)main"]);

#pragma mark Foundation

    objectRepresentation = NSStringFromAnyObject( NSMakeRange(0, 10) );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(NSRange){0, 10}"]);

#pragma mark C Pointers

    objectRepresentation = NSStringFromAnyObject( NULL );
    XCTAssertTrue([objectRepresentation isEqualToString:@"nil/NULL"]);

    void *ptr = &printf;
    objectRepresentation = NSStringFromAnyObject( ptr );
    output = [NSString stringWithFormat:@"(void *)%p", ptr];
    XCTAssertTrue([objectRepresentation isEqualToString:output]);

    const void *const_ptr = &printf;
    objectRepresentation = NSStringFromAnyObject( const_ptr );
    output = [NSString stringWithFormat:@"(const void *)%p", ptr];
    XCTAssertTrue([objectRepresentation isEqualToString:output]);

#pragma mark C Numbers

    objectRepresentation = NSStringFromAnyObject( (BOOL)YES );
    XCTAssertTrue([objectRepresentation isEqualToString:@"YES"]);
    objectRepresentation = NSStringFromAnyObject( (BOOL)NO );
    XCTAssertTrue([objectRepresentation isEqualToString:@"NO"]);

    objectRepresentation = NSStringFromAnyObject( 1.24 );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(double)1.240000"]);

    objectRepresentation = NSStringFromAnyObject( 1.24f );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(float)1.240000f"]);

    objectRepresentation = NSStringFromAnyObject( 1 );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(int)1"]);

    objectRepresentation = NSStringFromAnyObject( (short)1 );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(short)1"]);

    objectRepresentation = NSStringFromAnyObject( (long)1000L );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(long)1000L"]);

    objectRepresentation = NSStringFromAnyObject( (long long)100000000000LL );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(long long)100000000000LL"]);

    objectRepresentation = NSStringFromAnyObject( (char)'c' );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(char)c"]);

    objectRepresentation = NSStringFromAnyObject( (unsigned char)'c' );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(unsigned char)c"]);

#pragma mark C Strings

    char *str = "A string";
    const char *conststr = (const char *)str;

    objectRepresentation = NSStringFromAnyObject( str );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(char *)A string"]);

    objectRepresentation = NSStringFromAnyObject( conststr );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(const char *)A string"]);

#pragma mark C Typical Structs

    typedef struct {
        float one;
        float two;
    } TwoFloatsStruct;

    typedef struct {
        TwoFloatsStruct one;
        TwoFloatsStruct two;
    } TwoOfTwoFloatsStruct;

    TwoFloatsStruct twoFloatsStruct = (TwoFloatsStruct){11.0f, 12.0f};
    TwoOfTwoFloatsStruct twoOfTwoFloatsStruct = (TwoOfTwoFloatsStruct){11.0f, 12.0f, 13.0f, 14.0f};

    objectRepresentation = NSStringFromAnyObject( twoFloatsStruct );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(struct){11.000000f, 12.000000f}"]);

    objectRepresentation = NSStringFromAnyObject( twoOfTwoFloatsStruct );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(struct){11.000000f, 12.000000f, 13.000000f, 14.000000f}"]);

    typedef struct {
        double one;
        double two;
    } TwoDoublesStruct;

    typedef struct {
        TwoDoublesStruct one;
        TwoDoublesStruct two;
    } TwoOfTwoDoublesStruct;

    TwoDoublesStruct twoDoublesStruct = (TwoDoublesStruct){11.0f, 12.0f};
    TwoOfTwoDoublesStruct twoOfTwoDoublesStruct = (TwoOfTwoDoublesStruct){11.0, 12.0, 13.0, 14.0};

    objectRepresentation = NSStringFromAnyObject( twoDoublesStruct );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(struct){11.000000, 12.000000}"]);

    objectRepresentation = NSStringFromAnyObject( twoOfTwoDoublesStruct );
    XCTAssertTrue([objectRepresentation isEqualToString:@"(struct){11.000000, 12.000000, 13.000000, 14.000000}"]);

}

#pragma mark - NSStringFromAnyObject - Unsupported types

- (void)test_NSStringFromAnyObject_UnsupportedTypes {
    NSString *objectRepresentation;

    objectRepresentation = NSStringFromAnyObject( "String literal" );
    XCTAssertTrue([objectRepresentation isEqualToString:@"NSStringFromAnyObject: unsupported type: [15c]"]);

    typedef struct {
        int x;
        int y;
    } NSSomeStructType;

    NSSomeStructType someStructTypeVariable;
    objectRepresentation = NSStringFromAnyObject( someStructTypeVariable );
    XCTAssertTrue([objectRepresentation isEqualToString:@"NSStringFromAnyObject: unsupported type: {?=ii}"]);

    int *b = malloc(3 * sizeof(int));
    objectRepresentation = NSStringFromAnyObject( b );
    XCTAssertTrue([objectRepresentation isEqualToString:@"NSStringFromAnyObject: unsupported type: ^i"]);
    free(b);
}

@end