text:
namespace MinimapPingEnemyHero {

	static bool Enable;
	static bool ShowEnemy;
	static bool ShowFriend;
	static bool AltIcon;
	static bool IgnoreSpecialHero;

	//²âÊÔÏÔʾ·½Ïò
	static UnitGroup *Heroes;
	static std::map<Unit *, UnitStateIcon *> HeroDirectionIconMap;

	void onRefreshHeroDirection(Timer *tm)
	{
		for (std::map<Unit *, UnitStateIcon *>::iterator iter = HeroDirectionIconMap.begin();
			iter != HeroDirectionIconMap.end(); ++iter)
		{
			if (!Heroes->has(iter->first))
			{
				delete (iter->second);
				HeroDirectionIconMap.erase(iter->first);
				break;
			}
		}

		for (UnitGroup::iterator iter = Heroes->begin(); iter != Heroes->end(); ++iter)
		{
			Unit *hero = *iter;
			//¼ÆËãÏà¶ÔÓÚµ±Ç°ÆÁÄ»·½Ïò
			Point pointCamera(Jass::GetCameraTargetPositionX(), Jass::GetCameraTargetPositionY());
			float direction = pointCamera.angleTo(hero->position());
			float distance = pointCamera.distanceTo(hero->position());

			//FramePoint fp;
			//hero->framepointGet(&fp);
			bool bIsInvisible = //fp.x < 0 || fp.x > 0.8f || fp.y < 0 || fp.y > 0.6f;
				distance > 1300;

			UnitStateIcon *icon;
			float size = 0.02f;
			if ( !HeroDirectionIconMap.count(hero) )
			{
				icon = new UnitStateIcon(UI_NULL, size, size, hero );
				icon->setParent(UIObject::GetMinimapFrame());
				HeroDirectionIconMap[hero] = icon;
			}
			else
			{
				icon = HeroDirectionIconMap[hero];
			}

			float bottom = 0.15f + size/2, top = 0.575f - size/2, left = size/2, right = 0.8f - size/2;
			float height = top - bottom, width = right - left;
			float midX = left + width/2;
			float midY = bottom + height/2;

			float diag = atan2(height, width);

			//clip
			float x, y;
			if ( abs(sin(direction)) > sin(diag) )
			{
				if (sin(direction) > 0)
				{
					y = height/2;
					x = y / tan(direction);
				}
				else
				{
					y = -height/2;
					x = y / tan(direction);
				}
			}
			else
			{
				if (cos(direction) > 0)
				{
					x = width/2;
					y = x * tan(direction);
				}
				else
				{
					x = -width/2;
					y = x * tan(direction);
				}
			}

			if (bIsInvisible)
			{
				icon->show(true);
				//icon->setColor(1, 1, 1,
				//	1 - ( (distance - 1300) / 7500)
				//);
				icon->setAbsolutePosition(POS_C, midX + x, midY + y);
			}
			else
			{
				icon->show(false);
			}

		}
	}

	static void DumpAbilities(Unit* u) {
		OutputDebug("UNIT: 0x%X TYPE: %s\n", u->handleId(), u->typeIdChar());
		Ability* head = u->AbilityListHead();
		while (head) {

			OutputDebug("%s %s\n", head->typeIdChar(), head->className());

			head = head->nextNode();
		}
	}

	static bool WantIgnore(Unit* u) {
		bool rv = false;
		//ºöÂÔÓÐÓÀ¾ÃÎ޵кͻȳæµÄÓ¢ÐÛ
		if (IgnoreSpecialHero) {
			rv = rv || (NULL != u->AbilityById('Avul') || NULL != u->AbilityById('Aloc'));
		}
		return rv;
	}

	void onTimer(Timer *tm) {
		if (!Enable) return;

		PlayerGroup p;
		if (!ShowEnemy && !ShowFriend) return;
		else if (ShowEnemy && ShowFriend) p = PlayerGroupAll();
		else if (ShowEnemy && !ShowFriend) {
			p = PlayerGroup(
				NULL,
				PlayerFilter::ALLIANCE_PASSIVE | PlayerFilter::ALLIANCE_SHARED_VISION,
				PlayerLocal()
			);
		}
		else {
			p = PlayerGroup(
				PlayerFilter::ALLIANCE_PASSIVE | PlayerFilter::ALLIANCE_SHARED_VISION,
				NULL,
				PlayerLocal()
			);
		}

		UnitGroup *groupAllHeroes =
			GroupUnits(
				NULL,
				NULL,
				p,
				NULL,
				UnitFilter(
					UnitFilter::HERO | UnitFilter::VISIBLE,
					UnitFilter::DEAD
				)
			);

		Heroes->copy(groupAllHeroes);

		uint32_t red, green, blue, alpha;
		GroupForEachUnit(groupAllHeroes, hero,
			if (!WantIgnore(hero)) {
				if ( !AltIcon )
				{
					Jass::UnitSetUsesAltIcon(hero->handleId(), false);
					GetPlayerColor(hero->owner(), red, green, blue, alpha, false);
					PingMinimapEx(hero->x(), hero->y(), 0.3f, red, green, blue, false);
				}
				else
				{
					Jass::SetAltMinimapIcon("UI\\Minimap\\MinimapIconCreepLoc.blp");
					Jass::UnitSetUsesAltIcon(hero->handleId(), true);
				}
			}
		);
		GroupDestroy(groupAllHeroes);
	}

	static CheckBox*	CbEnablePing;
	static Label*		LbEnablePing;
	static CheckBox*	CbEnablePingEnemy;
	static Label*		LbEnablePingEnemy;
	static CheckBox*	CbEnablePingAlly;
	static Label*		LbEnablePingAlly;
	static CheckBox*	CbEnableAltIcon;
	static Label*		LbEnableAltIcon;
	static CheckBox*	CbIgnoreInvulnerableUnit;
	static Label*		LbIgnoreInvulnerableUnit;

	static void Dependency(CheckBox* cb, bool flag) {
		CbEnablePingEnemy->activate(flag);
		LbEnablePingEnemy->activate(flag);
		CbEnablePingAlly->activate(flag);
		LbEnablePingAlly->activate(flag);
		CbEnableAltIcon->activate(flag);
		LbEnableAltIcon->activate(flag);
		CbIgnoreInvulnerableUnit->activate(flag);
		LbIgnoreInvulnerableUnit->activate(flag);
	}

	static void CreateMenuContent(){

		UISimpleFrame* Panel = DefaultOptionMenuGet()->category(StringManager::GetString(STR::MAPHACK_CATEGORYNAME));

		CbEnablePing = new CheckBox(Panel);
		CbEnablePing->bindProfile("MinimapPingEnemyHero", "Enable", true);
		CbEnablePing->bindVariable(&Enable);
		CbEnablePing->bindCallback(Dependency);
		CbEnablePing->setRelativePosition(
			POS_UL, Panel, POS_UL,
			0.03f + Panel->width()/2, -0.03f);
		LbEnablePing = new Label(Panel, StringManager::GetString(STR::PINGHERO_ENABLE), 0.013f);
		LbEnablePing->setRelativePosition(
			POS_L,
			CbEnablePing->getFrame(),
			POS_R,
			0.01f, 0);

		CbEnablePingEnemy = new CheckBox(Panel);
		CbEnablePingEnemy->bindProfile("MinimapPingEnemyHero", "ShowEnemy", true);
		CbEnablePingEnemy->bindVariable(&ShowEnemy);
		CbEnablePingEnemy->setRelativePosition(
			POS_UL,
			Panel,
			POS_UL,
			0.03f + Panel->width()/2, -0.057f);
		LbEnablePingEnemy = new Label(Panel, StringManager::GetString(STR::PINGHERO_ENEMY), 0.013f);
		LbEnablePingEnemy->setRelativePosition(
			POS_L,
			CbEnablePingEnemy->getFrame(),
			POS_R,
			0.01f, 0);

		CbEnablePingAlly = new CheckBox(Panel);
		CbEnablePingAlly->bindProfile("MinimapPingEnemyHero", "ShowFriend", false);
		CbEnablePingAlly->bindVariable(&ShowFriend);
		CbEnablePingAlly->setRelativePosition(
			POS_UL,
			Panel,
			POS_UL,
			0.03f + Panel->width()/2, -0.084f);
		LbEnablePingAlly = new Label(Panel, StringManager::GetString(STR::PINGHERO_FRIEND), 0.013f);
		LbEnablePingAlly->setRelativePosition(
			POS_L,
			CbEnablePingAlly->getFrame(),
			POS_R,
			0.01f, 0);

		CbEnableAltIcon = new CheckBox(Panel);
		CbEnableAltIcon->bindProfile("MinimapPingEnemyHero", "AltIcon", false);
		CbEnableAltIcon->bindVariable(&AltIcon);
		CbEnableAltIcon->setRelativePosition(
			POS_UL,
			Panel,
			POS_UL,
			0.03f + Panel->width()/2, -0.111f);
		LbEnableAltIcon = new Label(Panel, StringManager::GetString(STR::PINGHERO_ALTICON), 0.013f);
		LbEnableAltIcon->setRelativePosition(
			POS_L,
			CbEnableAltIcon->getFrame(),
			POS_R,
			0.01f, 0);

		CbIgnoreInvulnerableUnit = new CheckBox(Panel);
		CbIgnoreInvulnerableUnit->bindProfile("MinimapPingEnemyHero", "IgnoreSpecialHero", true);
		CbIgnoreInvulnerableUnit->bindVariable(&IgnoreSpecialHero);
		CbIgnoreInvulnerableUnit->setRelativePosition(
			POS_UL,
			Panel,
			POS_UL,
			0.03f + Panel->width()/2, -0.138f);
		LbIgnoreInvulnerableUnit = new Label(Panel, StringManager::GetString(STR::PINGHERO_IGNORE_SPECIAL), 0.013f);
		LbIgnoreInvulnerableUnit->setRelativePosition(
			POS_L,
			CbIgnoreInvulnerableUnit->getFrame(),
			POS_R,
			0.01f, 0);

		Dependency(CbEnablePing, CbEnablePing->isChecked());
	}

	void Init(){
		CreateMenuContent();
		GetTimer(1.5, onTimer, true)->start();

		Heroes = new UnitGroup();
		//GetTimer(0.01, onRefreshHeroDirection, true)->start();
	}

	void Cleanup(){
		//for (std::map<Unit *, UnitStateIcon *>::iterator iter = HeroDirectionIconMap.begin();
		//	iter != HeroDirectionIconMap.end(); ++iter)
		//{
		//	delete iter->second;
		//}
		//HeroDirectionIconMap.clear();

		GroupDestroy(Heroes);
	}
}


text:
<?php
namespace Icecave\Agenda\Schedule;

use Icecave\Agenda\TypeCheck\TypeCheck;
use Icecave\Chrono\Interval\IntervalInterface;
use Icecave\Chrono\TimePointInterface;

abstract class AbstractSchedule implements ScheduleInterface
{
    public function __construct()
    {
        $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
    }

    /**
     * @param TimePointInterface $timePoint
     *
     * @return TimePointInterface|null The next scheduled time point.
     */
    public function firstEventAfter(TimePointInterface $timePoint)
    {
        TypeCheck::get(__CLASS__)->firstEventAfter(func_get_args());

        return $this->firstEventFrom($timePoint->add(1));
    }

    /**
     * @param IntervalInterface $interval
     *
     * @return TimePointInterface|null The next scheduled time point.
     */
    public function firstEventDuring(IntervalInterface $interval)
    {
        TypeCheck::get(__CLASS__)->firstEventDuring(func_get_args());

        $timePoint = $this->firstEventFrom($interval->start());
        if ($interval->contains($timePoint)) {
            return $timePoint;
        }

        return null;
    }

    private $typeCheck;
}

redpajama_set_name: RedPajamaGithub


text:
from enum import Enum
from typing import NamedTuple, Dict, List, Mapping

from pyrsistent.typing import PMap

from solo.configurator.config.routes import ViewMeta
from solo.configurator.config.sums import SumType

class HttpMethod(Enum):
    HEAD = 'head'
    GET = 'get'
    POST = 'post'

    def __lt__(self, other: 'HttpMethod') -> bool:
        return self.value.__lt__(other.value)

class ScopeType(Enum):
    HTTP_REQUEST = 'http'

class ScopeScheme(Enum):
    HTTP = 'http'

class ScopeServer(NamedTuple):
    host: str
    port: int

class Scope(NamedTuple):
    type: ScopeType
    scheme: ScopeScheme
    root_path: str
    server: ScopeServer
    http_version: str
    method: HttpMethod
    path: str
    headers: PMap[str, str]
    query_string: bytes

class PredicatedHandler:
    __slots__ = ('rules', 'view_metas')

    def __init__(self, rules: Dict[str, SumType], view_metas: List[ViewMeta]):
        self.view_metas = view_metas
        self.rules = rules

    def __call__(self, **kw):
        return

class MatchedRoute(NamedTuple):
    controller: PredicatedHandler
    params: Mapping[str, str]


text:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft shared
// source or premium shared source license agreement under which you licensed
// this source code. If you did not accept the terms of the license agreement,
// you are not authorized to use this source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the SOURCE.RTF on your install media or the root of your tools installation.
// THE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
/*
 *	@doc
 *
 *	@module _RANGE.H -- CTxtRange Class |
 *
 *		This class implements the internal text range and the TOM ITextRange
 *
 *	Authors: <nl>
 *		Original RichEdit code: David R. Fulmer
 *		Christian Fortini
 *		Murray Sargent
 *		Alex Gounares (floating ranges, etc.)
 *
 */

#ifndef _RANGE_H
#define _RANGE_H

#include "_text.h"
#include "_m_undo.h"
#include "_rtext.h"
#include "_edit.h"

long	FPPTS_TO_TWIPS(float x);
#define TWIPS_TO_FPPTS(x) (((float)(x)) * (float)0.05)

class CTxtEdit;
class CTxtFont;

/*
 *	SELRR
 *
 *	@enum	flags used to control how ReplaceRange (RR) should generate
 *			selection anti-events
 */
enum SELRR
{
	SELRR_IGNORE		= 0,
    SELRR_REMEMBERRANGE = 1,
    SELRR_REMEMBERCPMIN = 2,
    SELRR_REMEMBERENDIP = 3
};

/*
 *	FINDWORD_TYPE
 *
 *	@enum	defines the different cases for finding a word
 */
enum FINDWORD_TYPE {
	FW_EXACT	= 1,		//@emem	Finds the word exactly (no extra chars)
	FW_INCLUDE_TRAILING_WHITESPACE = 2,	//@emem find the word plus the
							// following whitespace (ala double-clicking)
};

enum MOVES
{
	MOVE_START = -1,
	MOVE_IP = 0,
	MOVE_END = 1,
};

enum MATCHES
{
	MATCH_UNTIL = 0,
	MATCH_WHILE = 1
};

enum EOPADJUST
{
	NONEWCHARS = 0,
	NEWCHARS = 1
};

/*
 *	CTxtRange
 *
 * 	@class
 *		The CTxtRange class implements RichEdit's text range, which is the
 *		main conduit through which changes are made to the document.
 *		The range inherits from the rich-text ptr, adding a signed length
 *		insertion-point char-format index, and a ref count for use when
 *		instantiated as a TOM ITextRange.  The range object also contains
 *		a flag that reveals whether the range is a selection (with associated
 *		screen behavior) or just a simple range.  This distinction is used
 *		to simplify some of the code.
 *
 *		Some methods are virtual to allow CTxtSelection objects to facilitate
 *		UI features and selection updating.
 *
 *		See tom.doc for lots of discussion on range and selection objects and
 *		on all methods in ITextRange, ITextSelection, ITextFont, and ITextPara.
 */
class CTxtRange : public ITextSelection, public CRchTxtPtr
{
	friend CTxtFont;

//@access Protected Data
protected:
	LONG	_cch;			//@cmember # chars in range. _cch > 0 for active
							//			end at range end (cpMost)
	LONG	_iFormat;		//@cmember Character format for degenerate range
	LONG	_cRefs;			//@cmember ITextRange/ITextSelection ref count

	union
	{
	  DWORD _dwFlags;			// All together now
	  struct
	  {
		DWORD _fExtend :1;		//@cmember True iff Advance methods should
								//  	   leave "other" end unchanged
		DWORD _fSel :1;			//@cmember True iff this is a CTxtSelection
		DWORD _fDragProtection :1;	//@cmember True is this range should think
								//	it's protected.  Set by drag/drop code
		DWORD _fDontUpdateFmt:1;//@cmember Don't update _iFormat
		DWORD _fDualFontMode:1;	//@cmember Set during dual font mode
		DWORD _fUseiFormat:1;	//@cmember Use iFormat when replacing
								// a non-degenerate range
		DWORD _fMoveBack:1;		//@cmember TRUE if last change moved backward
		DWORD _fSelHasEOP:1;	//@cmember TRUE if Sel has EOP
		DWORD _fSelHasCell:1;	//@cmember TRUE if Sel CELL	found looking for EOP
	  };
	};

//@access Public methods
public:

#ifdef DEBUG
	BOOL	Invariant( void ) const;
#endif // DEBUG

	CTxtRange(const CTxtRange &rg);
	CTxtRange(CTxtEdit *ped, LONG cp = 0, LONG cch = 0);
	virtual	~CTxtRange();

	virtual CRchTxtPtr& 	operator =(const CRchTxtPtr &rtp);
	virtual CTxtRange&		operator =(const CTxtRange &rp);

	// ITxNotify methods
										//@cmember Handles notifications
	virtual void OnPreReplaceRange(		//  prior to ReplaceRange calls
				DWORD cp, DWORD cchDel, DWORD cchNew,
				DWORD cpFormatMin, DWORD cpFormatMax);
										//@cmember Handles notifications for
	virtual void OnPostReplaceRange(	//  floating range and display updates
				DWORD cp, DWORD cchDel, DWORD cchNew,
				DWORD cpFormatMin, DWORD cpFormatMax);
	virtual	void Zombie();				//@cmember Convert range into zombie

	void	SetIgnoreFormatUpdate(BOOL fUpdate) { _fDontUpdateFmt = fUpdate; }

	void	SetDualFontMode(BOOL fDualFontMode) {_fDualFontMode = fDualFontMode; }

	// Internal cp/cch methods
    LONG 	GetCch (void) const			//@cmember Get signed character count
				{return _cch;}
    BOOL 	CpInRange (LONG cp) const;	//@cmember Says if cp is in this range
	BOOL	CheckTextLength (LONG cch);	//@cmember Says if cch chars can fit
	LONG	CheckChange(LONG cpSave);	//@cmember Used after _cp change to set
										//  selection-changed flag, choose _cch
										 //@cmember In outline mode, maintain _fSelHasEOP
	BOOL	CheckIfSelHasEOP(LONG cpSave, LONG cchSave);

	// GetRange() is faster than calling GetCpMin() and GetCpMost();
    LONG    GetCpMin () const;			//@cmember Get cp of first char in range
    LONG    GetCpMost () const;			//@cmember Get cp just beyond last char in range
										//@cmember Get range ends and count
	LONG	GetRange (LONG& cpMin, LONG& cpMost) const;
    BOOL	Set(LONG cp, LONG cch);
	DWORD	SetCp(DWORD cp);
    void 	SetExtend(unsigned f)			{_fExtend = f;}
	LONG	GetAdjustedTextLength() const
			{return GetPed()->GetAdjustedTextLength();}

	// Range specific methods
	LONG	Advance(LONG cch);
	void 	Collapser(long fStart);
	void 	FlipRange();
	LONG 	CleanseAndReplaceRange(
				LONG cch,
				TCHAR const *pch,
				BOOL fTestLimit,
				IUndoBuilder *publdr);
	BOOL	AdjustEndEOP (EOPADJUST NewChars);

	// Outline management
	void	CheckOutlineLevel(IUndoBuilder *publdr);
#ifdef PWD_JUPITER // GuyBark 81387: Allow undo of expand/collapse operation
	HRESULT	ExpandOutline  (LONG Level, BOOL fWholeDocument, IUndoBuilder *publdr);
	HRESULT	OutlineExpander(LONG Level, BOOL fWholeDocument, IUndoBuilder *publdr);
#else
	HRESULT	ExpandOutline  (LONG Level, BOOL fWholeDocument);
	HRESULT	OutlineExpander(LONG Level, BOOL fWholeDocument);
#endif // PWD_JUPITER
	HRESULT	Promote		   (LPARAM lparam, IUndoBuilder *publdr);

	// ReplaceRange must be virtual since the callers of
	// CLightDTEngine::CutRangeToClipboard() cast CTxtSelection* to CTxtRange*
	virtual	LONG 	ReplaceRange(LONG cchNew, TCHAR const *pch, IUndoBuilder *publdr,
						SELRR selaemode);
	virtual	BOOL 	Update(BOOL fScrollIntoView);

	//
	// Rich-text methods
	//

	enum { PROTECTED_YES, PROTECTED_NO, PROTECTED_ASK };

	// Get/Set Char/Para Format methods
	void 	Update_iFormat(LONG iFmtDefault);
	LONG	Get_iCF();						//@cmember Get range CF index
    void	Set_iCF(LONG iFormat);			//@cmember Set range CF index
	LONG	Get_iPF();						//@cmember Get active end PF index
	int		IsProtected(LONG iDirection);	//@cmember Is range protected?
	BOOL	IsZombie() {return !GetPed();}	//@cmember Is range zombied?
	BOOL	WriteAccessDenied ();
	void	GetCharFormat(CCharFormat *pcf, DWORD flags = 0) const;
	void	GetParaFormat(CParaFormat *pcf) const;
	void	SetDragProtection(BOOL fSet)	// Convinces range it's protected
				{_fDragProtection = fSet;}	//  w/o modifying backing store
	HRESULT	CharFormatSetter (const CCharFormat *pCF);
	HRESULT	ParaFormatSetter (const CParaFormat *pPF);

	// flags for SetCharFormat.
	enum { APPLYTOWORD = 1, IGNORESELAE = 2 };
	HRESULT	SetCharFormat(const CCharFormat *pCF, DWORD flags,
						  IUndoBuilder *publdr = NULL);
	HRESULT	SetParaFormat(const CParaFormat *pPF,
						  IUndoBuilder *publdr = NULL);
	HRESULT	SetParaStyle (const CParaFormat *pPF,
						  IUndoBuilder *publdr = NULL);

	// Find enclosing unit methods
	HRESULT	Expander	 (long Unit, BOOL fExtend, LONG *pDelta,
						  LONG *pcpMin, LONG *pcpMost);
	void	FindCell	 (LONG *pcpMin, LONG *pcpMost) const;
    BOOL    FindObject	 (LONG *pcpMin, LONG *pcpMost) const;
    void    FindParagraph(LONG *pcpMin, LONG *pcpMost) const;
    void    FindSentence (LONG *pcpMin, LONG *pcpMost) const;
    void    FindWord	 (LONG *pcpMin, LONG *pcpMost,
							FINDWORD_TYPE type)const;
	BOOL	FindVisibleRange (LONG *pcpMin, LONG *pcpMost) const;

	void	ExpandToLink(void);

	LONG	AdvanceCRLF();
	LONG	BackupCRLF();
	LONG    FindWordBreak(INT action);

	void	ValidateRange();

	void	SetUseiFormat(BOOL fUseiFormat) {_fUseiFormat = fUseiFormat;}

    // IUnknown methods
    STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
    STDMETHOD_(ULONG, AddRef)();
    STDMETHOD_(ULONG, Release)();

    // IDispatch methods
    STDMETHODIMP GetTypeInfoCount(UINT * pctinfo);
    STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo ** pptinfo);
    STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR ** rgszNames, UINT cNames,
							 LCID lcid, DISPID * rgdispid) ;
    STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags,
					  DISPPARAMS * pdispparams, VARIANT * pvarResult,
					  EXCEPINFO * pexcepinfo, UINT * puArgErr) ;

    // ITextRange methods
    STDMETHODIMP GetText (BSTR *pbstr);
    STDMETHODIMP SetText (BSTR bstr);
    STDMETHODIMP GetChar (long *pch);
    STDMETHODIMP SetChar (long ch);
    STDMETHODIMP GetDuplicate (ITextRange **ppRange);
    STDMETHODIMP GetFormattedText (ITextRange **ppRange);
    STDMETHODIMP SetFormattedText (ITextRange *pRange);
    STDMETHODIMP GetStart (long *pcpFirst);
    STDMETHODIMP SetStart (long cpFirst);
    STDMETHODIMP GetEnd (long *pcpLim);
    STDMETHODIMP SetEnd (long cpLim);
    STDMETHODIMP GetFont (ITextFont **pFont);
    STDMETHODIMP SetFont (ITextFont *pFont);
    STDMETHODIMP GetPara (ITextPara **pPara);
    STDMETHODIMP SetPara (ITextPara *pPara);
    STDMETHODIMP GetStoryLength (long *pcch);
    STDMETHODIMP GetStoryType (long *pValue);
    STDMETHODIMP Collapse (long bStart);
    STDMETHODIMP Expand (long Unit, long *pDelta);
    STDMETHODIMP GetIndex (long Unit, long *pIndex);
    STDMETHODIMP SetIndex (long Unit, long Index, long Extend);
    STDMETHODIMP SetRange (long cpActive, long cpOther);
    STDMETHODIMP InRange (ITextRange * pRange, long *pb);
    STDMETHODIMP InStory (ITextRange * pRange, long *pb);
    STDMETHODIMP IsEqual (ITextRange * pRange, long *pb);
    STDMETHODIMP Select ();
    STDMETHODIMP StartOf (long Unit, long Extend, long * pDelta);
    STDMETHODIMP EndOf (long Unit, long Extend, long * pDelta);
    STDMETHODIMP Move (long Unit, long Count, long * pDelta);
    STDMETHODIMP MoveStart (long Unit, long Count, long * pDelta);
    STDMETHODIMP MoveEnd (long Unit, long Count, long * pDelta);
    STDMETHODIMP MoveWhile (VARIANT * Cset, long Count, long * pDelta);
    STDMETHODIMP MoveStartWhile (VARIANT * Cset, long Count, long * pDelta);
    STDMETHODIMP MoveEndWhile (VARIANT * Cset, long Count, long * pDelta);
    STDMETHODIMP MoveUntil (VARIANT FAR* Cset, long Count, long * pDelta);
    STDMETHODIMP MoveStartUntil (VARIANT * Cset, long Count, long * pDelta);
    STDMETHODIMP MoveEndUntil (VARIANT * Cset, long Count, long * pDelta);
    STDMETHODIMP FindText (BSTR bstr, long cch, long Flags, long * pLength);
    STDMETHODIMP FindTextStart (BSTR bstr, long cch, long Flags, long * pLength);
    STDMETHODIMP FindTextEnd (BSTR bstr, long cch, long Flags, long * pLength);
    STDMETHODIMP Delete (long Unit, long Count, long * pDelta);
    STDMETHODIMP Cut (VARIANT * ppIDataObject);
    STDMETHODIMP Copy (VARIANT * ppIDataObject);
    STDMETHODIMP Paste (VARIANT * pIDataObject, long Format);
    STDMETHODIMP CanPaste (VARIANT * pIDataObject, long Format, long * pb);
    STDMETHODIMP CanEdit (long * pbCanEdit);
    STDMETHODIMP ChangeCase (long Type);
    STDMETHODIMP GetPoint (long Type, long * px, long * py);
    STDMETHODIMP SetPoint (long x, long y, long Type, long Extend);
    STDMETHODIMP ScrollIntoView (long Value);
    STDMETHODIMP GetEmbeddedObject (IUnknown ** ppv);

    // ITextSelection methods
    STDMETHODIMP GetFlags (long * pFlags) ;
    STDMETHODIMP SetFlags (long Flags) ;
    STDMETHODIMP GetType  (long * pType) ;
	STDMETHODIMP MoveLeft (long Unit, long Count, long Extend,
						   long *pDelta) ;
	STDMETHODIMP MoveRight(long pUnit, long Count, long Extend,
						   long *pDelta) ;
	STDMETHODIMP MoveUp   (long pUnit, long Count, long Extend,
						   long *pDelta) ;
	STDMETHODIMP MoveDown (long pUnit, long Count, long Extend,
						   long *pDelta) ;
	STDMETHODIMP HomeKey  (long pUnit, long Extend, long *pDelta) ;
	STDMETHODIMP EndKey   (long pUnit, long Extend, long *pDelta) ;
	STDMETHODIMP TypeText (BSTR bstr) ;

//@access Private ITextRange helper methods
private:
	LONG	Comparer (ITextRange * pv);
	HRESULT EndSetter(LONG cp, BOOL fOther);
	HRESULT Finder	 (BSTR bstr, long Count, long Flags, LONG *pDelta,
						MOVES Mode);
	HRESULT GetLong  (LONG lValue, long *pLong);
	HRESULT	IsTrue	 (BOOL f, long *pB);
	HRESULT Matcher	 (VARIANT *Cset, long Count, LONG *pDelta, MOVES Mode,
						MATCHES Match);
	HRESULT	Mover	 (long Unit, long Count, LONG *pDelta, MOVES Mode);
	HRESULT	Replacer (LONG cchNew, TCHAR const *pch);

	LONG	CalcTextLenNotInRange();
};

// Useful Unicode range definitions for use with MoveWhile/Until methods

#define	CodeRange(n, m)	0x8000000 | ((m) - (n)) << 16 | n

#define	CR_ASCII		CodeRange(0x0, 0x7f)
#define	CR_ANSI			CodeRange(0x0, 0xff)
#define	CR_ASCIIPrint	CodeRange(0x20, 0x7e)
#define	CR_Latin1		CodeRange(0x20, 0xff)
#define	CR_Latin1Supp	CodeRange(0xa0, 0xff)
#define	CR_LatinXA		CodeRange(0x100, 0x17f)
#define	CR_LatinXB		CodeRange(0x180, 0x24f)
#define	CR_IPAX			CodeRange(0x250, 0x2af)
#define	CR_SpaceMod		CodeRange(0x2b0, 0x2ff)
#define	CR_Combining	CodeRange(0x300, 0x36f)
#define	CR_Greek		CodeRange(0x370, 0x3ff)
#define	CR_BasicGreek	CodeRange(0x370, 0x3cf)
#define	CR_GreekSymbols	CodeRange(0x3d0, 0x3ff)
#define	CR_Cyrillic		CodeRange(0x400, 0x4ff)
#define	CR_Armenian		CodeRange(0x530, 0x58f)
#define	CR_Hebrew		CodeRange(0x590, 0x5ff)
#define	CR_BasicHebrew	CodeRange(0x5d0, 0x5ea)
#define	CR_HebrewXA		CodeRange(0x590, 0x5cf)
#define	CR_HebrewXB		CodeRange(0x5eb, 0x5ff)
#define	CR_Arabic		CodeRange(0x600, 0x6ff)
#define	CR_BasicArabic	CodeRange(0x600, 0x652)
#define	CR_ArabicX		CodeRange(0x653, 0x6ff)
#define	CR_Devengari	CodeRange(0x900, 0x97f)
#define	CR_Bengali		CodeRange(0x980, 0x9ff)
#define	CR_Gurmukhi		CodeRange(0xa00, 0xa7f)
#define	CR_Gujarati		CodeRange(0xa80, 0xaff)
#define	CR_Oriya		CodeRange(0xb00, 0xb7f)
#define	CR_Tamil		CodeRange(0xb80, 0xbff)
#define	CR_Teluga		CodeRange(0xc00, 0xc7f)
#define	CR_Kannada		CodeRange(0xc80, 0xcff)
#define	CR_Malayalam	CodeRange(0xd00, 0xd7f)
#define	CR_Thai 		CodeRange(0xe00, 0xe7f)
#define	CR_Lao  		CodeRange(0xe80, 0xeff)
#define	CR_GeorgianX	CodeRange(0x10a0, 0xa0cf)
#define	CR_BascGeorgian	CodeRange(0x10d0, 0x10ff)
#define	CR_Hanguljamo	CodeRange(0x1100, 0x11ff)
#define	CR_LatinXAdd	CodeRange(0x1e00, 0x1eff)
#define	CR_GreekX		CodeRange(0x1f00, 0x1fff)
#define	CR_GenPunct		CodeRange(0x2000, 0x206f)
#define	CR_SuperScript	CodeRange(0x2070, 0x207f)
#define	CR_SubScript	CodeRange(0x2080, 0x208f)
#define	CR_SubSuperScrp	CodeRange(0x2070, 0x209f)
#define	CR_Currency		CodeRange(0x20a0, 0x20cf)
#define	CR_CombMarkSym	CodeRange(0x20d0, 0x20ff)
#define	CR_LetterLike	CodeRange(0x2100, 0x214f)
#define	CR_NumberForms	CodeRange(0x2150, 0x218f)
#define	CR_Arrows		CodeRange(0x2190, 0x21ff)
#define	CR_MathOps		CodeRange(0x2200, 0x22ff)
#define	CR_MiscTech		CodeRange(0x2300, 0x23ff)
#define	CR_CtrlPictures	CodeRange(0x2400, 0x243f)
#define	CR_OptCharRecog	CodeRange(0x2440, 0x245f)
#define	CR_EnclAlphaNum	CodeRange(0x2460, 0x24ff)
#define	CR_BoxDrawing	CodeRange(0x2500, 0x257f)
#define	CR_BlockElement	CodeRange(0x2580, 0x259f)
#define	CR_GeometShapes	CodeRange(0x25a0, 0x25ff)
#define	CR_MiscSymbols	CodeRange(0x2600, 0x26ff)
#define	CR_Dingbats		CodeRange(0x2700, 0x27bf)
#define	CR_CJKSymPunct	CodeRange(0x3000, 0x303f)
#define	CR_Hiragana		CodeRange(0x3040, 0x309f)
#define	CR_Katakana		CodeRange(0x30a0, 0x30ff)
#define	CR_Bopomofo		CodeRange(0x3100, 0x312f)
#define	CR_HangulJamo	CodeRange(0x3130, 0x318f)
#define	CR_CJLMisc		CodeRange(0x3190, 0x319f)
#define	CR_EnclCJK		CodeRange(0x3200, 0x32ff)
#define	CR_CJKCompatibl	CodeRange(0x3300, 0x33ff)
#define	CR_Hangul		CodeRange(0x3400, 0x3d2d)
#define	CR_HangulA		CodeRange(0x3d2e, 0x44b7)
#define	CR_HangulB		CodeRange(0x44b8, 0x4dff)
#define	CR_CJKIdeograph	CodeRange(0x4e00, 0x9fff)
#define	CR_PrivateUse	CodeRange(0xe000, 0xf800)
#define	CR_CJKCompIdeog	CodeRange(0xf900, 0xfaff)
#define	CR_AlphaPres	CodeRange(0xfb00, 0xfb4f)
#define	CR_ArabicPresA	CodeRange(0xfb50, 0xfdff)
#define	CR_CombHalfMark	CodeRange(0xfe20, 0xfe2f)
#define	CR_CJKCompForm	CodeRange(0xfe30, 0xfe4f)
#define	CR_SmallFormVar	CodeRange(0xfe50, 0xfe6f)
#define	CR_ArabicPresB	CodeRange(0xfe70, 0xfefe)
#define	CR_HalfFullForm	CodeRange(0xff00, 0xffef)
#define	CR_Specials		CodeRange(0xfff0, 0xfffd)

#endif


text:
package org.alfasoftware.morf.upgrade;

import static org.alfasoftware.morf.metadata.SchemaUtils.schema;
import static org.alfasoftware.morf.metadata.SchemaUtils.view;
import static org.alfasoftware.morf.sql.SqlUtils.literal;
import static org.alfasoftware.morf.sql.SqlUtils.select;
import static org.alfasoftware.morf.sql.SqlUtils.tableRef;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.RETURNS_SMART_NULLS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.util.Map;
import java.util.Optional;

import org.alfasoftware.morf.jdbc.SqlDialect;
import org.alfasoftware.morf.metadata.Schema;
import org.alfasoftware.morf.metadata.View;
import org.alfasoftware.morf.sql.SelectStatement;
import org.alfasoftware.morf.sql.element.FieldLiteral;
import org.alfasoftware.morf.upgrade.ExistingViewStateLoader.Result;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import com.google.common.collect.ImmutableMap;

/**
 * Tests for {@link ExistingViewStateLoader}.
 *
 * @author Copyright (c) Alfa Financial Software 2014
 */
public class TestExistingViewStateLoader {

  private final ExistingViewHashLoader existingViewHashLoader = mock(ExistingViewHashLoader.class, RETURNS_SMART_NULLS);
  private final SqlDialect dialect = mock(SqlDialect.class, RETURNS_SMART_NULLS);

  private ExistingViewStateLoader onTest;

  /**
   * @throws java.lang.Exception
   */
  @Before
  public void setUp() throws Exception {
    onTest = new ExistingViewStateLoader(dialect, existingViewHashLoader);

    // All hash requests should return the field value + the table name.
    when(dialect.convertStatementToHash(any(SelectStatement.class))).thenAnswer(new Answer<String>() {
      @Override
      public String answer(InvocationOnMock invocation) throws Throwable {
        SelectStatement statement = (SelectStatement)invocation.getArguments()[0];
        return ((FieldLiteral)statement.getFields().get(0)).getValue() + statement.getTable().getName();
      }
    });
  }

  /**
   * Tests that when we have two matching schemas and matching hashes, there are
   * no changes to deploy, even if there are case differences between the view
   * names in the source and target schemas.
   */
  @Test
  public void testNoChanges() {
    Schema sourceSchema = schema(
      view("View1", select(literal("x")).from(tableRef("a"))),
      view("VIEW2", select(literal("y")).from(tableRef("b"))),
      view("view3", select(literal("z")).from(tableRef("c")))
    );

    Schema targetSchema = schema(
      view("VIEW1", select(literal("x")).from(tableRef("a"))),
      view("view2", select(literal("y")).from(tableRef("b"))),
      view("View3", select(literal("z")).from(tableRef("c")))
    );

    when(existingViewHashLoader.loadViewHashes(sourceSchema)).thenReturn(Optional.<Map<String, String>>of(ImmutableMap.of(
      "VIEW1", "xa",
      "VIEW2", "yb",
      "VIEW3", "zc"
    )));

    assertTrue("No changes", onTest.viewChanges(sourceSchema, targetSchema).isEmpty());
  }

  /**
   * Tests that when we have two matching schemas and matching hashes but no
   * deployed views table, we drop and recreate everything
   */
  @Test
  public void testNoChangesButNoDeployedViewsTable() {
    View sourceView1   = view("View1", select(literal("x")).from(tableRef("a")));
    View sourceView2   = view("VIEW2", select(literal("y")).from(tableRef("b")));
    View sourceView3   = view("view3", select(literal("z")).from(tableRef("c")));
    Schema sourceSchema = schema(sourceView1, sourceView2, sourceView3);

    View targetView1   = view("VIEW1", select(literal("x")).from(tableRef("a")));
    View targetView2   = view("view2", select(literal("y")).from(tableRef("b")));
    View targetView3   = view("View3", select(literal("z")).from(tableRef("c")));
    Schema targetSchema = schema(targetView1, targetView2, targetView3);

    when(existingViewHashLoader.loadViewHashes(sourceSchema)).thenReturn(Optional.<Map<String, String>>empty());

    Result viewChanges = onTest.viewChanges(sourceSchema, targetSchema);

    assertThat(
      "Deploying all target views",
      viewChanges.getViewsToDeploy(),
      containsInAnyOrder(targetView1, targetView2, targetView3)
    );

    assertThat(
      "Dropping all source views",
      viewChanges.getViewsToDrop(),
      containsInAnyOrder(sourceView1, sourceView2, sourceView3)
    );
  }

  /**
   * Tests that when we have two matching schemas, matching hashes and an empty
   * deployed views table, we drop and recreate everything
   */
  @Test
  public void testNoChangesButEmptyDeployedViewsTable() {
    View sourceView1   = view("View1", select(literal("x")).from(tableRef("a")));
    View sourceView2   = view("VIEW2", select(literal("y")).from(tableRef("b")));
    Schema sourceSchema = schema(sourceView1, sourceView2);

    View targetView1   = view("VIEW1", select(literal("x")).from(tableRef("a")));
    View targetView2   = view("view2", select(literal("y")).from(tableRef("b")));
    Schema targetSchema = schema(targetView1, targetView2);

    when(existingViewHashLoader.loadViewHashes(sourceSchema)).thenReturn(Optional.<Map<String, String>>of(ImmutableMap.<String, String>of()));

    Result viewChanges = onTest.viewChanges(sourceSchema, targetSchema);

    assertThat(
      "Deploying all target views",
      viewChanges.getViewsToDeploy(),
      containsInAnyOrder(targetView1, targetView2)
    );

    assertThat(
      "Dropping all source views",
      viewChanges.getViewsToDrop(),
      containsInAnyOrder(sourceView1, sourceView2)
    );
  }

  /**
   * Tests that we drop unnecessary views.
   */
  @Test
  public void testDropUnwantedViews() {
    View sourceView1   = view("View1", select(literal("x")).from(tableRef("a")));
    View sourceView2   = view("VIEW2", select(literal("y")).from(tableRef("b")));
    View sourceViewOld1= view("Old1", select(literal("z")).from(tableRef("c")));
    View sourceViewOld2= view("Old2", select(literal("z")).from(tableRef("c")));
    Schema sourceSchema = schema(sourceView1, sourceView2, sourceViewOld1, sourceViewOld2);

    View targetView1   = view("VIEW1", select(literal("x")).from(tableRef("a")));
    View targetView2   = view("view2", select(literal("y")).from(tableRef("b")));
    Schema targetSchema = schema(targetView1, targetView2);

    when(existingViewHashLoader.loadViewHashes(sourceSchema)).thenReturn(Optional.<Map<String, String>>of(ImmutableMap.of(
      "VIEW1", "xa",
      "VIEW2", "yb"
    )));

    Result viewChanges = onTest.viewChanges(sourceSchema, targetSchema);

    assertThat("Nothing to deploy", viewChanges.getViewsToDeploy(), Matchers.hasSize(0));
    assertThat("Dropping unnecessary view", viewChanges.getViewsToDrop(), containsInAnyOrder(sourceViewOld1, sourceViewOld2));
  }

  /**
   * Tests that we add any views which don't exist.
   */
  @Test
  public void testDeployMissingViews() {
    View sourceView1   = view("View1", select(literal("x")).from(tableRef("a")));
    View sourceView2   = view("VIEW2", select(literal("y")).from(tableRef("b")));
    Schema sourceSchema = schema(sourceView1, sourceView2);

    View targetView1   = view("VIEW1", select(literal("x")).from(tableRef("a")));
    View targetView2   = view("view2", select(literal("y")).from(tableRef("b")));
    View targetViewNew1= view("New1", select(literal("z")).from(tableRef("c")));
    View targetViewNew2= view("New2", select(literal("z")).from(tableRef("c")));
    Schema targetSchema = schema(targetView1, targetView2, targetViewNew1, targetViewNew2);

    when(existingViewHashLoader.loadViewHashes(sourceSchema)).thenReturn(Optional.<Map<String, String>>of(ImmutableMap.of(
      "VIEW1", "xa",
      "VIEW2", "yb"
    )));

    Result viewChanges = onTest.viewChanges(sourceSchema, targetSchema);

    assertThat("Deploy new views", viewChanges.getViewsToDeploy(), containsInAnyOrder(targetViewNew1, targetViewNew2));
    assertThat("Nothing to drop", viewChanges.getViewsToDrop(), Matchers.hasSize(0));
  }

  /**
   * Tests that we add any views which don't exist and clean up orphaned DeployedViews
   * records.
   */
  @Test
  public void testDeployMissingViewsAndCleanUpOrphanedDeployedViewsRecord() {
    View sourceView1   = view("View1", select(literal("x")).from(tableRef("a")));
    View sourceView2   = view("VIEW2", select(literal("y")).from(tableRef("b")));
    Schema sourceSchema = schema(sourceView1, sourceView2);

    View targetView1   = view("VIEW1", select(literal("x")).from(tableRef("a")));
    View targetView2   = view("view2", select(literal("y")).from(tableRef("b")));
    View targetViewNew1= view("New1", select(literal("z")).from(tableRef("c")));
    View targetViewNew2= view("New2", select(literal("z")).from(tableRef("c")));
    Schema targetSchema = schema(targetView1, targetView2, targetViewNew1, targetViewNew2);

    when(existingViewHashLoader.loadViewHashes(sourceSchema)).thenReturn(Optional.<Map<String, String>>of(ImmutableMap.of(
      "VIEW1", "xa",
      "VIEW2", "yb",
      "NEW1", "zc",
      "NEW2", "zc"
    )));

    Result viewChanges = onTest.viewChanges(sourceSchema, targetSchema);

    assertThat("Deploy new views", viewChanges.getViewsToDeploy(), containsInAnyOrder(targetViewNew1, targetViewNew2));
    assertThat("Drop the orphaned DeployedViews records", viewChanges.getViewsToDrop(), containsInAnyOrder(targetViewNew1, targetViewNew2));
  }

  /**
   * Tests that we redeploy views with mismatched hashes.
   */
  @Test
  public void testMismatchedHash() {
    View sourceView1   = view("View1", select(literal("x")).from(tableRef("a")));
    View sourceView2   = view("VIEW2", select(literal("y")).from(tableRef("b")));
    View sourceView3   = view("view3", select(literal("z")).from(tableRef("c")));
    Schema sourceSchema = schema(sourceView1, sourceView2, sourceView3);

    View targetView1   = view("VIEW1", select(literal("CHANGED")).from(tableRef("a")));
    View targetView2   = view("view2", select(literal("y")).from(tableRef("b")));
    View targetView3   = view("View3", select(literal("z")).from(tableRef("CHANGED")));
    Schema targetSchema = schema(targetView1, targetView2, targetView3);

    when(existingViewHashLoader.loadViewHashes(sourceSchema)).thenReturn(Optional.<Map<String, String>>of(ImmutableMap.of(
      "VIEW1", "xa",
      "VIEW2", "yb",
      "VIEW3", "zc"
    )));

    Result viewChanges = onTest.viewChanges(sourceSchema, targetSchema);

    assertThat("Deploy new views", viewChanges.getViewsToDeploy(), containsInAnyOrder(targetView1, targetView3));
    assertThat("Drop the orphaned DeployedViews records", viewChanges.getViewsToDrop(), containsInAnyOrder(sourceView1, sourceView3));
  }
}


text:
sap.ui.define(['sap/ui/core/Renderer', './InputBaseRenderer'], function(Renderer, InputBaseRenderer) {
	"use strict";

	/**
	 * DateTimeFieldRenderer renderer.
	 * @namespace
	 */
	var DateTimeFieldRenderer = Renderer.extend(InputBaseRenderer);
	DateTimeFieldRenderer.apiVersion = 2;

	return DateTimeFieldRenderer;

}, /* bExport= */ true);


text:
export OS_USERNAME=glance
export OS_PASSWORD=osglance
export OS_TENANT_NAME=services
export OS_AUTH_URL=http://controller-m:35357/v2.0


text:
namespace ElectronicObserver.Window.Dialog {
	partial class DialogTextInput {
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose( bool disposing ) {
			if ( disposing && ( components != null ) ) {
				components.Dispose();
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent() {
			this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
			this.ButtonOK = new System.Windows.Forms.Button();
			this.ButtonCancel = new System.Windows.Forms.Button();
			this.Description = new System.Windows.Forms.Label();
			this.TextInput = new System.Windows.Forms.TextBox();
			this.tableLayoutPanel1.SuspendLayout();
			this.SuspendLayout();
			//
			// tableLayoutPanel1
			//
			this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
			this.tableLayoutPanel1.ColumnCount = 1;
			this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
			this.tableLayoutPanel1.Controls.Add(this.Description, 0, 0);
			this.tableLayoutPanel1.Controls.Add(this.TextInput, 0, 1);
			this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12);
			this.tableLayoutPanel1.Name = "tableLayoutPanel1";
			this.tableLayoutPanel1.RowCount = 2;
			this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
			this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
			this.tableLayoutPanel1.Size = new System.Drawing.Size(360, 59);
			this.tableLayoutPanel1.TabIndex = 0;
			//
			// ButtonOK
			//
			this.ButtonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.ButtonOK.Location = new System.Drawing.Point(216, 77);
			this.ButtonOK.Name = "ButtonOK";
			this.ButtonOK.Size = new System.Drawing.Size(75, 23);
			this.ButtonOK.TabIndex = 1;
			this.ButtonOK.Text = "OK";
			this.ButtonOK.UseVisualStyleBackColor = true;
			this.ButtonOK.Click += new System.EventHandler(this.ButtonOK_Click);
			//
			// ButtonCancel
			//
			this.ButtonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.ButtonCancel.Location = new System.Drawing.Point(297, 77);
			this.ButtonCancel.Name = "ButtonCancel";
			this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
			this.ButtonCancel.TabIndex = 2;
			this.ButtonCancel.Text = "キャンセル";
			this.ButtonCancel.UseVisualStyleBackColor = true;
			this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
			//
			// Description
			//
			this.Description.AutoSize = true;
			this.Description.Location = new System.Drawing.Point(3, 3);
			this.Description.Margin = new System.Windows.Forms.Padding(3);
			this.Description.Name = "Description";
			this.Description.Size = new System.Drawing.Size(139, 15);
			this.Description.TabIndex = 0;
			this.Description.Text = "テキストを入力してください:";
			//
			// TextInput
			//
			this.TextInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
			this.TextInput.Location = new System.Drawing.Point(3, 28);
			this.TextInput.Name = "TextInput";
			this.TextInput.Size = new System.Drawing.Size(354, 23);
			this.TextInput.TabIndex = 1;
			//
			// DialogTextInput
			//
			this.AcceptButton = this.ButtonOK;
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
			this.CancelButton = this.ButtonCancel;
			this.ClientSize = new System.Drawing.Size(384, 112);
			this.Controls.Add(this.ButtonCancel);
			this.Controls.Add(this.ButtonOK);
			this.Controls.Add(this.tableLayoutPanel1);
			this.Font = new System.Drawing.Font("Meiryo UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "DialogTextInput";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "テキストを入力";
			this.tableLayoutPanel1.ResumeLayout(false);
			this.tableLayoutPanel1.PerformLayout();
			this.ResumeLayout(false);

		}

		#endregion

		private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
		private System.Windows.Forms.Button ButtonOK;
		private System.Windows.Forms.Button ButtonCancel;
		private System.Windows.Forms.Label Description;
		public System.Windows.Forms.TextBox TextInput;
	}
}


text:
package j2html.tags.specialized;

import j2html.tags.EmptyTag;
import j2html.tags.attributes.IName;
import j2html.tags.attributes.IValue;

public final class ParamTag extends EmptyTag<ParamTag>
    implements IName<ParamTag>, IValue<ParamTag> {
    public ParamTag() {
        super("param");
    }
}


text:
Monte Carlo simulation of the Orchard Game
====

For more information see [http://www.samuelbosch.com/2014/01/monte-carlo-experiment-of-orchard-game.html](http://www.samuelbosch.com/2014/01/monte-carlo-experiment-of-orchard-game.html).


text:
@interface ACAdminViewController : UIViewController <UITableViewDataSource,UITableViewDelegate>

@end


text:
"""tod, a simple command line todo application

Usage:
  t  add <task>
  t  check <id>
  t  uncheck <id>
  t  clear
  t  count
  t  ls [--all]
  t  -h | --help
  t  --version

Commands:
  add           Add a new task
  check         Check a new task as done
  uncheck       Uncheck a task as done
  clear         Refresh the database
  ls            List all tasks

Options:
  -h --help     Show this screen.
  --version     Show version.
  --all         List all tasks
"""
import sqlite3
import os
import datetime
from docopt import docopt
from termcolor import colored
from prettytable import PrettyTable

SMILEY = "\xF0\x9F\x98\x83"  # Smiley emoji
GRIN = "\xF0\x9F\x98\x81"  # Grin face emoji

def echo(msg, err=False):
    """
    A simple function for printing to terminal with colors and emoji's
    """
    if err:
        print colored(msg + " " + GRIN, "red")
    else:
        print colored(msg + " " + SMILEY, "cyan")

class Tod(object):

    def __init__(self):
        """
        Set up the db and docopt upon creation of object
        """
        # Create a path to store the database file
        db_path = os.path.expanduser("~/")
        self.db_path = db_path + "/" + ".tod_file"
        self._init_db()
        self.arg = docopt(__doc__, version=0.21)

    def _init_db(self):
        """
        Setup database
        """
        self.db = sqlite3.connect(self.db_path)
        self.cursor = self.db.cursor()
        self.cursor.execute('''
            CREATE TABLE IF NOT EXISTS todo(id INTEGER PRIMARY KEY, task TEXT,
            done INT, date_added TEXT, date_completed TEXT)
            ''')
        self.db.commit()

    def run(self):
        """
        Parse the arg's using docopt and route to the respoctive methods
        """
        if self.arg['add']:
            self.add_task()
        elif self.arg['check']:
            self.check_task()
        elif self.arg['uncheck']:
            self.uncheck_task()
        elif self.arg['clear']:
            self.clear_task()
        elif self.arg['count']:
            self.count_task()
        else:
            if self.arg['--all']:
                self.list_task()
            else:
                self.list_pending_tasks()

    def _record_exists(self, id):
        """
        Checks if the record exists in the db
        """
        self.cursor.execute('''
            SELECT * FROM todo WHERE id=?
          ''', (id,))
        record = self.cursor.fetchone()
        if record is None:
            return False
        return True

    def add_task(self):
        """
        Add a task todo to the db
        """
        task = self.arg['<task>']
        date = datetime.datetime.now()
        date_now = "%s-%s-%s" % (date.day, date.month, date.year)
        self.cursor.execute('''
          INSERT INTO todo(task, done, date_added)
          VALUES (?, ?, ?)
        ''', (str(task), 0, date_now))
        self.db.commit()
        echo("The task has been been added to the list")

    def _is_done(self, id):
        """
        Check if task is done
        """
        self.cursor.execute('''
                SELECT done FROM todo WHERE id=?
            ''', (id,))
        record = self.cursor.fetchone()
        if record[0] == 0:
            return
        else:
            return True

    def check_task(self):
        """
        Mark a task as done
        """
        task_id = self.arg['<id>']
        date = datetime.datetime.now()
        # format todays date into a string for sqlite database
        date_now = "%s-%s-%s" % (date.day, date.month, date.year)
        if self._record_exists(task_id):
            if self._is_done(task_id):
                echo("The task is already done", err=True)
            else:
                self.cursor.execute('''
                    UPDATE todo SET done=?, date_completed=? WHERE Id=?
                ''', (1, date_now, int(task_id)))
                echo("Task %s has been marked as done" % str(task_id))
                self.db.commit()
        else:
            echo("Task %s doesn't even exist" % (str(task_id)), err=True)

    def uncheck_task(self):
        """
        Mark a done task as undone
        """
        task_id = self.arg['<id>']
        if self._record_exists(task_id):
            # Checks if the task is marked as done
            if self._is_done(task_id):
                self.cursor.execute('''
                    UPDATE todo SET done=? WHERE id=?
                  ''', (0, int(task_id)))
                echo("Task %s has been unchecked" % str(task_id))
                self.db.commit()
            else:
                echo("The task is already pending", err=True)
        else:
            echo("Task %s doesn't exist" % str(task_id), err=True)

    def list_task(self):
        """
        Display all tasks in a table
        """
        tab = PrettyTable(["Id", "Task Todo", "Done ?", "Date Added",
                          "Date Completed"])
        tab.align["Id"] = "l"
        tab.padding_width = 1
        self.cursor.execute('''
            SELECT id, task, done, date_added, date_completed FROM todo
          ''')
        records = self.cursor.fetchall()
        for each_record in records:
            if each_record[2] == 0:
                done = "Nop"
            else:
                done = "Yup"
            if each_record[4] is None:
                status = "Pending..."
            else:
                status = each_record[4]
            tab.add_row([each_record[0], each_record[1], done,
                        each_record[3], status])
        print tab

    def list_pending_tasks(self):
        """
        Display all pending tasks in a tabular form
        """
        tab = PrettyTable(["Id", "Task Todo", "Date Added"])
        tab.align["Id"] = "l"
        tab.padding_width = 1
        self.cursor.execute('''
            SELECT id, task, date_added FROM todo WHERE done=?
          ''', (int(0),))
        records = self.cursor.fetchall()
        for each_record in records:
            tab.add_row([each_record[0], each_record[1], each_record[2]])
        print tab

    def clear_task(self):
        """
        Delete the table to refresh the app
        """
        self.cursor.execute('''
            DROP TABLE todo
          ''')
        self.db.commit()

    def count_task(self):
        """
        Count the number of tasks
        """
        self.cursor.execute('''
            SELECT id FROM todo
            ''')
        records = self.cursor.fetchall()
        num = len(records)
        if num == 1:
            echo("%s task is still pending" % str(num))
        else:
            echo("%s tasks are still pending" % str(num))

    def __del__(self):
        """
        Close database connection when destroying the object
        """
        self.db.close()

def main():
    """
    Entry point for console script
    """
    app = Tod()
    app.run()

if __name__ == "__main__":
    # if run as a console script
    main()


text:
namespace operations_research {

// Perform a lookup in a map or std::unordered_map.
// If the key is present in the map then the value associated with that
// key is returned, otherwise the value passed as a default is returned.
template <class Collection>
const typename Collection::value_type::second_type& FindWithDefault(
    const Collection& collection,
    const typename Collection::value_type::first_type& key,
    const typename Collection::value_type::second_type& value) {
  typename Collection::const_iterator it = collection.find(key);
  if (it == collection.end()) {
    return value;
  }
  return it->second;
}

// Perform a lookup in a map or std::unordered_map.
// If the key is present a const pointer to the associated value is returned,
// otherwise a NULL pointer is returned.
template <class Collection>
const typename Collection::value_type::second_type* FindOrNull(
    const Collection& collection,
    const typename Collection::value_type::first_type& key) {
  typename Collection::const_iterator it = collection.find(key);
  if (it == collection.end()) {
    return 0;
  }
  return &it->second;
}

// Perform a lookup in a map or std::unordered_map.
// Same as above but the returned pointer is not const and can be used to change
// the stored value.
template <class Collection>
typename Collection::value_type::second_type* FindOrNull(
    Collection& collection,  // NOLINT
    const typename Collection::value_type::first_type& key) {
  typename Collection::iterator it = collection.find(key);
  if (it == collection.end()) {
    return 0;
  }
  return &it->second;
}

// Perform a lookup in a map or std::unordered_map whose values are pointers.
// If the key is present a const pointer to the associated value is returned,
// otherwise a NULL pointer is returned.
// This function does not distinguish between a missing key and a key mapped
// to a NULL value.
template <class Collection>
const typename Collection::value_type::second_type FindPtrOrNull(
    const Collection& collection,
    const typename Collection::value_type::first_type& key) {
  typename Collection::const_iterator it = collection.find(key);
  if (it == collection.end()) {
    return 0;
  }
  return it->second;
}

// Change the value associated with a particular key in a map or
// std::unordered_map. If the key is not present in the map the key and value
// are inserted, otherwise the value is updated to be a copy of the value
// provided. True indicates that an insert took place, false indicates an
// update.
template <class Collection, class Key, class Value>
bool InsertOrUpdate(Collection* const collection, const Key& key,
                    const Value& value) {
  std::pair<typename Collection::iterator, bool> ret =
      collection->insert(typename Collection::value_type(key, value));
  if (!ret.second) {
    // update
    ret.first->second = value;
    return false;
  }
  return true;
}

// Insert a new key and value into a map or std::unordered_map.
// If the key is not present in the map the key and value are
// inserted, otherwise nothing happens. True indicates that an insert
// took place, false indicates the key was already present.
template <class Collection, class Key, class Value>
bool InsertIfNotPresent(Collection* const collection, const Key& key,
                        const Value& value) {
  std::pair<typename Collection::iterator, bool> ret =
      collection->insert(typename Collection::value_type(key, value));
  return ret.second;
}

// Inserts a new std::pair<key,value> into a map or std::unordered_map.
// Insert a new key into a set or std::unordered_set.
// Dies if the key is already present.
template <class Collection>
void InsertOrDie(Collection* const collection,
                 const typename Collection::value_type& value) {
  CHECK(collection->insert(value).second) << "duplicate value: " << value;
}

// Inserts a new key/value into a map or std::unordered_map.
// Dies if the key is already present.
template <class Collection>
void InsertOrDie(Collection* const collection,
                 const typename Collection::value_type::first_type& key,
                 const typename Collection::value_type::second_type& data) {
  typedef typename Collection::value_type value_type;
  CHECK(collection->insert(value_type(key, data)).second)
      << "duplicate key: " << key;
}

// Perform a lookup in map or std::unordered_map.
// If the key is present and value is non-NULL then a copy of the value
// associated with the key is made into *value. Returns whether key was present.
template <class Collection, class Key, class Value>
bool FindCopy(const Collection& collection, const Key& key,
              Value* const value) {
  typename Collection::const_iterator it = collection.find(key);
  if (it == collection.end()) {
    return false;
  }
  if (value) {
    *value = it->second;
  }
  return true;
}

// Test to see if a set, map, std::unordered_set or std::unordered_map contains
// a particular key. Returns true if the key is in the collection.
template <class Collection, class Key>
bool ContainsKey(const Collection& collection, const Key& key) {
  typename Collection::const_iterator it = collection.find(key);
  return it != collection.end();
}

template <class Collection>
const typename Collection::value_type::second_type& FindOrDie(
    const Collection& collection,
    const typename Collection::value_type::first_type& key) {
  typename Collection::const_iterator it = collection.find(key);
  CHECK(it != collection.end()) << "Map key not found: " << key;
  return it->second;
}

// Lookup a key in a map or std::unordered_map, insert it if it is not present.
// Returns a reference to the value associated with the key.
template <class Collection>
typename Collection::value_type::second_type& LookupOrInsert(
    Collection* const collection,
    const typename Collection::value_type::first_type& key,
    const typename Collection::value_type::second_type& value) {
  std::pair<typename Collection::iterator, bool> ret =
      collection->insert(typename Collection::value_type(key, value));
  return ret.first->second;
}
}  // namespace operations_research

#endif  // OR_TOOLS_BASE_MAP_UTIL_H_


text:
package org.apache.wicket.security;

import java.net.MalformedURLException;

import junit.framework.TestCase;

import org.apache.wicket.Page;
import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.security.authentication.LoginException;
import org.apache.wicket.security.hive.HiveMind;
import org.apache.wicket.security.hive.authentication.PrimaryLoginContext;
import org.apache.wicket.security.hive.config.PolicyFileHiveFactory;
import org.apache.wicket.security.hive.config.SwarmPolicyFileHiveFactory;
import org.apache.wicket.security.pages.MockHomePage;
import org.apache.wicket.security.pages.MockLoginPage;
import org.apache.wicket.security.swarm.SwarmWebApplication;
import org.apache.wicket.util.tester.WicketTester;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author marrink
 */
public class StackOverFlowTest extends TestCase
{
	private final class MyWebApplication extends SwarmWebApplication
	{
		@Override
		protected Object getHiveKey()
		{
			// if we were using servlet-api 2.5 we could get the contextpath
			// from the servletcontext
			return "test";
		}

		@Override
		protected void setUpHive()
		{
			PolicyFileHiveFactory factory = new SwarmPolicyFileHiveFactory(getActionFactory());
			try
			{
				factory.addPolicyFile(getServletContext().getResource("WEB-INF/policy.hive"));
				factory.setAlias("SimplePrincipal",
					"org.apache.wicket.security.hive.authorization.SimplePrincipal");
				factory.setAlias("myPackage", "org.apache.wicket.security.pages");
			}
			catch (MalformedURLException e)
			{
				log.error(e.getMessage(), e);
			}
			HiveMind.registerHive(getHiveKey(), factory);
		}

		@Override
		public Class< ? extends Page> getHomePage()
		{
			return MockHomePage.class;
		}

		public Class< ? extends Page> getLoginPage()
		{
			return MockLoginPage.class;
		}

		@Override
		public Session newSession(Request request, Response response)
		{
			WaspSession session = (WaspSession) super.newSession(request, response);
			try
			{
				session.login(new PrimaryLoginContext());
			}
			catch (LoginException e)
			{
				throw new RuntimeException(e);
			}
			return session;
		}
	}

	private static final Logger log = LoggerFactory.getLogger(StackOverFlowTest.class);

	/**
	 * The swarm application used for the test.
	 */
	protected WebApplication application;

	/**
	 * Handle to the mock environment.
	 */
	protected WicketTester mock;

	/**
	 * @see junit.framework.TestCase#setUp()
	 */
	@Override
	protected void setUp()
	{
		mock =
			new WicketTester(application = new MyWebApplication(), "src/test/java/"
				+ getClass().getPackage().getName().replace('.', '/'));
	}

	/**
	 * @see junit.framework.TestCase#tearDown()
	 */
	@Override
	protected void tearDown()
	{
		mock.setupRequestAndResponse();
		mock.getWicketSession().invalidate();
		mock.processRequestCycle();
		mock.destroy();
		mock = null;
		application = null;
		HiveMind.unregisterHive("test");
	}

	/**
	 * Test if automatically logging in in does not trigger a stackoverflow in
	 * {@link Session#get()}.
	 */
	public void testStackoverflow()
	{
		try
		{
			mock.startPage(MockHomePage.class);
		}
		catch (Exception e)
		{
			fail(e.getMessage());
		}
		mock.assertRenderedPage(MockHomePage.class);
	}
}


text:
package org.apache.oodt.cas.curation.structs;

import java.io.File;
import java.util.List;

public class ExtractorConfig {

  public final static String PROP_CLASS_NAME = "extractor.classname";

  public final static String PROP_CONFIG_FILES = "extractor.config.files";

  private final List<File> configFiles;

  private final String className;

  private final String identifier;

  public ExtractorConfig(String identifier, String className,
      List<File> configFiles) {
    this.configFiles = configFiles;
    this.className = className;
    this.identifier = identifier;
  }

  public List<File> getConfigFiles() {
    return this.configFiles;
  }

  public String getClassName() {
    return this.className;
  }

  public String getIdentifier() {
    return this.identifier;
  }

}


text:
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion

class Migration(migrations.Migration):

    dependencies = [
        ('main', '0004_auto_20170117_2053'),
    ]

    operations = [
        migrations.AlterField(
            model_name='comment',
            name='post',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='main.Post'),
        ),
    ]


text:
<app-toast [message]="toast.message"></app-toast>

Login

    <form [formGroup]="loginForm" (ngSubmit)="login()">

        <input class="form-control" type="email" name="email"
               formControlName="email" placeholder="Email" autofocus>

        <input class="form-control" type="password" name="password"
               formControlName="password" placeholder="Password">

      <button class="btn btn-primary" type="submit" [disabled]="!loginForm.valid">
         Login
      </button>
    </form>


text:
package Lev17.Task1712;

public class Table {
  private static byte tableNumber;
  private byte number = ++tableNumber;

  public Order getOrder () {
    return new Order(number);
  }
}


text:
package com.microsoft.xrm.sdk.Messages;

import com.microsoft.xrm.sdk.OrganizationResponse;

public final class MergeResponse extends OrganizationResponse {
}


text:
echo " --- Bootstrapping ---"

repo_root="$(git rev-parse --show-toplevel)"
echo "Dotfiles installed at $repo_root"

source "$repo_root/bootstrap/macos/links.sh"
source "$repo_root/bootstrap/macos/apps.sh"
source "$repo_root/bootstrap/macos/vim.sh"
echo ""
echo " --- Finished Bootstrapping ---"

# exec $SHELL -l


text:
#include <aws/redshift/model/ReservedNode.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>

#include <utility>

using namespace Aws::Utils::Xml;
using namespace Aws::Utils;

namespace Aws
{
namespace Redshift
{
namespace Model
{

ReservedNode::ReservedNode() :
    m_reservedNodeIdHasBeenSet(false),
    m_reservedNodeOfferingIdHasBeenSet(false),
    m_nodeTypeHasBeenSet(false),
    m_startTimeHasBeenSet(false),
    m_duration(0),
    m_durationHasBeenSet(false),
    m_fixedPrice(0.0),
    m_fixedPriceHasBeenSet(false),
    m_usagePrice(0.0),
    m_usagePriceHasBeenSet(false),
    m_currencyCodeHasBeenSet(false),
    m_nodeCount(0),
    m_nodeCountHasBeenSet(false),
    m_stateHasBeenSet(false),
    m_offeringTypeHasBeenSet(false),
    m_recurringChargesHasBeenSet(false),
    m_reservedNodeOfferingType(ReservedNodeOfferingType::NOT_SET),
    m_reservedNodeOfferingTypeHasBeenSet(false)
{
}

ReservedNode::ReservedNode(const XmlNode& xmlNode) :
    m_reservedNodeIdHasBeenSet(false),
    m_reservedNodeOfferingIdHasBeenSet(false),
    m_nodeTypeHasBeenSet(false),
    m_startTimeHasBeenSet(false),
    m_duration(0),
    m_durationHasBeenSet(false),
    m_fixedPrice(0.0),
    m_fixedPriceHasBeenSet(false),
    m_usagePrice(0.0),
    m_usagePriceHasBeenSet(false),
    m_currencyCodeHasBeenSet(false),
    m_nodeCount(0),
    m_nodeCountHasBeenSet(false),
    m_stateHasBeenSet(false),
    m_offeringTypeHasBeenSet(false),
    m_recurringChargesHasBeenSet(false),
    m_reservedNodeOfferingType(ReservedNodeOfferingType::NOT_SET),
    m_reservedNodeOfferingTypeHasBeenSet(false)
{
  *this = xmlNode;
}

ReservedNode& ReservedNode::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode reservedNodeIdNode = resultNode.FirstChild("ReservedNodeId");
    if(!reservedNodeIdNode.IsNull())
    {
      m_reservedNodeId = Aws::Utils::Xml::DecodeEscapedXmlText(reservedNodeIdNode.GetText());
      m_reservedNodeIdHasBeenSet = true;
    }
    XmlNode reservedNodeOfferingIdNode = resultNode.FirstChild("ReservedNodeOfferingId");
    if(!reservedNodeOfferingIdNode.IsNull())
    {
      m_reservedNodeOfferingId = Aws::Utils::Xml::DecodeEscapedXmlText(reservedNodeOfferingIdNode.GetText());
      m_reservedNodeOfferingIdHasBeenSet = true;
    }
    XmlNode nodeTypeNode = resultNode.FirstChild("NodeType");
    if(!nodeTypeNode.IsNull())
    {
      m_nodeType = Aws::Utils::Xml::DecodeEscapedXmlText(nodeTypeNode.GetText());
      m_nodeTypeHasBeenSet = true;
    }
    XmlNode startTimeNode = resultNode.FirstChild("StartTime");
    if(!startTimeNode.IsNull())
    {
      m_startTime = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(startTimeNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
      m_startTimeHasBeenSet = true;
    }
    XmlNode durationNode = resultNode.FirstChild("Duration");
    if(!durationNode.IsNull())
    {
      m_duration = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(durationNode.GetText()).c_str()).c_str());
      m_durationHasBeenSet = true;
    }
    XmlNode fixedPriceNode = resultNode.FirstChild("FixedPrice");
    if(!fixedPriceNode.IsNull())
    {
      m_fixedPrice = StringUtils::ConvertToDouble(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(fixedPriceNode.GetText()).c_str()).c_str());
      m_fixedPriceHasBeenSet = true;
    }
    XmlNode usagePriceNode = resultNode.FirstChild("UsagePrice");
    if(!usagePriceNode.IsNull())
    {
      m_usagePrice = StringUtils::ConvertToDouble(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(usagePriceNode.GetText()).c_str()).c_str());
      m_usagePriceHasBeenSet = true;
    }
    XmlNode currencyCodeNode = resultNode.FirstChild("CurrencyCode");
    if(!currencyCodeNode.IsNull())
    {
      m_currencyCode = Aws::Utils::Xml::DecodeEscapedXmlText(currencyCodeNode.GetText());
      m_currencyCodeHasBeenSet = true;
    }
    XmlNode nodeCountNode = resultNode.FirstChild("NodeCount");
    if(!nodeCountNode.IsNull())
    {
      m_nodeCount = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(nodeCountNode.GetText()).c_str()).c_str());
      m_nodeCountHasBeenSet = true;
    }
    XmlNode stateNode = resultNode.FirstChild("State");
    if(!stateNode.IsNull())
    {
      m_state = Aws::Utils::Xml::DecodeEscapedXmlText(stateNode.GetText());
      m_stateHasBeenSet = true;
    }
    XmlNode offeringTypeNode = resultNode.FirstChild("OfferingType");
    if(!offeringTypeNode.IsNull())
    {
      m_offeringType = Aws::Utils::Xml::DecodeEscapedXmlText(offeringTypeNode.GetText());
      m_offeringTypeHasBeenSet = true;
    }
    XmlNode recurringChargesNode = resultNode.FirstChild("RecurringCharges");
    if(!recurringChargesNode.IsNull())
    {
      XmlNode recurringChargesMember = recurringChargesNode.FirstChild("RecurringCharge");
      while(!recurringChargesMember.IsNull())
      {
        m_recurringCharges.push_back(recurringChargesMember);
        recurringChargesMember = recurringChargesMember.NextNode("RecurringCharge");
      }

      m_recurringChargesHasBeenSet = true;
    }
    XmlNode reservedNodeOfferingTypeNode = resultNode.FirstChild("ReservedNodeOfferingType");
    if(!reservedNodeOfferingTypeNode.IsNull())
    {
      m_reservedNodeOfferingType = ReservedNodeOfferingTypeMapper::GetReservedNodeOfferingTypeForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(reservedNodeOfferingTypeNode.GetText()).c_str()).c_str());
      m_reservedNodeOfferingTypeHasBeenSet = true;
    }
  }

  return *this;
}

void ReservedNode::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
  if(m_reservedNodeIdHasBeenSet)
  {
      oStream << location << index << locationValue << ".ReservedNodeId=" << StringUtils::URLEncode(m_reservedNodeId.c_str()) << "&";
  }

  if(m_reservedNodeOfferingIdHasBeenSet)
  {
      oStream << location << index << locationValue << ".ReservedNodeOfferingId=" << StringUtils::URLEncode(m_reservedNodeOfferingId.c_str()) << "&";
  }

  if(m_nodeTypeHasBeenSet)
  {
      oStream << location << index << locationValue << ".NodeType=" << StringUtils::URLEncode(m_nodeType.c_str()) << "&";
  }

  if(m_startTimeHasBeenSet)
  {
      oStream << location << index << locationValue << ".StartTime=" << StringUtils::URLEncode(m_startTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
  }

  if(m_durationHasBeenSet)
  {
      oStream << location << index << locationValue << ".Duration=" << m_duration << "&";
  }

  if(m_fixedPriceHasBeenSet)
  {
        oStream << location << index << locationValue << ".FixedPrice=" << StringUtils::URLEncode(m_fixedPrice) << "&";
  }

  if(m_usagePriceHasBeenSet)
  {
        oStream << location << index << locationValue << ".UsagePrice=" << StringUtils::URLEncode(m_usagePrice) << "&";
  }

  if(m_currencyCodeHasBeenSet)
  {
      oStream << location << index << locationValue << ".CurrencyCode=" << StringUtils::URLEncode(m_currencyCode.c_str()) << "&";
  }

  if(m_nodeCountHasBeenSet)
  {
      oStream << location << index << locationValue << ".NodeCount=" << m_nodeCount << "&";
  }

  if(m_stateHasBeenSet)
  {
      oStream << location << index << locationValue << ".State=" << StringUtils::URLEncode(m_state.c_str()) << "&";
  }

  if(m_offeringTypeHasBeenSet)
  {
      oStream << location << index << locationValue << ".OfferingType=" << StringUtils::URLEncode(m_offeringType.c_str()) << "&";
  }

  if(m_recurringChargesHasBeenSet)
  {
      unsigned recurringChargesIdx = 1;
      for(auto& item : m_recurringCharges)
      {
        Aws::StringStream recurringChargesSs;
        recurringChargesSs << location << index << locationValue << ".RecurringCharge." << recurringChargesIdx++;
        item.OutputToStream(oStream, recurringChargesSs.str().c_str());
      }
  }

  if(m_reservedNodeOfferingTypeHasBeenSet)
  {
      oStream << location << index << locationValue << ".ReservedNodeOfferingType=" << ReservedNodeOfferingTypeMapper::GetNameForReservedNodeOfferingType(m_reservedNodeOfferingType) << "&";
  }

}

void ReservedNode::OutputToStream(Aws::OStream& oStream, const char* location) const
{
  if(m_reservedNodeIdHasBeenSet)
  {
      oStream << location << ".ReservedNodeId=" << StringUtils::URLEncode(m_reservedNodeId.c_str()) << "&";
  }
  if(m_reservedNodeOfferingIdHasBeenSet)
  {
      oStream << location << ".ReservedNodeOfferingId=" << StringUtils::URLEncode(m_reservedNodeOfferingId.c_str()) << "&";
  }
  if(m_nodeTypeHasBeenSet)
  {
      oStream << location << ".NodeType=" << StringUtils::URLEncode(m_nodeType.c_str()) << "&";
  }
  if(m_startTimeHasBeenSet)
  {
      oStream << location << ".StartTime=" << StringUtils::URLEncode(m_startTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
  }
  if(m_durationHasBeenSet)
  {
      oStream << location << ".Duration=" << m_duration << "&";
  }
  if(m_fixedPriceHasBeenSet)
  {
        oStream << location << ".FixedPrice=" << StringUtils::URLEncode(m_fixedPrice) << "&";
  }
  if(m_usagePriceHasBeenSet)
  {
        oStream << location << ".UsagePrice=" << StringUtils::URLEncode(m_usagePrice) << "&";
  }
  if(m_currencyCodeHasBeenSet)
  {
      oStream << location << ".CurrencyCode=" << StringUtils::URLEncode(m_currencyCode.c_str()) << "&";
  }
  if(m_nodeCountHasBeenSet)
  {
      oStream << location << ".NodeCount=" << m_nodeCount << "&";
  }
  if(m_stateHasBeenSet)
  {
      oStream << location << ".State=" << StringUtils::URLEncode(m_state.c_str()) << "&";
  }
  if(m_offeringTypeHasBeenSet)
  {
      oStream << location << ".OfferingType=" << StringUtils::URLEncode(m_offeringType.c_str()) << "&";
  }
  if(m_recurringChargesHasBeenSet)
  {
      unsigned recurringChargesIdx = 1;
      for(auto& item : m_recurringCharges)
      {
        Aws::StringStream recurringChargesSs;
        recurringChargesSs << location <<  ".RecurringCharge." << recurringChargesIdx++;
        item.OutputToStream(oStream, recurringChargesSs.str().c_str());
      }
  }
  if(m_reservedNodeOfferingTypeHasBeenSet)
  {
      oStream << location << ".ReservedNodeOfferingType=" << ReservedNodeOfferingTypeMapper::GetNameForReservedNodeOfferingType(m_reservedNodeOfferingType) << "&";
  }
}

} // namespace Model
} // namespace Redshift
} // namespace Aws


text:
package scala.tools
package cmd

/** The trait mixed into each instance of a specification.
 *
 *  @see    Reference
 */
trait Instance extends Spec {
  def parsed: CommandLine

  protected def help(str: => String): Unit = ()

  def isSet(s: String)    = parsed isSet toOpt(s)
  def originalArgs        = parsed.originalArgs     // the full original list
  def residualArgs        = parsed.residualArgs     // only args which were not options or args to options

  type OptionMagic = Opt.Instance
  protected implicit def optionMagicAdditions(name: String) = new Opt.Instance(programInfo, parsed, name)
}


text:
package com.cmput301.cia.intent;

import android.content.Intent;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
import android.widget.ListView;
import android.widget.TextView;

import com.cmput301.cia.R;
import com.cmput301.cia.TestProfile;
import com.cmput301.cia.activities.events.FilterHabitsActivity;
import com.cmput301.cia.activities.events.HistoryActivity;
import com.cmput301.cia.models.Habit;
import com.cmput301.cia.models.HabitEvent;
import com.cmput301.cia.models.Profile;
import com.robotium.solo.Solo;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Version 2
 * Author: Adil Malik
 * Date: Nov 11 2017
 *
 * This class tests the UI for logging into the system and creating
 * a new profile
 */

public class FilterEventsIntentTests extends ActivityInstrumentationTestCase2<HistoryActivity> {

    private Solo solo;

    public FilterEventsIntentTests() {
        super(HistoryActivity.class);
    }

    public void setUp() throws Exception {

        List<Integer> allDays = new ArrayList<>();
        for (int i = 1; i <= 7; ++i){
            allDays.add(i);
        }

        Profile profile = new TestProfile("xyz");
        Habit habit = new Habit("T1", "", new Date(), allDays, "");
        habit.setId("one");
        profile.addHabit(habit);

        Habit habit2 = new Habit("T55", "", new Date(), allDays, "");
        habit2.setId("h2");
        habit2.addHabitEvent(new HabitEvent("one"));
        profile.addHabit(habit2);

        Intent intent = new Intent();
        intent.putExtra(HistoryActivity.ID_PROFILE, profile);
        setActivityIntent(intent);

        solo = new Solo(getInstrumentation(), getActivity());
        Log.d("SETUP", "setUp()");

        solo.sleep(1000);
        solo.clickOnButton("Habits");
        solo.sleep(2000);
    }

    public void testFinishAndCancel() throws NoSuchFieldException, IllegalAccessException {

        Field fieldFilter = solo.getCurrentActivity().getClass().getDeclaredField("selected");
        fieldFilter.setAccessible(true);

        assertTrue(fieldFilter.get(solo.getCurrentActivity()) == null);
        solo.clickInList(1, 0);
        solo.sleep(1000);

        Habit habit = (Habit) fieldFilter.get(solo.getCurrentActivity());

        assertEquals(habit, ((ListView)solo.getView(R.id.filterListView)).getAdapter().getItem(0));

        solo.clickOnButton("Finish");
        solo.sleep(1000);
        solo.assertCurrentActivity("wrong activity", HistoryActivity.class);

        // make sure that the history activity was notified of the habit selection
        Field field = solo.getCurrentActivity().getClass().getDeclaredField("filterHabit");
        field.setAccessible(true);
        assertEquals(field.get(solo.getCurrentActivity()), habit);

        solo.clickOnButton("Habits");
        solo.sleep(1000);
        solo.assertCurrentActivity("wrong activity", FilterHabitsActivity.class);

        // make sure that the selected habit does not change if nothing was selected in the activity
        solo.clickOnButton("Finish");
        solo.sleep(1000);
        solo.assertCurrentActivity("wrong activity", HistoryActivity.class);

        assertEquals(field.get(solo.getCurrentActivity()), habit);

        solo.clickOnButton("Habits");
        solo.sleep(1000);
        solo.assertCurrentActivity("wrong activity", FilterHabitsActivity.class);

        // make sure the selected habit does not change if the activity was cancelled
        solo.goBack();
        solo.sleep(1000);
        solo.assertCurrentActivity("wrong activity", HistoryActivity.class);

        assertEquals(field.get(solo.getCurrentActivity()), habit);
    }

    @Override
    public void tearDown() throws Exception{
        solo.finishOpenedActivities();
    }

}


text:
/**
 * A simple JSON search
 * Requires jQuery (v 1.7+)
 *
 * @author  Mat Hayward - Erskine Design
 * @version  0.1
 */

 /* ==========================================================================
    Initialisation
    ========================================================================== */

var q, jsonFeedUrl = "/search.json",
    $searchForm = $(".simple-search"),
    $searchInput = $("[data-search-input]"),
    $resultTemplate = $("#search-result"),
    $resultsPlaceholder = $("[data-search-results]"),
    $foundContainer = $("[data-search-found]"),
    $foundTerm = $("[data-search-found-term]"),
    $foundCount = $("[data-search-found-count]"),
    allowEmpty = true,
    showLoader = true,
    loadingClass = "is--loading";

$(document).ready( function() {

    // hide items found string
    $foundContainer.hide();

    // initiate search functionality
    initSearch();
});

 /* ==========================================================================
    Search functions
    ========================================================================== */

/**
 * Initiate search functionality.
 * Shows results based on querystring if present.
 * Binds search function to form submission.
 */
function initSearch() {

    // Get search results if q parameter is set in querystring
    if (getParameterByName('q')) {
        q = decodeURIComponent(getParameterByName('q'));
        $searchInput.val(q);
        execSearch(q);
    }

    // Get search results on submission of form
    $(document).on("submit", $searchForm, function(e) {
        e.preventDefault();
        q = $searchInput.val();
        execSearch(q);
    });
}

/**
 * Executes search
 * @param {String} q
 * @return null
 */
function execSearch(q) {
    if (q != '' || allowEmpty) {
        if (showLoader) {
            toggleLoadingClass();
        }

        getSearchResults(processData());
    }
}

/**
 * Toggles loading class on results and found string
 * @return null
 */
function toggleLoadingClass() {
    $resultsPlaceholder.toggleClass(loadingClass);
    $foundContainer.toggleClass(loadingClass);
}

/**
 * Get Search results from JSON
 * @param {Function} callbackFunction
 * @return null
 */
function getSearchResults(callbackFunction) {
    $.get(BASE_URL + jsonFeedUrl, callbackFunction, 'json');
}

/**
 * Process search result data
 * @return null
 */
function processData() {
    $results = [];

    return function(data) {
        var resultsCount = 0,
            results = "";

        $.each(data, function(index, item) {
            // check if search term is in content or title
            if (item.excerpt.toLowerCase().indexOf(q.toLowerCase()) > -1 || item.title.toLowerCase().indexOf(q.toLowerCase()) > -1 ||
          (item.tags && item.tags.indexOf(q.toLowerCase()) > -1)) {
                var result = populateResultContent($resultTemplate.html(), item);
                resultsCount++;
                results += result;
            }
        });

        if (showLoader) {
            toggleLoadingClass();
        }

        populateResultsString(resultsCount);
        showSearchResults(results);
    }
}

/**
 * Add search results to placeholder
 * @param {String} results
 * @return null
 */
function showSearchResults(results) {
    // Add results HTML to placeholder
    $resultsPlaceholder.html(results);
}

/**
 * Add results content to item template
 * @param {String} html
 * @param {object} item
 * @return {String} Populated HTML
 */
function populateResultContent(html, item) {
    html = injectContent(html, item.title, '##Title##');
    html = injectContent(html, item.link, '##Url##');
    html = injectContent(html, item.excerpt, '##Excerpt##');
    html = injectContent(html, item.date, '##Date##');
    return html;
}

/**
 * Populates results string
 * @param {String} count
 * @return null
 */
function populateResultsString(count) {
    $foundTerm.text(q);
    $foundCount.text(count);
    $foundContainer.show();
}

 /* ==========================================================================
    Helper functions
    ========================================================================== */

/**
 * Gets query string parameter - taken from http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
 * @param {String} name
 * @return {String} parameter value
 */
function getParameterByName(name) {
    var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}

/**
 * Injects content into template using placeholder
 * @param {String} originalContent
 * @param {String} injection
 * @param {String} placeholder
 * @return {String} injected content
 */
function injectContent(originalContent, injection, placeholder) {
    var regex = new RegExp(placeholder, 'g');
    return originalContent.replace(regex, injection);
}