text:
/**
 *  @brief usb-specific hardware setup, NVIC, clocks, and usb activities
 *  in the pre-attached state. includes some of the lower level callbacks
 *  needed by the usb library, like suspend,resume,init,etc
 */

#include "usb.h"
#include "libsmrobot.h"
#include "usb_lib.h"
#include "gpio.h"
#include "usb_hardware.h"
#include "delay.h"

#include "usb_config.h"
#include "usb_callbacks.h"
#include "usb_lib.h"

#include "usart.h"

/* persistent usb structs */

volatile uint32 bDeviceState = UNCONNECTED;
volatile uint16 wIstr = 0;
volatile uint32 bIntPackSOF = 0;

DEVICE Device_Table =
    {NUM_ENDPTS,
     1};

DEVICE_PROP Device_Property =
    {usbInit,
     usbReset,
     usbStatusIn,
     usbStatusOut,
     usbDataSetup,
     usbNoDataSetup,
     usbGetInterfaceSetting,
     usbGetDeviceDescriptor,
     usbGetConfigDescriptor,
     usbGetStringDescriptor,
     0,
     bMaxPacketSize};

USER_STANDARD_REQUESTS User_Standard_Requests =
    {NOP_Process,
     usbSetConfiguration,
     NOP_Process,
     NOP_Process,
     NOP_Process,
     NOP_Process,
     NOP_Process,
     NOP_Process,
     usbSetDeviceAddress};

void (*pEpInt_IN[7])(void) =
    {vcomDataTxCb,
     vcomManagementCb,
     NOP_Process,
     NOP_Process,
     NOP_Process,
     NOP_Process,
     NOP_Process};

void (*pEpInt_OUT[7])(void) =
    {NOP_Process,
     NOP_Process,
     vcomDataRxCb,
     NOP_Process,
     NOP_Process,
     NOP_Process,
     NOP_Process};

struct {
  volatile RESUME_STATE eState;
  volatile uint8 bESOFcnt;
} ResumeS;
#include "usart.h"
//For debug
/*void TxDByteC(uint8 buf){

	   while (!usart_tx(USART2, &buf, 1))
	        ;
}

void TxDStringC(char *str)
{
	int i;
	for(i=0; str[i] ; i++)
	{
		TxDByteC(str[i]);
	}
}
void TxDHex8C(u16 bSentData)
{
	u16 bTmp;

	bTmp = ((bSentData>>4)&0x000f) + (u8)'0';
	if(bTmp > '9') bTmp += 7;
	TxDByteC(bTmp);

	bTmp = (bSentData & 0x000f) + (u8)'0';
	if(bTmp > '9') bTmp += 7;
	TxDByteC(bTmp);
}
void TxDHex16C(u16 wSentData)
{
	TxDHex8C((wSentData>>8)&0x00ff );
	TxDHex8C( wSentData&0x00ff);
}

void TxDHex32C(u32 lSentData)
{
	TxDHex16C((lSentData>>16)&0x0000ffff );
	TxDHex16C( lSentData&0x0000ffff);
}*/
void setupUSB (void) {
  gpio_set_mode(USB_DISC_DEV, USB_DISC_PIN, GPIO_OUTPUT_PP);

  /* setup the apb1 clock for USB */
  pRCC->APB1ENR |= 0x00800000;

  /* initialize the usb application */
  gpio_write_bit(USB_DISC_DEV, USB_DISC_PIN, 0); // presents us to the host
  USB_Init();  // low level init routine provided by the ST library
}

void disableUSB (void) {
  // These are just guesses about how to do this
  // TODO: real disable function
  usbDsbISR();
  gpio_write_bit(USB_DISC_DEV, USB_DISC_PIN, 1);
}

void usbSuspend(void) {
  u16 wCNTR;
  wCNTR = _GetCNTR();
  wCNTR |= CNTR_FSUSP | CNTR_LPMODE;
  _SetCNTR(wCNTR);

  /* run any power reduction handlers */
  bDeviceState = SUSPENDED;
}

void usbResumeInit(void) {
  u16 wCNTR;

  /* restart any clocks that had been stopped */

  wCNTR = _GetCNTR();
  wCNTR &= (~CNTR_LPMODE);
  _SetCNTR(wCNTR);

  /* undo power reduction handlers here */
  _SetCNTR(ISR_MSK);

}

void usbResume(RESUME_STATE eResumeSetVal) {
  u16 wCNTR;

  if (eResumeSetVal != RESUME_ESOF)
    ResumeS.eState = eResumeSetVal;

  switch (ResumeS.eState)
    {
    case RESUME_EXTERNAL:
      usbResumeInit();
      ResumeS.eState = RESUME_OFF;
      break;
    case RESUME_INTERNAL:
      usbResumeInit();
      ResumeS.eState = RESUME_START;
      break;
    case RESUME_LATER:
      ResumeS.bESOFcnt = 2;
      ResumeS.eState = RESUME_WAIT;
      break;
    case RESUME_WAIT:
      ResumeS.bESOFcnt--;
      if (ResumeS.bESOFcnt == 0)
        ResumeS.eState = RESUME_START;
      break;
    case RESUME_START:
      wCNTR = _GetCNTR();
      wCNTR |= CNTR_RESUME;
      _SetCNTR(wCNTR);
      ResumeS.eState = RESUME_ON;
      ResumeS.bESOFcnt = 10;
      break;
    case RESUME_ON:
      ResumeS.bESOFcnt--;
      if (ResumeS.bESOFcnt == 0) {
          wCNTR = _GetCNTR();
          wCNTR &= (~CNTR_RESUME);
          _SetCNTR(wCNTR);
          ResumeS.eState = RESUME_OFF;
      }
      break;
    case RESUME_OFF:
    case RESUME_ESOF:
    default:
      ResumeS.eState = RESUME_OFF;
      break;
    }
}

RESULT usbPowerOn(void) {
  u16 wRegVal;

  wRegVal = CNTR_FRES;
  _SetCNTR(wRegVal);

  wInterrupt_Mask = 0;
  _SetCNTR(wInterrupt_Mask);
  _SetISTR(0);
  wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM; // the bare minimum
  _SetCNTR(wInterrupt_Mask);

  return USB_SUCCESS;
}

RESULT usbPowerOff(void) {
  _SetCNTR(CNTR_FRES);
  _SetISTR(0);
  _SetCNTR(CNTR_FRES + CNTR_PDWN);

  /* note that all weve done here is powerdown the
     usb peripheral. we have no disabled the clocks,
     pulled the usb_disc pin back up, or reset the
     application state machines */

  return USB_SUCCESS;
}

// These two functions (usbEnbISR/usbDsbISR) are implementented in ST style,
// and at least the DsbISR doesn't seem to work?
void usbEnbISR(void) {
  NVIC_InitTypeDef NVIC_InitStructure;
  NVIC_InitStructure.NVIC_IRQChannel = USB_LP_IRQ;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = TRUE;
  nvicInit(&NVIC_InitStructure);
}

void usbDsbISR(void) {
  NVIC_InitTypeDef NVIC_InitStructure;
  NVIC_InitStructure.NVIC_IRQChannel = USB_LP_IRQ;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = FALSE;
  nvicInit(&NVIC_InitStructure);
}

/* overloaded ISR routine, this is the main usb ISR */
void __irq_usb_lp_can_rx0(void) {
wIstr = _GetISTR();

/* go nuts with the preproc switches since this is an ISTR and must be FAST */
#if (ISR_MSK & ISTR_RESET)
if (wIstr & ISTR_RESET & wInterrupt_Mask)
  {
    _SetISTR((u16)CLR_RESET);
    Device_Property.Reset();
  }
#endif

#if (ISR_MSK & ISTR_DOVR)
if (wIstr & ISTR_DOVR & wInterrupt_Mask)
  {
    _SetISTR((u16)CLR_DOVR);
  }
#endif

#if (ISR_MSK & ISTR_ERR)
if (wIstr & ISTR_ERR & wInterrupt_Mask)
  {
    _SetISTR((u16)CLR_ERR);
  }
#endif

#if (ISR_MSK & ISTR_WKUP)
if (wIstr & ISTR_WKUP & wInterrupt_Mask) {
    _SetISTR((u16)CLR_WKUP);
    usbResume(RESUME_EXTERNAL);
}
#endif

/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if (ISR_MSK & ISTR_SUSP)
if (wIstr & ISTR_SUSP & wInterrupt_Mask) {
    /* check if SUSPEND is possible */
    if (F_SUSPEND_ENABLED) {
        usbSuspend();
    } else {
        /* if not possible then resume after xx ms */
        usbResume(RESUME_LATER);
    }
    /* clear of the ISTR bit must be done after setting of CNTR_FSUSP */
    _SetISTR((u16)CLR_SUSP);
}
#endif

#if (ISR_MSK & ISTR_SOF)
if (wIstr & ISTR_SOF & wInterrupt_Mask) {
    _SetISTR((u16)CLR_SOF);
    bIntPackSOF++;
 }
#endif

#if (ISR_MSK & ISTR_ESOF)
if (wIstr & ISTR_ESOF & wInterrupt_Mask) {
    _SetISTR((u16)CLR_ESOF);
    /* resume handling timing is made with ESOFs */
    usbResume(RESUME_ESOF); /* request without change of the machine state */
 }
#endif

/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#if (ISR_MSK & ISTR_CTR)
if (wIstr & ISTR_CTR & wInterrupt_Mask) {
    /* servicing of the endpoint correct transfer interrupt */
    /* clear of the CTR flag into the sub */
    CTR_LP(); /* low priority ISR defined in the usb core lib */
 }
#endif

}

void usbWaitReset(void) {
  delay_us(RESET_DELAY);
  systemHardReset();
}

/* This low-level send bytes function is NON-BLOCKING; blocking behavior, with
 * a timeout, is implemented in usercode (or in the Wirish C++ high level
 * implementation).
 *
 * This function will quickly copy up to 64 bytes of data (out of an
 * arbitrarily large buffer) into the USB peripheral TX buffer and return the
 * number placed in that buffer. It is up to usercode to divide larger packets
 * into 64-byte chunks to guarantee delivery.
 *
 *
 */
void usbBlockingSendByte(char ch) {
    while (countTx);
    UserToPMABufferCopy((uint8*)&ch,VCOM_TX_ADDR,1);
//    HexDump(ch, 1);

    _SetEPTxCount(VCOM_TX_ENDP,1);
    _SetEPTxValid(VCOM_TX_ENDP);
    countTx = 1;
    while (countTx);
}

uint32 usbSendBytes(const uint8* sendBuf, uint32 nCount) {
	if(gbUsbVcpStatus == USB_PORT_CLOSE)
		return 0;
	//TxDStringC("[sendUSB]gbUsbVcpStatus = "); TxDHex8C(gbUsbVcpStatus);TxDStringC("\r\n");
	do{

		//TxDStringC("nCount = "); TxDHex8C(nCount);TxDStringC("\r\n");

		 //wait until Tx is valid... this is really important delay. delay(1) also can be alternative.
		while( ( _GetENDPOINT(VCOM_TX_ENDP) & EP_TX_VALID) == EP_TX_VALID );

		//if length > 64bytes
		if( nCount > VCOM_TX_EPSIZE){
			UserToPMABufferCopy(sendBuf, VCOM_TX_ADDR, VCOM_TX_EPSIZE);
//      HexDump(sendBuf, VCOM_TX_EPSIZE);

			_SetEPTxCount(VCOM_TX_ENDP, VCOM_TX_EPSIZE);
			nCount -= VCOM_TX_EPSIZE; // discount the 64 bytes sent.
			sendBuf += VCOM_TX_EPSIZE;// pointer is moved to next 64bytes.
		}
		else{  // len < 64 bytes , the rest will be sent.
			UserToPMABufferCopy(sendBuf, VCOM_TX_ADDR, nCount);
//      HexDump(sendBuf, nCount);
			_SetEPTxCount(VCOM_TX_ENDP, nCount);
			nCount = 0; //Exit
		}

		_SetEPTxValid(VCOM_TX_ENDP);  //it is enables to transfer data to PC again.
	 }while(nCount);

	return nCount;

#if 0
  /* Last transmission hasn't finished, abort */
  if (countTx) {
    return 0;
  }

  // We can only put VCOM_TX_EPSIZE bytes in the buffer
  if (len > VCOM_TX_EPSIZE / 2) {
    len = VCOM_TX_EPSIZE / 2;
  }

  // Try to load some bytes if we can
  if (len) {
    UserToPMABufferCopy(sendBuf, VCOM_TX_ADDR, len);
    _SetEPTxCount(VCOM_TX_ENDP, len);
    countTx += len;
    _SetEPTxValid(VCOM_TX_ENDP);
  }

  return len;
#endif

}

/* returns the number of available bytes are in the recv FIFO */
uint32 usbBytesAvailable(void) {
  return newBytes;
}

/* copies len bytes from the local recieve FIFO (not
   usb packet buffer) into recvBuf and deq's the fifo.
   will only copy the minimum of len or the available
   bytes. returns the number of bytes copied */
uint32 usbReceiveBytes(uint8* recvBuf, uint32 len) {
  static int offset = 0;

  if (len > newBytes) {
      len = newBytes;
  }

  int i;
  for (i=0;i<len;i++) {
      recvBuf[i] = (uint8)(vcomBufferRx[i+offset]);
  }

  newBytes -= len;
  offset += len;

  /* re-enable the rx endpoint which we had set to receive 0 bytes */
  if (newBytes == 0) {
    SetEPRxCount(VCOM_RX_ENDP,VCOM_RX_EPSIZE);
    SetEPRxStatus(VCOM_RX_ENDP,EP_RX_VALID);
    offset = 0;
  }

  return len;
}

void usbSendHello(void) {
  uint8 bufin = 48 + recvBufIn;;
  uint8 bufout = 48 + recvBufOut;
  uint8 avail  = 48 + usbBytesAvailable();

  char *line = "\r\n";
  while(usbSendBytes(&bufin,1) == 0);
  while(usbSendBytes(&bufout,1) == 0);
  while(usbSendBytes(&avail,1) == 0);
  while(usbSendBytes((uint8*)line,2) == 0);

  uint8 recv[64];
  usbReceiveBytes(&recv[0],1);
}

uint8 usbGetDTR() {
  return ((line_dtr_rts & CONTROL_LINE_DTR) != 0);
}

uint8 usbGetRTS() {
  return ((line_dtr_rts & CONTROL_LINE_RTS) != 0);
}

uint8 usbIsConfigured() {
  return (bDeviceState == CONFIGURED);
}

uint8 usbIsConnected() {
  return (bDeviceState != UNCONNECTED);
}

uint16 usbGetPending() {
  return countTx;
}


text:
#ifndef HTMLVideoElement_h
#define HTMLVideoElement_h

#if ENABLE(VIDEO)
#include "HTMLMediaElement.h"

namespace WebCore {

class HTMLImageLoader;

class HTMLVideoElement FINAL : public HTMLMediaElement {
public:
    static PassRefPtr<HTMLVideoElement> create(const QualifiedName&, Document&, bool);

    unsigned width() const;
    unsigned height() const;

    unsigned videoWidth() const;
    unsigned videoHeight() const;

    // Fullscreen
    void webkitEnterFullscreen(ExceptionCode&);
    void webkitExitFullscreen();
    bool webkitSupportsFullscreen();
    bool webkitDisplayingFullscreen();

    // FIXME: Maintain "FullScreen" capitalization scheme for backwards compatibility.
    // https://bugs.webkit.org/show_bug.cgi?id=36081
    void webkitEnterFullScreen(ExceptionCode& ec) { webkitEnterFullscreen(ec); }
    void webkitExitFullScreen() { webkitExitFullscreen(); }

#if ENABLE(MEDIA_STATISTICS)
    // Statistics
    unsigned webkitDecodedFrameCount() const;
    unsigned webkitDroppedFrameCount() const;
#endif

    // Used by canvas to gain raw pixel access
    void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);

    // Used by WebGL to do GPU-GPU textures copy if possible.
    // See more details at MediaPlayer::copyVideoTextureToPlatformTexture() defined in Source/WebCore/platform/graphics/MediaPlayer.h.
    bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3DObject texture, GC3Dint level, GC3Denum type, GC3Denum internalFormat, bool premultiplyAlpha, bool flipY);

    bool shouldDisplayPosterImage() const { return displayMode() == Poster || displayMode() == PosterWaitingForVideo; }

    KURL posterImageURL() const;

private:
    HTMLVideoElement(const QualifiedName&, Document&, bool);

    virtual bool rendererIsNeeded(const RenderStyle&);
#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
    virtual RenderElement* createRenderer(RenderArena&, RenderStyle&);
#endif
    virtual void didAttachRenderers() OVERRIDE;
    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
    virtual bool isVideo() const { return true; }
    virtual bool hasVideo() const { return player() && player()->hasVideo(); }
    virtual bool supportsFullscreen() const;
    virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
    virtual const AtomicString& imageSourceURL() const OVERRIDE;

    virtual bool hasAvailableVideoFrame() const;
    virtual void updateDisplayState();
    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    virtual void setDisplayMode(DisplayMode);

    OwnPtr<HTMLImageLoader> m_imageLoader;

    AtomicString m_defaultPosterURL;
};

ELEMENT_TYPE_CASTS(HTMLVideoElement)

} //namespace

#endif
#endif

redpajama_set_name: RedPajamaGithub


text:
#pragma once

#include <wx/image.h>

class ToolImage: public wxImage{
public:
	static float m_button_scale;
	static const int full_size;
	static const int default_bitmap_size;

	ToolImage(const wxString& name, bool full_path_given = false);

	static int GetBitmapSize();
	static void SetBitmapSize(int size);
};


text:
require 'totem'
require 'graph'
require 'torch'
local tester = totem.Tester()
local tests = {}

function tests.layout()
    local g = graph.Graph()
    local root = graph.Node(10)
    local n1 = graph.Node(1)
    local n2 = graph.Node(2)
    g:add(graph.Edge(root, n1))
    g:add(graph.Edge(n1, n2))

    local positions = graph.graphvizLayout(g, 'dot')
    local xs = positions:select(2, 1)
    local ys = positions:select(2, 2)
    tester:assertlt(xs:add(-xs:mean()):norm(), 1e-3,
                    "x coordinates should be the same")
    tester:assertTensorEq(ys, torch.sort(ys, true), 1e-3,
                    "y coordinates should be ordered")
end

function tests.testDotEscape()
  tester:assert(graph._dotEscape('red') == 'red', 'Don\'t escape single words')
  tester:assert(graph._dotEscape('My label') == '"My label"',
                'Use quotes for spaces')
  tester:assert(graph._dotEscape('Non[an') == '"Non[an"',
                'Use quotes for non-alpha characters')
  tester:assert(graph._dotEscape('My\nnewline') == '"My\\nnewline"',
                'Escape newlines')
  tester:assert(graph._dotEscape('Say "hello"') == '"Say \\"hello\\""',
                'Escape quotes')
end

return tester:add(tests):run()


text:
package colr

import (
	"encoding/xml"

	"github.com/fgrid/iso20022"
)

type Document00300103 struct {
	XMLName xml.Name              `xml:"urn:iso:std:iso:20022:tech:xsd:colr.003.001.03 Document"`
	Message *MarginCallRequestV03 `xml:"MrgnCallReq"`
}

func (d *Document00300103) AddMessage() *MarginCallRequestV03 {
	d.Message = new(MarginCallRequestV03)
	return d.Message
}

// Scope
// The MarginCallRequest message is sent by the collateral taker or its collateral manager to the collateral giver or its collateral manager
// This message is used to request new collateral at the initiation of an exposure or request additional collateral for an existing exposure. It can also be used to recall collateral upon the collateral giver or its collateral manager's request.
//
// The message definition is intended for use with the ISO20022 Business Application Header.
//
// Usage
// When sent by the collateral taker the MarginCallRequest message is used to:
// - request new collateral at the initiation of an exposure
// - request additional collateral
// When sent by the collateral giver the MarginCallRequest message is used to:
// - request the return of collateral
type MarginCallRequestV03 struct {

	// Unambiguous identification of the transaction as know by the instructing party.
	TransactionIdentification *iso20022.Max35Text `xml:"TxId"`

	// Provides information like the identification of the party or parties associated with the collateral agreement, the exposure type and the valuation date.
	Obligation *iso20022.Obligation3 `xml:"Oblgtn"`

	// Agreement details for the over the counter market.
	Agreement *iso20022.Agreement2 `xml:"Agrmt,omitempty"`

	// Provides details about the margin calculation that would be due to party A.
	MarginDetailsDueToA *iso20022.MarginCall1 `xml:"MrgnDtlsDueToA,omitempty"`

	// Provides details about the margin calculation that would be due to party B.
	MarginDetailsDueToB *iso20022.MarginCall1 `xml:"MrgnDtlsDueToB,omitempty"`

	// Amount of expected margin that will be either delivered to party A by party B or recalled to party A from party B.
	RequirementDetailsDueToA *iso20022.MarginRequirement1Choice `xml:"RqrmntDtlsDueToA,omitempty"`

	// Amount of expected margin that will be either delivered to party B by party A or recalled to party B from party A.
	RequirementDetailsDueToB *iso20022.MarginRequirement1Choice `xml:"RqrmntDtlsDueToB,omitempty"`

	// Summation of the call amounts per margin type. It is provided for the purposes of carrying forward for future messages that are used to compare the margin call results to determine whether a call is agreed or full/partially disputed.
	MarginCallResult *iso20022.MarginCallResult3 `xml:"MrgnCallRslt"`

	// Provides details about the type of collateral that will be either delivered to party B by party A or recalled to party B from party A.
	ExpectedCollateralDueToB *iso20022.ExpectedCollateral1Choice `xml:"XpctdCollDueToB,omitempty"`

	// Provides details about the type of collateral that will be either delivered to party A by party B or recalled to party A from party B.
	ExpectedCollateralDueToA *iso20022.ExpectedCollateral1Choice `xml:"XpctdCollDueToA,omitempty"`

	// Additional information that can not be captured in the structured fields and/or any other specific block.
	SupplementaryData []*iso20022.SupplementaryData1 `xml:"SplmtryData,omitempty"`
}

func (m *MarginCallRequestV03) SetTransactionIdentification(value string) {
	m.TransactionIdentification = (*iso20022.Max35Text)(&value)
}

func (m *MarginCallRequestV03) AddObligation() *iso20022.Obligation3 {
	m.Obligation = new(iso20022.Obligation3)
	return m.Obligation
}

func (m *MarginCallRequestV03) AddAgreement() *iso20022.Agreement2 {
	m.Agreement = new(iso20022.Agreement2)
	return m.Agreement
}

func (m *MarginCallRequestV03) AddMarginDetailsDueToA() *iso20022.MarginCall1 {
	m.MarginDetailsDueToA = new(iso20022.MarginCall1)
	return m.MarginDetailsDueToA
}

func (m *MarginCallRequestV03) AddMarginDetailsDueToB() *iso20022.MarginCall1 {
	m.MarginDetailsDueToB = new(iso20022.MarginCall1)
	return m.MarginDetailsDueToB
}

func (m *MarginCallRequestV03) AddRequirementDetailsDueToA() *iso20022.MarginRequirement1Choice {
	m.RequirementDetailsDueToA = new(iso20022.MarginRequirement1Choice)
	return m.RequirementDetailsDueToA
}

func (m *MarginCallRequestV03) AddRequirementDetailsDueToB() *iso20022.MarginRequirement1Choice {
	m.RequirementDetailsDueToB = new(iso20022.MarginRequirement1Choice)
	return m.RequirementDetailsDueToB
}

func (m *MarginCallRequestV03) AddMarginCallResult() *iso20022.MarginCallResult3 {
	m.MarginCallResult = new(iso20022.MarginCallResult3)
	return m.MarginCallResult
}

func (m *MarginCallRequestV03) AddExpectedCollateralDueToB() *iso20022.ExpectedCollateral1Choice {
	m.ExpectedCollateralDueToB = new(iso20022.ExpectedCollateral1Choice)
	return m.ExpectedCollateralDueToB
}

func (m *MarginCallRequestV03) AddExpectedCollateralDueToA() *iso20022.ExpectedCollateral1Choice {
	m.ExpectedCollateralDueToA = new(iso20022.ExpectedCollateral1Choice)
	return m.ExpectedCollateralDueToA
}

func (m *MarginCallRequestV03) AddSupplementaryData() *iso20022.SupplementaryData1 {
	newValue := new(iso20022.SupplementaryData1)
	m.SupplementaryData = append(m.SupplementaryData, newValue)
	return newValue
}


text:
package com.iticket.service;

import java.util.List;

import com.iticket.model.api.ClientMember;
import com.iticket.model.stadium.Stadium;
import com.iticket.model.ticket.Voucher;
import com.iticket.vo.TicketVo;

public interface TicketService {
	/**
	 * 预售卖出
	 * @param member
	 * @param voucherId
	 * @param ticketType
	 * @param payMethod
	 * @param showPrice
	 * @param saleType
	 * @param disType
	 * @return
	 * @throws IException
	 */
	List<TicketVo> reserveSell(ClientMember member, Long voucherId,
			String ticketType, String payMethod, String showPrice, Integer saleType, String disType)
			throws IException;
	/**
	 * 预售取消
	 * @param member
	 * @param voucherId
	 * @throws IException
	 */
	void reserveCancel(ClientMember member, Long voucherId) throws IException;
	/**
	 * 重复打印
	 * @param member
	 * @param voucherId
	 * @return
	 * @throws IException
	 */
	List<TicketVo> repeatPrint(Stadium stadium, ClientMember member, Long voucherId, String reprintPass)throws IException;
	/**
	 * 退款
	 * @param member
	 * @param voucherId
	 * @throws IException
	 */
	void refund(Stadium stadium, ClientMember member, Long voucherId, String refundPass) throws IException;
	/**
	 * 根据凭证获取座位名称
	 * @param voucher
	 * @return
	 */
	String getSeatLabelsByVoucherId(Voucher voucher);
}


text:
{
  jestExpect(list).toContainEqual(v);
  expect(() =>
    jestExpect(list).not.toContainEqual(v)
  ).toThrowErrorMatchingSnapshot();
}


text:
<?php
/**
 * Displays a list of provided records in a HTML Table
 *
 * @package WP_Stream
 */

namespace WP_Stream;

/**
 * Class - Preview_List_Table
 */
class Preview_List_Table extends List_Table {

	/**
	 * Class constructor.
	 *
	 * @param Plugin $plugin Plugin object.
	 *
	 * @return void
	 */
	public function __construct( $plugin ) {
		$this->plugin = $plugin;
		parent::__construct( $plugin );
	}

	/**
	 * Sets up the records for display.
	 *
	 * @param array $items List of items for display.
	 *
	 * @return void
	 */
	public function set_records( $items ) {
		$columns  = $this->get_columns();
		$sortable = $this->get_sortable_columns();
		$hidden   = $this->get_hidden_columns();
		$primary  = $columns['summary'];

		$this->_column_headers = array(
			$columns,
			$hidden,
			$sortable,
			$primary,
		);

		$this->items = $items;
	}

	/**
	 * Display the table
	 *
	 * @since 3.1.0
	 * @access public
	 */
	public function display() {
		?>
		<table class="wp-list-table <?php esc_attr( implode( ' ', $this->get_table_classes() ) ); ?>">

				<?php $this->print_column_headers(); ?>

			<?php $this->display_rows_or_placeholder(); ?>

				<?php $this->print_column_headers( false ); ?>

		<?php
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
		"http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>doh.robot Tree DnD Multi-parent Test</title>

		<style>
			@import "../../../../util/doh/robot/robot.css";
		</style>

		<!-- required: dojo.js -->
		<script type="text/javascript" src="../../../../dojo/dojo.js"></script>

		<!-- functions to help test -->
		<script type="text/javascript" src="Tree_dnd.js"></script>

		<script type="text/javascript">
			dojo.require("dojo.window");
			dojo.require("dijit.robotx");
			dojo.require("dijit.tests.helpers");	// functions to help test

			dojo.ready(function(){
				doh.robot.initRobot('../test_Tree_DnD.html');

				setup();

				doh.register("multi-parent tests", [
					{
						name: "add 'Fruits' as parent of vegetables",
						timeout: 10000,
						runTest: function(){
							var
								d = new doh.Deferred(),
								vegetablesTreeNode = findTreeNodeByPath("collectionsTree", ["Vegetables (0)"]),	// the left tree
								fruitsTreeNode = findTreeNodeByPath("itemTree", ["Fruits"]);	// right tree

							doh.robot.mouseMoveAt("collectionsTree", 500, 1); // scroll source parent into view
							doh.robot.mouseMoveAt(vegetablesTreeNode.domNode, 500, 1);
							// Drag and Drop, *copying* in order to add a parent rather than change
							doh.robot.keyDown(dojo.keys.copyKey, 500);
							if(dojo.isMac){
								// I can't get DOH robot to generate the mousePress event w/metaKey=true so
								// hack it
								doh.robot.sequence(function(){
									realIsCopyKey = dojo.global.dojo.isCopyKey;
									dojo.global.dojo.isCopyKey = function(){ return true; }
								});
							}

							doh.robot.mousePress({left: true}, 500);
							doh.robot.mouseMoveAt("itemTree", 500, 500); // move to dest parent to scroll it into view
							doh.robot.mouseMoveAt(fruitsTreeNode.labelNode, 0, 500);
							doh.robot.mouseRelease({left: true}, 500);
							doh.robot.keyUp(dojo.keys.copyKey, 500);
							if(dojo.isMac){
								// See if(dojo.isMac) above
								doh.robot.sequence(function(){
									dojo.global.dojo.isCopyKey = realIsCopyKey;
								});
							}

							doh.robot.sequence(d.getTestCallback(function(){
								// Check that Vegetables remains a child of Foods
								var children = getNamesOfChildrenOfItem("Foods");
								doh.is(3, children.categories.length, "foods category child");
								doh.is("Fruits", children.categories[0]);
								doh.is("Vegetables", children.categories[1]);
								doh.is("Cereals", children.categories[2]);

								// Check that Vegetables added as child of Fruits
								var children2 = getNamesOfChildrenOfItem("Fruits");
								doh.is(2, children2.categories.length, "foods category child");
								doh.is("Citrus", children2.categories[0]);
								doh.is("Vegetables", children2.categories[1]);

								// Check that new item *wasn't* created
								var items;
								dojo.global.myStore.fetch({
									onComplete: function(i){ items = i; }
								});
								doh.is(6, items.length, "# of items in store");

								// Check that data store update was reflected in the tree
								doh.t(fruitsTreeNode.isExpanded, "drop caused the node to expand");
								var treeNodeChildren = fruitsTreeNode.getChildren();
								doh.is(2, treeNodeChildren.length, "2 TreeNode children");
								doh.is("Citrus", innerText(treeNodeChildren[0].labelNode));
								doh.is("Vegetables", innerText(treeNodeChildren[1].labelNode));
							}), 1000);	// 1000ms to wait for 'Fruits' node to expand and show 'Apple' node

							return d;
						}
					},
					{
						name: "move Foods/Vegetables to Foods/Cereal/Vegetables",
						timeout: 10000,
						runTest: function(){
							var
								d = new doh.Deferred(),
								vegetablesTreeNode = findTreeNodeByPath("itemTree", ["Vegetables"]),
								cerealsTreeNode = findTreeNodeByPath("itemTree", ["Cereals"]);

							dojo.global.scrollTo(0, 9000); // scroll to bottom to try and prevent the DnD code from autoscrolling

							// Drag and Drop
							doh.robot.mouseMoveAt(vegetablesTreeNode.domNode, 500, 1);
							doh.robot.mouseClick({left: true}, 500); // helps prevent screen jitter
							doh.robot.mousePress({left: true}, 1000);
							doh.robot.mouseMoveAt(vegetablesTreeNode.labelNode, 500, 500, 0, 0); // move mouse slightly to trigger DnD
							doh.robot.mouseMoveAt(cerealsTreeNode.domNode, 500, 100); // double move to allow for autoscrolling jitter
							doh.robot.mouseMoveAt(cerealsTreeNode.domNode, 500, 100);
							doh.robot.mouseRelease({left: true}, 500);

							doh.robot.sequence(d.getTestCallback(function(){
								// Check that Vegetables remains a child of Fruits
								var children = getNamesOfChildrenOfItem("Fruits");
								doh.is(2, children.categories.length, "fruits category child");
								doh.is("Citrus", children.categories[0]);
								doh.is("Vegetables", children.categories[1]);

								// Check that Vegetables added as child of Cereals
								children = getNamesOfChildrenOfItem("Cereals");
								doh.is(1, children.categories.length, "cereals category child");
								doh.is("Vegetables", children.categories[0]);

								// Check that Vegetables no longer a child of Foods
								children = getNamesOfChildrenOfItem("Foods");
								doh.is(2, children.categories.length, "foods category child");
								doh.is("Fruits", children.categories[0]);
								doh.is("Cereals", children.categories[1]);

								// Check that new item *wasn't* created
								var items;
								dojo.global.myStore.fetch({
									onComplete: function(i){ items = i; }
								});
								doh.is(6, items.length, "# of items in store");
							}), 1000);	// 1000ms to wait for 'Fruits' node to expand and show 'Apple' node

							return d;
						}
					},
					{
						name: "move Fruits/Vegetables to Fruits/Citrus",
						timeout: 10000,
						runTest: function(){
							var
								d = new doh.Deferred(),
								vegetablesTreeNode = findTreeNodeByPath("itemTree", ["Fruits", "Vegetables"]),
								citrusTreeNode = findTreeNodeByPath("itemTree", ["Fruits", "Citrus"]);

							// Drag and Drop
							doh.robot.mouseMoveAt(vegetablesTreeNode.labelNode, 500, 1);
							doh.robot.mouseClick({left: true}, 500); // helps prevent screen jitter
							doh.robot.mousePress({left: true}, 1000);
							doh.robot.mouseMoveAt(vegetablesTreeNode.labelNode, 500, 500, 0, 0); // move mouse slightly to trigger DnD
							doh.robot.mouseMoveAt(citrusTreeNode.labelNode, 0, 500);
							doh.robot.mouseRelease({left: true}, 500);

							doh.robot.sequence(d.getTestCallback(function(){
								// Check that Vegetables remains a child of Cereals
								var children = getNamesOfChildrenOfItem("Cereals");
								doh.is(1, children.categories.length, "cereals category child");
								doh.is("Vegetables", children.categories[0]);

								// Check that Vegetables added as child of Citrus
								children = getNamesOfChildrenOfItem("Citrus");
								doh.is(1, children.categories.length, "citrus category child");
								doh.is("Vegetables", children.categories[0]);
								doh.is(1, children.items.length, "citrus item child");
								doh.is("Orange", children.items[0]);

								// Check that Vegetables removed as child of Fruits
								children = getNamesOfChildrenOfItem("Fruits");
								doh.is(1, children.categories.length, "fruits category child");
								doh.is("Citrus", children.categories[0]);

								// Check that new item *wasn't* created
								var items;
								dojo.global.myStore.fetch({
									onComplete: function(i){ items = i; }
								});
								doh.is(6, items.length, "# of items in store");
							}), 1000);	// 1000ms to wait for 'Fruits' node to expand and show 'Apple' node

							return d;
						}
					}
				]);

				doh.register("external drop tests", [
					{
						name: "drop banana on fruits",
						timeout: 10000,
						runTest: function(){
							var
								d = new doh.Deferred(),
								fruitsTreeNode = findTreeNodeByPath("itemTree", ["Fruits"]);	// right tree

							doh.robot.mouseMoveAt(dojo.byId("1003").parentNode, 500, 1, 0, 0); // move to source parent node to help prevent DnD autoscrolling
							doh.robot.mouseMoveAt(dojo.byId("1003"), 500, 1); // move to source banana node
							doh.robot.mousePress({left: true}, 500);
							doh.robot.mouseMoveAt(dojo.byId("1003").parentNode, 500, 100); //  move just a little to start the DnD operation before scrolling
							doh.robot.mouseMoveAt("itemTree", 500, 500); // go to target parent top to allow for better scrolling of the destination
							doh.robot.mouseMoveAt(fruitsTreeNode.labelNode, 1000, 500);
							doh.robot.mouseRelease({left: true}, 500);

							doh.robot.sequence(d.getTestCallback(function(){

								var children = getChildrenOfItem("Fruits");
								doh.is(1, children.items.length, "new item added");
								doh.is(1003, children.items[0].id, "id of new item came from dropped node");
								doh.is("Banana", children.items[0].name, "name of new item came from dropped node");

								dojo.global.myStore.fetch({
									query: { name: "Banana" },
									queryOptions: { deep: true },
									onComplete: function(i){ items = i; }
								});
								doh.is(1, items.length, "1 banana item in store");
							}), 1000);

							return d;
						}
					},
					{
						name: "drop banana on cereal",
						timeout: 10000,
						runTest: function(){
							var
								d = new doh.Deferred(),
								cerealsTreeNode = findTreeNodeByPath("itemTree", ["Cereals"]);					// right tree

							doh.robot.mouseMoveAt(dojo.byId("1003").parentNode, 500, 1, 0, 0); // move to source parent node to help prevent DnD autoscrolling
							doh.robot.mouseMoveAt(dojo.byId("1003"), 500, 1); // move to source banana node
							doh.robot.mousePress({left: true}, 500);
							doh.robot.mouseMoveAt(dojo.byId("1003").parentNode, 500, 100); //  move just a little to start the DnD operation before scrolling
							doh.robot.mouseMoveAt("itemTree", 500, 100); // go to target parent top to allow for better scrolling of the destination
							doh.robot.mouseMoveAt(cerealsTreeNode.labelNode, 1000, 500);
							doh.robot.mouseRelease({left: true}, 500);

							doh.robot.sequence(d.getTestCallback(function(){

								var children = getChildrenOfItem("Cereals");
								doh.is(1, children.items.length, "banana is child of cereals");
								doh.is(1003, children.items[0].id, "id of item came from dropped node");
								doh.is("Banana", children.items[0].name, "name of new item came from dropped node");

								var children2 = getChildrenOfItem("Fruits");
								doh.is(1, children2.items.length, "banana still a child of fruits");
								doh.is(1003, children2.items[0].id, "id of new item came from dropped node");
								doh.is("Banana", children2.items[0].name, "name of new item came from dropped node");

								dojo.global.myStore.fetch({
									query: { name: "Banana" },
									queryOptions: { deep: true },
									onComplete: function(i){ items = i; }
								});
								doh.is(1, items.length, "1 banana item in store (with 2 parents)");
							}), 1000);

							return d;
						}
					}
				]);

				doh.register("illegal drop", [
					// This tests dropping a node onto another node when both nodes represent the same item.
					{
						name: "try to drop Vegetables as child of Vegetables",
						timeout: 10000,
						runTest: function(){
							var
								d = new doh.Deferred(),
								drag = findTreeNodeByPath("itemTree", ["Cereals", "Vegetables"]),
								aboveDrop = findTreeNodeByPath("itemTree", ["Fruits", "Citrus"]);
								drop = findTreeNodeByPath("itemTree", ["Fruits", "Citrus", "Vegetables"]);

							doh.is(drop.item.id, drag.item.id, "both nodes point to same item");

							// Drag bottom vegetables node over Citrus
							doh.robot.mouseMoveAt(drag.domNode, 500, 1);
							doh.robot.mousePress({left: true}, 500);
							doh.robot.mouseMoveAt(aboveDrop.labelNode, 0, 500);

							doh.robot.sequence(d.getTestErrback(function(){
								var avatar = dojo.query(".dojoDndAvatar");
								doh.t(avatar && avatar[0], "avatar found");
								doh.t(dojo.hasClass(avatar[0], "dojoDndAvatarCanDrop"), "can drop");
							}), 500);

							// Now move it to over first Vegetables node.   Should be red icon indicating drop-unallowed
							doh.robot.mouseMoveAt(drop.labelNode, 0, 500);
							doh.robot.sequence(d.getTestErrback(function(){
								var avatar = dojo.query(".dojoDndAvatar");
								doh.t(avatar && avatar[0], "avatar found");
								doh.f(dojo.hasClass(avatar[0], "dojoDndAvatarCanDrop"), "can't drop");
							}), 500);

							// Try to drop anyway, and make sure Tree structure doesn't change
							doh.robot.mouseRelease({left: true}, 500);
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is(0, drop.getChildren().length, "drop node has no children");
								doh.t(drag == findTreeNodeByPath("itemTree", ["Cereals", "Vegetables"]),
										"drag node still in same place");
							}), 500);

							return d;
						}
					}
				]);

				doh.run();
			});
		</script>
	</head>
</html>


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Microsoft.Band.Admin;
using Microsoft.Band;
using Microsoft.Band.Personalization;

namespace unBand.BandHelpers
{
    [StructLayout(LayoutKind.Explicit)]
    public struct PixelColor
    {
        // 32 bit BGRA
        [FieldOffset(0)]
        public UInt32 ColorBGRA;
        // 8 bit components
        [FieldOffset(0)]
        public byte Blue;
        [FieldOffset(1)]
        public byte Green;
        [FieldOffset(2)]
        public byte Red;
        [FieldOffset(3)]
        public byte Alpha;
    }

    public class BandTheme : INotifyPropertyChanged
    {
        private ICargoClient _client;
        private bool _inited;

        private WriteableBitmap _background;
        private Microsoft.Band.BandTheme _themeColor;

        private SolidColorBrush _baseColor;
        private SolidColorBrush _highlightColor;
        private SolidColorBrush _lowlightColor;
        private SolidColorBrush _mutedColor;
        private SolidColorBrush _secondaryTextColor;
        private SolidColorBrush _highContrastColor;

        // magic values for the background size (if you pass anything else in you get an exception)
        public static short BACKGROUND_WIDTH = 310;
        public static short BACKGROUND_HEIGHT = 102;

        public WriteableBitmap Background
        {
            get { return _background; }
            set
            {
                if (_background != value)
                {
                    _background = value;

                    var colorMuted = new PixelColor
                    {
                        Blue = 0,
                        Green = 0,
                        Red = 255,
                        Alpha = 0
                    };

                    // Usually we would just call the below, but that has a bug that switches channels so
                    // all images come out blue tinted, so call our implementation instead
                    //_client.SetMeTileImageAsync(value);
                    SetMeTileImageAsync(value);

                    NotifyPropertyChanged();
                }
            }
        }

        public SolidColorBrush BaseColor
        {
            get { return _baseColor; }
            set
            {
                // for some reason .Equals is not overridden, so check equality manually
                if (_baseColor == null || _baseColor.Color != value.Color)
                {
                    _baseColor = value;

                    NotifyPropertyChanged();

                    UpdateColors();
                }
            }
        }

        public SolidColorBrush HighlightColor
        {
            get { return _highlightColor; }
            set
            {
                // for some reason .Equals is not overridden, so check equality manually
                if (_highlightColor == null || _highlightColor.Color != value.Color)
                {
                    _highlightColor = value;

                    NotifyPropertyChanged();

                    UpdateColors();
                }
            }
        }

        public SolidColorBrush LowlightColor
        {
            get { return _lowlightColor; }
            set
            {
                // for some reason .Equals is not overridden, so check equality manually
                if (_lowlightColor == null || _lowlightColor.Color != value.Color)
                {
                    _lowlightColor = value;

                    NotifyPropertyChanged();

                    UpdateColors();
                }
            }
        }

        public SolidColorBrush MutedColor
        {
            get { return _mutedColor; }
            set
            {
                // for some reason .Equals is not overridden, so check equality manually
                if (_mutedColor == null || _mutedColor.Color != value.Color)
                {
                    _mutedColor = value;

                    NotifyPropertyChanged();

                    UpdateColors();
                }
            }
        }

        public SolidColorBrush SecondaryTextColor
        {
            get { return _secondaryTextColor; }
            set
            {
                // for some reason .Equals is not overridden, so check equality manually
                if (_secondaryTextColor == null || _secondaryTextColor.Color != value.Color)
                {
                    _secondaryTextColor = value;

                    NotifyPropertyChanged();

                    UpdateColors();
                }
            }
        }

        public SolidColorBrush HighContrastColor
        {
            get { return _highContrastColor; }
            set
            {
                // for some reason .Equals is not overridden, so check equality manually
                if (_highContrastColor == null || _highContrastColor.Color != value.Color)
                {
                    _highContrastColor = value;

                    NotifyPropertyChanged();

                    UpdateColors();
                }
            }
        }

        public BandTheme(ICargoClient client)
        {
            _client = client;
        }

        public async Task InitAsync()
        {
            // NEEDS BT VERIFICATION IF THIS STILL HAPPENS: check if there is a MeTile to grab (otherwise you get an exception
            // that will also kill the BT connection for daring to read to far beyond the Stream)
            // Need to find a workaround, since this is not exposed in the new lib: var tileId = _client.GetMeTileId();

            BandImage meTileImage = null;

            try
            {
                meTileImage = await _client.PersonalizationManager.GetMeTileImageAsync();
            }
            catch (InvalidOperationException)
            { } // no background image

            if (meTileImage != null)
                _background = meTileImage.ToWriteableBitmap();

            _themeColor = await _client.PersonalizationManager.GetThemeAsync();

            SetColorProperties();

            // Notify that all properties have changed
            NotifyPropertyChanged(null);

            _inited = true;
        }

        /// <summary>
        /// Break out all of the colors from _themeColor and set the relevant properties
        /// </summary>
        private void SetColorProperties()
        {
            BaseColor          = new SolidColorBrush(_themeColor.Base.ToColor());
            HighlightColor     = new SolidColorBrush(_themeColor.Highlight.ToColor());
            LowlightColor      = new SolidColorBrush(_themeColor.Lowlight.ToColor());
            MutedColor         = new SolidColorBrush(_themeColor.Muted.ToColor());
            SecondaryTextColor = new SolidColorBrush(_themeColor.SecondaryText.ToColor());
            HighContrastColor  = new SolidColorBrush(_themeColor.HighContrast.ToColor());
        }

        /// Known Colors:
        /// Base          : Base tile color
        /// Highlight     : accent color for various headings
        /// Lowlight      : button press highlight
        /// Muted         : unused?
        /// SecondaryText : controls some (literally) random items such as toggles that are off in settings
        ///                 meeting locations, date received for emails etc.
        /// High Contrast : Tile background when tile has an unread count (such as email, sms, phone etc.)
        public void UpdateColors()
        {
            if (!_inited) return;

            //TODO: all of these properties should be of type Color and the XAML should use a Converter
            _themeColor.Base          = BaseColor.Color.ToBandColor();
            _themeColor.Highlight     = HighlightColor.Color.ToBandColor();
            _themeColor.Lowlight      = LowlightColor.Color.ToBandColor();
            _themeColor.Muted         = MutedColor.Color.ToBandColor();
            _themeColor.SecondaryText = SecondaryTextColor.Color.ToBandColor();
            _themeColor.HighContrast  = HighContrastColor.Color.ToBandColor();

            _client.SetDeviceThemeAsync(_themeColor);
        }

        public async Task ResetThemeAsync()
        {
            await _client.ResetThemeColorsAsync();
        }

        public void SetBackground(string file)
        {
            if (File.Exists(file))
            {
                var bitmapSource = new BitmapImage();

                bitmapSource.BeginInit();
                bitmapSource.UriSource = new Uri(file);

                // ensure that we resize to the correct dimensions
                bitmapSource.DecodePixelHeight = 102;
                bitmapSource.DecodePixelWidth = 310;

                bitmapSource.EndInit();

                // the Band expects a Pbgra32 image, so convert it now
                var pbgra32Image = new FormatConvertedBitmap(bitmapSource, PixelFormats.Pbgra32, null, 0);

                WriteableBitmap b = new WriteableBitmap(pbgra32Image);
                Background = b;
            }
        }

        private async Task SetMeTileImageAsync(WriteableBitmap wb)
        {
            var bandImage = wb.ToBandImage();
            await _client.PersonalizationManager.SetMeTileImageAsync(bandImage);
        }

        #region INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            if (PropertyChanged != null)
            {
                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                }));
            }
        }

        #endregion
    }
}


text:
#include "common.h"

#include "dbcache.h"
#include "log.h"
#include "zbxserver.h"
#include "zbxicmpping.h"
#include "daemon.h"
#include "zbxself.h"

#include "pinger.h"

/* defines for `fping' and `fping6' to successfully process pings */
#define MIN_COUNT	1
#define MAX_COUNT	10000
#define MIN_INTERVAL	20
#define MIN_SIZE	24
#define MAX_SIZE	65507
#define MIN_TIMEOUT	50

extern unsigned char	process_type, daemon_type;
extern int		server_num, process_num;

/******************************************************************************
 *                                                                            *
 * Function: process_value                                                    *
 *                                                                            *
 * Purpose: process new item value                                            *
 *                                                                            *
 * Parameters:                                                                *
 *                                                                            *
 * Return value:                                                              *
 *                                                                            *
 * Author: Alexei Vladishev, Alexander Vladishev                              *
 *                                                                            *
 * Comments:                                                                  *
 *                                                                            *
 ******************************************************************************/
static void	process_value(zbx_uint64_t itemid, zbx_uint64_t *value_ui64, double *value_dbl,	zbx_timespec_t *ts,
		int ping_result, char *error)
{
	const char	*__function_name = "process_value";
	DC_ITEM		item;
	int		errcode;
	AGENT_RESULT	value;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);

	DCconfig_get_items_by_itemids(&item, &itemid, &errcode, 1);

	if (SUCCEED != errcode)
		goto clean;

	if (ITEM_STATUS_ACTIVE != item.status)
		goto clean;

	if (HOST_STATUS_MONITORED != item.host.status)
		goto clean;

	if (NOTSUPPORTED == ping_result)
	{
		item.state = ITEM_STATE_NOTSUPPORTED;
		dc_add_history(item.itemid, item.value_type, item.flags, NULL, ts, item.state, error);
	}
	else
	{
		init_result(&value);

		if (NULL != value_ui64)
			SET_UI64_RESULT(&value, *value_ui64);
		else
			SET_DBL_RESULT(&value, *value_dbl);

		item.state = ITEM_STATE_NORMAL;
		dc_add_history(item.itemid, item.value_type, item.flags, &value, ts, item.state, NULL);

		free_result(&value);
	}
clean:
	DCrequeue_items(&item.itemid, &item.state, &ts->sec, NULL, NULL, &errcode, 1);

	DCconfig_clean_items(&item, &errcode, 1);

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
}

/******************************************************************************
 *                                                                            *
 * Function: process_values                                                   *
 *                                                                            *
 * Purpose: process new item values                                           *
 *                                                                            *
 * Parameters:                                                                *
 *                                                                            *
 * Return value:                                                              *
 *                                                                            *
 * Author: Alexei Vladishev, Alexander Vladishev                              *
 *                                                                            *
 * Comments:                                                                  *
 *                                                                            *
 ******************************************************************************/
static void	process_values(icmpitem_t *items, int first_index, int last_index, ZBX_FPING_HOST *hosts,
		int hosts_count, zbx_timespec_t *ts, int ping_result, char *error)
{
	const char	*__function_name = "process_values";
	int		i, h;
	zbx_uint64_t	value_uint64;
	double		value_dbl;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);

	for (h = 0; h < hosts_count; h++)
	{
		const ZBX_FPING_HOST	*host = &hosts[h];

		if (NOTSUPPORTED == ping_result)
		{
			zabbix_log(LOG_LEVEL_DEBUG, "host [%s] %s", host->addr, error);
		}
		else
		{
			zabbix_log(LOG_LEVEL_DEBUG, "host [%s] cnt=%d rcv=%d"
					" min=" ZBX_FS_DBL " max=" ZBX_FS_DBL " sum=" ZBX_FS_DBL,
					host->addr, host->cnt, host->rcv, host->min, host->max, host->sum);
		}

		for (i = first_index; i < last_index; i++)
		{
			const icmpitem_t	*item = &items[i];

			if (0 != strcmp(item->addr, host->addr))
				continue;

			if (NOTSUPPORTED == ping_result)
			{
				process_value(item->itemid, NULL, NULL, ts, NOTSUPPORTED, error);
				continue;
			}

			if (0 == host->cnt)
			{
				process_value(item->itemid, NULL, NULL, ts, NOTSUPPORTED,
						"Cannot send ICMP ping packets to this host.");
				continue;
			}

			switch (item->icmpping)
			{
				case ICMPPING:
					value_uint64 = (0 != host->rcv ? 1 : 0);
					process_value(item->itemid, &value_uint64, NULL, ts, SUCCEED, NULL);
					break;
				case ICMPPINGSEC:
					switch (item->type)
					{
						case ICMPPINGSEC_MIN:
							value_dbl = host->min;
							break;
						case ICMPPINGSEC_MAX:
							value_dbl = host->max;
							break;
						case ICMPPINGSEC_AVG:
							value_dbl = (0 != host->rcv ? host->sum / host->rcv : 0);
							break;
					}
					process_value(item->itemid, NULL, &value_dbl, ts, SUCCEED, NULL);
					break;
				case ICMPPINGLOSS:
					value_dbl = (100 * (host->cnt - host->rcv)) / (double)host->cnt;
					process_value(item->itemid, NULL, &value_dbl, ts, SUCCEED, NULL);
					break;
			}
		}
	}

	dc_flush_history();

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
}

static int	parse_key_params(const char *key, const char *host_addr, icmpping_t *icmpping, char **addr, int *count,
		int *interval, int *size, int *timeout, icmppingsec_type_t *type, char *error, int max_error_len)
{
	char	cmd[16], params[MAX_STRING_LEN], buffer[MAX_STRING_LEN];
	int	num_params;

	if (ZBX_COMMAND_ERROR == parse_command(key, cmd, sizeof(cmd), params, sizeof(params)))
		return NOTSUPPORTED;

	if (0 == strcmp(cmd, SERVER_ICMPPING_KEY))
	{
		*icmpping = ICMPPING;
	}
	else if (0 == strcmp(cmd, SERVER_ICMPPINGLOSS_KEY))
	{
		*icmpping = ICMPPINGLOSS;
	}
	else if (0 == strcmp(cmd, SERVER_ICMPPINGSEC_KEY))
	{
		*icmpping = ICMPPINGSEC;
	}
	else
	{
		zbx_snprintf(error, max_error_len, "Unsupported pinger key.");
		return NOTSUPPORTED;
	}

	num_params = num_param(params);

	if (6 < num_params || (ICMPPINGSEC != *icmpping && 5 < num_params))
	{
		zbx_snprintf(error, max_error_len, "Too many arguments.");
		return NOTSUPPORTED;
	}

	if (0 != get_param(params, 2, buffer, sizeof(buffer)) || '\0' == *buffer)
	{
		*count = 3;
	}
	else if (FAIL == is_uint31(buffer, (uint32_t*)count) || MIN_COUNT > *count || *count > MAX_COUNT)
	{
		zbx_snprintf(error, max_error_len, "Number of packets \"%s\" is not between %d and %d.",
				buffer, MIN_COUNT, MAX_COUNT);
		return NOTSUPPORTED;
	}

	if (0 != get_param(params, 3, buffer, sizeof(buffer)) || '\0' == *buffer)
	{
		*interval = 0;
	}
	else if (FAIL == is_uint31(buffer, (uint32_t*)interval) || MIN_INTERVAL > *interval)
	{
		zbx_snprintf(error, max_error_len, "Interval \"%s\" should be at least %d.", buffer, MIN_INTERVAL);
		return NOTSUPPORTED;
	}

	if (0 != get_param(params, 4, buffer, sizeof(buffer)) || '\0' == *buffer)
	{
		*size = 0;
	}
	else if (FAIL == is_uint31(buffer, (uint32_t*)size) || MIN_SIZE > *size || *size > MAX_SIZE)
	{
		zbx_snprintf(error, max_error_len, "Packet size \"%s\" is not between %d and %d.",
				buffer, MIN_SIZE, MAX_SIZE);
		return NOTSUPPORTED;
	}

	if (0 != get_param(params, 5, buffer, sizeof(buffer)) || '\0' == *buffer)
		*timeout = 0;
	else if (FAIL == is_uint31(buffer, (uint32_t*)timeout) || MIN_TIMEOUT > *timeout)
	{
		zbx_snprintf(error, max_error_len, "Timeout \"%s\" should be at least %d.", buffer, MIN_TIMEOUT);
		return NOTSUPPORTED;
	}

	if (0 != get_param(params, 6, buffer, sizeof(buffer)) || '\0' == *buffer)
		*type = ICMPPINGSEC_AVG;
	else
	{
		if (0 == strcmp(buffer, "min"))
		{
			*type = ICMPPINGSEC_MIN;
		}
		else if (0 == strcmp(buffer, "avg"))
		{
			*type = ICMPPINGSEC_AVG;
		}
		else if (0 == strcmp(buffer, "max"))
		{
			*type = ICMPPINGSEC_MAX;
		}
		else
		{
			zbx_snprintf(error, max_error_len, "Mode \"%s\" is not supported.", buffer);
			return NOTSUPPORTED;
		}
	}

	if (0 != get_param(params, 1, buffer, sizeof(buffer)) || '\0' == *buffer)
		*addr = strdup(host_addr);
	else
		*addr = strdup(buffer);

	return SUCCEED;
}

static int	get_icmpping_nearestindex(icmpitem_t *items, int items_count, int count, int interval, int size, int timeout)
{
	int		first_index, last_index, index;
	icmpitem_t	*item;

	if (items_count == 0)
		return 0;

	first_index = 0;
	last_index = items_count - 1;
	while (1)
	{
		index = first_index + (last_index - first_index) / 2;
		item = &items[index];

		if (item->count == count && item->interval == interval && item->size == size && item->timeout == timeout)
			return index;
		else if (last_index == first_index)
		{
			if (item->count < count ||
					(item->count == count && item->interval < interval) ||
					(item->count == count && item->interval == interval && item->size < size) ||
					(item->count == count && item->interval == interval && item->size == size && item->timeout < timeout))
				index++;
			return index;
		}
		else if (item->count < count ||
				(item->count == count && item->interval < interval) ||
				(item->count == count && item->interval == interval && item->size < size) ||
				(item->count == count && item->interval == interval && item->size == size && item->timeout < timeout))
			first_index = index + 1;
		else
			last_index = index;
	}
}

static void	add_icmpping_item(icmpitem_t **items, int *items_alloc, int *items_count, int count, int interval,
		int size, int timeout, zbx_uint64_t itemid, char *addr, icmpping_t icmpping, icmppingsec_type_t type)
{
	const char	*__function_name = "add_icmpping_item";
	int		index;
	icmpitem_t	*item;
	size_t		sz;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s() addr:'%s' count:%d interval:%d size:%d timeout:%d",
			__function_name, addr, count, interval, size, timeout);

	index = get_icmpping_nearestindex(*items, *items_count, count, interval, size, timeout);

	if (*items_alloc == *items_count)
	{
		*items_alloc += 4;
		sz = *items_alloc * sizeof(icmpitem_t);
		*items = zbx_realloc(*items, sz);
	}

	memmove(&(*items)[index + 1], &(*items)[index], sizeof(icmpitem_t) * (*items_count - index));

	item = &(*items)[index];
	item->count	= count;
	item->interval	= interval;
	item->size	= size;
	item->timeout	= timeout;
	item->itemid	= itemid;
	item->addr	= addr;
	item->icmpping	= icmpping;
	item->type	= type;

	(*items_count)++;

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
}

/******************************************************************************
 *                                                                            *
 * Function: get_pinger_hosts                                                 *
 *                                                                            *
 * Purpose: creates buffer which contains list of hosts to ping               *
 *                                                                            *
 * Parameters:                                                                *
 *                                                                            *
 * Return value: SUCCEED - the file was created successfully                  *
 *               FAIL - otherwise                                             *
 *                                                                            *
 * Author: Alexei Vladishev, Alexander Vladishev                              *
 *                                                                            *
 * Comments:                                                                  *
 *                                                                            *
 ******************************************************************************/
static void	get_pinger_hosts(icmpitem_t **icmp_items, int *icmp_items_alloc, int *icmp_items_count)
{
	const char		*__function_name = "get_pinger_hosts";
	DC_ITEM			items[MAX_PINGER_ITEMS];
	int			i, num, count, interval, size, timeout, rc, errcode = SUCCEED;
	char			error[MAX_STRING_LEN], *addr = NULL;
	icmpping_t		icmpping;
	icmppingsec_type_t	type;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);

	num = DCconfig_get_poller_items(ZBX_POLLER_TYPE_PINGER, items);

	for (i = 0; i < num; i++)
	{
		ZBX_STRDUP(items[i].key, items[i].key_orig);
		rc = substitute_key_macros(&items[i].key, NULL, &items[i], NULL, MACRO_TYPE_ITEM_KEY,
				error, sizeof(error));

		if (SUCCEED == rc)
		{
			rc = parse_key_params(items[i].key, items[i].interface.addr, &icmpping, &addr, &count,
					&interval, &size, &timeout, &type, error, sizeof(error));
		}

		if (SUCCEED == rc)
		{
			add_icmpping_item(icmp_items, icmp_items_alloc, icmp_items_count, count, interval, size,
				timeout, items[i].itemid, addr, icmpping, type);
		}
		else
		{
			zbx_timespec_t	ts;

			zbx_timespec(&ts);

			items[i].state = ITEM_STATE_NOTSUPPORTED;
			dc_add_history(items[i].itemid, items[i].value_type, items[i].flags, NULL, &ts,
					items[i].state, error);

			DCrequeue_items(&items[i].itemid, &items[i].state, &ts.sec, NULL, NULL, &errcode, 1);
		}

		zbx_free(items[i].key);
	}

	DCconfig_clean_items(items, NULL, num);

	dc_flush_history();

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%d", __function_name, *icmp_items_count);
}

static void	free_hosts(icmpitem_t **items, int *items_count)
{
	int	i;

	for (i = 0; i < *items_count; i++)
		zbx_free((*items)[i].addr);

	*items_count = 0;
}

static void	add_pinger_host(ZBX_FPING_HOST **hosts, int *hosts_alloc, int *hosts_count, char *addr)
{
	const char	*__function_name = "add_pinger_host";

	int		i;
	size_t		sz;
	ZBX_FPING_HOST	*h;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s() addr:'%s'", __function_name, addr);

	for (i = 0; i < *hosts_count; i ++)
		if (0 == strcmp(addr, (*hosts)[i].addr))
			return;

	(*hosts_count)++;

	if (*hosts_alloc < *hosts_count)
	{
		*hosts_alloc += 4;
		sz = *hosts_alloc * sizeof(ZBX_FPING_HOST);
		*hosts = zbx_realloc(*hosts, sz);
	}

	h = &(*hosts)[*hosts_count - 1];
	memset(h, 0, sizeof(ZBX_FPING_HOST));
	h->addr = addr;

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
}

/******************************************************************************
 *                                                                            *
 * Function: process_pinger_hosts                                             *
 *                                                                            *
 * Purpose:                                                                   *
 *                                                                            *
 * Parameters:                                                                *
 *                                                                            *
 * Return value:                                                              *
 *                                                                            *
 * Author: Alexander Vladishev                                                *
 *                                                                            *
 * Comments:                                                                  *
 *                                                                            *
 ******************************************************************************/
static void	process_pinger_hosts(icmpitem_t *items, int items_count)
{
	const char		*__function_name = "process_pinger_hosts";
	int			i, first_index = 0, ping_result;
	char			error[ITEM_ERROR_LEN_MAX];
	static ZBX_FPING_HOST	*hosts = NULL;
	static int		hosts_alloc = 4;
	int			hosts_count = 0;
	zbx_timespec_t		ts;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);

	if (NULL == hosts)
		hosts = zbx_malloc(hosts, sizeof(ZBX_FPING_HOST) * hosts_alloc);

	for (i = 0; i < items_count; i++)
	{
		add_pinger_host(&hosts, &hosts_alloc, &hosts_count, items[i].addr);

		if (i == items_count - 1 || items[i].count != items[i + 1].count || items[i].interval != items[i + 1].interval ||
				items[i].size != items[i + 1].size || items[i].timeout != items[i + 1].timeout)
		{
			zbx_setproctitle("%s #%d [pinging hosts]", get_process_type_string(process_type), process_num);

			zbx_timespec(&ts);

			ping_result = do_ping(hosts, hosts_count,
						items[i].count, items[i].interval, items[i].size, items[i].timeout,
						error, sizeof(error));

			process_values(items, first_index, i + 1, hosts, hosts_count, &ts, ping_result, error);

			hosts_count = 0;
			first_index = i + 1;
		}
	}

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
}

/******************************************************************************
 *                                                                            *
 * Function: main_pinger_loop                                                 *
 *                                                                            *
 * Purpose: periodically perform ICMP pings                                   *
 *                                                                            *
 * Parameters:                                                                *
 *                                                                            *
 * Return value:                                                              *
 *                                                                            *
 * Author: Alexei Vladishev                                                   *
 *                                                                            *
 * Comments: never returns                                                    *
 *                                                                            *
 ******************************************************************************/
ZBX_THREAD_ENTRY(pinger_thread, args)
{
	int			nextcheck, sleeptime, items_count = 0, itc;
	double			sec;
	static icmpitem_t	*items = NULL;
	static int		items_alloc = 4;

	process_type = ((zbx_thread_args_t *)args)->process_type;
	server_num = ((zbx_thread_args_t *)args)->server_num;
	process_num = ((zbx_thread_args_t *)args)->process_num;

	zabbix_log(LOG_LEVEL_INFORMATION, "%s #%d started [%s #%d]", get_daemon_type_string(daemon_type),
			server_num, get_process_type_string(process_type), process_num);

	if (NULL == items)
		items = zbx_malloc(items, sizeof(icmpitem_t) * items_alloc);

	for (;;)
	{
		zbx_setproctitle("%s #%d [getting values]", get_process_type_string(process_type), process_num);

		sec = zbx_time();
		get_pinger_hosts(&items, &items_alloc, &items_count);
		process_pinger_hosts(items, items_count);
		sec = zbx_time() - sec;
		itc = items_count;

		free_hosts(&items, &items_count);

		nextcheck = DCconfig_get_poller_nextcheck(ZBX_POLLER_TYPE_PINGER);
		sleeptime = calculate_sleeptime(nextcheck, POLLER_DELAY);

		zbx_setproctitle("%s #%d [got %d values in " ZBX_FS_DBL " sec, idle %d sec]",
				get_process_type_string(process_type), process_num, itc, sec, sleeptime);

		zbx_sleep_loop(sleeptime);
	}
}


text:
using System;
using System.Text;

namespace Microsoft.WindowsAPICodePack.ExtendedLinguisticServices
{

    /// <summary>
    /// Converts byte arrays containing Unicode null-terminated strings into .NET string objects.
    /// </summary>
    public class NullTerminatedStringFormatter : IMappingFormatter<string>
    {
        /// <summary>
        /// Converts a single <see cref="MappingDataRange">MappingDataRange</see> into a string, stripping the trailing null character.
        /// If the string doesn't contain null characters, the empty string is returned.
        /// </summary>
        /// <param name="dataRange">The <see cref="MappingDataRange">MappingDataRange</see> to convert</param>
        /// <returns>The resulting string</returns>
        public string Format(MappingDataRange dataRange)
        {
            if (dataRange == null) { throw new ArgumentNullException("dataRange"); }

            byte[] data = dataRange.GetData();
            if ((data.Length & 1) != 0)
            {
                throw new LinguisticException(LinguisticException.InvalidArgs);
            }

            int nullIndex = data.Length;
            for (int i = 0; i < data.Length; i += 2)
            {
                if (data[i] == 0 && data[i + 1] == 0)
                {
                    nullIndex = i;
                    break;
                }
            }

            string resultText = Encoding.Unicode.GetString(data, 0, nullIndex);
            return resultText;
        }

        /// <summary>
        /// Uses <see cref="Format(MappingDataRange)">Format</see> to format all the ranges of the supplied
        /// <see cref="MappingPropertyBag">MappingPropertyBag</see>.
        /// </summary>
        /// <param name="bag">The property bag to convert.</param>
        /// <returns>An array of strings, one per <see cref="MappingDataRange">MappingDataRange</see>.</returns>
        public string[] FormatAll(MappingPropertyBag bag)
        {
            if (bag == null) { throw new ArgumentNullException("bag"); }

            MappingDataRange[] dataRanges = bag.GetResultRanges();
            string[] results = new string[dataRanges.Length];
            for (int i = 0; i < results.Length; ++i)
            {
                results[i] = Format(dataRanges[i]);
            }
            return results;
        }
    }

}


text:
//
//  BrowseTopScrollView.m
//  BrowseImagesImplementation
//
//  Created by shuang on 15/5/21.
//  Copyright (c) 2015年 shuang. All rights reserved.
//

#import "BrowseTopScrollView.h"
#import "Header.h"

@interface BrowseTopScrollView ()<UIScrollViewDelegate>
{
    UIImageView *imgView;

    //记录自己的位置
    CGRect scaleOriginRect;

    //图片的大小
    CGSize imgSize;

    //缩放前大小
    CGRect initRect;
}

@end

@implementation BrowseTopScrollView

#pragma mark---- 初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        self.showsHorizontalScrollIndicator = NO;
        self.showsVerticalScrollIndicator = NO;
        self.delegate = self;
        self.bouncesZoom = YES;
        self.backgroundColor = [UIColor clearColor];

        self.minimumZoomScale = 1.0;
        self.maximumZoomScale = 2.0;
        imgView = [[UIImageView alloc] init];
        imgView.clipsToBounds = YES;
        imgView.contentMode = UIViewContentModeScaleAspectFill;
        [self addSubview:imgView];
        imgView.userInteractionEnabled = YES;

        //长按手势
        UILongPressGestureRecognizer * longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressScrollViewChangedAction:)];
        //        longPress.minimumPressDuration = 0.5;
        [imgView addGestureRecognizer:longPress];

    }

    return self;
}

#pragma mark----设置content frame
- (void)setContentWithFram:(CGRect)rect
{
    imgView.frame = rect;
    initRect = rect;

}
- (void)setImage:(UIImage *)image
{
    if (image) {
        imgView.image = image;
        imgSize = image.size;

        //判断缩放的值
        float scaleX = Width / imgSize.width;
        float scaleY = Height /imgSize.height;

        //倍数小的先到边缘
        if (scaleX > scaleY) {
            //y方向先到边缘
            //计算放大后的imageView的宽度
            float imgViewWidth = scaleY*imgSize.width;
            //计算最大缩放比例
//            self.maximumZoomScale = Width / imgViewWidth;
            //记录放大后位置,y方向到最上端
            scaleOriginRect = (CGRect){Width/2 - imgViewWidth/2,0,imgViewWidth,Height};

        }else{

            //x方向先到边缘
            float imgViewHeight = scaleX*imgSize.height;
//            self.maximumZoomScale = Height / imgViewHeight;
            scaleOriginRect = (CGRect){0,Height/2 - imgViewHeight/2,Width,imgViewHeight};

        }
    }
}
//放大
- (void)setAnimationRect
{
    imgView.frame = scaleOriginRect;
}
//返回原来大小
- (void)rechangeInitRect
{
    self.zoomScale = 1.0;
    /*
     1、回到原来界面的初始位置
     imgView.frame = initRect;
     */

    /*
     1、回到原来界面的中心点位置
     imgView.frame = CGRectMake(Width/2, Height/2, 0, 0);
     */

    //由于图片的初始位置超出了屏幕的边缘,返回到初始位置用户体验不太好,所以选择返回中心点位置。
    imgView.frame = CGRectMake(Width/2, Height/2, 0, 0);

}

#pragma mark ----scrollViewDelegate
//在那个视图上缩放
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return imgView;
}
//缩放的位置
- (void)scrollViewDidZoom:(UIScrollView *)scrollView
{
    CGSize boundSize = CGSizeMake(Width, Height);
    CGSize contentSize = scrollView.contentSize;
    CGRect imageFrame = imgView.frame;

    //中心点
    CGPoint centerPoint = CGPointMake(contentSize.width/2, contentSize.height/2);

    //水平中心
    if (imageFrame.size.width <= boundSize.width) {
        centerPoint.x = boundSize.width/2;
    }
    //垂直中心
    if (imageFrame.size.height <= boundSize.height) {
        centerPoint.y = boundSize.height/2;
    }

    imgView.center = centerPoint;

}
//缩放到边界值,停止缩放
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale
{
    CGFloat zs = scrollView.zoomScale;
    zs = MAX(zs, 0.5);//最小
    zs = MIN(zs, 2.0);//最大
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    scrollView.zoomScale = zs;
    [UIView commitAnimations];
}

#pragma mark ---- touch end 点击大图--缩回小图
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch * touch = [[event allTouches] anyObject];
    NSTimeInterval delayTime = 0.5;
    switch ([touch tapCount]) {
        case 1:
            //单击事件
            [self performSelector:@selector(singleTap) withObject:nil afterDelay:delayTime];
            break;
        case 2:{
            //消除单击事件
            [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(singleTap) object:nil];
            //走双击事件
            [self performSelector:@selector(doubleTap) withObject:nil afterDelay:delayTime];
        }
            break;
        default:
            break;
    }
}

- (void)singleTap
{
    //单击
    if ([self.bigDelegate respondsToSelector:@selector(singleTappedBigImageViewAction:)]) {
        [self.bigDelegate singleTappedBigImageViewAction:self];
    }

}
- (void)doubleTap
{
    //双击
    if ([self.bigDelegate respondsToSelector:@selector(doubleTappedBigImageViewAction:)]) {
        [self.bigDelegate doubleTappedBigImageViewAction:self];
    }

}

#pragma mark == longPress Gesture
- (void)longPressScrollViewChangedAction:(UIPanGestureRecognizer *)panGesture
{
    //long press 会在开始和结束时 都会调用一次
    //将状态区分开,只调用一次即可

    if (panGesture.state == UIGestureRecognizerStateEnded) {
        //结束的时候,跳出
        return;
    }else if (panGesture.state == UIGestureRecognizerStateBegan){
        //开始的时候,调用
        if ([self.bigDelegate respondsToSelector:@selector(longPressBigImageViweAction:)]) {
            [self.bigDelegate longPressBigImageViweAction:imgView];
        }
    }

}

@end


text:
package com.google.devtools.moe.client.database;

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.devtools.moe.client.MoeProblem;
import com.google.devtools.moe.client.Ui;
import com.google.devtools.moe.client.Ui.Task;
import com.google.devtools.moe.client.codebase.Codebase;
import com.google.devtools.moe.client.codebase.CodebaseCreationError;
import com.google.devtools.moe.client.codebase.ExpressionEngine;
import com.google.devtools.moe.client.codebase.expressions.Expression;
import com.google.devtools.moe.client.codebase.expressions.RepositoryExpression;
import com.google.devtools.moe.client.migrations.MigrationConfig;
import com.google.devtools.moe.client.project.ProjectContext;
import com.google.devtools.moe.client.project.TranslatorConfig;
import com.google.devtools.moe.client.repositories.Revision;
import com.google.devtools.moe.client.repositories.RevisionHistory;
import com.google.devtools.moe.client.repositories.RevisionHistory.SearchType;
import com.google.devtools.moe.client.repositories.RevisionMetadata;
import com.google.devtools.moe.client.tools.CodebaseDiffer;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import javax.inject.Inject;

/**
 * Logic behind keeping MOE db up to date (moe bookkeeping)
 */
public class Bookkeeper {
  private static final Logger logger = Logger.getLogger(Bookkeeper.class.getName());

  /** The field key for MOE-migrated changes, as found in the changelog of the to-repo. */
  private static final String MIGRATED_REV_KEY = "MOE_MIGRATED_REVID";

  private final ProjectContext context;
  private final CodebaseDiffer differ;
  private final Db db;
  private final Ui ui;
  private final ExpressionEngine expressionEngine;

  @Inject
  public Bookkeeper(
      ProjectContext context,
      CodebaseDiffer differ,
      Db db,
      Ui ui,
      ExpressionEngine expressionEngine) {
    this.context = context;
    this.differ = differ;
    this.db = db;
    this.ui = ui;
    this.expressionEngine = expressionEngine;
  }

  private Revision head(String repositoryName) {
    return context.getRepository(repositoryName).revisionHistory().findHighestRevision(null);
  }

  /**
   * Diff codebases at HEADs of fromRepository and toRepository, adding an Equivalence to db if
   * equivalent at HEADs.
   *
   * @return a {@link RepositoryEquivalence} if the codebases at the given revisions are equivalent
   */
  private RepositoryEquivalence tryHeadEquivalence(
      Revision from, Revision to, Db db, boolean inverse) {
    try (Ui.Task checkHeadsTask =
        ui.newTask(
            "checking head equivalency",
            "Checking head equivalence between '%s' and '%s'",
            from,
            to)) {
      RepositoryEquivalence equivalence =
          inverse ? determineEquivalence(to, from) : determineEquivalence(from, to);
      if (equivalence != null) {
        ui.message("SUCCESS: Found Equivalence between %s and %s", from, to);
        db.noteEquivalence(equivalence);
      } else {
        ui.message("No equivalence found between %s and %s", from, to);
      }
      checkHeadsTask.result().append(equivalence != null ? "Found!!" : "Not Found.");
      return equivalence;
    }
  }

  /**
   * Determines if the two revisions given are equivalent - that is to say, when fromRevision
   * is translated into the project space of toRevision, are their codebases without difference.
   *
   * @return a RepositoryEquivalence if the two codebases (after transformation) are equivalent.
   */
  private RepositoryEquivalence determineEquivalence(Revision fromRevision, Revision toRevision) {
    String toSpace =
        context.config().getRepositoryConfig(toRevision.repositoryName()).getProjectSpace();
    Codebase from = createCodebaseForRevision(fromRevision, toSpace);
    Codebase to = createCodebaseForRevision(toRevision, null);
    if (from == null || to == null) {
      return null;
    }
    boolean equivalent;
    try (Ui.Task task = ui.newTask("diff_codebases", "Diff codebases '%s' and '%s'", from, to)) {
      equivalent = !differ.diffCodebases(from, to).areDifferent();
      task.result().append(equivalent ? "No Difference" : "Difference Found");
    }
    return equivalent ? RepositoryEquivalence.create(fromRevision, toRevision) : null;
  }

  private Codebase createCodebaseForRevision(Revision rev, String translateSpace) {
    Expression expression = new RepositoryExpression(rev.repositoryName()).atRevision(rev.revId());
    if (translateSpace != null) {
      expression = expression.translateTo(translateSpace);
    }
    try {
      return expressionEngine.createCodebase(expression, context);
    } catch (CodebaseCreationError e) {
      // Don't error out, since we're only bookkeeping.
      ui.message("WARNING: Could not create codebase: %s,", expression);
      return null;
    }
  }
  /**
   * Find Revisions in toRepository that were the result of a migration and record them, noting
   * any found equivalences along the way.
   */
  private void noteCompletedMigrations(
      String fromRepository, String toRepository, Db db, boolean inverse) {
    try (Ui.Task t =
        ui.newTask(
            "check_migrations",
            "Checking completed migrations for new equivalence between '%s' and '%s'",
            fromRepository,
            toRepository)) {

      RevisionHistory toHistory = context.getRepository(toRepository).revisionHistory();
      RepositoryEquivalenceMatcher.Result equivMatch =
          toHistory.findRevisions(
              null /*revision*/,
              new RepositoryEquivalenceMatcher(fromRepository, db),
              SearchType.BRANCHED);

      List<Revision> toRevs = equivMatch.getRevisionsSinceEquivalence().getBreadthFirstHistory();
      ui.message(
          "Found %d revisions in %s since equivalence (%s)",
          toRevs.size(), toRepository, equivMatch.getEquivalences());
      logger.fine("Revisions since equivalence: " + Joiner.on(" ").join(toRevs));
      int countUnmigrated = 0;
      int countProcessed = 0;
      for (Revision toRev : toRevs) {
        // Look up the migrated commit
        String fromRevId = getMigratedRevId(toHistory.getMetadata(toRev));
        if (fromRevId != null) {
          SubmittedMigration migration =
              SubmittedMigration.create(Revision.create(fromRevId, fromRepository), toRev);
          logger.fine("Processing submitted migration: " + migration);
          if (processMigration(migration, db, inverse) != null) {
            ui.message("Equivalence found - skipping remaining revisions in this migration.");
            countProcessed++; // Since we're short circuiting, count this commit as processed
            break;
          }
        } else {
          countUnmigrated++;
          logger.finer("Ignoring non-migrated revision " + toRev);
        }
        countProcessed++;
      }
      ui.message("Ignored %s commits that were not migrated by MOE", countUnmigrated);
      if (countProcessed < toRevs.size()) {
        ui.message(
            "Skipped %s commits that preceded a discovered equivalence",
            toRevs.size() - countProcessed);
      }
    }
  }

  /** Pulls out the first migrated CL field for this bit of metadata. */
  @Nullable
  private static String getMigratedRevId(RevisionMetadata metadata) {
    ImmutableSet<String> ids = metadata.fields().get(MIGRATED_REV_KEY);
    // For legacy reasons, in replacing the matcher, just use the first found rev id, if any.
    // TODO(cgruber) Should this throw on more than one?
    return Iterables.getFirst(ids, null);
  }

  /**
   * Check a submitted migration for equivalence by translating the from-repo to the to-repo, or
   * in the case of an inverse translation, translating the to-repo to the from-repo via the
   * forward-translator.  A representation of that equivalence is returned, if one is found, or
   * null if no equivalence is found.
   */
  private RepositoryEquivalence processMigration(
      SubmittedMigration migration, Db db, boolean inverse) {
    if (db.hasMigration(migration)) {
      ui.message(
          "Skipping: already recorded %s -> %s", migration.fromRevision(), migration.toRevision());
      return null;
    }
    RepositoryEquivalence equivalence;
    try (Task t = ui.newTask("process_migration", "Bookkeeping migrated revision %s", migration)) {
      // If an inverse translator, use the forward translator (but backwards)
      equivalence =
          (inverse)
              ? determineEquivalence(migration.toRevision(), migration.fromRevision())
              : determineEquivalence(migration.fromRevision(), migration.toRevision());

      if (equivalence != null) {
        db.noteEquivalence(equivalence);
        ui.message("SUCCESS: Equivalence found and recorded: %s", equivalence);
      }
      db.noteMigration(migration); // TODO(cgruber): Implement a blacklist separate from migrations.
      db.write();
    }
    return equivalence;
  }

  /**
   * Looks for and adds to db SubmittedMigrations and Equivalences as the result of running one of
   * the directives Migrate or OneMigration, and the user commiting the result. Bookkeep only
   * considers Equivalences between repositories which are part of a migration listed both in
   * migrationNames and context.
   *
   * <p>Bookkeep should be run before performing any directive which reads from the db, since it is
   * MOE's way of keeping the db up-to-date.
   *
   * @return 0 on success, 1 on failure
   */
  public int bookkeep() {
    try (Ui.Task t = ui.newTask("bookkeeping", "Updating database")) {
      Set<Set<Revision>> testedHeadEquivalences = new LinkedHashSet<>();
      for (MigrationConfig config : context.migrationConfigs().values()) {
        bookkeepMigration(
            testedHeadEquivalences,
            config.getName(),
            config.getFromRepository(),
            config.getToRepository());
      }
    }
    db.write();
    return 0;
  }

  private void bookkeepMigration(
      Set<Set<Revision>> testedHeadEquivalences, String name, String from, String to) {
    try (Ui.Task bookkeepOneMigrationTask =
        ui.newTask(
            "bookkeeping " + name,
            "Doing bookkeeping between '%s' and '%s' for migration '%s'",
            from,
            to,
            name)) {

      TranslatorConfig translator = context.config().findTranslatorFrom(from, to);
      if (translator == null) {
        throw new MoeProblem("Couldn't find a translator for %s -> %s", from, to);
      }

      Revision fromHead = head(from);
      Revision toHead = head(to);
      if (testedHeadEquivalences.add(ImmutableSet.of(fromHead, toHead))) {
        // If we haven't checked the inverse head-map of this pair, then check it, else skip.
        // This avoids checking head twice (once for forward mapping, once for inverse mapping)
        if (tryHeadEquivalence(fromHead, toHead, db, translator.isInverse()) != null) {
          // An equivalence at head was noted, don't bother noting all the intermediates.
          return;
        }
      }
      // Check each migration in turn, to see if we have an equivalence at some point in
      // the recent migration history.
      noteCompletedMigrations(from, to, db, translator.isInverse());
    }
  }
}


text:
using System.Collections.Generic;
using System.Linq;
using Exercism.CSharp.Output;
using Exercism.CSharp.Output.Rendering;

namespace Exercism.CSharp.Exercises.Generators
{
    public class KindergartenGarden : GeneratorExercise
    {
        protected override void UpdateTestMethod(TestMethod testMethod)
        {
            testMethod.TestedMethodType = TestedMethodType.InstanceMethod;
            testMethod.TestMethodName = testMethod.TestMethodNameWithPath;

            if (testMethod.Input.ContainsKey("students"))
                testMethod.ConstructorInputParameters = new[] { "diagram", "students" };
            else
                testMethod.ConstructorInputParameters = new[] { "diagram" };

            testMethod.Expected = ConvertExpected(testMethod.Expected);
        }

        private UnescapedValue[] ConvertExpected(IEnumerable<string> plants)
            => plants
                .Select(plant => Render.Enum("Plant", plant))
                .ToArray();
    }
}


text:
if hash tilt >/dev/null 2>&1; then
	curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash


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

    <title>jQuery MiniUI - 专业WebUI控件库</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="keywords" content="jquery,web,grid,表格,datagrid,js,javascript,ajax,web开发,tree,table" />
    <meta name="description" content="jQuery MiniUI - 专业WebUI控件库。它能缩短开发时间,减少代码量,使开发者更专注于业务和服务端,轻松实现界面开发,带来绝佳的用户体验。" />
    <link href="../core.css" rel="stylesheet" type="text/css" />

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

            jQuery MiniUI
            为什么选择MiniUI?

首页

产品

产品介绍

功能特性

界面截图

支持服务

授权方式

常见问题

示例

文档

快速入门

开发教程

精华文章

Api参考手册

论坛

下载

联系

            首页>文档中心>开发教程>TreeGrid

TreeGrid:懒加载

参考示例:
                TreeGrid:懒加载

创建代码

<div id="treegrid1" class="mini-treegrid" style="width:600px;height:250px;"
    url="../data/TreeService.aspx?method=LoadNodes" showTreeIcon="true" textField="text" idField="id"
    treeColumn="filename" onbeforeload="onBeforeTreeLoad"
>
    <div property="columns">
        <div name="filename" field="name" width="150">名称</div>
        <div field="type" width="100">类型</div>
        <div field="size" width="100" dateFormat="yyyy-MM-dd">大小</div>
        <div field="createdate" width="100" dateFormat="yyyy-MM-dd">创建日期</div>
    </div>
</div>

服务端返回数据

[{
    id: "form",
    text: "Form",
    ......
    isLeaf: false,                            //是否叶子节点:+和-号
    expanded: false                            //节点处于收缩状态
},
......
]

其中,isLeft 说明此节点是否有下一级节点。expanded 表示此节点处于折叠状态。

懒加载事件

当用户点击"+"图标时,会自动加载下一级节点,此时会把当前节点id传递到后台,也可以拦截加载事件,增加额外属性:

function onBeforeTreeLoad(e) {
    var tree = e.sender;    //树控件
    var node = e.node;      //当前节点
    var params = e.params;  //参数对象

    //可以传递自定义的属性
    params.myField = "123"; //后台:request对象获取"myField"
}

服务端处理

服务端通过request获取"id"属性后,加载此节点的下一级节点数组,并通过JSON返回。

String id = Request["id"];
if (String.IsNullOrEmpty(id)) id = "-1";

//获取下一级节点
String sql = "select * from plus_file where pid = '" + id + "' order by updatedate";
ArrayList folders = DBUtil.Select(sql);

//判断节点,是否有子节点。如果有,则处理isLeaf和expanded。
for (int i = 0, l = folders.Count; i < l; i++)
{
    Hashtable node = (Hashtable)folders[i];
    String nodeId = node["id"].ToString();

    String sql2 = "select * from plus_file where pid = '" + nodeId + "' order by updatedate";
    ArrayList nodes = DBUtil.Select(sql2);

    if (nodes.Count > 0)
    {
        node["isLeaf"] = false;
        node["expanded"] = false;
    }

}

//返回JSON
String json = PluSoft.Utils.JSON.Encode(folders);
Response.Write(json);

Copyright © 上海普加软件有限公司版权所有

网站导航|支持服务|授权方式|联系我们


text:
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'zero_g'

require 'minitest/autorun'


text:
<?php

namespace Prooph\Processing\Processor;

use Assert\Assertion;
use Prooph\Common\Event\ActionEventListenerAggregate;
use Prooph\ServiceBus\CommandBus;
use Prooph\ServiceBus\EventBus;

/**
 * Class RegistryWorkflowEngine
 *
 * Register all required infrastructure via register* methods at runtime
 *
 * @package Prooph\Processing\Processor
 * @author Alexander Miertsch <kontakt@codeliner.ws>
 */
class RegistryWorkflowEngine extends AbstractWorkflowEngine
{
    private $commandBusMap = array();

    private $eventBusMap = array();

    private $commandBusList = array();

    private $eventBusList = array();

    /**
     * @param CommandBus $commandBus
     * @param array $targets
     * @throws \RuntimeException
     */
    public function registerCommandBus(CommandBus $commandBus, array $targets)
    {
        foreach($targets as $target) {
            Assertion::notEmpty($target);
            Assertion::string($target);
        }

        $registered = false;

        foreach($this->commandBusList as $registeredCommandBus) {
            if ($registeredCommandBus === $commandBus) {
                $registered = true;
                break;
            }
        }

        if (!$registered)
            $this->commandBusList[] = $commandBus;

        foreach ($targets as $target) {
            if (isset($this->commandBusMap[$target])) {
                throw new \RuntimeException(sprintf(
                    "Target %s is already connected with a command bus",
                    $target
                ));
            }

            $this->commandBusMap[$target] = $commandBus;
        }
    }

    /**
     * @param EventBus $eventBus
     * @param array $targets
     * @throws \RuntimeException
     */
    public function registerEventBus(EventBus $eventBus, array $targets)
    {
        $registered = false;

        foreach($this->eventBusList as $registeredEventBus) {
            if ($registeredEventBus === $eventBus) {
                $registered = true;
                break;
            }
        }

        if (!$registered)
            $this->eventBusList[] = $eventBus;

        foreach ($targets as $target) {
            Assertion::notEmpty($target);
            Assertion::string($target);

            if (isset($this->eventBusMap[$target])) {
                throw new \RuntimeException(sprintf(
                    "Target %s is already connected with an event bus",
                    $target
                ));
            }

            $this->eventBusMap[$target] = $eventBus;
        }
    }

    /**
     * @inheritdoc
     */
    public function getCommandChannelFor($target, $origin = null, $sender = null)
    {
        Assertion::string($target);

        if (! isset($this->commandBusMap[$target])) {
            throw new \RuntimeException(sprintf(
                "Target %s is not connected with a command channel",
                $target
            ));
        }

        return $this->commandBusMap[$target];
    }

    /**
     * @inheritdoc
     */
    public function getEventChannelFor($target, $origin = null, $sender = null)
    {
        if (is_null($target)) $target = self::LOCAL_CHANNEL;

        Assertion::string($target);

        if (! isset($this->eventBusMap[$target])) {
            throw new \RuntimeException(sprintf(
                "Target %s is not connected with an event channel",
                $target
            ));
        }

        return $this->eventBusMap[$target];
    }

    /**
     * @param ActionEventListenerAggregate $plugin
     * @return void
     */
    public function attachPluginToAllChannels(ActionEventListenerAggregate $plugin)
    {
        foreach ($this->commandBusList as $commandBus) $commandBus->utilize($plugin);
        foreach ($this->eventBusList as $eventBus) $eventBus->utilize($plugin);
    }
}


text:
<?xml version="1.0" encoding="utf-8" ?>

<odoo>
    <template id="assets_frontend" inherit_id="website.assets_frontend" name="Shop">
        <xpath expr="." position="inside">
            <link
                rel='stylesheet'
                href='/website_sale_available/static/src/css/website_sale_available.css'
            />

        </xpath>
    </template>
</odoo>


text:
package zelda;

import java.util.ArrayList;

public abstract class Rectangle {

    protected int x,  y,  height,  width;

    public Rectangle(int inX, int inY, int inWidth, int inHeight) {
        x = inX;
        y = inY;
        height = inHeight;
        width = inWidth;
    }

    public int left() {
        return x;
    }

    public int top() {
        return y;
    }

    public int right() {
        return x + width;
    }

    public int bottom() {
        return y + height;
    }

    public int width() {
        return width;
    }

    public int height() {
        return height;
    }

    public boolean intercepts(Rectangle inRect) {
        return (left() < inRect.right() && right() > inRect.left() &&
                top() < inRect.bottom() && bottom() > inRect.top());
    }
    //public abstract void remove(ArrayList... lists);
    @SuppressWarnings("empty-statement")
    public void remove(ArrayList... lists) {
        for(int i = 0; i < lists.length; i++) {
            while(lists[i].remove(this));
        }
    }

    protected abstract int testUp(ArrayList<Rectangle> r, int s, boolean p, int rght, int bttm, boolean wrap);

    protected abstract int testDown(ArrayList<Rectangle> r, int s, boolean p, int rght, int bttm, boolean wrap);

    protected abstract int testRight(ArrayList<Rectangle> r, int s, boolean p, int rght, int bttm, boolean wrap);

    protected abstract int testLeft(ArrayList<Rectangle> r, int s, boolean p, int rght, int bttm, boolean wrap);
}


text:
package msgraph

// DiamondModel undocumented
type DiamondModel string

const (
	// DiamondModelVUnknown undocumented
	DiamondModelVUnknown DiamondModel = "unknown"
	// DiamondModelVAdversary undocumented
	DiamondModelVAdversary DiamondModel = "adversary"
	// DiamondModelVCapability undocumented
	DiamondModelVCapability DiamondModel = "capability"
	// DiamondModelVInfrastructure undocumented
	DiamondModelVInfrastructure DiamondModel = "infrastructure"
	// DiamondModelVVictim undocumented
	DiamondModelVVictim DiamondModel = "victim"
	// DiamondModelVUnknownFutureValue undocumented
	DiamondModelVUnknownFutureValue DiamondModel = "unknownFutureValue"
)

var (
	// DiamondModelPUnknown is a pointer to DiamondModelVUnknown
	DiamondModelPUnknown = &_DiamondModelPUnknown
	// DiamondModelPAdversary is a pointer to DiamondModelVAdversary
	DiamondModelPAdversary = &_DiamondModelPAdversary
	// DiamondModelPCapability is a pointer to DiamondModelVCapability
	DiamondModelPCapability = &_DiamondModelPCapability
	// DiamondModelPInfrastructure is a pointer to DiamondModelVInfrastructure
	DiamondModelPInfrastructure = &_DiamondModelPInfrastructure
	// DiamondModelPVictim is a pointer to DiamondModelVVictim
	DiamondModelPVictim = &_DiamondModelPVictim
	// DiamondModelPUnknownFutureValue is a pointer to DiamondModelVUnknownFutureValue
	DiamondModelPUnknownFutureValue = &_DiamondModelPUnknownFutureValue
)

var (
	_DiamondModelPUnknown            = DiamondModelVUnknown
	_DiamondModelPAdversary          = DiamondModelVAdversary
	_DiamondModelPCapability         = DiamondModelVCapability
	_DiamondModelPInfrastructure     = DiamondModelVInfrastructure
	_DiamondModelPVictim             = DiamondModelVVictim
	_DiamondModelPUnknownFutureValue = DiamondModelVUnknownFutureValue
)


text:
@__experimental_modules_import CmdLine;

void test() {
#ifdef FOO_RETURNS_INT_PTR
  int *ip = foo();
#else
  float *fp = foo();
#endif
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace TimeTracker.util
{
    class TimedListCollectionView : ListCollectionView
    {
        public TimedListCollectionView(IList list) : base(list)
        {
        }
        protected override void RefreshOverride()
        {
            System.Diagnostics.Debug.WriteLine("TimedListCollectionView. Refresh start " + DateTime.Now.ToLongTimeString());
            base.RefreshOverride();
            System.Diagnostics.Debug.WriteLine("TimedListCollectionView. Refresh end " + DateTime.Now.ToLongTimeString());
        }
    }
}


text: {{ (branchId ? (isLocationPermission ? 'visit.notInRange' : 'visit.positionPermission') : 'branch.notFound') | translate }} {{ 'branch.clickHere' | translate }}   {{ 'branch.loadBranches' | translate }}


text:
module Taps
  class BaseError < StandardError
    attr_reader :original_backtrace

    def initialize(message, opts={})
      @original_backtrace = opts.delete(:backtrace)
      super(message)
    end
  end

  class NotImplemented < BaseError; end
  class DuplicatePrimaryKeyError < BaseError; end
  class CorruptedData < BaseError; end
  class InvalidData < BaseError; end
end


text:
package xyz.niteshsahni.cityguidepro.holder;

import java.util.Vector;

import xyz.niteshsahni.cityguidepro.model.ReviewList;

public class AllCityReview {
	public static Vector<ReviewList> allReviewList = new Vector<ReviewList>();

	public static Vector<ReviewList> getAllCityReview() {
		return AllCityReview.allReviewList;
	}

	public static void setAllCityReview(Vector<ReviewList> allReviewList) {
		AllCityReview.allReviewList = allReviewList;
	}

	public static ReviewList getReviewList(int pos) {
		return AllCityReview.allReviewList.elementAt(pos);
	}

	public static void setReviewList(ReviewList ReviewList) {
		AllCityReview.allReviewList.addElement(ReviewList);
	}

	public static void removeAll() {
		AllCityReview.allReviewList.removeAllElements();
	}

}