text:
package godis

import (
	"sync"
	"log"
	"time"
	"gopkg.in/redis.v3"
	"strconv"
	"math/rand"
)

// Task handler representation
type ClientTask struct {
	done        chan bool
	HandlerFunc HandleClientFunc
}

type ServiceCache struct {
	id       string
	expireAt int64
}

type Client struct {
	id            string
	redisClient   *RedisClient
	mutex         sync.Mutex
	HandleTasks   map[string]*ClientTask
	serviceCache  map[string]*ServiceCache
	maxRetryCount int
	isListening   bool
}

func NewClient(id string, addr string, maxRetryCount int) (*Client, error) {

	redisClient, err := NewRedisClient(addr)
	if err!=nil {
		return nil, err
	}
	key := Consumers(id)
	val := redisClient.pushConn.Keys(key)
	if val.Err()!=nil {
		return nil, val.Err()
	}
	if len(val.Val())!=0 {
		return nil, SCRepeatErr
	}

	key = ConsumerMsgQueen(id)
	redisClient.pushConn.Del(key)

	log.Println("key,%v", val)
	client := Client{
		id: id,
		redisClient: redisClient,
		HandleTasks: make(map[string]*ClientTask),
		serviceCache: make(map[string]*ServiceCache),
		maxRetryCount:maxRetryCount,
	}

	return &client, nil
}

func (c *Client) Call(name string, handlerFunc HandleClientFunc, args ProtoType) error {
	c.mutex.Lock()
	defer c.mutex.Unlock()

	if (!c.isListening) {
		go c.Listen()
		c.isListening = true
	}

	event, err := newEvent(c.id, name, args)
	if err != nil {
		return err
	}

	msg, err := event.packBytes()

	done := make(chan bool)
	c.HandleTasks[event.MsgId] = &ClientTask{
		done:done,
		HandlerFunc:handlerFunc,
	}

	go c.Invoke(event.MsgId, done, string(msg[:]), name, 0)
	go c.IncServiceCount(name)
	return nil
}

func randServer(l int) int {
	return rand.Intn(l)
}

func (c *Client) Invoke(msgId string, done chan bool, msg string, serviceName string, retryCount int) {
	c.mutex.Lock()

	now := time.Now().Unix()
	var server string
	if sc, ok := c.serviceCache[serviceName]; ok && sc.expireAt > now {
		server = sc.id
	} else {
		key := ProducerService(serviceName)
		opt := redis.ZRangeByScore{
			Min: strconv.FormatInt(now, 10),
			Max: "+inf",
		}
//		log.Println("no cache %v", opt)
		servers := c.redisClient.pushConn.ZRangeByScore(key, opt).Val()
		l := len(servers)
		if l!= 0 {
			server = servers[randServer(l)]
			c.serviceCache[serviceName]= &ServiceCache{//save cache
				id:server,
				expireAt:time.Now().Add(time.Minute).Unix(),
			}
		}else {
			go c.Send404(msgId)
			go c.IncServiceNotFoundCount(serviceName)
			return
		}
	}

	serverKey := ProducerMsgQueen(server)
	c.redisClient.pushConn.RPush(serverKey, string(msg[:]))

	c.mutex.Unlock()
	go func() {
		ttl := time.After(60 * time.Second)
		end := make(chan int64)
		Loop:
		for {
			select {
			case <-done:
				end <- 1
			case <-ttl:
				go func() {
					retryCount=retryCount+1
					log.Println("retry : %d", retryCount)
					if retryCount<c.maxRetryCount {
						go c.Invoke(msgId, done, msg, serviceName, retryCount)
					} else {
						go c.RemoveTimeoutTask(msgId)
						go c.IncRequestTimeoutCount(serviceName)
					}
					end <- 1
				}()
			case <-end:
				break Loop
			}

		}
	}()
	//	log.Println("finish!")
}

func (c *Client) RemoveTimeoutTask(msgId string) {
	log.Println("sorry timeout!")
	resp := newResp(msgId, 1001, errMsgMap[1001], nil)
	go c.ProcessFunc(&resp)
}

func (c *Client) Send404(msgId string) {
	log.Println("sorry not found !")
	resp := newResp(msgId, 1000, errMsgMap[1000], nil)
	go c.ProcessFunc(&resp)
}

func (c *Client) Listen() {

	key := ConsumerMsgQueen(c.id)

	for {
		if !c.isListening {
			break;
		}
		msg := c.redisClient.popConn.BLPop(2 * time.Second, key).Val()
		if len(msg)!=0 {
			go c.UnpackMsg(msg[1])
		}

	}
}

func (c *Client) UnpackMsg(msg string) {

	mySlice := []byte(msg)

	resp, err := unPackRespByte(mySlice)
	if err != nil {
		log.Printf("err: %v\n", err)
	}

	go c.ProcessFunc(resp)
}

func (c *Client) ProcessFunc(resp *Resp) {

	if fn, ok := c.HandleTasks[resp.MsgId]; ok {
		(*fn.HandlerFunc)(resp.RespInfo)
		fn.done <- true
		delete(c.HandleTasks, resp.MsgId)
	} else {
		log.Println("fn Not Found")
	}

	c.mutex.Lock()
	defer c.mutex.Unlock()
	if len(c.HandleTasks)==0 {
		c.isListening = false
	}
}

//monitor

func (c *Client) IncServiceCount(serviceName string) {
	key := ServiceCallCount(serviceName)
	c.redisClient.pushConn.Incr(key)
}

func (c *Client) IncRequestTimeoutCount(serviceName string) {
	key := RequestTimeoutCount(serviceName)
	c.redisClient.pushConn.Incr(key)
}

func (c *Client) IncServiceNotFoundCount(serviceName string) {
	key := ServiceNotFoundCount(serviceName)
	c.redisClient.pushConn.Incr(key)
}


text:
    SECTION("has NAME disengaged") {                 \
        REQUIRE(!OBJECT.NAME());                     \
    }                                                \
                                                     \
    SECTION("has a method to set the NAME") {        \
        OBJECT.NAME(VALUE);                          \
        REQUIRE(OBJECT.NAME().value() == VALUE);     \
    }

#define CHECK_OPTIONAL_ARGUMENT_WITHOUT_EQUALITY(OBJECT, NAME, VALUE) \
    SECTION("has NAME disengaged") {                                  \
        REQUIRE(!OBJECT.NAME());                                      \
    }                                                                 \
                                                                      \
    SECTION("has a method to set the upsert") {                       \
        OBJECT.NAME(VALUE);                                           \
        REQUIRE(OBJECT.NAME());                                       \
    }

#define MOCK_POOL_NOSSL                                                                        \
    auto client_pool_new = libmongoc::client_pool_new.create_instance();                       \
    client_pool_new->interpose([](const mongoc_uri_t*) { return nullptr; }).forever();         \
    auto client_pool_destroy = libmongoc::client_pool_destroy.create_instance();               \
    client_pool_destroy->interpose([&](::mongoc_client_pool_t*) {}).forever();                 \
    auto client_pool_pop = libmongoc::client_pool_pop.create_instance();                       \
    client_pool_pop->interpose([](::mongoc_client_pool_t*) { return nullptr; }).forever();     \
    auto client_pool_push = libmongoc::client_pool_push.create_instance();                     \
    client_pool_push->interpose([](::mongoc_client_pool_t*, ::mongoc_client_t*) {}).forever(); \
    auto client_pool_try_pop = libmongoc::client_pool_try_pop.create_instance();               \
    client_pool_try_pop->interpose([](::mongoc_client_pool_t*) { return nullptr; }).forever();

#if defined(MONGOC_HAVE_SSL)
#define MOCK_POOL                                                                          \
    MOCK_POOL_NOSSL                                                                        \
    auto client_pool_set_ssl_opts = libmongoc::client_pool_set_ssl_opts.create_instance(); \
    client_pool_set_ssl_opts->interpose([](::mongoc_client_pool_t*, const ::mongoc_ssl_opt_t*) {});
#else
#define MOCK_POOL MOCK_POOL_NOSSL
#endif

#define MOCK_CLIENT                                                                             \
    auto client_new = libmongoc::client_new_from_uri.create_instance();                         \
    client_new->interpose([](const mongoc_uri_t*) { return nullptr; }).forever();               \
    auto client_destroy = libmongoc::client_destroy.create_instance();                          \
    client_destroy->interpose([](mongoc_client_t*) {}).forever();                               \
    auto client_set_read_concern = libmongoc::client_set_read_concern.create_instance();        \
    auto client_set_preference = libmongoc::client_set_read_prefs.create_instance();            \
    client_set_preference->interpose([](mongoc_client_t*, const mongoc_read_prefs_t*) {})       \
        .forever();                                                                             \
    auto client_get_preference = libmongoc::client_get_read_prefs.create_instance();            \
    client_get_preference->interpose([](const mongoc_client_t*) { return nullptr; }).forever(); \
    auto client_set_concern = libmongoc::client_set_write_concern.create_instance();            \
    client_set_concern->interpose([](mongoc_client_t*, const mongoc_write_concern_t*) {})       \
        .forever();                                                                             \
    auto client_get_concern = libmongoc::client_get_write_concern.create_instance();            \
    client_get_concern->interpose([](const mongoc_client_t*) { return nullptr; }).forever();

#define MOCK_DATABASE                                                                            \
    auto get_database = libmongoc::client_get_database.create_instance();                        \
    get_database->interpose([&](mongoc_client_t*, const char*) { return nullptr; });             \
    auto database_set_read_concern = libmongoc::database_set_read_concern.create_instance();     \
    auto database_set_preference = libmongoc::database_set_read_prefs.create_instance();         \
    database_set_preference->interpose([](mongoc_database_t*, const mongoc_read_prefs_t*) {})    \
        .forever();                                                                              \
    auto database_get_preference = libmongoc::database_get_read_prefs.create_instance();         \
    database_get_preference->interpose([](const mongoc_database_t*) { return nullptr; })         \
        .forever();                                                                              \
    auto database_set_concern = libmongoc::database_set_write_concern.create_instance();         \
    database_set_concern->interpose([](mongoc_database_t*, const mongoc_write_concern_t*) {})    \
        .forever();                                                                              \
    auto database_get_concern = libmongoc::database_get_write_concern.create_instance();         \
    database_get_concern->interpose([](const mongoc_database_t*) { return nullptr; }).forever(); \
    auto database_destroy = libmongoc::database_destroy.create_instance();                       \
    database_destroy->interpose([](mongoc_database_t*) {}).forever();                            \
    auto database_drop = libmongoc::database_drop.create_instance();                             \
    database_drop->interpose([](mongoc_database_t*, bson_error_t*) { return true; }).forever();  \
    auto database_get_collection = libmongoc::database_get_collection.create_instance();         \
    database_get_collection->interpose([](mongoc_database_t*, const char*) { return nullptr; })  \
        .forever();                                                                              \
    auto database_has_collection = libmongoc::database_has_collection.create_instance();         \
    auto database_command = libmongoc::database_command.create_instance();                       \
    auto database_command_simple = libmongoc::database_command_simple.create_instance();         \
    database_command_simple->interpose([](mongoc_database_t*, const bson_t*,                     \
                                          const mongoc_read_prefs_t*, bson_t*,                   \
                                          bson_error_t*) { return true; }).forever();

#define MOCK_COLLECTION                                                                           \
    auto collection_set_preference = libmongoc::collection_set_read_prefs.create_instance();      \
    collection_set_preference->interpose([](mongoc_collection_t*, const mongoc_read_prefs_t*) {}) \
        .forever();                                                                               \
    auto collection_get_preference = libmongoc::collection_get_read_prefs.create_instance();      \
    collection_get_preference->interpose([](const mongoc_collection_t*) { return nullptr; })      \
        .forever();                                                                               \
    auto collection_set_read_concern = libmongoc::collection_set_read_concern.create_instance();  \
    auto collection_set_concern = libmongoc::collection_set_write_concern.create_instance();      \
    collection_set_concern->interpose([](mongoc_collection_t*, const mongoc_write_concern_t*) {}) \
        .forever();                                                                               \
    auto collection_destroy = libmongoc::collection_destroy.create_instance();                    \
    collection_destroy->interpose([](mongoc_collection_t*) {});                                   \
    auto collection_drop = libmongoc::collection_drop.create_instance();                          \
    auto collection_count = libmongoc::collection_count.create_instance();                        \
    auto collection_count_with_opts = libmongoc::collection_count_with_opts.create_instance();    \
    auto collection_create_index = libmongoc::collection_create_index.create_instance();          \
    auto collection_find = libmongoc::collection_find.create_instance();                          \
    auto collection_aggregate = libmongoc::collection_aggregate.create_instance();                \
    auto collection_get_name = libmongoc::collection_get_name.create_instance();                  \
    collection_get_name->interpose([](mongoc_collection_t*) { return "dummy_collection"; });      \
    auto collection_rename = libmongoc::collection_rename.create_instance();                      \
    auto collection_find_and_modify_with_opts =                                                   \
        libmongoc::collection_find_and_modify_with_opts.create_instance();

#define MOCK_FAM                                                                                \
    auto find_and_modify_opts_destroy = libmongoc::find_and_modify_opts_destroy.create_instance(); \
    find_and_modify_opts_destroy->interpose([](mongoc_find_and_modify_opts_t*) {}).forever();      \
    auto find_and_modify_opts_new = libmongoc::find_and_modify_opts_new.create_instance();         \
    find_and_modify_opts_new->interpose([]() { return nullptr; }).forever();                       \
    bool expected_find_and_modify_opts_bypass_document_validation;                                 \
    auto find_and_modify_opts_set_bypass_document_validation =                                     \
        libmongoc::find_and_modify_opts_set_bypass_document_validation.create_instance();          \
    find_and_modify_opts_set_bypass_document_validation->interpose(                                \
        [&expected_find_and_modify_opts_bypass_document_validation](                               \
            mongoc_find_and_modify_opts_t*, bool bypass_document_validation) {                     \
        REQUIRE(bypass_document_validation ==                                                      \
                expected_find_and_modify_opts_bypass_document_validation);                         \
        return true;                                                                               \
        });                                                                                \
    bsoncxx::document::view expected_find_and_modify_opts_fields;                                  \
    auto find_and_modify_opts_set_fields =                                                         \
        libmongoc::find_and_modify_opts_set_fields.create_instance();                              \
    find_and_modify_opts_set_fields->interpose([&expected_find_and_modify_opts_fields](            \
        mongoc_find_and_modify_opts_t*, const ::bson_t* fields) {                                  \
        auto fields_view = bsoncxx::helpers::view_from_bson_t(fields);                             \
        REQUIRE(fields_view == expected_find_and_modify_opts_fields);                              \
        return true;                                                                               \
    });                                                                                \
    ::mongoc_find_and_modify_flags_t expected_find_and_modify_opts_flags;                          \
    auto find_and_modify_opts_set_flags =                                                          \
        libmongoc::find_and_modify_opts_set_flags.create_instance();                               \
    find_and_modify_opts_set_flags->interpose([&expected_find_and_modify_opts_flags](              \
        mongoc_find_and_modify_opts_t*, const ::mongoc_find_and_modify_flags_t flags) {            \
        REQUIRE(flags == expected_find_and_modify_opts_flags);                                     \
        return true;                                                                               \
    });                                                                                \
    bsoncxx::document::view expected_find_and_modify_opts_sort;                                    \
    auto find_and_modify_opts_set_sort =                                                           \
        libmongoc::find_and_modify_opts_set_sort.create_instance();                                \
    find_and_modify_opts_set_sort->interpose([&expected_find_and_modify_opts_sort](                \
        mongoc_find_and_modify_opts_t*, const ::bson_t* sort) {                                    \
        auto sort_view = bsoncxx::helpers::view_from_bson_t(sort);                                 \
        REQUIRE(sort_view == expected_find_and_modify_opts_sort);                                  \
        return true;                                                                               \
    });                                                                                \
    bsoncxx::document::view expected_find_and_modify_opts_update;                                  \
    auto find_and_modify_opts_set_update =                                                         \
        libmongoc::find_and_modify_opts_set_update.create_instance();                              \
    find_and_modify_opts_set_update->interpose([&expected_find_and_modify_opts_update](            \
        mongoc_find_and_modify_opts_t*, const ::bson_t* update) {                                  \
        auto update_view = bsoncxx::helpers::view_from_bson_t(update);                             \
        REQUIRE(update_view == expected_find_and_modify_opts_update);                              \
        return true;                                                                               \
    });

#define MOCK_CURSOR                                                    \
    auto cursor_destroy = libmongoc::cursor_destroy.create_instance(); \
    cursor_destroy->interpose([&](mongoc_cursor_t*) {});

#define MOCK_BULK                                                                                \
    auto bulk_operation_new = libmongoc::bulk_operation_new.create_instance();                   \
    auto bulk_operation_insert = libmongoc::bulk_operation_insert.create_instance();             \
    auto bulk_operation_remove_one = libmongoc::bulk_operation_remove_one.create_instance();     \
    auto bulk_operation_update_one = libmongoc::bulk_operation_update_one.create_instance();     \
    auto bulk_operation_replace_one = libmongoc::bulk_operation_replace_one.create_instance();   \
    auto bulk_operation_update = libmongoc::bulk_operation_update.create_instance();             \
    auto bulk_operation_remove = libmongoc::bulk_operation_remove.create_instance();             \
    auto bulk_operation_set_bypass_document_validation =                                         \
        libmongoc::bulk_operation_set_bypass_document_validation.create_instance();              \
    auto bulk_operation_set_client = libmongoc::bulk_operation_set_client.create_instance();     \
    auto bulk_operation_set_database = libmongoc::bulk_operation_set_database.create_instance(); \
    auto bulk_operation_set_collection =                                                         \
        libmongoc::bulk_operation_set_collection.create_instance();                              \
    auto bulk_operation_set_write_concern =                                                      \
        libmongoc::bulk_operation_set_write_concern.create_instance();                           \
    auto bulk_operation_execute = libmongoc::bulk_operation_execute.create_instance();           \
    auto bulk_operation_destroy = libmongoc::bulk_operation_destroy.create_instance();           \
    bool bulk_operation_new_called = false;                                                      \
    bool bulk_operation_op_called = false;                                                       \
    bool bulk_operation_set_bypass_document_validation_called = false;                           \
    bool bulk_operation_set_client_called = false;                                               \
    bool bulk_operation_set_database_called = false;                                             \
    bool bulk_operation_set_collection_called = false;                                           \
    bool bulk_operation_set_write_concern_called = false;                                        \
    bool bulk_operation_execute_called = false;                                                  \
    bool bulk_operation_destroy_called = false;

#define MOCK_CONCERN                                                     \
    auto concern_copy = libmongoc::write_concern_copy.create_instance(); \
    concern_copy->interpose([](const mongoc_write_concern_t*) { return nullptr; }).forever();

redpajama_set_name: RedPajamaGithub


text:
<?php

class CakeDjjobAppController extends AppController {
}


text:
"use strict";

const propertySets = {};

propertySets.acceptCustomIdents = new Set([
  "animation",
  "animation-name",
  "font",
  "font-family",
  "counter-increment",
  "grid-row",
  "grid-column",
  "grid-area",
  "list-style",
  "list-style-type"
]);

module.exports = propertySets;


text:
package com.phloc.commons.format.impl;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.phloc.commons.format.IFormatter;

/**
 * A formatter that adds a prefix to a string.
 *
 * @author Philip Helger
 */
public class StringPrefixFormatter extends StringPrefixAndSuffixFormatter
{
  public StringPrefixFormatter (@Nonnull final String sPrefix)
  {
    super (sPrefix, "");
  }

  /**
   * @deprecated Use {@link #StringPrefixFormatter(IFormatter,String)} instead
   */
  @Deprecated
  public StringPrefixFormatter (@Nonnull final String sPrefix, @Nullable final IFormatter aNestedFormatter)
  {
    this (aNestedFormatter, sPrefix);
  }

  public StringPrefixFormatter (@Nullable final IFormatter aNestedFormatter, @Nonnull final String sPrefix)
  {
    super (aNestedFormatter, sPrefix, "");
  }
}


text:
import React from 'react'
import Drawer from 'material-ui/Drawer';
import MenuItem from 'material-ui/MenuItem';
import Layout from './Layout';
import ListPrices from './ListPrices';
import AppBar from 'material-ui/AppBar';

import {
  BrowserRouter as Router,
  Route,
  Link
} from 'react-router-dom'

class AppRouter extends React.Component {

  constructor(props) {
    super(props);
    this.state = {open: false};
  }

  handleToggle = () => this.setState({open: !this.state.open});

  handleClose = () => this.setState({open: false});

  render() {
    return (
      <Router>
        <div>

          <AppBar
            title="Register Price"
            onTouchTap={this.handleToggle}
            iconClassNameRight="muidocs-icon-navigation-expand-more"
          />

          <Drawer
            docked={false}
            width={200}
            open={this.state.open}
            onRequestChange={(open) => this.setState({open})}
          >
            <MenuItem onTouchTap={this.handleClose}><Link to="/">Register</Link></MenuItem>
            <MenuItem onTouchTap={this.handleClose}><Link to="/list">List</Link></MenuItem>
          </Drawer>

          <Route exact path="/" component={Layout}/>
          <Route exact path="/list" component={ListPrices}/>
        </div>
      </Router>
    );
  }
}

export default AppRouter;


text:
Param (
    [switch] $uninstall=$false
)

# Import configuration.
. .\setup_common.ps1

Function TestMachineStatus($role)
{
    try
    {
        $status = Invoke-Command -ComputerName $role.MachineName -ArgumentList $role.Name -ErrorAction Stop { [Environment]::GetEnvironmentVariable($args[0], "Machine") }

        $role.Reachable = $true
        if ($status -eq "Installed")
        {
            $role.Installed = $true
        }
        else
        {
            if (-not [string]::IsNullOrWhiteSpace($status))
            {
                Write-Warning "Role $($role.Name) found to have status of: $status."
                Write-Warning "The script will try to resume the installation. To manually resume installation, manually run the $($role.Script) on $($role.MachineName) as Administrator."
            }
        }
    }
    catch [System.Exception]
    {
        $role.Reachable = $false
    }
}

Function CheckRoles
{
    Write-Host "Verifying server applications:"
    $iisApplications = GetIISCodePath
    if (-not (Test-Path (Join-Path $iisApplications "index.html")))
    {
        throw "Cannot find index.html within the $iisApplications path. Make sure that you have built and copied the Server code before running this script."
    }

    Write-Host "Verifying roles:"
    foreach ($role in ($script:Roles + $script:PreRebootRoles))
    {
        Write-Host -ForegroundColor DarkGray "`t" $role.Name
        if (-not (Test-Path $role.Script))
        {
            throw "Cannot find installation script for $($role.Name): $($role.Script)"
        }

        if ([string]::IsNullOrWhiteSpace($role.MachineName))
        {
            throw "Please edit config.ps1 and set a valid value name for $($role.Name)_Machine."
        }

        TestMachineStatus $role
    }

    Write-Host "OK."
}

Function EnsurePreRebootForCurrentMachine
{
    $machineInfo = Get-WmiObject win32_computersystem
    $currentRole = GetPreRebootRoleForMachine($Env:COMPUTERNAME)

    if (($machineInfo.PartOfDomain -eq $true) -and `
        ($machineInfo.Domain -eq $script:domainName) -and `
        ($currentRole.Installed -eq $true))
    {
        return $true
    }
    elseif (($machineInfo.PartOfDomain -eq $true) -and `
            ($machineInfo.Domain -ne $script:domainName))
    {
        Write-Error "The current machine is already joiend to the $($machineInfo.Domain) domain."
        Write-Error "Either change config.ps1 to use the correct domain information, select a different machine or remove the machine from the current domain."
        throw "Cannot use the current machine: already joined to a domain."
    }

    & (".\" + $currentRole.Script)
}

Function CreateDestinationPath($s)
{
    return Invoke-Command -Session $s `
    {
        $destPath = Join-Path $env:SystemDrive "COREFX_NET_Scripts"
        mkdir $destPath -ErrorAction SilentlyContinue | Out-Null
        return $destPath
    }
}

Function CopyScripts($s, $remotePath)
{
    Copy-Item -Recurse -Force -Path ".\*" -Destination $remotePath -ToSession $s -ErrorAction Stop
}

Function InstallRoles
{
    Write-Host -ForegroundColor Cyan "Remotely installing all roles."

    foreach ($role in $script:Roles)
    {
        Write-Host -ForegroundColor DarkCyan "Installing role [$($role.Name)]: $($role.MachineName)"

        Write-Host -ForegroundColor DarkGray "`tConnecting"
        $s = New-PSSession -ComputerName $role.MachineName

        Write-Host -ForegroundColor DarkGray "`tCopying scripts"
        # Copy scripts
        $remotePath = CreateDestinationPath $s
        CopyScripts $s $remotePath

        Write-Host -ForegroundColor DarkGray "`tInstalling"
        # Run remote scripts
        Invoke-Command -Session $s -ArgumentList $remotePath, $role.Script `
        {
            $path = $args[0]
            $script = $args[1]

            cd $path
            & (".\" + $script)
        }

        Write-Host -ForegroundColor DarkCyan "Role [$($role.Name)]: $($role.MachineName) installation complete."
        Write-Host
        Write-Host
    }
}

Function Install
{
    Write-Host -ForegroundColor Cyan "Install/Update CoreFX Networking multi-machine prerequisites"
    Write-Host
    CheckRoles

    EnsurePreRebootForCurrentMachine

    if (($script:Roles | where {$_.Reachable -ne $true}).Count -ne 0)
    {
        Write-Warning "Not all roles are reachable from this host."
        Write-Host "Log-on to the following machines, copy all scripts and run .\setup.ps1 as Administrator:"
        $script:Roles | where {$_.Reachable -ne $true}
        Write-Host -ForegroundColor Cyan "Rerun this command after all machines have been started and joined to the $($script:domainNetBios) domain."
        return
    }

    InstallRoles

    Write-Host -ForegroundColor Cyan "Role installation complete."
}

Function UnistallMachines
{
    Write-Host -ForegroundColor Cyan "Remotely uninstalling roles."

    foreach ($role in $script:Roles)
    {
        Write-Host -ForegroundColor DarkCyan "Uninstalling role [$($role.Name)]: $($role.MachineName)"

        Write-Host -ForegroundColor DarkGray "`tConnecting"
        $s = New-PSSession -ComputerName $role.MachineName

        Write-Host -ForegroundColor DarkGray "`tCopying scripts"
        # Copy scripts
        $remotePath = CreateDestinationPath $s
        CopyScripts $s $remotePath

        $preRebootRole = GetPreRebootRoleForMachine $role.MachineName

        Write-Host -ForegroundColor DarkGray "`tUninstalling"
        # Run remote scripts
        Invoke-Command -Session $s -ArgumentList $remotePath, $role.Script, $preRebootRole.Script `
        {
            $path = $args[0]
            $script = $args[1]
            $preRebootScript = $args[2]

            cd $path
            & (".\" + $script) -uninstall
            & (".\" + $preRebootScript) -uninstall
        }

        Write-Host -ForegroundColor DarkCyan "Role [$($role.Name)]: $($role.MachineName) uninstall complete."
        Write-Host
        Write-Host
    }
}

Function Uninstall
{
    Write-Host -ForegroundColor Cyan "Uninstall CoreFX Networking multi-machine prerequisites"
    Write-Host
    CheckRoles
    Write-Host

    Write-Warning "Some of the installed components may have existed before or got changes outside of this setup script."
    Write-Warning "The scripts will attempt to remove all components regardless of these changes."
    $continue = Read-Host "Do you want to continue? [Y/N]"

    if ($continue.ToUpper() -ne "Y")
    {
        Write-Warning "Aborted by user."
        return
    }

    UnistallMachines
}

if ($uninstall)
{
    Uninstall
}
else
{
    Install
}


text:
package io.reflectoring.jiraalerts.device;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;

import io.reflectoring.jiraalerts.device.Device;
import io.reflectoring.jiraalerts.device.DeviceRepository;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;

import com.github.springtestdbunit.annotation.DatabaseSetup;

import io.reflectoring.jiraalerts.testsetup.AbstractDbUnitTest;

@DatabaseSetup("DeviceRepositoryTest.xml")
public class DeviceRepositoryTest extends AbstractDbUnitTest {

	private static final long USER_ID_1 = 1;
	private static final long USER_ID_2 = 2;

	@Autowired
	private DeviceRepository testSubject;

	@Test
	public void findByOwnerFindsFourDevicesForUserOne() throws Exception {
		List<Device> devices = testSubject.findByOwner(USER_ID_1, PageRequest.of(0, 10, Sort.DEFAULT_DIRECTION, "id"));
		assertThat(devices).hasSize(4);
	}

	@Test
	public void findByOwnerFindsTwoDevicesForUserTwo() throws Exception {
		List<Device> devices = testSubject.findByOwner(USER_ID_2, PageRequest.of(0, 10, Sort.DEFAULT_DIRECTION, "id"));
		assertThat(devices).hasSize(2);
	}

	@Test
	public void countByOwnerReturnsFourForUserOne() throws Exception {
		assertThat(testSubject.countByOwner(USER_ID_1)).isEqualTo(4);
	}

	@Test
	public void countByOwnerReturnsTwoForUserTwo() throws Exception {
		assertThat(testSubject.countByOwner(USER_ID_2)).isEqualTo(2);
	}

}


text:
require 'current_user'
require_dependency 'canonical_url'
require_dependency 'discourse'
require_dependency 'custom_renderer'
require_dependency 'archetype'
require_dependency 'rate_limiter'

class ApplicationController < ActionController::Base
  include CurrentUser
  include CanonicalURL::ControllerExtensions

  serialization_scope :guardian

  protect_from_forgery

  # Default Rails 3.2 lets the request through with a blank session
  #  we are being more pedantic here and nulling session / current_user
  #  and then raising a CSRF exception
  def handle_unverified_request
    # NOTE: API key is secret, having it invalidates the need for a CSRF token
    unless is_api?
      super
      clear_current_user
      render text: "['BAD CSRF']", status: 403
    end
  end

  before_filter :set_locale
  before_filter :set_mobile_view
  before_filter :inject_preview_style
  before_filter :disable_customization
  before_filter :block_if_maintenance_mode
  before_filter :authorize_mini_profiler
  before_filter :store_incoming_links
  before_filter :preload_json
  before_filter :check_xhr
  before_filter :redirect_to_login_if_required

  rescue_from Exception do |exception|
    unless [ActiveRecord::RecordNotFound,
            ActionController::RoutingError,
            ActionController::UnknownController,
            AbstractController::ActionNotFound].include? exception.class
      begin
        ErrorLog.report_async!(exception, self, request, current_user)
      rescue
        # dont care give up
      end
    end
    raise
  end

  # Some exceptions
  class RenderEmpty < Exception; end

  # Render nothing unless we are an xhr request
  rescue_from RenderEmpty do
    render 'default/empty'
  end

  # If they hit the rate limiter
  rescue_from RateLimiter::LimitExceeded do |e|

    time_left = ""
    if e.available_in < 1.minute.to_i
      time_left = I18n.t("rate_limiter.seconds", count: e.available_in)
    elsif e.available_in < 1.hour.to_i
      time_left = I18n.t("rate_limiter.minutes", count: (e.available_in / 1.minute.to_i))
    else
      time_left = I18n.t("rate_limiter.hours", count: (e.available_in / 1.hour.to_i))
    end

    render json: {errors: [I18n.t("rate_limiter.too_many_requests", time_left: time_left)]}, status: 429
  end

  rescue_from Discourse::NotLoggedIn do |e|
    raise e if Rails.env.test?
    redirect_to "/"
  end

  rescue_from Discourse::NotFound do
    rescue_discourse_actions("[error: 'not found']", 404)
  end

  rescue_from Discourse::InvalidAccess do
    rescue_discourse_actions("[error: 'invalid access']", 403)
  end

  def rescue_discourse_actions(message, error)
    if request.format && request.format.json?
      render status: error, layout: false, text: (error == 404) ? build_not_found_page(error) : message
    else
      render text: build_not_found_page(error, 'no_js')
    end
  end

  def set_locale
    I18n.locale = SiteSetting.default_locale
  end

  def store_preloaded(key, json)
    @preloaded ||= {}
    # I dislike that there is a gsub as opposed to a gsub!
    #  but we can not be mucking with user input, I wonder if there is a way
    #  to inject this safty deeper in the library or even in AM serializer
    @preloaded[key] = json.gsub("</", "<\\/")
  end

  # If we are rendering HTML, preload the session data
  def preload_json
    # We don't preload JSON on xhr or JSON request
    return if request.xhr?

    preload_anonymous_data

    if current_user
      preload_current_user_data
      current_user.sync_notification_channel_position
    end
  end

  def set_mobile_view
    session[:mobile_view] = params[:mobile_view] if params.has_key?(:mobile_view)
  end

  def inject_preview_style
    style = request['preview-style']
    session[:preview_style] = style if style
  end

  def disable_customization
    session[:disable_customization] = params[:customization] == "0" if params.has_key?(:customization)
  end

  def guardian
    @guardian ||= Guardian.new(current_user)
  end

  def serialize_data(obj, serializer, opts={})
    # If it's an array, apply the serializer as an each_serializer to the elements
    serializer_opts = {scope: guardian}.merge!(opts)
    if obj.is_a?(Array) or obj.is_a?(ActiveRecord::Associations::CollectionProxy)
      serializer_opts[:each_serializer] = serializer
      ActiveModel::ArraySerializer.new(obj, serializer_opts).as_json
    else
      serializer.new(obj, serializer_opts).as_json
    end
  end

  # This is odd, but it seems that in Rails `render json: obj` is about
  # 20% slower than calling MultiJSON.dump ourselves. I'm not sure why
  # Rails doesn't call MultiJson.dump when you pass it json: obj but
  # it seems we don't need whatever Rails is doing.
  def render_serialized(obj, serializer, opts={})
    render_json_dump(serialize_data(obj, serializer, opts))
  end

  def render_json_dump(obj)
    render json: MultiJson.dump(obj)
  end

  def can_cache_content?
    !current_user.present?
  end

  # Our custom cache method
  def discourse_expires_in(time_length)
    return unless can_cache_content?
    Middleware::AnonymousCache.anon_cache(request.env, time_length)
  end

  def fetch_user_from_params
    username_lower = params[:username].downcase
    username_lower.gsub!(/\.json$/, '')

    user = User.where(username_lower: username_lower).first
    raise Discourse::NotFound.new if user.blank?

    guardian.ensure_can_see!(user)
    user
  end

  def post_ids_including_replies
    post_ids = params[:post_ids].map {|p| p.to_i}
    if params[:reply_post_ids]
      post_ids << PostReply.where(post_id: params[:reply_post_ids].map {|p| p.to_i}).pluck(:reply_id)
      post_ids.flatten!
      post_ids.uniq!
    end
    post_ids
  end

  private

    def preload_anonymous_data
      store_preloaded("site", Site.cached_json(guardian))
      store_preloaded("siteSettings", SiteSetting.client_settings_json)
      store_preloaded("customHTML", custom_html_json)
    end

    def preload_current_user_data
      store_preloaded("currentUser", MultiJson.dump(CurrentUserSerializer.new(current_user, scope: guardian, root: false)))
      serializer = ActiveModel::ArraySerializer.new(TopicTrackingState.report([current_user.id]), each_serializer: TopicTrackingStateSerializer)
      store_preloaded("topicTrackingStates", MultiJson.dump(serializer))
    end

    def custom_html_json
      MultiJson.dump({
        top: SiteContent.content_for(:top),
        bottom: SiteContent.content_for(:bottom),
      })
    end

    def render_json_error(obj)
      if obj.present?
        render json: MultiJson.dump(errors: obj.errors.full_messages), status: 422
      else
        render json: MultiJson.dump(errors: [I18n.t('js.generic_error')]), status: 422
      end
    end

    def success_json
      {success: 'OK'}
    end

    def failed_json
      {failed: 'FAILED'}
    end

    def json_result(obj, opts={})
      if yield(obj)

        json = success_json

        # If we were given a serializer, add the class to the json that comes back
        if opts[:serializer].present?
          json[obj.class.name.underscore] = opts[:serializer].new(obj, scope: guardian).serializable_hash
        end

        render json: MultiJson.dump(json)
      else
        render_json_error(obj)
      end
    end

    def block_if_maintenance_mode
      if Discourse.maintenance_mode?
        if request.format.json?
          render status: 503, json: failed_json.merge(message: I18n.t('site_under_maintenance'))
        else
          render status: 503, file: File.join( Rails.root, 'public', '503.html' ), layout: false
        end
      end
    end

    def mini_profiler_enabled?
      defined?(Rack::MiniProfiler) && current_user.try(:admin?)
    end

    def authorize_mini_profiler
      return unless mini_profiler_enabled?
      Rack::MiniProfiler.authorize_request
    end

    def store_incoming_links
      IncomingLink.add(request,current_user) unless request.xhr?
    end

    def check_xhr
      # bypass xhr check on PUT / POST / DELETE provided api key is there, otherwise calling api is annoying
      return if !request.get? && api_key_valid?
      raise RenderEmpty.new unless ((request.format && request.format.json?) || request.xhr?)
    end

    def ensure_logged_in
      raise Discourse::NotLoggedIn.new unless current_user.present?
    end

    def redirect_to_login_if_required
      redirect_to :login if SiteSetting.login_required? && !current_user
    end

    def build_not_found_page(status=404, layout=false)
      @top_viewed = Topic.top_viewed(10)
      @recent = Topic.recent(10)
      @slug =  params[:slug].class == String ? params[:slug] : ''
      @slug =  (params[:id].class == String ? params[:id] : '') if @slug.blank?
      @slug.gsub!('-',' ')
      render_to_string status: status, layout: layout, formats: [:html], template: '/exceptions/not_found'
    end

  protected

    def api_key_valid?
      request["api_key"] && ApiKey.where(key: request["api_key"]).exists?
    end

    # returns an array of integers given a param key
    # returns nil if key is not found
    def param_to_integer_list(key, delimiter = ',')
      if params[key]
        params[key].split(delimiter).map(&:to_i)
      end
    end

end


text:
import java.nio.ByteBuffer

import akka.NotUsed
import akka.stream.scaladsl.Source
import akka.stream.stage.{GraphStage, GraphStageLogic, OutHandler}
import akka.stream.{Attributes, Outlet, SourceShape}
import akka.util.ByteString
import org.mongodb.scala.gridfs.GridFSDownloadStream

import scala.concurrent.{ExecutionContext, Future}

/**
  * Created by zhijun on 2017/6/15 0015.
  * Wrap GridFSDownloadStream to Akka-Stream Source[ByteString, NotUsed]
  *
  * @param GridFSDownload stream provided by Mongo Scala Driver
  * @param chunkSize   Chunk size to read at a time
  */

case class GridfsSource(stream: GridFSDownloadStream, chunkSize: Int)(implicit ec: ExecutionContext) extends GraphStage[SourceShape[Future[ByteBuffer]]] {
  val out: Outlet[Future[ByteBuffer]] = Outlet("File Stream")

  override def shape: SourceShape[Future[ByteBuffer]] = SourceShape(out)

  override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) {
    setHandler(out, new OutHandler {
      override def onPull(): Unit = {
        val buffer = ByteBuffer.allocate(chunkSize)
        val loaded = stream.read(buffer).toFuture().map(_ => buffer)
        push(out, loaded)
      }

      override def onDownstreamFinish(): Unit = {
        super.onDownstreamFinish()
        stream.close()
        complete(out)
      }
    })
  }
}

object GridfsSource {
  def apply(stream: GridFSDownloadStream)(implicit ec: ExecutionContext): Source[ByteString, NotUsed] = {
    Source.fromGraph(GridfsSource(stream, 512 * 1024)).mapAsync(1)(fb => fb.map { buffer => buffer.flip(); ByteString(buffer) }).takeWhile(_.nonEmpty)
  }
}


text:
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateCommentsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('comments', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('status_id')->index();
			$table->integer('user_id')->index();
			$table->text('body');
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('comments');
	}

}


text:
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
	<id>runic:Topic_Count_In_Profile</id>
	<version>2.1</version>

	<file name="$sourcedir/Load.php">
		<operation>
			<search position="after"><![CDATA[	if (!empty($new_loaded_ids) && $set !== 'minimal')]]></search>
			<add><![CDATA[	// if this is the user's profile screen, also grab the count of topics they've made
	if (!empty($new_loaded_ids) && $set == 'profile')
	{
		$request = $smcFunc['db_query']('', '
			SELECT id_member_started, COUNT( id_topic ) AS topics
			FROM {db_prefix}topics
			WHERE id_member_started' . (count($new_loaded_ids) == 1 ? ' = {int:loaded_ids}' : ' IN ({array_int:loaded_ids})') . '
			GROUP BY id_member_started',
			array(
				'loaded_ids' => count($new_loaded_ids) == 1 ? $new_loaded_ids[0] : $new_loaded_ids,
			)
		);
		while ($row = $smcFunc['db_fetch_assoc']($request))
			$user_profile[$row['id_member_started']]['topics'] = $row['topics'];
		$smcFunc['db_free_result']($request);

		$request = $smcFunc['db_query']('', '
			SELECT id_member, COUNT(DISTINCT id_topic) AS topic_count
			FROM {db_prefix}messages
			WHERE id_member' . (count($new_loaded_ids) == 1 ? ' = {int:loaded_ids}' : ' IN ({array_int:loaded_ids})') . '
			GROUP BY id_member',
			array(
				'loaded_ids' => count($new_loaded_ids) == 1 ? $new_loaded_ids[0] : $new_loaded_ids,
			)
		);
		while ($row = $smcFunc['db_fetch_assoc']($request))
			$user_profile[$row['id_member']]['topic_count'] = $row['topic_count'];
		$smcFunc['db_free_result']($request);
	}

]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA['real_posts' => $profile['posts'],]]></search>
			<add><![CDATA[
		'topics' => (isset($profile['topics']) ? comma_format($profile['topics']) : 0),
		'topic_count' => (isset($profile['topic_count']) ? comma_format($profile['topic_count']) : 0),]]></add>
		</operation>
	</file>
	<file name="$sourcedir/Who.php">
		<operation>
			<search position="replace" whitespace="loose"><![CDATA[		'mods' => array(]]></search>
			<add><![CDATA[		'mods' => array( $txt['tcip_copy'],]]></add>
		</operation>
	</file>
	<file name="$sourcedir/Profile-View.php">
		<operation>
			<search position="before"><![CDATA[	if (empty($user_profile[$memID]['date_registered']) || $days_registered < 1)
		$context['member']['posts_per_day'] = $txt['not_applicable'];
	else
		$context['member']['posts_per_day'] = comma_format($context['member']['real_posts'] / $days_registered, 3);
]]></search>
			<add><![CDATA[

	if (empty($user_profile[$memID]['date_registered']) || $days_registered < 1)
		$context['member']['topics_per_day'] = $txt['not_applicable'];
	else
		$context['member']['topics_per_day'] = comma_format($context['member']['topics'] / $days_registered, 3);

	$context['tcip_enabled'] = !empty($modSettings['tcip_enabled']);
	$context['tcip_show_topic_count'] = !empty($modSettings['tcip_show_topic_count']);
	$context['tcip_show_participated_count'] = !empty($modSettings['tcip_show_participated_count']);
]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[	// Posting activity by time.
	$result = $smcFunc['db_query']('user_activity_by_time', '
		SELECT
			HOUR(FROM_UNIXTIME(poster_time + {int:time_offset})) AS hour,
			COUNT(*) AS post_count
		FROM {db_prefix}messages
		WHERE id_member = {int:current_member}' . ($modSettings['totalMessages'] > 100000 ? '
			AND id_topic > {int:top_ten_thousand_topics}' : '') . '
		GROUP BY hour',
		array(
			'current_member' => $memID,
			'top_ten_thousand_topics' => $modSettings['totalTopics'] - 10000,
			'time_offset' => (($user_info['time_offset'] + $modSettings['time_offset']) * 3600),
		)
	);
	$maxPosts = 0;
	$context['posts_by_time'] = array();
	while ($row = $smcFunc['db_fetch_assoc']($result))
	{
		// Cast as an integer to remove the leading 0.
		$row['hour'] = (int) $row['hour'];

		if ($row['post_count'] > $maxPosts)
			$maxPosts = $row['post_count'];

		$context['posts_by_time'][$row['hour']] = array(
			'hour' => $row['hour'],
			'posts_percent' => $row['post_count']
		);
	}
	$smcFunc['db_free_result']($result);

	if ($maxPosts > 0)
		for ($hour = 0; $hour < 24; $hour++)
		{
			if (!isset($context['posts_by_time'][$hour]))
				$context['posts_by_time'][$hour] = array(
					'hour' => $hour,
					'posts_percent' => 0,
				);
			else
				$context['posts_by_time'][$hour]['posts_percent'] = round(($context['posts_by_time'][$hour]['posts_percent'] * 100) / $maxPosts);
		}

	// Put it in the right order.
	ksort($context['posts_by_time']);
]]></search>
			<add><![CDATA[

	// Posting [topic] activity by time.
	$result = $smcFunc['db_query']('user_activity_by_time', '
		SELECT
			HOUR(FROM_UNIXTIME(m.poster_time + {int:time_offset})) AS hour,
			COUNT(m.id_msg) AS post_count
		FROM {db_prefix}messages AS m, {db_prefix}topics AS t
		WHERE m.id_member = {int:current_member} AND m.id_msg = t.id_first_msg' . ($modSettings['totalMessages'] > 100000 ? '
			AND m.id_topic > {int:top_ten_thousand_topics}' : '') . '
		GROUP BY hour',
		array(
			'current_member' => $memID,
			'top_ten_thousand_topics' => $modSettings['totalTopics'] - 10000,
			'time_offset' => (($user_info['time_offset'] + $modSettings['time_offset']) * 3600),
		)
	);
	$maxPosts = 0;
	$context['topics_by_time'] = array();
	while ($row = $smcFunc['db_fetch_assoc']($result))
	{
		// Cast as an integer to remove the leading 0.
		$row['hour'] = (int) $row['hour'];

		if ($row['post_count'] > $maxPosts)
			$maxPosts = $row['post_count'];

		$context['topics_by_time'][$row['hour']] = array(
			'hour' => $row['hour'],
			'posts_percent' => $row['post_count']
		);
	}
	$smcFunc['db_free_result']($result);

	if ($maxPosts > 0)
		for ($hour = 0; $hour < 24; $hour++)
		{
			if (!isset($context['topics_by_time'][$hour]))
				$context['topics_by_time'][$hour] = array(
					'hour' => $hour,
					'posts_percent' => 0,
				);
			else
				$context['topics_by_time'][$hour]['posts_percent'] = round(($context['topics_by_time'][$hour]['posts_percent'] * 100) / $maxPosts);
		}

	// Put it in the right order.
	ksort($context['topics_by_time']);

]]></add>
		</operation>
	</file>

	<file name="$sourcedir/Admin.php">
		<operation>
			<search position="before"><![CDATA[
						// Mod Authors for a "ADD AFTER" on this line. Ensure you end your change with a comma. For example:]]></search>
			<add><![CDATA[
						'tcip' => array($txt['tcip_title']),]]></add>
		</operation>
	</file>

	<file name="$sourcedir/ManageSettings.php">
		<operation>
			<search position="before"><![CDATA[
		// Mod authors, once again, if you have a whole section to add do it AFTER this line, and keep a comma at the end.]]></search>
			<add><![CDATA[
		'tcip' => 'ModifytcipSettings',]]></add>
		</operation>
		<operation>
			<search position="end"></search>
			<add><![CDATA[
function ModifytcipSettings($return_config = false)
{
	global $txt, $scripturl, $context, $settings, $sc;

	$config_vars = array(
		array('check', 'tcip_enabled'),
		array('check', 'tcip_show_topic_count'),
		array('check', 'tcip_show_participated_count'),
	);

	if ($return_config)
		return $config_vars;

	if (isset($_GET['save']))
	{
		checkSession();

		saveDBSettings($config_vars);
		writeLog();

		redirectexit('action=admin;area=modsettings;sa=tcip');
	}

	$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=tcip';
	$context['settings_title'] = $txt['tcip_title'];

	prepareDBSettingContext($config_vars);
}
]]></add>
		</operation>
	</file>
	<file name="$themedir/Profile.template.php">
		<operation>
			<search position="before"><![CDATA[
', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')
';]]></search>
			<add><![CDATA[

	echo '
				', $context['tcip_enabled'] && $context['tcip_show_topic_count'] ? '
'. $txt['profile_topics_started']. ':

'. $context['member']['topics']. ' ('. $context['member']['topics_per_day']. ' '. $txt['posts_per_day']. ')

				' : '', $context['tcip_enabled'] && $context['tcip_show_participated_count'] ? '
'. $txt['profile_topics_participated']. ':

'. $context['member']['topic_count']. '
' : '', '';
]]></add>
		</operation>
		<operation>
			<search position="replace"><![CDATA[// Otherwise do!
	else
	{
		echo '

';

		// The labels.
		foreach ($context['posts_by_time'] as $time_of_day)
			echo '

', date('g a', mktime($time_of_day['hour'])), '

', !empty($time_of_day['posts_percent']) ? '

' . $time_of_day['posts_percent'] . '%' : '', '
';
		echo '

';]]></search>
			<add><![CDATA[

	// Otherwise do!
	else
	{
		echo '

', $txt['tcip_posts'] ,'

';

		// The labels.
		foreach ($context['posts_by_time'] as $time_of_day)
			echo '

', date('g a', mktime($time_of_day['hour'])), '

', !empty($time_of_day['posts_percent']) ? '

' . $time_of_day['posts_percent'] . '%' : '', '
';
		echo '

', $txt['tcip_topics'] ,'

';

		// The labels.
		foreach ($context['topics_by_time'] as $time_of_day)
			echo '

', date('g a', mktime($time_of_day['hour'])), '

', !empty($time_of_day['posts_percent']) ? '

' . $time_of_day['posts_percent'] . '%' : '', '
';
		echo '

';

]]></add>
		</operation>
	</file>
</modification>


text:
// Copyright Pololu Corporation.  For more information, see http://www.pololu.com/

/*! \file PololuBuzzer.h
 *
 * See the PololuBuzzer class reference for more information about this library.
 *
 * The main repository for this library is
 * https://github.com/pololu/pololu-buzzer-arduino, though copies of this
 * library also exist in other repositories.
 *
 * \class PololuBuzzer PololuBuzzer.h
 * \brief Play beeps and music with the buzzer.
 *
 * The PololuBuzzer library allows various sounds to be played through a buzzer,
 * from simple beeps to complex tunes.
 *
 * On the ATmega328P/168 boards, this library uses Timer 2 and pin 3 (PD3/OC2B).
 * On ATmega32U4 boards, this library uses Timer 4 and pin 6 (PD7/OC4D).  This
 * library will conflict will other libraries that use the same timer or pin.
 *
 * Note durations are timed using a timer overflow interrupt
 * (`TIMER2_OVF`/`TIMER4_OVF`), which will briefly interrupt execution of your
 * main program at the frequency of the sound being played. In most cases, the
 * interrupt-handling routine is very short (several microseconds). However,
 * when playing a sequence of notes in `PLAY_AUTOMATIC` mode (the default mode)
 * with the `play()` command, this interrupt takes much longer than normal
 * (perhaps several hundred microseconds) every time it starts a new note. It is
 * important to take this into account when writing timing-critical code.
 *
 * This library is fully compatible with the OrangutanBuzzer functions
 * in the [Pololu AVR C/C++ Library](http://www.pololu.com/docs/0J18)
 * and the [ZumoBuzzer library](https://github.com/pololu/zumo-shield),
 * so any sequences and melodies written for those libraries will also work
 * with the equivalent PololuBuzzer functions. */

#pragma once

#include <avr/pgmspace.h>

/*! \brief Specifies that the sequence of notes will play with no further action
 *  required by the user. */
#define PLAY_AUTOMATIC 0

/*! \brief Specified that the user will need to call `playCheck()` regularly. */
#define PLAY_CHECK     1

//                                             n
// Equal Tempered Scale is given by f  = f  * a
//                                   n    o
//
//  where f  is chosen as A above middle C (A4) at f  = 440 Hz
//         o                                        o
//  and a is given by the twelfth root of 2 (~1.059463094359)

/*! \anchor note_macros
 *
 * \name Note Macros
 * \a x specifies the octave of the note
 * @{
 */
#define NOTE_C(x)       ( 0 + (x)*12)
#define NOTE_C_SHARP(x) ( 1 + (x)*12)
#define NOTE_D_FLAT(x)  ( 1 + (x)*12)
#define NOTE_D(x)       ( 2 + (x)*12)
#define NOTE_D_SHARP(x) ( 3 + (x)*12)
#define NOTE_E_FLAT(x)  ( 3 + (x)*12)
#define NOTE_E(x)       ( 4 + (x)*12)
#define NOTE_F(x)       ( 5 + (x)*12)
#define NOTE_F_SHARP(x) ( 6 + (x)*12)
#define NOTE_G_FLAT(x)  ( 6 + (x)*12)
#define NOTE_G(x)       ( 7 + (x)*12)
#define NOTE_G_SHARP(x) ( 8 + (x)*12)
#define NOTE_A_FLAT(x)  ( 8 + (x)*12)
#define NOTE_A(x)       ( 9 + (x)*12)
#define NOTE_A_SHARP(x) (10 + (x)*12)
#define NOTE_B_FLAT(x)  (10 + (x)*12)
#define NOTE_B(x)       (11 + (x)*12)

/*! \brief silences buzzer for the note duration */
#define SILENT_NOTE   0xFF

/*! \brief frequency bit that indicates Hz/10

 * e.g. \a frequency = `(445 | DIV_BY_10)` gives a frequency of 44.5 Hz
 */
#define DIV_BY_10     (1 << 15)
/*! @} */

class PololuBuzzer
{
  public:

  /*! \brief Plays the specified frequency for the specified duration.
   *
   * \param freq     Frequency to play in Hz (or 0.1 Hz if the `DIV_BY_10` bit
   *                 is set).
   * \param duration Duration of the note in milliseconds.
   * \param volume   Volume of the note (0--15).
   *
   * The \a frequency argument must be between 40 Hz and 10 kHz. If the most
   * significant bit of \a frequency is set, the frequency played is the value
   * of the lower 15 bits of \a frequency in units of 0.1 Hz. Therefore, you can
   * play a frequency of 44.5 Hz by using a \a frequency of `(DIV_BY_10 | 445)`.
   * If the most significant bit of \a frequency is not set, the units for
   * frequency are Hz. The \a volume argument controls the buzzer volume, with
   * 15 being the loudest and 0 being the quietest. A \a volume of 15 supplies
   * the buzzer with a 50% duty cycle PWM at the specified \a frequency.
   * Lowering \a volume by one halves the duty cycle (so 14 gives a 25% duty
   * cycle, 13 gives a 12.5% duty cycle, etc). The volume control is somewhat
   * crude (especially on the ATmega328/168) and should be thought of as a bonus
   * feature.
   *
   * This function plays the note in the background while your program continues
   * to execute. If you call another buzzer function while the note is playing,
   * the new function call will overwrite the previous and take control of the
   * buzzer. If you want to string notes together, you should either use the
   * `play()` function or put an appropriate delay after you start a note
   * playing. You can use the `is_playing()` function to figure out when the
   * buzzer is through playing its note or melody.
   *
   * ### Example ###
   *
   * ~~~{.cpp}
   * PololuBuzzer buzzer;
   *
   * ...
   *
   * // play a 6 kHz note for 250 ms at a lower volume
   * buzzer.playFrequency(6000, 250, 12);
   *
   * // wait for buzzer to finish playing the note
   * while (buzzer.isPlaying());
   *
   * // play a 44.5 Hz note for 1 s at full volume
   * buzzer.playFrequency(DIV_BY_10 | 445, 1000, 15);
   * ~~~
   *
   * \warning \a frequency × \a duration / 1000 must be no greater than
   * 0xFFFF (65535). This means you can't use a duration of 65535 ms for
   * frequencies greater than 1 kHz. For example, the maximum duration you can
   * use for a frequency of 10 kHz is 6553 ms. If you use a duration longer than
   * this, you will produce an integer overflow that can result in unexpected
   * behavior.
   */
  static void playFrequency(unsigned int freq, unsigned int duration,
                unsigned char volume);

  /*! \brief Plays the specified note for the specified duration.
   *
   *  \param note     Note to play (see \ref note_macros "Note Macros").
   *  \param duration Duration of the note in milliseconds.
   *  \param volume   Volume of the note (0--15).
   *
   * The \a note argument is an enumeration for the notes of the equal tempered
   * scale (ETS). See \ref note_macros "Note Macros" for more information. The
   * \a volume argument controls the buzzer volume, with 15 being the loudest
   * and 0 being the quietest. A \a volume of 15 supplies the buzzer with a 50%
   * duty cycle PWM at the specified \a frequency. Lowering \a volume by one
   * halves the duty cycle (so 14 gives a 25% duty cycle, 13 gives a 12.5% duty
   * cycle, etc). The volume control is somewhat crude (especially on the
   * ATmega328/168) and should be thought of as a bonus feature.
   *
   * This function plays the note in the background while your program continues
   * to execute. If you call another buzzer function while the note is playing,
   * the new function call will overwrite the previous and take control of the
   * buzzer. If you want to string notes together, you should either use the
   * `play()` function or put an appropriate delay after you start a note
   * playing. You can use the `is_playing()` function to figure out when the
   * buzzer is through playing its note or melody.
   */
  static void playNote(unsigned char note, unsigned int duration,
          unsigned char volume);

  /*! \brief Plays the specified sequence of notes.
   *
   *  \param sequence Char array containing a sequence of notes to play.
   *
   * If the play mode is `PLAY_AUTOMATIC` (default), the sequence of notes will
   * play with no further action required by the user. If the play mode is
   * `PLAY_CHECK`, the user will need to call `playCheck()` in the main loop to
   * initiate the playing of each new note in the sequence. The play mode can be
   * changed while the sequence is playing. The sequence syntax is modeled after
   * the PLAY commands in GW-BASIC, with just a few differences.
   *
   * The notes are specified by the characters **C**, **D**, **E**, **F**,
   * **G**, **A**, and **B**, and they are played by default as "quarter notes"
   * with a length of 500 ms. This corresponds to a tempo of 120 beats/min.
   * Other durations can be specified by putting a number immediately after the
   * note. For example, C8 specifies C played as an eighth note, with half the
   * duration of a quarter note. The special note **R** plays a rest (no sound).
   * The sequence parser is case-insensitive and ignores spaces, which may be
   * used to format your music nicely.
   *
   * Various control characters alter the sound:
   *

   *
Control character(s)	Effect

   *
A--G
   *     Specifies a note that will be played.

   *
R
   *     Specifies a rest (no sound for the duration of the note).

   *
+ or # after a note
   *     Raises the preceding note one half-step.

   *
- after a note
   *     Lowers the preceding note one half-step.

   *
1--2000 after a note
   *     Determines the duration of the preceding note. For example, C16
   *         specifies C played as a sixteenth note (1/16th the length of a
   *         whole note).

   *
. after a note
   *     "Dots" the preceding note, increasing the length by 50%. Each
   *         additional dot adds half as much as the previous dot, so that "A.."
   *         is 1.75 times the length of "A".

   *
> before a note
   *     Plays the following note one octave higher.

   *
< before a note
   *     Plays the following note one octave lower.

   *
O followed by a number
   *     Sets the octave. (default: **O4**)

   *
T followed by a number
   *     Sets the tempo in beats per minute (BPM). (default: **T120**)

   *
L followed by a number
   *     Sets the default note duration to the type specified by the number:
   *         4 for quarter notes, 8 for eighth notes, 16 for sixteenth notes,
   *         etc. (default: **L4**)

   *
V followed by a number
   *     Sets the music volume (0--15). (default: **V15**)

   *
MS
   *     Sets all subsequent notes to play play staccato -- each note is
   *     played for 1/2 of its allotted time, followed by an equal period of
   *     silence.

   *
ML
   *     Sets all subsequent notes to play legato -- each note is played for
   *     full length. This is the default setting.

   *
!
   *     Resets the octave, tempo, duration, volume, and staccato setting to
   *     their default values. These settings persist from one `play()` to the
   *     next, which allows you to more conveniently break up your music into
   *     reusable sections.

   *

   *
   * This function plays the string of notes in the background while your
   * program continues to execute. If you call another buzzer function while the
   * melody is playing, the new function call will overwrite the previous and
   * take control of the buzzer. If you want to string melodies together, you
   * should put an appropriate delay after you start a melody playing. You can
   * use the `is_playing()` function to figure out when the buzzer is through
   * playing the melody.
   *
   * ### Example ###
   *
   * ~~~{.cpp}
   * PololuBuzzer buzzer;
   *
   * ...
   *
   * // play a C major scale up and back down:
   * buzzer.play("!L16 V8 cdefgab>cbagfedc");
   * while (buzzer.isPlaying());
   *
   * // the first few measures of Bach's fugue in D-minor
   * buzzer.play("!T240 L8 agafaea dac+adaea fa<aa<bac#a dac#adaea f4");
   * ~~~
   */
  static void play(const char *sequence);

  /*! \brief Plays the specified sequence of notes from program space.
   *
   * \param sequence Char array in program space containing a sequence of notes
   *                 to play.
   *
   * A version of `play()` that takes a pointer to program space instead of RAM.
   * This is desirable since RAM is limited and the string must be in program
   * space anyway.
   *
   * ### Example ###
   *
   * ~~~{.cpp}
   * #include <avr/pgmspace.h>
   *
   * PololuBuzzer buzzer;
   * const char melody[] PROGMEM = "!L16 V8 cdefgab>cbagfedc";
   *
   * ...
   *
   * buzzer.playFromProgramSpace(melody);
   * ~~~
   */
  static void playFromProgramSpace(const char *sequence);

  /*! \brief Controls whether `play()` sequence is played automatically or
   *         must be driven with `playCheck()`.
   *
   * \param mode Play mode (either `PLAY_AUTOMATIC` or `PLAY_CHECK`).
   *
   * This method lets you determine whether the notes of the `play()` sequence
   * are played automatically in the background or are driven by the
   * `playCheck()` method. If \a mode is `PLAY_AUTOMATIC`, the sequence will
   * play automatically in the background, driven by the timer overflow
   * interrupt. The interrupt will take a considerable amount of time to execute
   * when it starts the next note in the sequence playing, so it is recommended
   * that you do not use automatic-play if you cannot tolerate being interrupted
   * for more than a few microseconds. If \a mode is `PLAY_CHECK`, you can
   * control when the next note in the sequence is played by calling the
   * `playCheck()` method at acceptable points in your main loop. If your main
   * loop has substantial delays, it is recommended that you use automatic-play
   * mode rather than play-check mode. Note that the play mode can be changed
   * while the sequence is being played. The mode is set to `PLAY_AUTOMATIC` by
   * default.
   */
  static void playMode(unsigned char mode);

  /*! \brief Starts the next note in a sequence, if necessary, in `PLAY_CHECK`
   *         mode.
   *
   *  \return 0 if sequence is complete, 1 otherwise.
   *
   * This method only needs to be called if you are in `PLAY_CHECK` mode. It
   * checks to see whether it is time to start another note in the sequence
   * initiated by `play()`, and starts it if so. If it is not yet time to start
   * the next note, this method returns without doing anything. Call this as
   * often as possible in your main loop to avoid delays between notes in the
   * sequence. This method returns 0 (false) if the melody to be played is
   * complete, otherwise it returns 1 (true).
   */
  static unsigned char playCheck();

  /*! \brief Checks whether a note, frequency, or sequence is being played.
   *
   * \return 1 if the buzzer is current playing a note, frequency, or sequence;
   *         0 otherwise.
   *
   * This method returns 1 (true) if the buzzer is currently playing a
   * note/frequency or if it is still playing a sequence started by `play()`.
   * Otherwise, it returns 0 (false). You can poll this method to determine when
   * it's time to play the next note in a sequence, or you can use it as the
   * argument to a delay loop to wait while the buzzer is busy.
   */
  static unsigned char isPlaying();

  /*! \brief Stops any note, frequency, or melody being played.
   *
   * This method will immediately silence the buzzer and terminate any
   * note/frequency/melody that is currently playing.
   */
  static void stopPlaying();

  private:

  // initializes timer for buzzer control
  static void init2();
  static void init();
};


text:
from django.db import models
from django.contrib.auth.models import Group

from eve_api.models import EVEAPIModel

class EVEPlayerAlliance(EVEAPIModel):
    """
    Represents a player-controlled alliance. Updated from the alliance
    EVE XML API puller at intervals.
    """
    name = models.CharField(max_length=255, blank=True, null=False)
    ticker = models.CharField(max_length=15, blank=True, null=False)
    executor = models.ForeignKey('eve_api.EVEPlayerCorporation', blank=True, null=True)
    member_count = models.IntegerField(blank=True, null=True)
    date_founded = models.DateField(blank=True, null=True)
    group = models.ForeignKey(Group, blank=True, null=True)

    class Meta:
        app_label = 'eve_api'
        ordering = ['date_founded']
        verbose_name = 'Alliance'
        verbose_name_plural = 'Alliances'

    def __unicode__(self):
        if self.name:
            return self.name
        else:
            return "(#%d)" % self.id


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"/>
    <title>Statistics of SYM in UD_Thai-PUD</title>
    <link rel="root" href=""/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/hint.css"/>

          home

          edit page
          issue tracker

          <gcse:search></gcse:search>

        This page pertains to UD version 2.

            It appears that you have Javascript disabled.
            Please consider enabling Javascript for this page to see the visualizations.

Treebank Statistics: UD_Thai-PUD: POS Tags: SYM

There are 1 SYM lemmas (6%), 3 SYM types (0%) and 134 SYM tokens (1%).
Out of 16 observed tags, the rank of SYM is: 14 in number of lemmas, 15 in number of types and 14 in number of tokens.

The 10 most frequent SYM lemmas: _

The 10 most frequent SYM types:  ๆ, %, /

The 10 most frequent ambiguous lemmas: _ (<tt>NOUN</tt> 6052, <tt>VERB</tt> 4361, <tt>ADP</tt> 3134, <tt>PROPN</tt> 1491, <tt>AUX</tt> 1449, <tt>DET</tt> 1026, <tt>ADJ</tt> 969, <tt>ADV</tt> 951, <tt>PRON</tt> 683, <tt>PART</tt> 608, <tt>CCONJ</tt> 606, <tt>NUM</tt> 581, <tt>PUNCT</tt> 272, <tt>SYM</tt> 134, <tt>X</tt> 4, <tt>SCONJ</tt> 1)

The 10 most frequent ambiguous types:

Morphology

The form / lemma ratio of SYM is 3.000000 (the average of all parts of speech is 269.375000).

The 1st highest number of forms (3) was observed with the lemma "_": %, /, ๆ.

SYM does not occur with any features.

Relations

SYM nodes are attached to their parents using 6 different relations: <tt>dep</tt> (117; 87% instances), <tt>advmod</tt> (6; 4% instances), <tt>clf</tt> (5; 4% instances), <tt>nsubj</tt> (4; 3% instances), <tt>obj</tt> (1; 1% instances), <tt>obl</tt> (1; 1% instances)

Parents of SYM nodes belong to 6 different parts of speech: <tt>ADJ</tt> (79; 59% instances), <tt>ADV</tt> (27; 20% instances), <tt>VERB</tt> (13; 10% instances), <tt>NOUN</tt> (10; 7% instances), <tt>PROPN</tt> (3; 2% instances), <tt>DET</tt> (2; 1% instances)

117 (87%) SYM nodes are leaves.

11 (8%) SYM nodes have one child.

6 (4%) SYM nodes have two children.

The highest child degree of a SYM node is 2.

Children of SYM nodes are attached using 4 different relations: <tt>nummod</tt> (17; 74% instances), <tt>nmod:poss</tt> (4; 17% instances), <tt>case</tt> (1; 4% instances), <tt>nmod</tt> (1; 4% instances)

Children of SYM nodes belong to 3 different parts of speech: <tt>NUM</tt> (17; 74% instances), <tt>NOUN</tt> (5; 22% instances), <tt>ADP</tt> (1; 4% instances)

© 2014–2021
            Universal Dependencies contributors.
            Site powered by Annodoc and brat
.


text:
#import <XCTest/XCTest.h>
#import "HL7CCD.h"
#import "HL7CCDParser.h"
#import "HL7CCDParserDelegateProtocol.h"
#import "HL7Code.h"
#import "HL7Const.h"
#import "HL7Entry.h"
#import "HL7Enums.h"
#import "HL7ProcedureEntry.h"
#import "HL7ProcedureSection.h"
#import "HL7ProcedureActivityProcedure.h"

@interface HL7ProceduresSectionParserTests : XCTestCase <HL7CCDParserDelegateProtocol>
@end

@implementation HL7ProceduresSectionParserTests

- (void)willParseSectionsWithMapping:(id<HL7SectionMapperProtocol>)mapper
{
    [mapper enableParsers:[[NSSet alloc] initWithArray:@[ HL7TemplateProcedures ]]];
}

#pragma mark -

- (void)setUp
{
    [super setUp];
}

- (void)tearDown
{
    [super tearDown];
}

- (void)testBluebutton
{
    HL7CCDParser *parser = [HL7CCDParser new];
    NSError *error;
    [parser setDelegate:self];
    NSBundle *bundle = [NSBundle bundleForClass:[self class]];
    NSString *resource = [bundle pathForResource:@"bluebutton" ofType:@"xml"];
    HL7ProcedureEntry *entry;

    // execute
    HL7CCD *ccd = [parser parseXMLFilePath:resource error:&error];

    // assert
    HL7ProcedureSection *section = (HL7ProcedureSection *)[ccd getSectionByTemplateId:HL7TemplateProcedures];
    XCTAssertNil(error);
    XCTAssertNotNil(ccd);
    XCTAssertNotNil(section);
    XCTAssertTrue([[section title] isEqualToString:@"PROCEDURES"]);
    XCTAssertEqual([[section entries] count], 1);
    entry = [section entries][0];
    XCTAssertNotNil([entry procedure]);
    XCTAssertNotNil([[entry procedure] statusCode]);
    XCTAssertNotNil([[entry procedure] priorityCode]);
    XCTAssertNotNil([[entry procedure] targetSiteCode]);
    XCTAssertNotNil([[entry procedure] effectiveTime]);
    XCTAssertNotNil([[entry procedure] code]);
    XCTAssertTrue([[[[entry procedure] code] displayName] isEqualToString:@"Chest X-Ray"]);
    XCTAssertNil([entry act]);
    XCTAssertNil([entry observation]);
}

- (void)testhl7cdar
{
    HL7CCDParser *parser = [HL7CCDParser new];
    NSError *error;
    [parser setDelegate:self];
    NSBundle *bundle = [NSBundle bundleForClass:[self class]];
    NSString *resource = [bundle pathForResource:@"hl7cdar2" ofType:@"xml"];
    HL7ProcedureEntry *entry;

    // execute
    HL7CCD *ccd = [parser parseXMLFilePath:resource error:&error];

    // assert
    HL7ProcedureSection *section = (HL7ProcedureSection *)[ccd getSectionByTemplateId:HL7TemplateProcedures];
    XCTAssertNil(error);
    XCTAssertNotNil(ccd);
    XCTAssertNotNil(section);
    XCTAssertTrue([[section title] isEqualToString:@"PROCEDURES"]);
    XCTAssertEqual([[section entries] count], 3);
    entry = [section entries][0];
    XCTAssertNotNil([entry procedure]);
    XCTAssertNotNil([[entry procedure] statusCode]);
    XCTAssertNil([[entry procedure] priorityCode]);
    XCTAssertNotNil([[entry procedure] targetSiteCode]);
    XCTAssertNotNil([[entry procedure] effectiveTime]);
    XCTAssertNotNil([[entry procedure] code]);
    XCTAssertTrue([[[[entry procedure] code] displayName] isEqualToString:@"Colonoscopy"]);
    XCTAssertNil([entry act]);
    XCTAssertNil([entry observation]);
    entry = [section entries][1];
    XCTAssertNil([entry procedure]);
    XCTAssertNil([entry act]);
    XCTAssertNotNil([entry observation]);
    entry = [section entries][2];
    XCTAssertNil([entry procedure]);
    XCTAssertNotNil([entry act]);
    XCTAssertNil([entry observation]);
}
@end


text:
angular.module("devcenter.plugins")
.controller("DevcenterCtrl", ['$scope', '$q', '$interval', 'Navigation', 'Plugins', utils.BaseContentCtrl.extend({
	init			: function($scope, $q, $interval, Navigation, Plugins) {
        this._super($scope, $interval, Navigation, Plugins);

        function dfs(node) {
            return [node].concat(node.kids
                .map(function(kid) {
                    return dfs(kid);
                })
                .reduce(function(a, b) {
                    return a.concat(b)
                }, []));
        }

        var flatSlides;
        $scope.$watch(function() {
            return Navigation.currentNavigationModel();
        },
        function(model) {
            if (model != null) {
                flatSlides = dfs(model);
            }
        });

        $scope.prevSlide = null;
        $scope.nextSlide = null;

        $scope.currentNavigationNode = Navigation.currentNavigationNode;

        $scope.$watch(function() {
            return Navigation.currentNavigationNode();
        },
        function(node) {
            if (node != null) {
                $scope.prevSlide = flatSlides[flatSlides.indexOf(node) - 1];
                $scope.nextSlide = flatSlides[flatSlides.indexOf(node) + 1];
            }
        });
	}
})]);


text:
"""
Copyright: (c) 2012-2014 Artem Nezvigin <artem@artnez.com>
License: MIT, see LICENSE for details
"""