text:
#ifndef FPC_PAL_SENSOR_H_
#define FPC_PAL_SENSOR_H_

#include <stdint.h>

typedef void *fpc_device_t;

/**
 * @brief Used to describe an interrupt
 */
typedef enum {
	IRQ_INT_TRIG = 0x01, /**< Internally triggered by sensor (fast
				interrupt)                   **/
	IRQ_EXT_TRIG = 0x02 /**< Externally triggered by event outside sensor
			       (may take long time) **/
} fpc_pal_irq_t;

/**
 * @brief Write sensor access buffer to SPI interface
 *
 * @param[in] device             Client's device handle.
 * @param[in] access_buffer      Buffer holding data to write.
 * @param[in] access_buffer_size Size of the access buffer.
 *
 * @return 0 on success.
 *         negative value on error.
 */
int fpc_pal_spi_write(fpc_device_t device, uint8_t *access_buffer,
		      uint32_t access_buffer_size);

/**
 * @brief Write and read sensor access buffer to SPI interface
 *
 * SPI transfers always write the same number of bytes as they read,
 * hence the size of tx_buffer and rx_buffer must be the same.
 *
 * @param[in] device    Client's device handle.
 * @param[in] tx_buffer Buffer holding data to write.
 * @param[in] rx_buffer Buffer where read data will be stored.
 * @param[in] size      Size of tx and rx buffer.
 *
 * @return 0 on success.
 *         negative value on error.
 */
int fpc_pal_spi_writeread(fpc_device_t device, uint8_t *tx_buffer,
			  uint8_t *rx_buffer, uint32_t size);

/**
 * @brief Wait for IRQ
 *
 * @param[in] device   Client's device handle.
 * @param[in] irq_type The expected IRQ type.
 *
 * @return 0 on success.
 *         negative value on error.
 */
int fpc_pal_wait_irq(fpc_device_t device, fpc_pal_irq_t irq_type);

/**
 * @brief Get time
 *
 * @param[out] time_us Timestamp in microseconds.
 *
 * Not all platforms have microsecond resolution. These should
 * return time in terms of hole milliseconds.
 *
 * @return 0 on success.
 *         negative value on error.
 */
int fpc_pal_get_time(uint64_t *time_us);

/**
 * @brief Delay function
 *
 * @param[in] us Delay in microseconds.
 *
 * Not all platforms have microsecond resolution. These should
 * delay in terms of hole milliseconds.
 *
 * @return 0 on success.
 *         negative value on error.
 */
int fpc_pal_delay_us(uint64_t us);

/**
 * @brief Get platform SPI clock frequency
 *
 * @param[in]  device   Client's device handle.
 * @param[out] speed_hz SPI frequency in hertz.
 *
 * Required by platform for adaptive SPI calculations.
 *
 * @return 0 on success.
 *         negative value on error.
 */
int fpc_pal_spi_get_speed_hz(fpc_device_t device, uint32_t *speed_hz);

/**
 * @brief Print SDK log strings
 *
 * @param[in] tag sensor sdk log prefix
 * @param[in] log_level  FPC_SENSOR_SDK_LOG_LEVEL_DEBUG - debug print
 *                       FPC_SENSOR_SDK_LOG_LEVEL_INFO  - information print
 *                       FPC_SENSOR_SDK_LOG_LEVEL_ERROR - error print
 * @param[in] format     the format specifier.
 * @param[in] ...        additional arguments.
 *
 */
#define FPC_SENSOR_SDK_LOG_LEVEL_DEBUG (1)
#define FPC_SENSOR_SDK_LOG_LEVEL_INFO (2)
#define FPC_SENSOR_SDK_LOG_LEVEL_ERROR (3)
#define FPC_SENSOR_SDK_LOG_LEVEL_DISABLED (4)
void fpc_pal_log_entry(const char *tag, int log_level, const char *format, ...);

#endif // FPC_PAL_SENSOR_H_


text:
package server

import (
	"fmt"
	"server/libs/log"
)

const (
	DP_BEAT        = 1
	DP_BEGINUPDATE = 1 << 1
	DP_UPDATE      = 1 << 2
	DP_LASTUPDATE  = 1 << 3
	DP_FRAME       = 1 << 4
	DP_FLUSH       = 1 << 5
	DP_ALL         = DP_BEAT | DP_BEGINUPDATE | DP_UPDATE | DP_LASTUPDATE | DP_FRAME | DP_FLUSH
)

var (
	alltypes = []int{DP_BEAT, DP_BEGINUPDATE, DP_UPDATE, DP_LASTUPDATE, DP_FRAME, DP_FLUSH}
)

type Dispatcher interface {
	OnBeatRun()
	OnBeginUpdate()
	OnUpdate()
	OnLastUpdate()
	OnFrame()
	OnFlush()
	SetDispatchID(string)
	GetDispatchID() string
}

type DispatchSlot struct {
	Dispatchs map[string]Dispatcher
}

func NewDispatchSlot() *DispatchSlot {
	ds := &DispatchSlot{}
	ds.Dispatchs = make(map[string]Dispatcher)
	return ds
}

func (ds *DispatchSlot) Len() int {
	return len(ds.Dispatchs)
}

func (ds *DispatchSlot) Add(name string, d Dispatcher) bool {
	if _, dup := ds.Dispatchs[name]; dup {
		return false
	}
	ds.Dispatchs[name] = d
	return true
}

func (ds *DispatchSlot) Remove(name string) {
	delete(ds.Dispatchs, name)
}

//调度组件
type Dispatch struct {
	name string
}

func (d *Dispatch) OnBeatRun() {
}

func (d *Dispatch) OnBeginUpdate() {
}

func (d *Dispatch) OnUpdate() {
}

func (d *Dispatch) OnLastUpdate() {
}

func (d *Dispatch) OnFrame() {
}

func (d *Dispatch) OnFlush() {
}

func (d *Dispatch) SetDispatchID(n string) {
	d.name = n
}

func (d *Dispatch) GetDispatchID() string {
	return d.name
}

//挂载组件
func (kernel *Kernel) AddDispatch(name string, d Dispatcher, dtyp int) bool {
	for _, t := range alltypes {
		if dtyp&t != 0 {
			ds := kernel.dispatcherList[t]
			if ds == nil {
				ds = NewDispatchSlot()
				kernel.dispatcherList[t] = ds
			}
			d.SetDispatchID(name)
			if ds.Add(name, d) {
				log.LogMessage("add dispatch:", name, " type:", t)
			} else {
				log.LogError("add dispatch ", name, " type:", t, " failed")
			}
		}
	}
	return true
}

func (kernel *Kernel) AddDispatchNoName(d Dispatcher, dtyp int) bool {
	kernel.dispatchserial++
	return kernel.AddDispatch(fmt.Sprintf("dispatch%d", kernel.dispatchserial), d, dtyp)
}

func (kernel *Kernel) RemoveDispatch(name string) {
	for t, ds := range kernel.dispatcherList {
		if ds != nil {
			ds.Remove(name)
			log.LogMessage("remove dispatch:", name, " type:", t)
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
package com.diozero.devices.imu;

public class TapEvent {
	private TapType direction;
	private short count;

	public TapEvent(TapType direction, short count) {
		this.direction = direction;
		this.count = count;
	}

	public TapType getDirection() {
		return direction;
	}

	public short getCount() {
		return count;
	}

	@Override
	public String toString() {
		return "TapCallbackEvent [direction=" + direction + ", count=" + count + "]";
	}

	public static enum TapAxisType {
		TAP_X(1), TAP_Y(2), TAP_Z(4), TAP_XYZ(7);

		private int val;

		private TapAxisType(int val) {
			this.val = val;
		}

		public int getVal() {
			return val;
		}
	}

	public static enum TapType {
		UNKNOWN, TAP_X_UP, TAP_X_DOWN, TAP_Y_UP, TAP_Y_DOWN, TAP_Z_UP, TAP_Z_DOWN
	}
}


text:
<!doctype html>
<html <?php language_attributes(); ?> class="no-js">

	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title><?php echo the_title(); ?> | <?php echo strtoupper( get_section_name() ); ?></title>
	<link rel="apple-touch-icon" sizes="180x180" href="<?php echo get_stylesheet_directory_uri(); ?>/apple-touch-icon.png">
	<link rel="icon" type="image/png" sizes="32x32" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon-32x32.png">
	<link rel="icon" type="image/png" sizes="16x16" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon-16x16.png">
	<link rel="manifest" href="<?php echo get_stylesheet_directory_uri(); ?>/manifest.json">
	<link rel="mask-icon" href="<?php echo get_stylesheet_directory_uri(); ?>/safari-pinned-tab.svg" color="#ef4136">
	<meta name="theme-color" content="#ffffff">

	<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>?<?php echo time(); ?>">

	<?php wp_head(); ?>
	<?php ?>

<body <?php body_class( 'chapter' ); ?>>
<?php
/*

*/
?>
<?php if ( ! konkret_cookie_accepted() ) : ?>
	<?php
	/*

Fusce vehicula dolor arcu, sit amet blandit dolor mollis nec. Donec viverra eleifend lacus. Vitae ullamcorper metus.

			<button>Jag accepterar</button>

	*/
	?>
<?php endif; ?>

			<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_negative<?php brand_suffix(); ?>.svg" alt="<?php section_name(); ?>">
			<?php //echo get_stylesheet_directory_uri(); ?><?php //echo get_brand_suffix(); ?><?php //section_name(); ?><?php //echo get_stylesheet_directory_uri(); ?><?php //echo get_brand_suffix(); ?><?php //echo get_stylesheet_directory_uri(); ?><?php //echo get_brand_suffix(); ?><?php //echo get_stylesheet_directory_uri(); ?><?php //echo get_brand_suffix(); ?>

			<?php echo get_series_title(); ?>

				<?php
				$related = get_series_chapters();

				for ( $i = 0; $i < sizeof( $related ); $i++ ): ?>

<a href="<?php echo $related[ $i ]; ?>">Kapitel <?php echo $i + 1; ?>

				<?php endfor; ?>


text:
package error

import "testing"

func TestInternalServerError(t *testing.T) {
	err := InternalServerError()

	if !IsInternalServerError(err) {
		t.Error("Create a InternalServerError error must return a InternalServerError error.")
	}

	if err.Error() != InternalServerErrorMessage {
		t.Error("Create a InternalServerError error must return a InternalServerError error with the default error message.")
	}
}


text:
var util = require("util");
var choreography = require("temboo/core/choreography");

/*
    GetLenderDetails
    Returns details for lenders.
*/

var GetLenderDetails = function(session) {
    /*
        Create a new instance of the GetLenderDetails Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/Kiva/Lenders/GetLenderDetails"
    GetLenderDetails.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new GetLenderDetailsResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new GetLenderDetailsInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the GetLenderDetails
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var GetLenderDetailsInputSet = function() {
    GetLenderDetailsInputSet.super_.call(this);
        /*
        Set the value of the AppID input for this Choreo. ((optional, string) Your unique application ID, usually in reverse DNS notation.)
        */
        this.set_AppID = function(value) {
            this.setInput("AppID", value);
        }

        /*
        Set the value of the LenderName input for this Choreo. ((required, string) List of comma-delimited lender names for which to return details. Maximum list items: 50.)
        */
        this.set_LenderName = function(value) {
            this.setInput("LenderName", value);
        }

        /*
        Set the value of the ResponseType input for this Choreo. ((optional, string) Output returned can be XML or JSON. Defaults to JSON.)
        */
        this.set_ResponseType = function(value) {
            this.setInput("ResponseType", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the GetLenderDetails Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var GetLenderDetailsResultSet = function(resultStream) {
    GetLenderDetailsResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. (The response from Kiva.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
}

util.inherits(GetLenderDetails, choreography.Choreography);
util.inherits(GetLenderDetailsInputSet, choreography.InputSet);
util.inherits(GetLenderDetailsResultSet, choreography.ResultSet);
exports.GetLenderDetails = GetLenderDetails;

/*
    GetLenderLoans
    Returns loans belonging to a particular lender.
*/

var GetLenderLoans = function(session) {
    /*
        Create a new instance of the GetLenderLoans Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/Kiva/Lenders/GetLenderLoans"
    GetLenderLoans.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new GetLenderLoansResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new GetLenderLoansInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the GetLenderLoans
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var GetLenderLoansInputSet = function() {
    GetLenderLoansInputSet.super_.call(this);
        /*
        Set the value of the AppID input for this Choreo. ((optional, string) Your unique application ID, usually in reverse DNS notation.)
        */
        this.set_AppID = function(value) {
            this.setInput("AppID", value);
        }

        /*
        Set the value of the LenderName input for this Choreo. ((required, string) The lender name for which to return details.)
        */
        this.set_LenderName = function(value) {
            this.setInput("LenderName", value);
        }

        /*
        Set the value of the Page input for this Choreo. ((optional, integer) The page position of results to return. Defaults to 1.)
        */
        this.set_Page = function(value) {
            this.setInput("Page", value);
        }

        /*
        Set the value of the ResponseType input for this Choreo. ((optional, string) Output returned can be XML or JSON. Defaults to JSON.)
        */
        this.set_ResponseType = function(value) {
            this.setInput("ResponseType", value);
        }

        /*
        Set the value of the SortBy input for this Choreo. ((optional, string) The order by which to sort results. Acceptable values: oldest, newest. Defaults to newest.)
        */
        this.set_SortBy = function(value) {
            this.setInput("SortBy", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the GetLenderLoans Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var GetLenderLoansResultSet = function(resultStream) {
    GetLenderLoansResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. (The response from Kiva.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
}

util.inherits(GetLenderLoans, choreography.Choreography);
util.inherits(GetLenderLoansInputSet, choreography.InputSet);
util.inherits(GetLenderLoansResultSet, choreography.ResultSet);
exports.GetLenderLoans = GetLenderLoans;

/*
    GetLenderTeams
    Returns teams that a particular lender is part of.
*/

var GetLenderTeams = function(session) {
    /*
        Create a new instance of the GetLenderTeams Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/Kiva/Lenders/GetLenderTeams"
    GetLenderTeams.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new GetLenderTeamsResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new GetLenderTeamsInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the GetLenderTeams
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var GetLenderTeamsInputSet = function() {
    GetLenderTeamsInputSet.super_.call(this);
        /*
        Set the value of the AppID input for this Choreo. ((optional, string) Your unique application ID, usually in reverse DNS notation.)
        */
        this.set_AppID = function(value) {
            this.setInput("AppID", value);
        }

        /*
        Set the value of the LenderName input for this Choreo. ((required, string) The lender name for which to return details.)
        */
        this.set_LenderName = function(value) {
            this.setInput("LenderName", value);
        }

        /*
        Set the value of the Page input for this Choreo. ((optional, integer) The page position of results to return. Defaults to 1.)
        */
        this.set_Page = function(value) {
            this.setInput("Page", value);
        }

        /*
        Set the value of the ResponseType input for this Choreo. ((optional, string) Output returned can be XML or JSON. Defaults to JSON.)
        */
        this.set_ResponseType = function(value) {
            this.setInput("ResponseType", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the GetLenderTeams Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var GetLenderTeamsResultSet = function(resultStream) {
    GetLenderTeamsResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. (The response from Kiva.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
}

util.inherits(GetLenderTeams, choreography.Choreography);
util.inherits(GetLenderTeamsInputSet, choreography.InputSet);
util.inherits(GetLenderTeamsResultSet, choreography.ResultSet);
exports.GetLenderTeams = GetLenderTeams;

/*
    GetNewestLenders
    Returns listings for the lenders who have most recently joined Kiva.
*/

var GetNewestLenders = function(session) {
    /*
        Create a new instance of the GetNewestLenders Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/Kiva/Lenders/GetNewestLenders"
    GetNewestLenders.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new GetNewestLendersResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new GetNewestLendersInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the GetNewestLenders
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var GetNewestLendersInputSet = function() {
    GetNewestLendersInputSet.super_.call(this);
        /*
        Set the value of the AppID input for this Choreo. ((optional, string) Your unique application ID, usually in reverse DNS notation.)
        */
        this.set_AppID = function(value) {
            this.setInput("AppID", value);
        }

        /*
        Set the value of the Page input for this Choreo. ((optional, integer) The page position of results to return. Defaults to 1.)
        */
        this.set_Page = function(value) {
            this.setInput("Page", value);
        }

        /*
        Set the value of the ResponseType input for this Choreo. ((optional, string) Output returned can be XML or JSON. Defaults to JSON.)
        */
        this.set_ResponseType = function(value) {
            this.setInput("ResponseType", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the GetNewestLenders Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var GetNewestLendersResultSet = function(resultStream) {
    GetNewestLendersResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. (The response from Kiva.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
}

util.inherits(GetNewestLenders, choreography.Choreography);
util.inherits(GetNewestLendersInputSet, choreography.InputSet);
util.inherits(GetNewestLendersResultSet, choreography.ResultSet);
exports.GetNewestLenders = GetNewestLenders;

/*
    SearchLenders
    Returns a keyword search for lenders based on multiple criteria.
*/

var SearchLenders = function(session) {
    /*
        Create a new instance of the SearchLenders Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/Kiva/Lenders/SearchLenders"
    SearchLenders.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new SearchLendersResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new SearchLendersInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the SearchLenders
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var SearchLendersInputSet = function() {
    SearchLendersInputSet.super_.call(this);
        /*
        Set the value of the AppID input for this Choreo. ((optional, string) Your unique application ID, usually in reverse DNS notation.)
        */
        this.set_AppID = function(value) {
            this.setInput("AppID", value);
        }

        /*
        Set the value of the CountryCode input for this Choreo. ((optional, string) An ISO country code by which to filter results.)
        */
        this.set_CountryCode = function(value) {
            this.setInput("CountryCode", value);
        }

        /*
        Set the value of the Page input for this Choreo. ((optional, integer) The page position of results to return. Defaults to 1.)
        */
        this.set_Page = function(value) {
            this.setInput("Page", value);
        }

        /*
        Set the value of the Query input for this Choreo. ((conditional, string) A general search query parameter which matches against lenders' names occupations, whereabouts, and reasons for lending.)
        */
        this.set_Query = function(value) {
            this.setInput("Query", value);
        }

        /*
        Set the value of the ResponseType input for this Choreo. ((optional, string) Output returned can be XML or JSON. Defaults to JSON.)
        */
        this.set_ResponseType = function(value) {
            this.setInput("ResponseType", value);
        }

        /*
        Set the value of the SortBy input for this Choreo. ((optional, string) The order by which to sort results. Acceptable values: oldest, newest. Defaults to newest.)
        */
        this.set_SortBy = function(value) {
            this.setInput("SortBy", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the SearchLenders Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var SearchLendersResultSet = function(resultStream) {
    SearchLendersResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. (The response from Kiva.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
}

util.inherits(SearchLenders, choreography.Choreography);
util.inherits(SearchLendersInputSet, choreography.InputSet);
util.inherits(SearchLendersResultSet, choreography.ResultSet);
exports.SearchLenders = SearchLenders;

/******************************************************************************
Begin output wrapper classes
******************************************************************************/

/**
 * Utility function, to retrieve the array-type sub-item specified by the key from the parent (array) specified by the item.
 * Returns an empty array if key is not present.
 */
function getSubArrayByKey(item, key) {
	var val = item[key];
	if(val == null) {
		val = new Array();
	}
	return val;
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>S-Index</title>
<meta name="date" content="2018-06-03">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D F G H I L N O P R S T U V

S

setBalance(float) - Method in class de.ralleytn.simple.audio.AbstractAudio

setBalance(float) - Method in interface de.ralleytn.simple.audio.Audio

Sets the balance.

setFramePosition(long) - Method in interface de.ralleytn.simple.audio.Audio

Sets the position at which the audio should play.

setFramePosition(long) - Method in class de.ralleytn.simple.audio.BufferedAudio

setFramePosition(long) - Method in class de.ralleytn.simple.audio.StreamedAudio

setLoop(boolean) - Method in class de.ralleytn.simple.audio.Playlist

Sets whether the Playlist should restart once it reached the end or not.

setMute(boolean) - Method in class de.ralleytn.simple.audio.AbstractAudio

setMute(boolean) - Method in interface de.ralleytn.simple.audio.Playable

Sets wherever the Playable should be muted or not.

setMute(boolean) - Method in class de.ralleytn.simple.audio.Playlist

setPosition(long) - Method in interface de.ralleytn.simple.audio.Audio

Sets the position at which the audio should play.

setPosition(long) - Method in class de.ralleytn.simple.audio.BufferedAudio

setPosition(long) - Method in class de.ralleytn.simple.audio.StreamedAudio

setShuffle(boolean) - Method in class de.ralleytn.simple.audio.Playlist

Sets whether the next track to play should be picked randomly or not.

setTrack(int) - Method in class de.ralleytn.simple.audio.Playlist

setVolume(float) - Method in class de.ralleytn.simple.audio.AbstractAudio

setVolume(float) - Method in interface de.ralleytn.simple.audio.Playable

Sets the volume.

setVolume(float) - Method in class de.ralleytn.simple.audio.Playlist

start(File) - Method in class de.ralleytn.simple.audio.Recorder

Starts the recording and writes the data in the given file.

start(OutputStream) - Method in class de.ralleytn.simple.audio.Recorder

Starts the recording and writes the data on the given output stream.

stop() - Method in class de.ralleytn.simple.audio.BufferedAudio

stop() - Method in interface de.ralleytn.simple.audio.Playable

Stops the Playable.

stop() - Method in class de.ralleytn.simple.audio.Playlist

stop() - Method in class de.ralleytn.simple.audio.Recorder

Stops the recording.

stop() - Method in class de.ralleytn.simple.audio.StreamedAudio

StreamedAudio - Class in de.ralleytn.simple.audio

Never loads the entire audio data into the RAM.

StreamedAudio(String) - Constructor for class de.ralleytn.simple.audio.StreamedAudio

StreamedAudio(File) - Constructor for class de.ralleytn.simple.audio.StreamedAudio

StreamedAudio(Path) - Constructor for class de.ralleytn.simple.audio.StreamedAudio

StreamedAudio(String, String) - Constructor for class de.ralleytn.simple.audio.StreamedAudio

StreamedAudio(File, String) - Constructor for class de.ralleytn.simple.audio.StreamedAudio

StreamedAudio(Path, String) - Constructor for class de.ralleytn.simple.audio.StreamedAudio

StreamedAudio(URL) - Constructor for class de.ralleytn.simple.audio.StreamedAudio

StreamedAudio(URI) - Constructor for class de.ralleytn.simple.audio.StreamedAudio

A B C D F G H I L N O P R S T U V

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
package checkpoints;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;

/*
 * Find the kth smallest element in an unsorted array of non-negative integers.

Definition of kth smallest element

 kth smallest element is the minimum possible n such that there are at least k elements in the array <= n.
In other words, if the array A was sorted, then A[k - 1] ( k is 1 based, while the arrays are 0 based )
NOTE
You are not allowed to modify the array ( The array is read only ).
Try to do it using constant extra space.

Example:

A : [2 1 4 3 2]
k : 3

answer : 2
 */

public class KthSmallestElement {

	public static void main(String[] args) {
		List<Integer> list = Arrays.asList(2, 1, 4, 3, 2);
		KthSmallestElement k =  new KthSmallestElement();
		System.out.println(k.kthsmallest(list, 3));
	}

	public int kthsmallest(final List<Integer> a, int k) {
	    PriorityQueue<Integer> pq = new PriorityQueue<Integer>(new MyComparator());
	    for(int item: a){
	        if(pq.size()<k) pq.add(item);
	        else{
	            if(pq.peek() > item){
	                pq.remove();
	                pq.add(item);
	            }
	        }
	    }

	    return pq.remove().intValue();
	}

	class MyComparator implements Comparator<Integer>{
	    public int compare(Integer a, Integer b){
	        if(a < b) return 1;
	        else if(a > b) return -1;
	        else return 0;
	    }
	}

}


text:
package org.jbehave.core;

import org.jbehave.core.errors.ErrorStrategy;
import org.jbehave.core.errors.PendingErrorStrategy;
import org.jbehave.core.i18n.LocalizedKeywords;
import org.jbehave.core.parser.*;
import org.jbehave.core.reporters.*;
import org.jbehave.core.reporters.StoryReporter;
import org.jbehave.core.steps.DefaultStepdocGenerator;
import org.jbehave.core.steps.MarkUnmatchedStepsAsPending;
import org.jbehave.core.steps.StepCreator;
import org.jbehave.core.steps.StepdocGenerator;

import java.util.Locale;

/**
 * The configuration that works for most situations that users are likely to encounter.
 * The elements configured are:
 *

 *
{@link org.jbehave.core.model.Keywords}: new I18nKeyWords()

 *
{@link StepCreator}: new UnmatchedToPendingStepCreator()

 *
{@link StoryParser}: new PatternStoryParser(keywords())

 *
{@link org.jbehave.core.parser.StoryLoader}: new ClasspathLoader()

 *
{@link ErrorStrategy}: ErrorStrategy.RETHROW

 *
{@link PendingErrorStrategy}: PendingErrorStrategy.PASSING

 *
{@link StoryReporter}: new PassSilentlyDecorator(new PrintStreamStoryReporter())

 *
{@link StepdocGenerator}: new DefaultStepdocGenerator()

 *
{@link StepdocReporter}: new PrintStreamStepdocReporter(true)

 *

 */
public class MostUsefulStoryConfiguration extends StoryConfiguration {

    public MostUsefulStoryConfiguration() {
        useKeywords(new LocalizedKeywords(Locale.ENGLISH));
        useStepCreator(new MarkUnmatchedStepsAsPending());
        useStoryParser(new RegexStoryParser(keywords()));
        useStoryLoader(new LoadFromClasspath());
        useErrorStrategy(ErrorStrategy.RETHROW);
        usePendingErrorStrategy(PendingErrorStrategy.PASSING);
        useStoryReporter(new SilentSuccessFilter(new PrintStreamOutput()));
        useStepdocReporter(new PrintStreamStepdocReporter(true));
        useStepdocGenerator(new DefaultStepdocGenerator());
    }

}


text:
<?php

namespace Admin\DashboardBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class DashboardBundle extends Bundle
{
}


text:
import TaskCanceller from "../../utils/task_canceller";
import { ISegmentLoader } from "../types";
import checkISOBMFFIntegrity from "../utils/check_isobmff_integrity";
import inferSegmentContainer from "../utils/infer_segment_container";

/**
 * Add multiple checks on the response given by the `segmentLoader` in argument.
 * If the response appear to be corrupted, the returned Promise will reject with
 * an error with an `INTEGRITY_ERROR` code.
 * @param {Function} segmentLoader
 * @returns {Function}
 */
export default function addSegmentIntegrityChecks<T>(
  segmentLoader : ISegmentLoader<T>
) : ISegmentLoader<T> {
  return (url, content, loaderOptions, initialCancelSignal, callbacks) => {
    return new Promise((resolve, reject) => {
      const requestCanceller = new TaskCanceller({ cancelOn: initialCancelSignal });

      // Reject the `CancellationError` when `requestCanceller`'s signal emits
      // `stopRejectingOnCancel` here is a function allowing to stop this mechanism
      const stopRejectingOnCancel = requestCanceller.signal.register(reject);

      segmentLoader(url, content, loaderOptions, requestCanceller.signal, {
        ...callbacks,
        onNewChunk(data) {
          try {
            trowOnIntegrityError(data);
            callbacks.onNewChunk(data);
          } catch (err) {
            // Do not reject with a `CancellationError` after cancelling the request
            stopRejectingOnCancel();
            // Cancel the request
            requestCanceller.cancel();
            // Reject with thrown error
            reject(err);
          }
        },
      }).then((info) => {
        if (requestCanceller.isUsed) {
          return;
        }
        stopRejectingOnCancel();
        if (info.resultType === "segment-loaded") {
          try {
            trowOnIntegrityError(info.resultData.responseData);
          } catch (err) {
            reject(err);
            return;
          }
        }
        resolve(info);
      }, (error : unknown) => {
        stopRejectingOnCancel();
        reject(error);
      });
    });

    /**
     * If the data's seems to be corrupted, throws an `INTEGRITY_ERROR` error.
     * @param {*} data
     */
    function trowOnIntegrityError(data : T) : void {
      if (!(data instanceof ArrayBuffer) && !(data instanceof Uint8Array) ||
          inferSegmentContainer(content.adaptation.type,
                                content.representation) !== "mp4")
      {
        return;
      }
      checkISOBMFFIntegrity(new Uint8Array(data), content.segment.isInit);
    }
  };
}


text:
package com.tradeshift.reaktive;

import java.util.Iterator;
import java.util.Spliterators;
import java.util.function.BiFunction;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import io.vavr.control.Option;

/**
 * Various methods dealing with Java 8 streams
 */
public class JavaStreams {

    /**
     * Has the given aggregation function process all elements of the stream, starting with the given initial element.
     */
    @SuppressWarnings("unchecked")
    public static <T,U> U foldLeft(U initial, Stream<T> stream, BiFunction<U,T,U> f) {
        U u = initial;
        for (Object t: stream.toArray()) {
            u = f.apply(u, (T) t);
        }
        return u;
    }

    /**
     * Returns Option.none() if the stream is empty, or an Option.of(stream) if there are elements in the stream.
     */
    public static <T> Option<Stream<T>> toOption(Stream<T> stream) {
        Iterator<T> iterator = stream.iterator();
        if (iterator.hasNext()) {
            return Option.of(StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false));
        } else {
            return Option.none();
        }
    }
}


text:
ACCEPTED

#### According to
Integrated Taxonomic Information System

#### Published in
Proc. Calif. Acad. Sci. ser. 3, 1:136, t. 11, fig. 7. 1898

#### Original name
null

### Remarks
null


text:
#include "Anything.h"
#include "Context.h"
#include "StringStream.h"
#include "Renderer.h"
#include "TestSuite.h"
#include "FormRenderer.h"
#include "PulldownMenuRendererTest.h"

PulldownMenuRendererTest::PulldownMenuRendererTest (TString tname) : FieldRendererTest(tname)
{
	fFieldRenderer = new (coast::storage::Global()) PulldownMenuRenderer("PulldownMenuRenderer");
};

PulldownMenuRendererTest::~PulldownMenuRendererTest()
{
	if (fFieldRenderer) {
		delete fFieldRenderer;
	}
	fFieldRenderer = 0;
};

/*===============================================================*/
/*     Init                                                      */
/*===============================================================*/
void PulldownMenuRendererTest::setUp ()
{
	FieldRendererTest::setUp();
}

Test *PulldownMenuRendererTest::suite ()
{
	TestSuite *testSuite = new TestSuite;

	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseEmptyConf);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCase0);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCase1);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCase2);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCase3);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseWithoutName);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseWithoutLabel);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseWithoutValue);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseWithoutSource);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseWithoutMultiple);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseWithoutChecked);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseWithoutOptions);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseWrong);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseWithUndefList);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestCaseNameAndMultiple);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestOptionRenderer);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestFaultOptionRenderer);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestOptionRendererOld);
	ADD_CASE(testSuite, PulldownMenuRendererTest, TestFaultOptionRendererOld);
	return testSuite;
}

/*===============================================================*/
/*     Check where all is correctly defined                      */
/*===============================================================*/
void PulldownMenuRendererTest::TestCase0()
{
	fCurrentTestMethod = "PulldownMenu-TestCase0";
	this->TestField0();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' the options of field>\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestCase1()
{
	fCurrentTestMethod = "PulldownMenu-TestCase1";
	this->TestField1();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' 0="the option nr. 0 of field" 1="the option nr. 1 of field" 2="the option nr. 2 of field">\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestCase2()
{
	fCurrentTestMethod = "PulldownMenu-TestCase2";
	this->TestField2();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' 0="the option nr. 0 of field" the option nr. 1 of field 2="the option nr. 2 of field">\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestCase3()
{
	fCurrentTestMethod = "PulldownMenu-TestCase3";
	this->TestField3();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' 0="the option nr. 0 of field" the option nr. 1 of field 2="the option nr. 2 of field">\n</select>\n), fReply.str() );
}

/*===============================================================*/
/*     Check where not all is correctly defined                  */
/*===============================================================*/
void PulldownMenuRendererTest::TestCaseEmptyConf()
{
	fCurrentTestMethod = "PulldownMenu-TestCaseEmptyConf";
	this->TestEmptyConf();
	assertCharPtrEqual( "", fReply.str() );
}

void PulldownMenuRendererTest::TestCaseWithoutName()
{
	fCurrentTestMethod = "PulldownMenu-TestCaseWithoutName";
	this->TestFieldWithoutName();
	assertCharPtrEqual( "", fReply.str() );
}

void PulldownMenuRendererTest::TestCaseWithoutLabel()
{
	fCurrentTestMethod = "PulldownMenu-TestCaseWithoutLabel";
	this->TestFieldWithoutLabel();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' the options of field>\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestCaseWithoutValue()
{
	fCurrentTestMethod = "PulldownMenu-TestFieldWithoutValue";
	this->TestFieldWithoutValue();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' the options of field>\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestCaseWithoutSource()
{
	fCurrentTestMethod = "PulldownMenu-TestFieldWithoutSource";
	this->TestFieldWithoutSource();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' the options of field>\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestCaseWithoutMultiple()
{
	fCurrentTestMethod = "PulldownMenu-TestFieldWithoutMultiple";
	this->TestFieldWithoutMultiple();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' the options of field>\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestCaseWithoutChecked()
{
	fCurrentTestMethod = "PulldownMenu-TestFieldWithoutChecked";
	this->TestFieldWithoutChecked();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' the options of field>\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestCaseWithoutOptions()
{
	fCurrentTestMethod = "PulldownMenu-TestFieldWithoutOptions";
	this->TestFieldWithoutOptions();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1'>\n</select>\n), fReply.str() );
}

/*===============================================================*/
/*     Check where there is a fault fConfig                      */
/*===============================================================*/
void PulldownMenuRendererTest::TestCaseWrong()
{
	fCurrentTestMethod = "PulldownMenu-TestCaseWrong";
	this->TestFieldWithoutName();
	assertCharPtrEqual( "", fReply.str() );
}

/*===============================================================*/
/*     Check List and ListName                                 */
/*===============================================================*/
void PulldownMenuRendererTest::TestCaseWithUndefList()
{
	String str("<select name=\"fld_the name of field\" size='1' 0=\"the option nr. 0 of field\" 1=\"the option nr. 1 of field\" 2=\"the option nr. 2 of field\">\n<option></option>\n</select>\n");

	fCurrentTestMethod = "PulldownMenu-TestCaseWithUndefList";
	this->TestFieldWithUndefList();
	assertCharPtrEqual( (const char *)str, fReply.str() );
}

void PulldownMenuRendererTest::TestCaseNameAndMultiple()
{
	String str("<select name=\"fld_EinName\" size='1'>\n</select>\n");

	fCurrentTestMethod = "PulldownMenu-TestCaseNameAndMultiple";
	this->TestNameAndMultiple();
	assertCharPtrEqual( (const char *)str, fReply.str() );
}

/*===============================================================*/
/*     Check the indirection                                     */
/*===============================================================*/
void PulldownMenuRendererTest::TestOptionRendererOld()
{
	fCurrentTestMethod = "PulldownMenuRendererTest-TestOptionRendererOld";
	this->TestFieldOptionRendererOld();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' 0="the option nr. 0 of field" 1="07.08.97" 2="the option nr. 2 of field">\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestFaultOptionRendererOld()
{
	fCurrentTestMethod = "PulldownMenuRendererTest-TestFaultOptionRendererOld";
	this->TestFieldFaultOptionRendererOld();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' 0="the option nr. 0 of field" 1="" 2="the option nr. 2 of field">\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestOptionRenderer()
{
	fCurrentTestMethod = "PulldownMenuRendererTest-TestOptionRenderer";
	this->TestFieldOptionRenderer();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' 0="the option nr. 0 of field" 1="07.08.97" 2="the option nr. 2 of field">\n</select>\n), fReply.str() );
}

void PulldownMenuRendererTest::TestFaultOptionRenderer()
{
	fCurrentTestMethod = "PulldownMenuRendererTest-TestFaultOptionRenderer";
	this->TestFieldFaultOptionRenderer();
	assertCharPtrEqual( _QUOTE_(<select name="fld_the name of field" size='1' 0="the option nr. 0 of field" 1="%d.%m.%y870912000" 2="the option nr. 2 of field">\n</select>\n), fReply.str() );
}


text:
package eu.uqasar.web.pages.tree;

import java.util.List;
import java.util.UUID;

import javax.inject.Inject;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.string.StringValue;
import org.jboss.solder.logging.Logger;

import eu.uqasar.model.analytic.Analysis;
import eu.uqasar.model.qmtree.QMMetric;
import eu.uqasar.model.qmtree.QMQualityIndicator;
import eu.uqasar.model.qmtree.QMQualityObjective;
import eu.uqasar.model.qmtree.QMTreeNode;
import eu.uqasar.model.qmtree.QModel;
import eu.uqasar.model.tree.ITreeNode;
import eu.uqasar.model.tree.Metric;
import eu.uqasar.model.tree.Project;
import eu.uqasar.model.tree.QualityIndicator;
import eu.uqasar.model.tree.QualityObjective;
import eu.uqasar.model.tree.TreeNode;
import eu.uqasar.model.tree.historic.Snapshot;
import eu.uqasar.service.QMTreeNodeService;
import eu.uqasar.service.tree.TreeNodeService;
import eu.uqasar.util.UQasarUtil;
import eu.uqasar.web.components.tree.DeletionConfirmationModal;
import eu.uqasar.web.components.tree.TreePanel;
import eu.uqasar.web.components.tree.util.Tree;
import eu.uqasar.web.pages.AboutPage;
import eu.uqasar.web.pages.BasePage;
import eu.uqasar.web.pages.tree.metric.MetricEditPage;
import eu.uqasar.web.pages.tree.metric.MetricViewPage;
import eu.uqasar.web.pages.tree.panels.filter.FilterPanel;
import eu.uqasar.web.pages.tree.panels.filter.TreeFilterStructure;
import eu.uqasar.web.pages.tree.projects.ProjectEditPage;
import eu.uqasar.web.pages.tree.projects.ProjectViewPage;
import eu.uqasar.web.pages.tree.projects.ProjectWizardPage;
import eu.uqasar.web.pages.tree.quality.indicator.QualityIndicatorEditPage;
import eu.uqasar.web.pages.tree.quality.indicator.QualityIndicatorViewPage;
import eu.uqasar.web.pages.tree.quality.objective.QualityObjectiveEditPage;
import eu.uqasar.web.pages.tree.quality.objective.QualityObjectiveViewPage;

public abstract class BaseTreePage<Type extends TreeNode>
		extends BasePage {

	/**
	 *
	 */
	private static final long serialVersionUID = -7161895697889951287L;
	private final Logger logger = Logger.getLogger(getClass());

	@Inject
	TreeNodeService treeNodeService;
	@Inject
	QMTreeNodeService qmTreeNodeService;

	@SuppressWarnings("unused")
	private WebMarkupContainer content;
	protected TreePanel treePanel;
	protected FilterPanel filterPanel;
	protected Long currentlySelectedNodeId, initiallyRequestedNodeId;
	protected TreeNode currentlySelectedNode,
			initiallyRequestedNode;
	protected TreeNode currentParentProjectNode, currentParentQualityObjective,
			currentParentQualityIndicator;
	protected DeletionConfirmationModal deleteConfirmationModal;
	private static final String Container_Id = "content";

	public BaseTreePage(final PageParameters parameters) {
		super(parameters);

		add(filterPanel = new FilterPanel("filter"){
			@Override
			public void applyClicked(AjaxRequestTarget target, Form<?> form) {
				TreeFilterStructure filter = this.getFilter();
				filter.setCurrentlyEditedProjectId(getCurrentlyEditedProjectId());
				unselectNodeCurrentlySelectedNode();
				treePanel.updateFilter(filter);
				target.add(treePanel);
			}

			@Override
			public void resetClicked(AjaxRequestTarget target, Form<?> form) {
				treePanel.updateFilter(new TreeFilterStructure());
				target.add(treePanel);
			}
		});
		add(treePanel = getTreePanel(filterPanel.getFilter()));
		add(content = new WebMarkupContainer(Container_Id));
		add(deleteConfirmationModal = createDeleteConfirmationModal());
	}

	private Long getCurrentlyEditedProjectId() {
		if(initiallyRequestedNode instanceof Project){
			return initiallyRequestedNode.getId();
		} else {
			if(initiallyRequestedNode != null) {
				return initiallyRequestedNode.getProject().getId();
			}
		}
		return null;
	}

	private TreePanel getTreePanel(TreeFilterStructure filter) {
		TreePanel panel = new TreePanel("tree", filter) {
			private static final long serialVersionUID = -3862120828153062154L;

			@Override
			public void onNodeClicked(AjaxRequestTarget target,
					IModel<TreeNode> nodeModel) {
				BaseTreePage.this.handleNodeClick(target, nodeModel);
			}

			@Override
			public void onMoveUpClicked(AjaxRequestTarget target,
					IModel<TreeNode> node) {
				moveNode(node.getObject(), target, false);
			}

			@Override
			public void onMoveDownClicked(AjaxRequestTarget target,
					IModel<TreeNode> node) {
				moveNode(node.getObject(), target, true);
			}

			@Override
			public void onEditClicked(AjaxRequestTarget target,
					IModel<TreeNode> node) {
				if (node.getObject() instanceof Project) {
					setResponsePage(ProjectEditPage.class,
							BaseTreePage.forProject((Project) node.getObject()));
				} else if (node.getObject() instanceof QualityObjective) {
					setResponsePage(
							QualityObjectiveEditPage.class,
							BaseTreePage
							.forQualityObjective((QualityObjective) node
									.getObject()));
				} else if (node.getObject() instanceof QualityIndicator) {
					setResponsePage(
							QualityIndicatorEditPage.class,
							BaseTreePage
							.forQualityIndicator((QualityIndicator) node
									.getObject()));
				} else if (node.getObject() instanceof Metric) {
					setResponsePage(MetricEditPage.class,
							BaseTreePage.forMetric((Metric) node.getObject()));
				}
			}

			@Override
			public void onDeleteClicked(AjaxRequestTarget target,
					IModel<TreeNode> node) {
				deleteNode(node.getObject(), target);
			}

			@Override
			public void onNewClicked(AjaxRequestTarget target,
					IModel<TreeNode> node, Class<? extends TreeNode> newNodeType) {
				TreeNode newNode = null;
				if (newNodeType == Project.class) {
					createNewProject();
				} else if (newNodeType == QualityObjective.class) {
					newNode = createNewQualityObjective(node.getObject().getProject());
				} else if (newNodeType == QualityIndicator.class) {
					newNode = createNewQualityIndicator(node.getObject()
							.getQualityObjective());
				} else if (newNodeType == Metric.class) {
					newNode = createNewMetric(node.getObject().getQualityIndicator());
				}

				if (newNode instanceof QualityObjective) {
					setResponsePage(QualityObjectiveEditPage.class, forQualityObjective((QualityObjective) newNode, true));
				} else if (newNode instanceof QualityIndicator) {
					setResponsePage(QualityIndicatorEditPage.class, forQualityIndicator((QualityIndicator) newNode, true));
				} else if (newNode instanceof Metric) {
					setResponsePage(MetricEditPage.class, forMetric((Metric) newNode, true));
				}
			}

//			@Override
//			public void onNewProjectFromQMClicked(AjaxRequestTarget target,
//					IModel<TreeNode> node) {
//				createProjectTreeLeaves(node.getObject(), target);
//			}
		};
		return panel;
	}

//	/**
//	 * Create quality project tree nodes from a quality model TODO: take only
//	 * parts of the quality tree into account
//	 *
//	 * @param node
//	 * @param target
//	 */
//	protected void createProjectTreeLeaves(final TreeNode node, AjaxRequestTarget target) {
//		logger.info("Associate a quality model to the quality project");
//
//		// Check whether there is a quality model active
//		QModel activeQModel = qmTreeNodeService.getActiveQModel();
//		if (activeQModel != null) {
//			// Mark the current tree node as the parent where start from
//			// to add nodes to the quality project tree
//			currentParentProjectNode = node;
//			// Start traversal from the root of the tree
//			preorder(activeQModel);
//			target.add(BaseTreePage.this.treePanel);
//		}
//	}

	/**
	 * Traverse the quality model tree in preorder and associate nodes to the
	 * quality project.
	 *
	 * @param node
	 */
	public void preorder(QMTreeNode node) {
		if (node == null) {
			return;
		}
		logger.info("Traversing quality tree in preorder..." + node.toString());

		addNodeToProjectTree(node);
		// If the node has children, iterate those
		for (Object o : node.getChildren()) {
			node = (QMTreeNode) o;
			preorder(node);
		}
	}

	/**
	 * Associate a quality model tree node to the quality project
	 *
	 * @param node
	 */
	private void addNodeToProjectTree(QMTreeNode node) {
		if (node instanceof QModel) {
			QModel qm = (QModel) node;
			long randomId = UUID.randomUUID().toString().hashCode();
			Project project = (Project) treeNodeService.create(new Project("Project from " + qm.getName(), String.format("prj-%s", randomId)));
			logger.info("[Quality Model] " + qm);
			project.setQmodel(qm);
			currentParentProjectNode = project;
		} else if (node instanceof QMQualityObjective) {
			QMQualityObjective qmqo = (QMQualityObjective) node;
			logger.info("[Quality Objective] " + qmqo);
			QualityObjective qo = new QualityObjective(qmqo, (Project) currentParentProjectNode);
			logger.info("qo: " + qo);
			currentParentQualityObjective = qo;
		} else if (node instanceof QMQualityIndicator) {
			QMQualityIndicator qmqi = (QMQualityIndicator) node;
			logger.info("[Quality Indicator] " + qmqi);
			QualityIndicator qi = new QualityIndicator(qmqi, (QualityObjective) currentParentQualityObjective);
			currentParentQualityIndicator = qi;
		} else if (node instanceof QMMetric) {
			QMMetric qmm = (QMMetric) node;
			logger.info("[Quality Metric] " + qmm);
			//Metric m = new Metric(qmm.getName(), (QualityIndicator) currentParentQualityIndicator);
			new Metric(qmm, (QualityIndicator) currentParentQualityIndicator);
		}
	}

	protected void moveNode(final TreeNode node,
			AjaxRequestTarget target, boolean down) {
		boolean up = !down;
		if (!(node instanceof Project)) {
			boolean moved = false;
			TreeNode oldParent = node.getParent();
			if (down) {
				moved = node.changePositionWithNextSibling();
			} else if (up) {
				moved = node.changePositionWithPreviousSibling();
			}
			TreeNode newParent = node.getParent();
			if (moved) {
				if (oldParent.equals(newParent)) {
					treeNodeService.update(oldParent);
				}
				treeNodeService.update(node.getParent());
				expandTreeToSelectedNode(node.getId());
				target.add(BaseTreePage.this.treePanel);
			}
		}
	}

	protected void deleteNode(final TreeNode node,
			AjaxRequestTarget target) {
		target.add(getUpdatedDeleteConfirmationModal());
		deleteConfirmationModal.appendShowDialogJavaScript(target);
	}

	protected void createNewProject() {
		//long randomId = UUID.randomUUID().toString().hashCode();
		//Project project = (Project) treeNodeService.create(new Project("Project", String.format("prj-%s", randomId)));
		setResponsePage(ProjectWizardPage.class);
	}

	protected TreeNode createNewQualityObjective(Project parent) {
		if (parent != null) {
			QualityObjective obj = new QualityObjective("Quality Objective", parent);
			return treeNodeService.addNewChild(parent, obj);
		}
		return null;
	}

	protected TreeNode createNewQualityIndicator(QualityObjective parent) {
		if (parent != null) {
			QualityIndicator indi = new QualityIndicator("Quality Indicator", parent);
			return treeNodeService.addNewChild(parent, indi);
		}
		return null;
	}

	protected TreeNode createNewMetric(QualityIndicator parent) {
		if (parent != null) {
			Metric metric = new Metric("Metric", parent);
			return treeNodeService.addNewChild(parent, metric);
		}
		return null;
	}

	private void unselectNodeCurrentlySelectedNode() {
		this.currentlySelectedNode = null;
		this.currentlySelectedNodeId = null;
		treePanel.unselectNode();
	}

	public Tree getTree() {
		return getTreePanel().getTree();
	}

	public TreePanel getTreePanel() {
		return this.treePanel;
	}

	public ITreeNode<String> getCurrentlySelectedNode() {
		return this.currentlySelectedNode;
	}

	public Long getCurrentlySelectedNodeId() {
		return this.currentlySelectedNodeId;
	}

	@Override
	public void renderHead(IHeaderResponse response) {
		super.renderHead(response);
		response.render(CssHeaderItem.forUrl("assets/css/tree/tree.css"));
		response.render(CssHeaderItem.forUrl("assets/css/tree/panels.css"));
	}

	public abstract WebMarkupContainer getContent(final String markupId,
			final IModel<Type> model);

	@SuppressWarnings("unchecked")
	@Override
	protected void onConfigure() {
		super.onConfigure();
		currentlySelectedNodeId = initiallyRequestedNodeId = getRequestedNodeId();

		if (currentlySelectedNodeId == null) {
			// create project
			long randomId = UUID.randomUUID().toString().hashCode();
			Project project = (Project) treeNodeService.create(new Project("Project", String.format("prj-%s", randomId)));
			currentlySelectedNodeId = initiallyRequestedNodeId = project.getId();
		}

		currentlySelectedNode = initiallyRequestedNode = getRequestedNode(currentlySelectedNodeId);
		if (currentlySelectedNodeId != null) {
			selectCurrentNode(currentlySelectedNodeId);
			expandTreeToSelectedNode(currentlySelectedNodeId);
			replace(content = getContent(Container_Id,
					Model.of((Type) currentlySelectedNode)));
		}
		addOrReplace(getUpdatedDeleteConfirmationModal());
	}

	protected void handleNodeClick(AjaxRequestTarget target,
			IModel<TreeNode> nodeModel) {
		TreeNode node = nodeModel.getObject();
		setRedirectToNodePage(node);
		currentlySelectedNode = node;
		currentlySelectedNodeId = node.getId();
	}

	protected void setRedirectToNodePage(TreeNode node) {
		if (node instanceof Project) {
			setResponsePage(ProjectViewPage.class, forProject((Project) node));
		} else if (node instanceof QualityObjective) {
			setResponsePage(QualityObjectiveViewPage.class,
					forQualityObjective((QualityObjective) node));
		} else if (node instanceof QualityIndicator) {
			setResponsePage(QualityIndicatorViewPage.class,
					forQualityIndicator((QualityIndicator) node));
		} else if (node instanceof Metric) {
			setResponsePage(MetricViewPage.class, forMetric((Metric) node));
		}
	}

	private DeletionConfirmationModal createDeleteConfirmationModal() {
		deleteConfirmationModal = new DeletionConfirmationModal(
				"deleteConfirmationModal", currentlySelectedNode) {

					private static final long serialVersionUID = -2647776051399096877L;

					@Override
					public void onConfirmed(AjaxRequestTarget target) {
						/* either project or node of project */
						if (currentlySelectedNode instanceof Project) {
							treeNodeService.delete(currentlySelectedNodeId);

							List<Project> projects = treeNodeService.getAllProjects();
							if (projects.isEmpty()) {
								// TODO what todo if no project left?
								setResponsePage(AboutPage.class);
							} else {
								setRedirectToNodePage(projects.get(0));
							}
						} else {
							if (currentlySelectedNode instanceof QualityObjective) {
								Project p = currentlySelectedNode.getProject();
				                // Update the project tree content (metric values and computed values of QOs and QIs based on metrics)
				                UQasarUtil.updateTree(p);
								p.removeChild(currentlySelectedNode);
								setRedirectToNodePage(currentlySelectedNode.getParent());
							} else {
								TreeNode n = currentlySelectedNode.getParent();
				                // Update the project tree content (metric values and computed values of QOs and QIs based on metrics)
				                UQasarUtil.updateTree(n.getProject());
								n.removeChild(currentlySelectedNode);
								setRedirectToNodePage(n);
							}
							/*for(Project p : treeNodeService.getAllProjects()) {
							 if(p.getChildren().contains(currentlySelectedNode)) {
							 p.removeChild(currentlySelectedNode);
							 setRedirectToNodePage(currentlySelectedNode.getParent());
							 }
							 }*/
						}
						/* previous code

						 TreeNode removedTreeNode = treeNodeService
						 .removeTreeNode(currentlySelectedNode.getId());

						 if (removedTreeNode != null) {
						 if (!(removedTreeNode instanceof Project)) {
						 setRedirectToNodePage(removedTreeNode.getParent());
						 } else {
						 // TODO where to go, when there is no project anymore?
						 setResponsePage(AboutPage.class);
						 }
						 }*/
					}
				};
		return deleteConfirmationModal;
	}

	protected DeletionConfirmationModal getUpdatedDeleteConfirmationModal() {
		deleteConfirmationModal.update(currentlySelectedNode);
		return deleteConfirmationModal;
	}

	protected Long getRequestedNodeId() {
		StringValue id = getPageParameters().get("id");
		if (id.isEmpty()) {
			String key = getPageParameters().get("project-key")
					.toOptionalString();
			if (key != null) {
				ITreeNode<String> node = treeNodeService
						.getTreeNodeByKey(key);
				if (node != null) {
					id = StringValue.valueOf(node.getId());
				} else {
					// TODO give translated message for the 404 reason
					throw new AbortWithHttpErrorCodeException(404);
				}
			}
		}
		return id.toOptionalLong();
	}

	@SuppressWarnings("unchecked")
	protected Type getRequestedNode() {
		if (getRequestedNodeId() == null) {
			// create project
			return (Type) (new Project());
		} else {
			return (Type) treeNodeService.getTreeNode(getRequestedNodeId());
		}
	}

	@SuppressWarnings("unchecked")
	protected Type getRequestedNode(final Long requestedNodeId) {
		return (Type) treeNodeService.getTreeNode(requestedNodeId);
	}

	protected void selectCurrentNode(final Long requestedNodeId) {
		TreeNode node = treeNodeService
				.getTreeNode(requestedNodeId);
		if (node == null) {
			throw new eu.uqasar.exception.model.EntityNotFoundException(TreeNode.class, String.valueOf(requestedNodeId));
		}
		// select the requested node
		treePanel.getTree().selectNode(node);
	}

	protected void expandTreeToSelectedNode(final Long requestedNodeId) {
		TreeNode node = treeNodeService
				.getTreeNode(requestedNodeId);
		// add nodes and all parents to initial tree expansion
		while (node != null) {
			treePanel.getTree().getModel().getObject().add(node);
			node = node.getParent();
		}
	}

	@Override
	protected IModel<String> getPageTitleModel() {
		Type node = getRequestedNode();
		if (node != null) {
			return new StringResourceModel("page.title", this, Model.of(node));
		}
		return new StringResourceModel("page.title", this, null);
	}

	public static PageParameters forNode(ITreeNode<String> node) {
		if (node instanceof Project) {
			return forProject((Project) node);
		} else if (node instanceof QualityObjective) {
			return forQualityObjective((QualityObjective) node);
		} else if (node instanceof QualityIndicator) {
			return forQualityIndicator((QualityIndicator) node);
		} else if (node instanceof Metric) {
			return forMetric((Metric) node);
		}
		return new PageParameters();
	}

	public static PageParameters forProject(final Project project,
			final boolean newProject) {
		PageParameters params = new PageParameters();
		params.add("isNew", newProject);
		if (project != null) {
			return params.add("project-key", project.getNodeKey());
		} else {
			return params;
		}
	}

	public static PageParameters forProject(Project project) {
		if (project != null) {
			return forProject(project.getNodeKey());
		} else {
			return new PageParameters();
		}
	}

	public static PageParameters forProject(final String projectKey) {
		return new PageParameters().add("project-key", projectKey);
	}

	// New QO
	public static PageParameters forQualityObjective(QualityObjective objective,
			final boolean newQO) {
		PageParameters params = forProject(objective.getProject()).add("id", objective.getId());
		params.add("isNew", newQO);
		return params;
	}

	public static PageParameters forQualityObjective(QualityObjective objective) {
		return forProject(objective.getProject()).add("id", objective.getId());
	}

	// New QI
	public static PageParameters forQualityIndicator(QualityIndicator indicator,
			final boolean newQI) {
		PageParameters params
				= forProject(indicator.getProject()).add("id", indicator.getId());
		params.add("isNew", newQI);
		return params;
	}

	public static PageParameters forQualityIndicator(QualityIndicator indicator) {
		return forProject(indicator.getProject()).add("id", indicator.getId());
	}

	// New QM
	public static PageParameters forMetric(Metric metric, final boolean newM) {
		PageParameters params = forProject(metric.getProject()).add("id", metric.getId());
		params.add("isNew", newM);
		return params;
	}

	public static PageParameters forMetric(Metric metric) {
		return forProject(metric.getProject()).add("id", metric.getId());
	}

	public static PageParameters forAnalysis(Analysis analysis) {
		return new PageParameters().add("analysis-id", analysis.getId());
	}

	public static PageParameters forSnapshot(Snapshot snapshot){
		return new PageParameters().add("snap-id", snapshot.getId());
	}
}


text:
using UnityEngine;
using UnityEditor;
using AGXUnity;
using AGXUnity.Rendering;
using GUI = AGXUnity.Utils.GUI;

namespace AGXUnityEditor.Tools
{
  [CustomTool( typeof( DebugRenderManager ) )]
  public class DebugRenderManagerTool : CustomTargetTool
  {
    public DebugRenderManager Manager
    {
      get
      {
        return Targets[ 0 ] as DebugRenderManager;
      }
    }

    public DebugRenderManagerTool( Object[] targets )
      : base( targets )
    {
    }

    public override void OnPreTargetMembersGUI()
    {
      var skin = InspectorEditor.Skin;
      GUILayout.Label( GUI.MakeLabel( "Debug render manager", 16, true ),
                       skin.LabelMiddleCenter );

      var newRenderState = InspectorGUI.Toggle( GUI.MakeLabel( "Debug render shapes" ), Manager.RenderShapes );
      if ( newRenderState != Manager.RenderShapes ) {
        Manager.RenderShapes = newRenderState;
        EditorUtility.SetDirty( Manager );
      }
      InspectorGUI.UnityMaterial( GUI.MakeLabel( "Shape material" ),
                                  Manager.ShapeRenderMaterial,
                                  newMaterial => Manager.ShapeRenderMaterial = newMaterial );

      using ( new GUILayout.HorizontalScope() ) {
        Manager.RenderContacts = InspectorGUI.Toggle( GUI.MakeLabel( "Render contacts" ), Manager.RenderContacts );
        Manager.ContactColor = EditorGUILayout.ColorField( Manager.ContactColor );
      }

      Manager.ContactScale = EditorGUILayout.Slider( GUI.MakeLabel( "Scale" ), Manager.ContactScale, 0.0f, 1.0f );

      Manager.ColorizeBodies = InspectorGUI.Toggle( GUI.MakeLabel( "Colorize bodies",
                                                                   false,
                                                                   "Every rigid body instance will be rendered with a unique color (wire framed)." ),
                                                    Manager.ColorizeBodies );
      Manager.HighlightMouseOverObject = InspectorGUI.Toggle( GUI.MakeLabel( "Highlight mouse over object",
                                                                             false,
                                                                             "Highlight mouse over object in scene view." ),
                                                              Manager.HighlightMouseOverObject );
      Manager.IncludeInBuild = InspectorGUI.Toggle( GUI.MakeLabel( "Include in build",
                                                                   false,
                                                                   "Include debug rendering when building the project." ),
                                                    Manager.IncludeInBuild );
    }
  }
}


text:
<resources>
    <string name="app_name">RNBase</string>
</resources>


text:
package org.qcri.rheem.spark.mapping;

import org.qcri.rheem.basic.operators.CountOperator;
import org.qcri.rheem.core.mapping.*;
import org.qcri.rheem.core.types.DataSetType;
import org.qcri.rheem.spark.operators.SparkCountOperator;
import org.qcri.rheem.spark.platform.SparkPlatform;

import java.util.Collection;
import java.util.Collections;

/**
 * Mapping from {@link CountOperator} to {@link SparkCountOperator}.
 */
public class CountMapping implements Mapping {

    @Override
    public Collection<PlanTransformation> getTransformations() {
        return Collections.singleton(new PlanTransformation(
                this.createSubplanPattern(),
                this.createReplacementSubplanFactory(),
                SparkPlatform.getInstance()
        ));
    }

    private SubplanPattern createSubplanPattern() {
        final OperatorPattern operatorPattern = new OperatorPattern(
                "count", new CountOperator<>(DataSetType.none()), false
        );
        return SubplanPattern.createSingleton(operatorPattern);
    }

    private ReplacementSubplanFactory createReplacementSubplanFactory() {
        return new ReplacementSubplanFactory.OfSingleOperators<CountOperator>(
                (matchedOperator, epoch) -> new SparkCountOperator<>(matchedOperator).at(epoch)
        );
    }
}


text:
from .base import BaseAccessControlledModel
from girder.constants import AccessType
from girder.models.group import Group
from girder.models.item import Item
from girder.models.file import File
from bson.objectid import ObjectId

class Projection(BaseAccessControlledModel):
    def initialize(self):
        self.name = 'mdb.projections'
        self.ensureIndices(['datasetId'])

        self.types = {
            'voltage': float,
            'convergenceSemiAngle': float,
            'probeSize': float,
            'detectorInnerAngle': float,
            'detectorOuterAngle': float,
            'depthOfFocus': float,
            'pixelSize': float,
            'electronDose': float,
            'tiltRange': lambda v : self.validate_list(v, float),
            'nProjections': int
        }

    def create(self, dataset, emd_file_id, voltage=None, convergence_semi_angle=None,
               probe_size=None, detector_inner_angle=None, detector_outer_angle=None,
               depth_of_focus=None, pixel_size=None, tilt_range=None,
               electron_dose=None, number_projections=None, user=None, public=False):

        projection = {
            'datasetId': dataset['_id'],
            'emdFileId': emd_file_id,
            'voltage': voltage,
            'convergenceSemiAngle': convergence_semi_angle,
            'probeSize': probe_size,
            'detectorInnerAngle': detector_inner_angle,
            'detectorOuterAngle': detector_outer_angle,
            'depthOfFocus': depth_of_focus,
            'pixelSize': pixel_size,
            'tiltRange': tilt_range,
            'electronDose': electron_dose,
            'nProjections': number_projections
        }

        self.setPublic(projection, public)
        curator = list(Group().find({
            'name': 'curator',
        }))
        if len(curator) > 0:
            self.setGroupAccess(projection, group=curator[0], level=AccessType.ADMIN)

        self.setPublic(projection, public)

        if user:
            projection['userId'] = user['_id']
            self.setUserAccess(projection, user=user, level=AccessType.ADMIN)
        else:
            projection['userId'] = None

        return self.save(projection)

    def update(self, projection, projection_updates, user=None, public=None ):
        query = {
            '_id': projection['_id']
        }

        projection_updates = self.validate(projection_updates)

        updates = {}

        mutable_props = ['voltage', 'convergenceSemiAngle', 'probeSize',
                         'detectorInnerAngle', 'detectorOuterAngle',
                         'depthOfFocus', 'pixelSize', 'tiltRange',
                         'electronDose', 'nProjections']
        for prop in projection_updates:
            if prop in mutable_props:
                updates.setdefault('$set', {})[prop] = projection_updates[prop]

        if 'emdFileId' in projection_updates:
            updates.setdefault('$set', {})['emdFileId'] = ObjectId(projection_updates['emdFileId'])

        if public is not None:
            updates.setdefault('$set', {})['public'] = public

        if updates:
            file_id = projection['emdFileId']
            super(Projection, self).update(query, update=updates, multi=False)
            if 'emdFileId' in projection_updates and \
                projection_updates['emdFileId'] != file_id:
                f = File().load(file_id, force=True)
                if f is not None:
                    item =  Item().load(f['itemId'], force=True)
                    Item().remove(item)

            return self.load(projection['_id'], user=user, level=AccessType.READ)

        return projection

    def delete(self, projection, user):
        if 'emdFileId' in projection:
            emd_file = File().load(projection['emdFileId'], force=True)
            item =  Item().load(emd_file['itemId'], force=True)
            Item().remove(item)

        super(Projection, self).remove(projection)


text:
<?xml version='1.0' encoding='utf-8'?>
<resources>
    <string name="app_name">CBPlugins</string>
    <string name="launcher_name">@string/app_name</string>
    <string name="activity_name">@string/launcher_name</string>

    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>

    <string name="select_album">选择相册</string>
    <string name="album_loading">相册初始化中...</string>
</resources>


text:
package net.openhft.chronicle.queue.impl.single;

public class IndexNotAvailableException extends IllegalStateException {
    public IndexNotAvailableException(String s) {
        super(s);
    }
}


text:
package org.wildfly.swarm.opentracing.hawkular.jaxrs;

import org.hawkular.apm.api.services.TracePublisher;
import org.hawkular.apm.client.api.recorder.BatchTraceRecorder;
import org.hawkular.apm.client.api.recorder.LoggingRecorder;
import org.hawkular.apm.client.api.recorder.TraceRecorder;
import org.hawkular.apm.client.api.sampler.PercentageSampler;
import org.hawkular.apm.client.opentracing.APMTracer;
import org.hawkular.apm.client.opentracing.DeploymentMetaData;
import org.hawkular.apm.trace.publisher.rest.client.TracePublisherRESTClient;
import org.wildfly.swarm.spi.api.Fraction;
import org.wildfly.swarm.spi.api.annotations.DeploymentModule;
import org.wildfly.swarm.spi.api.annotations.DeploymentModules;

import io.opentracing.contrib.global.GlobalTracer;
import io.opentracing.contrib.jaxrs2.server.ServerTracingDynamicFeature;

/**
 * OpenTracing JAX-RS Hawkular fraction. This fraction traces all
 * server requests using OpenTracing API with Hawkular APM implementation.
 *
 *
Underneath It uses
 * www.github.com/opentracing-contrib/java-jaxrs
 * to do tracing. Therefore all tracing features provided by this library should be available.
 *
 *
 Tracer instance in REST handlers can be accessed via {@linkplain GlobalTracer#get()}
 *
 *
Initialization:
 * {@code
 *  OpenTracingHawkularFraction openTracingHawkularFraction = new OpenTracingHawkularFraction();
 *
 *  openTracingHawkularFraction.tracerBuilder()
 *      .withServiceName("wildfly-swarm")
 *      .withBatchRecorderBuilder(new OpenTracingHawkularFraction.TraceRecorderBuilder()
 *      .withHttpRecorder("jdoe", "password", "http://localhost:8180"))
 *      .withSampleRate(100);
 *
 *  container.fraction(openTracingHawkularFraction);
 * }
 * @author Pavol Loffay
 */
@DeploymentModules({
        @DeploymentModule(name = "io.opentracing.hawkular"),
        @DeploymentModule(name = "org.wildfly.swarm.opentracing.hawkular.jaxrs", slot = "main")
})
public class OpenTracingHawkularFraction implements Fraction<OpenTracingHawkularFraction> {

    private APMJaxRsTracingBuilder apmJaxRsTracingBuilder;

    public OpenTracingHawkularFraction() {
        this.apmJaxRsTracingBuilder = new APMJaxRsTracingBuilder();
    }

    @Override
    public OpenTracingHawkularFraction applyDefaults() {
        return this;
    }

    public APMJaxRsTracingBuilder apmJaxRsTracingBuilder() {
        return apmJaxRsTracingBuilder;
    }

    public ServerTracingDynamicFeature.Builder getJaxrsTraceBuilder() {
        return apmJaxRsTracingBuilder.build();
    }

    public class APMJaxRsTracingBuilder {
        private int percentageSampling = 100;
        private String serviceName;
        private String buildStamp;
        private boolean consoleRecorder;
        private TraceRecorderBuilder batchTraceRecorderBuilder;

        public APMJaxRsTracingBuilder withSampleRate(int percentage) {
            this.percentageSampling = percentage;
            return this;
        }

        public APMJaxRsTracingBuilder withServiceName(String serviceName) {
            this.serviceName = serviceName;
            return this;
        }

        public APMJaxRsTracingBuilder withBuilStamp(String buildStamp) {
            this.buildStamp = buildStamp;
            return this;
        }

        public APMJaxRsTracingBuilder withConsoleRecorder(boolean consoleRecorder) {
            this.consoleRecorder = consoleRecorder;
            return this;
        }

        public APMJaxRsTracingBuilder withBatchRecorderBuilder(TraceRecorderBuilder builder) {
            this.batchTraceRecorderBuilder = builder;
            return this;
        }

        private ServerTracingDynamicFeature.Builder build() {
            TraceRecorder traceRecorder = consoleRecorder ? new LoggingRecorder() :
                    batchTraceRecorderBuilder != null ?
                            this.batchTraceRecorderBuilder.build() : new BatchTraceRecorder();

            APMTracer apmTracer = new APMTracer(traceRecorder, PercentageSampler.withPercentage(percentageSampling),
                    new DeploymentMetaData(serviceName, buildStamp));

            GlobalTracer.register(apmTracer);

            return ServerTracingDynamicFeature.Builder
                    .traceAll(apmTracer);
        }
    }

    public static class TraceRecorderBuilder extends BatchTraceRecorder.BatchTraceRecorderBuilder {

        public TraceRecorderBuilder withHttpRecorder(String userName, String password, String url) {
            super.withTracePublisher(new TracePublisherRESTClient(userName, password, url));
            return this;
        }

        /**
         * Do not use this method instead use {@link #withHttpRecorder(String, String, String)}.
         *
         * @param tracePublisher trace publisher
         * @return builder
         */
        @Deprecated
        @Override
        public BatchTraceRecorder.BatchTraceRecorderBuilder withTracePublisher(TracePublisher tracePublisher) {
            throw new IllegalArgumentException("Please use #withHttpRecoreder");
        }

    }
}


text:
#import "FSPlaylistViewController.h"
#import "FSPlaylistItem.h"
#import "FSPlayerViewController.h"
#import "FSParsePlaylistFeedRequest.h"

@interface FSPlaylistViewController (PrivateMethods)

@property (nonatomic,readonly) FSParsePlaylistFeedRequest *request;

@end

@implementation FSPlaylistViewController

@synthesize navigationController=_navigationController;
@synthesize playerViewController=_playerViewContoller;
@synthesize playlistItems;

/*
 * =======================================
 * View controller
 * =======================================
 */

- (void)viewDidLoad
{
    [super viewDidLoad];

    __weak FSPlaylistViewController *weakSelf = self;

    _request = [[FSParsePlaylistFeedRequest alloc] init];
    _request.url = @"http://iPonyRadio.com/stations.xml";
    _request.onCompletion = ^() {
        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

        weakSelf.playlistItems = [[NSMutableArray alloc] initWithArray:weakSelf.request.playlistItems];
        [weakSelf.tableView reloadData];
    };
    _request.onFailure = ^() {
        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                        message:@"Failed to load playlists."
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];

        //Location Object
        FSAppDelegate *appDelegate = (FSAppDelegate *)[[UIApplication sharedApplication] delegate];

        //MMRequest Object
        MMRequest *request = [MMRequest requestWithLocation:appDelegate.locationManager.location];

        // Replace YOUR_APID with the APID provided to you by Millennial Media
        MMAdView *banner = [[MMAdView alloc] initWithFrame:MILLENNIAL_AD_VIEW_FRAME apid:@"135293"
                                        rootViewController:self];
        [self.view addSubview:banner];
        [banner getAdWithRequest:request onCompletion:^(BOOL success, NSError *error) {
            if (success) {
                NSLog(@"BANNER AD REQUEST SUCCEEDED");
            }
            else {
                NSLog(@"BANNER AD REQUEST FAILED WITH ERROR: %@", error); }
        }];

        [alert show];
    };
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
    self.navigationController.navigationBarHidden = NO;
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
    [_request start];
}

/*
 * =======================================
 * Table view
 * =======================================
 */

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
	return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
	return [[self playlistItems] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"FreeStreamPlayListItemCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    FSPlaylistItem *item = [[self playlistItems] objectAtIndex:indexPath.row];
    cell.textLabel.text = item.title;

	return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	FSPlaylistItem *item = [[self playlistItems] objectAtIndex:indexPath.row];

    self.playerViewController.selectedPlaylistItem = item;
    self.playerViewController.shouldStartPlaying = YES;

    [self.navigationController pushViewController:self.playerViewController animated:YES];
}

/*
 * =======================================
 * Private
 * =======================================
 */

- (FSParsePlaylistFeedRequest *)request
{
    return _request;
}

@end


text:
<!doctype html>

    <title>Code coverage report for src/__tests__/setup.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../prettify.css" />
    <link rel="stylesheet" href="../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

      all files / src/__tests__/ setup.js

        100%
        Statements
        4/4

        100%
        Branches
        0/0

        100%
        Functions
        0/0

        100%
        Lines
        4/4

1
2
3
4
5
6
7
8

1×
1×
1×

import {
  jsdom,
} from "jsdom";

global.document = jsdom(`<!doctype html><html><body></body></html>`);
global.window = document.defaultView;
global.navigator = global.window.navigator;

  Code coverage
  generated by istanbul at Thu Dec 10 2015 15:44:12 GMT+0800 (CST)


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2012 International Business Machines Corp.

  See the NOTICE file distributed with this work for additional information
  regarding copyright ownership. Licensed under the Apache License,
  Version 2.0 (the "License"); you may not use this file except in compliance
  with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<job id="job1" xmlns="http://batch.jsr352/jsl">
	<step id="MyGlobalStep" >
		<properties>
			<property name="javax.transaction.global.mode" value="true"></property>
			<property name="javax.transaction.global.timeout" value="600"></property>
		</properties>
		<chunk reader="DoSomethingItemReader"
		 writer="DoSomethingItemWriter"
		 processor="DoSomethingItemProcessor" buffer-size="1"
		 checkpoint-policy="item" />
	</step>
</job>


text:
'use strict';

// [START gae_node_request_example]
const express = require('express');

const app = express();

app.get('/', (req, res) => {
  res
    .status(200)
    .send('Hello, world!')
    .end();
});

// Start the server
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
  console.log(`App listening on port ${PORT}`);
  console.log('Press Ctrl+C to quit.');
});
// [END gae_node_request_example]


text:
/*
 * \brief
 * \author Sylvain Jaume, Francois Huguet
 */

# ifndef SO_VTK_GEOMETRICERRORMETRIC_H_
# define SO_VTK_GEOMETRICERRORMETRIC_H_

# include <Inventor/engines/SoSubEngine.h>

# include "xip/inventor/vtk/SoSFVtkAlgorithmOutput.h"
# include "xip/inventor/vtk/SoSFVtkObject.h"

# include "vtkGeometricErrorMetric.h"

# include "Inventor/fields/SoSFFloat.h"

class SoVtkGeometricErrorMetric : public SoEngine
{
	SO_ENGINE_HEADER( SoVtkGeometricErrorMetric );

public:

	/// Constructor
	SoVtkGeometricErrorMetric();

	/// Class Initialization
	static void initClass();

	// Inputs
	/// GenericCell of type vtkGenericAdaptorCell
	SoSFVtkObject GenericCell;
	/// DataSet of type vtkGenericDataSet
	SoSFVtkObject DataSet;
	/// AbsoluteGeometricTolerance
	SoSFFloat AbsoluteGeometricTolerance;

	// Outputs
	/// SoSFVtkObject of type vtkGenericAdaptorCell
	SoEngineOutput oGenericCell;
	/// SoSFVtkObject of type vtkGenericDataSet
	SoEngineOutput oDataSet;

protected:

	/// Destructor
	~SoVtkGeometricErrorMetric();

	/// Evaluate Function
	virtual void evaluate();

	/// inputChanged Function
	virtual void inputChanged(SoField *);

	/// reset Function
	virtual void reset();

	/// vtkGenericAdaptorCell
	SoVtkObject *mGenericCell;

	/// vtkGenericDataSet
	SoVtkObject *mDataSet;

private:

	vtkGeometricErrorMetric* mObject;
	/// addCalled checks if the Add*() method has been called
	bool addCalled;
};

#endif // SO_VTK_GEOMETRICERRORMETRIC_H_


text:
from django.utils.translation import ugettext_lazy as _
from rest_framework.fields import ChoiceField

class EnumField(ChoiceField):
    default_error_messages = {
        'invalid': _("No matching enum type.")
    }

    def __init__(self, **kwargs):
        self.enum_type = kwargs.pop("enum_type")
        kwargs.pop("choices", None)
        super(EnumField, self).__init__(self.enum_type.choices(), **kwargs)

    def to_internal_value(self, data):
        for choice in self.enum_type:
            if choice.name == data or choice.value == data:
                return choice
        self.fail("invalid")

    def to_representation(self, value):
        # this can be either an enum member or a "choice", i.e. a str
        if hasattr(value, "value"):
            return value.value
        return value


text:
package models

import (
  "regexp"
  "github.com/astaxie/beego/validation"
)

type FormAccountSignUp struct {
  First           string `valid:"Required;MinSize(2);Alpha"`
  Last            string `valid:"Required;MinSize(2);Alpha"`
  Email           string `valid:"Email"`
  Password        string `valid:"MinSize(8);MaxSize(36)"`
  ConfirmPassword string `valid:"Required"`
}

type FormAccountUpdate struct {
  First           string `valid:"Required;MinSize(2);Alpha"`
  Last            string `valid:"Required;MinSize(2);Alpha"`
  Email           string `valid:"Email"`
  Phone1          string
  Phone2          string
  Address         string
  CurrentPassword string `valid:"Required"`
}

type FormPasswordUpdate struct {
  NewPassword              string `valid:"MinSize(8);MaxSize(36)"`
  NewPasswordConfirmation  string `valid:"Required"`
  CurrentPassword          string `valid:"Required"`
}

func (form *FormPasswordUpdate) Valid(v *validation.Validation) {
  // Check passwords match
  if form.NewPassword != form.NewPasswordConfirmation {
    v.SetError("NewPassword", "Passwords don't match")
    v.SetError("NewPasswordConfirmation", "Passwords don't match")
  }

  // Check password contain capital letter
  r, _ := regexp.Compile(`[A-Z]`)

  if !r.MatchString(form.NewPassword) {
    v.SetError("NewPassword", "Password must contain at least one capital letter")
  }

  // Check password contain lowercase letter
  r, _ = regexp.Compile(`[a-z]`)

  if !r.MatchString(form.NewPassword) {
    v.SetError("NewPassword", "Password must contain at least one lower case letter")
  }

  // Check password contain number
  r, _ = regexp.Compile(`[0-9]`)

  if !r.MatchString(form.NewPassword) {
    v.SetError("NewPassword", "Password must contain at least one number")
  }

}//end FormPasswordUpdate.valid func

func (form *FormAccountSignUp) Valid(v *validation.Validation) {

  // Check passwords match
  if form.Password != form.ConfirmPassword {
    v.SetError("Password", "Passwords don't match")
    v.SetError("ConfirmPassword", "Passwords don't match")
  }

  // Check password contain capital letter
  r, _ := regexp.Compile(`[A-Z]`)

  if !r.MatchString(form.Password) {
    v.SetError("Password", "Password must contain at least one capital letter")
  }

  // Check password contain lowercase letter
  r, _ = regexp.Compile(`[a-z]`)

  if !r.MatchString(form.Password) {
    v.SetError("Password", "Password must contain at least one lower case letter")
  }

  // Check password contain number
  r, _ = regexp.Compile(`[0-9]`)

  if !r.MatchString(form.Password) {
    v.SetError("Password", "Password must contain at least one number")
  }

}//end FormAccountSignUp validation

func (form *FormAccountUpdate) Valid(v *validation.Validation) {

  valid := validation.Validation{}

  if form.Phone1 != "" {
    matched, err := regexp.MatchString("^\\d{3}\\-\\d{3}\\-\\d{4}$", form.Phone1)

    if err != nil {
      v.SetError("Phone1", "Something wierd is going on here.")
    } else if !matched {
      v.SetError("Phone1", "Phone should be something like: 647-123-4567")
    }
  } // end Phone1 validation if block

  if form.Phone2 != "" {
    matched, err := regexp.MatchString("^\\d{3}\\-\\d{3}\\-\\d{4}$", form.Phone2)

    if err != nil {
      v.SetError("Phone2", "Something wierd is going on here.")
    } else if !matched {
      v.SetError("Phone2", "Phone should be something like: 647-123-4567")
    }
  } // end Phone2 validation if block

  for _, err := range valid.Errors {
    v.SetError(err.Key, err.Message)
  }

}//end FormAccountUpdate validation


text:
#include <ztest.h>
#include <kernel.h>
#include <cmsis_os2.h>

struct sample_data {
	int data1;
	unsigned char data2;
	unsigned int data3;
};

#define MESSAGE1        512
#define MESSAGE2        123456
#define TIMEOUT_TICKS   50
#define Q_LEN           5
#define STACKSZ         CONFIG_CMSIS_V2_THREAD_MAX_STACK_SIZE

osMessageQueueId_t message_id;

void send_msg_thread(void *argument)
{
	int i;
	osStatus_t status;
	u32_t sample = MESSAGE1;
	struct sample_data data[Q_LEN] = { 0 };

	/* Wait for message_recv to complete initial checks */
	osDelay(TIMEOUT_TICKS);

	/* Prepare and send the 1st message (a simple integer data) */
	status = osMessageQueuePut(message_id, &sample, 0, osWaitForever);
	zassert_true(status == osOK, "osMessageQueuePut failure for Message1");

	/* The Queue should be empty at this point */
	zassert_equal(osMessageQueueGetCount(message_id), 0,
		      "Something's wrong with osMessageQueueGetCount!");
	zassert_equal(osMessageQueueGetSpace(message_id), Q_LEN,
		      "Something's wrong with osMessageQueueGetSpace!");

	/* Fill the queue with blocks of messages */
	for (i = 0; i < Q_LEN; i++) {
		data[i].data1 = i * 3;
		data[i].data2 = i * 3 + 1;
		data[i].data3 = i * 3 + 2;
		status = osMessageQueuePut(message_id, data + i,
					   0, osWaitForever);
		zassert_true(status == osOK,
			     "osMessageQueuePut failure for message!");
	}

	/* The Queue should be full at this point */
	zassert_equal(osMessageQueueGetCount(message_id), Q_LEN,
		      "Something's wrong with osMessageQueueGetCount!");
	zassert_equal(osMessageQueueGetSpace(message_id), 0,
		      "Something's wrong with osMessageQueueGetSpace!");

	/* Try putting message to a full queue immediately
	 * before it is emptied out and assert failure
	 */
	sample = MESSAGE2;
	status = osMessageQueuePut(message_id, &sample, 0, 0);
	zassert_true(status == osErrorResource,
		     "Something's wrong with osMessageQueuePut!");

	/* Try putting message to a full queue within a duration
	 * less than TIMEOUT_TICKS, before the queue is emptied out
	 */
	sample = MESSAGE2;
	status = osMessageQueuePut(message_id, &sample, 0, TIMEOUT_TICKS / 2);
	zassert_true(status == osErrorTimeout,
		     "Something's wrong with osMessageQueuePut!");

	/* Send another message after the queue is emptied */
	sample = MESSAGE2;
	status = osMessageQueuePut(message_id, &sample, 0, TIMEOUT_TICKS * 2);
	zassert_true(status == osOK,
		     "osMessageQueuePut failure for message!");
}

void message_recv(void)
{
	int i;
	osStatus_t status;
	u32_t sample;
	struct sample_data recv_data;

	/* Try getting message immediately before the queue is populated */
	status = osMessageQueueGet(message_id, (void *)&sample, NULL, 0);
	zassert_true(status == osErrorResource,
		     "Something's wrong with osMessageQueueGet!");

	/* Try receiving message within a duration of TIMEOUT */
	status = osMessageQueueGet(message_id, (void *)&sample,
				   NULL, TIMEOUT_TICKS);
	zassert_true(status == osErrorTimeout,
		     "Something's wrong with osMessageQueueGet!");

	zassert_equal(osMessageQueueGetCapacity(message_id), Q_LEN,
		      "Something's wrong with osMessageQueueGetCapacity!");

	zassert_equal(osMessageQueueGetMsgSize(message_id),
		      sizeof(struct sample_data),
		      "Something's wrong with osMessageQueueGetMsgSize!");

	/* Receive 1st message */
	status = osMessageQueueGet(message_id, (void *)&sample,
				   NULL, osWaitForever);
	zassert_true(status == osOK, "osMessageQueueGet failure");
	zassert_equal(sample, MESSAGE1, NULL);

	/* Wait for queue to get filled */
	osDelay(TIMEOUT_TICKS);

	/* Empty the queue */
	for (i = 0; i < Q_LEN; i++) {
		status = osMessageQueueGet(message_id, (void *)&recv_data, NULL,
					   osWaitForever);
		zassert_true(status == osOK, "osMessageQueueGet failure");

		zassert_equal(recv_data.data1, i * 3, NULL);
		zassert_equal(recv_data.data2, i * 3 + 1, NULL);
		zassert_equal(recv_data.data3, i * 3 + 2, NULL);
	}

	/* Receive the next message */
	status = osMessageQueueGet(message_id, (void *)&sample,
				   NULL, osWaitForever);
	zassert_true(status == osOK, "osMessageQueueGet failure");
	zassert_equal(sample, MESSAGE2, NULL);
}

static K_THREAD_STACK_DEFINE(test_stack, STACKSZ);
osThreadAttr_t thread_attr = {
	.name = "send_thread",
	.stack_mem = &test_stack,
	.stack_size = STACKSZ,
	.priority = osPriorityNormal,
};

static char __aligned(4) sample_mem[sizeof(struct sample_data) * Q_LEN];
static const osMessageQueueAttr_t init_mem_attrs = {
	.name = "TestMsgQ",
	.attr_bits = 0,
	.cb_mem = NULL,
	.cb_size = 0,
	.mq_mem = sample_mem,
	.mq_size = sizeof(struct sample_data) * Q_LEN,
};

void test_messageq(void)
{
	osStatus_t status;
	u32_t sample = MESSAGE1;
	osThreadId_t tid;

	message_id = osMessageQueueNew(Q_LEN, sizeof(struct sample_data),
				       &init_mem_attrs);
	zassert_true(message_id != NULL, "Message creation failed");

	tid = osThreadNew(send_msg_thread, NULL, &thread_attr);
	zassert_true(tid != NULL, "Thread creation failed");

	message_recv();

	/* Wait for the send_msg_thread to terminate before this thread
	 * terminates.
	 */
	osDelay(TIMEOUT_TICKS / 10);

	/* Make sure msgq is empty */
	zassert_equal(osMessageQueueGetCount(message_id), 0,
		      "Something's wrong with osMessageQueueGetCount!");

	status = osMessageQueuePut(message_id, &sample, 0, osWaitForever);
	zassert_true(status == osOK, "osMessageQueuePut failure for Message1");

	zassert_equal(osMessageQueueGetCount(message_id), 1,
		      "Something's wrong with osMessageQueueGetCount!");

	status = osMessageQueueReset(message_id);
	zassert_true(status == osOK, "osMessageQueueReset failure");

	/* After reset msgq must be empty */
	zassert_equal(osMessageQueueGetCount(message_id), 0,
		      "Something's wrong with osMessageQueueGetCount!");

	status = osMessageQueueDelete(message_id);
	zassert_true(status == osOK, "osMessageQueueDelete failure");
}


text:
define({
    select: "ã_Select_Ç",
    results: "ã_Results_Ç",
    selectLayer: "ã_Select from layer:_Ç",
    selectDrawtool: "ã_Select draw tool:_Ç",
    result: "ã_Result:_Ç",
    noresult: "ã_No query results to display chart._Ç",
    nomedia: "ã_There's no media in configuration!_Ç",
    envelop: "ã_Draw Rectangle_Ç",
    circle: "ã_Draw Circle_Ç",
    ellipse: "ã_Draw Ellipse_Ç",
    polygon: "ã_Draw Polygon_Ç",
    freehand: "ã_Draw Freehand Polygon_Ç",
    clear:"ã_Clear_Ç"
});