text:
/****************************************************************************//**
 * @file     usci_spi.h
 * @version  V3.00
 * @brief    M2351 series USCI_SPI driver header file
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * @copyright (C) 2016 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#ifndef __USCI_SPI_H__
#define __USCI_SPI_H__

#ifdef __cplusplus
extern "C"
{
#endif

/** @addtogroup Standard_Driver Standard Driver
  @{
*/

/** @addtogroup USCI_SPI_Driver USCI_SPI Driver
  @{
*/

/** @addtogroup USCI_SPI_EXPORTED_CONSTANTS USCI_SPI Exported Constants
  @{
*/

#define USPI_MODE_0        (0x0UL << USPI_PROTCTL_SCLKMODE_Pos)        /*!< SCLK idle low; data transmit with falling edge and receive with rising edge */
#define USPI_MODE_1        (0x1UL << USPI_PROTCTL_SCLKMODE_Pos)        /*!< SCLK idle low; data transmit with rising edge and receive with falling edge */
#define USPI_MODE_2        (0x2UL << USPI_PROTCTL_SCLKMODE_Pos)        /*!< SCLK idle high; data transmit with rising edge and receive with falling edge */
#define USPI_MODE_3        (0x3UL << USPI_PROTCTL_SCLKMODE_Pos)        /*!< SCLK idle high; data transmit with falling edge and receive with rising edge */

#define USPI_SLAVE         (USPI_PROTCTL_SLAVE_Msk)                    /*!< Set as slave */
#define USPI_MASTER        (0x0UL)                                     /*!< Set as master */

#define USPI_SS                (USPI_PROTCTL_SS_Msk)                   /*!< Set SS */
#define USPI_SS_ACTIVE_HIGH    (0x0UL)                                 /*!< SS active high */
#define USPI_SS_ACTIVE_LOW     (USPI_LINECTL_CTLOINV_Msk)              /*!< SS active low */

/* USCI_SPI Interrupt Mask */
#define USPI_SSINACT_INT_MASK        (0x001UL)                         /*!< Slave Slave Inactive interrupt mask */
#define USPI_SSACT_INT_MASK          (0x002UL)                         /*!< Slave Slave Active interrupt mask */
#define USPI_SLVTO_INT_MASK          (0x004UL)                         /*!< Slave Mode Time-out interrupt mask */
#define USPI_SLVBE_INT_MASK          (0x008UL)                         /*!< Slave Mode Bit Count Error interrupt mask */
#define USPI_TXUDR_INT_MASK          (0x010UL)                         /*!< Slave Transmit Under Run interrupt mask */
#define USPI_RXOV_INT_MASK           (0x020UL)                         /*!< Receive Buffer Overrun interrupt mask */
#define USPI_TXST_INT_MASK           (0x040UL)                         /*!< Transmit Start interrupt mask */
#define USPI_TXEND_INT_MASK          (0x080UL)                         /*!< Transmit End interrupt mask */
#define USPI_RXST_INT_MASK           (0x100UL)                         /*!< Receive Start interrupt mask */
#define USPI_RXEND_INT_MASK          (0x200UL)                         /*!< Receive End interrupt mask */

/* USCI_SPI Status Mask */
#define USPI_BUSY_MASK               (0x01UL)                          /*!< Busy status mask */
#define USPI_RX_EMPTY_MASK           (0x02UL)                          /*!< RX empty status mask */
#define USPI_RX_FULL_MASK            (0x04UL)                          /*!< RX full status mask */
#define USPI_TX_EMPTY_MASK           (0x08UL)                          /*!< TX empty status mask */
#define USPI_TX_FULL_MASK            (0x10UL)                          /*!< TX full status mask */
#define USPI_SSLINE_STS_MASK         (0x20UL)                          /*!< USCI_SPI_SS line status mask */

/*@}*/ /* end of group USCI_SPI_EXPORTED_CONSTANTS */

/** @addtogroup USCI_SPI_EXPORTED_FUNCTIONS USCI_SPI Exported Functions
  @{
*/

/**
  * @brief  Disable slave 3-wire mode.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return None
  * \hideinitializer
  */
#define USPI_DISABLE_3WIRE_MODE(uspi) ( (uspi)->PROTCTL &= ~USPI_PROTCTL_SLV3WIRE_Msk )

/**
  * @brief  Enable slave 3-wire mode.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return None
  * \hideinitializer
  */
#define USPI_ENABLE_3WIRE_MODE(uspi) ( (uspi)->PROTCTL |= USPI_PROTCTL_SLV3WIRE_Msk )

/**
  * @brief  Get the Rx buffer empty flag.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return Rx buffer flag
  * @retval 0: Rx buffer is not empty
  * @retval 1: Rx buffer is empty
  * \hideinitializer
  */
#define USPI_GET_RX_EMPTY_FLAG(uspi) ( ((uspi)->BUFSTS & USPI_BUFSTS_RXEMPTY_Msk) == USPI_BUFSTS_RXEMPTY_Msk ? 1:0 )

/**
  * @brief  Get the Tx buffer empty flag.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return Tx buffer flag
  * @retval 0: Tx buffer is not empty
  * @retval 1: Tx buffer is empty
  * \hideinitializer
  */
#define USPI_GET_TX_EMPTY_FLAG(uspi) ( ((uspi)->BUFSTS & USPI_BUFSTS_TXEMPTY_Msk) == USPI_BUFSTS_TXEMPTY_Msk ? 1:0 )

/**
  * @brief  Get the Tx buffer full flag.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return Tx buffer flag
  * @retval 0: Tx buffer is not full
  * @retval 1: Tx buffer is full
  * \hideinitializer
  */
#define USPI_GET_TX_FULL_FLAG(uspi) ( ((uspi)->BUFSTS & USPI_BUFSTS_TXFULL_Msk) == USPI_BUFSTS_TXFULL_Msk ? 1:0 )

/**
  * @brief  Get the datum read from RX register.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return data in Rx register
  * \hideinitializer
  */
#define USPI_READ_RX(uspi) ( (uspi)->RXDAT )

/**
  * @brief  Write datum to TX register.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @param[in]  u32TxData The datum which user attempt to transfer through USCI_SPI bus.
  * @return None
  * \hideinitializer
  */
#define USPI_WRITE_TX(uspi, u32TxData) ( (uspi)->TXDAT = (u32TxData) )

/**
  * @brief      Set USCI_SPI_SS pin to high state.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return     None.
  * @details    Disable automatic slave selection function and set USCI_SPI_SS pin to high state. Only available in Master mode.
  * \hideinitializer
  */
#define USPI_SET_SS_HIGH(uspi) \
    do{ \
        (uspi)->LINECTL &= ~USPI_LINECTL_CTLOINV_Msk; \
        (uspi)->PROTCTL = (((uspi)->PROTCTL & ~USPI_PROTCTL_AUTOSS_Msk) | USPI_PROTCTL_SS_Msk); \
    }while(0)

/**
  * @brief      Set USCI_SPI_SS pin to low state.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return     None.
  * @details    Disable automatic slave selection function and set USCI_SPI_SS pin to low state. Only available in Master mode.
  * \hideinitializer
  */
#define USPI_SET_SS_LOW(uspi) \
    do{ \
        (uspi)->LINECTL |= USPI_LINECTL_CTLOINV_Msk; \
        (uspi)->PROTCTL = (((uspi)->PROTCTL & ~USPI_PROTCTL_AUTOSS_Msk) | USPI_PROTCTL_SS_Msk); \
    }while(0)

/**
  * @brief  Set the length of suspend interval.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @param[in]  u32SuspCycle Decide the length of suspend interval.
  * @return None
  * \hideinitializer
  */
#define USPI_SET_SUSPEND_CYCLE(uspi, u32SuspCycle) ( (uspi)->PROTCTL = ((uspi)->PROTCTL & ~USPI_PROTCTL_SUSPITV_Msk) | ((u32SuspCycle) << USPI_PROTCTL_SUSPITV_Pos) )

/**
  * @brief  Set the USCI_SPI transfer sequence with LSB first.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return None
  * \hideinitializer
  */
#define USPI_SET_LSB_FIRST(uspi) ( (uspi)->LINECTL |= USPI_LINECTL_LSB_Msk )

/**
  * @brief  Set the USCI_SPI transfer sequence with MSB first.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return None
  * \hideinitializer
  */
#define USPI_SET_MSB_FIRST(uspi) ( (uspi)->LINECTL &= ~USPI_LINECTL_LSB_Msk )

/**
  * @brief  Set the data width of a USCI_SPI transaction.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @param[in]  u32Width The data width
  * @return None
  * \hideinitializer
  */
#define USPI_SET_DATA_WIDTH(uspi, u32Width) \
    do{ \
      if((u32Width) == 16ul){ \
        (uspi)->LINECTL = ((uspi)->LINECTL & ~USPI_LINECTL_DWIDTH_Msk) | (0 << USPI_LINECTL_DWIDTH_Pos); \
      }else { \
        (uspi)->LINECTL = ((uspi)->LINECTL & ~USPI_LINECTL_DWIDTH_Msk) | ((u32Width) << USPI_LINECTL_DWIDTH_Pos); \
      } \
    }while(0)

/**
  * @brief  Get the USCI_SPI busy state.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return USCI_SPI busy status
  * @retval 0: USCI_SPI module is not busy
  * @retval 1: USCI_SPI module is busy
  * \hideinitializer
  */
#define USPI_IS_BUSY(uspi) ( ((uspi)->PROTSTS & USPI_PROTSTS_BUSY_Msk) == USPI_PROTSTS_BUSY_Msk ? 1:0 )

/**
  * @brief Get the USCI_SPI wakeup flag.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @return Wakeup status.
  * @retval 0 Flag is not set.
  * @retval 1 Flag is set.
  * \hideinitializer
  */
#define USPI_GET_WAKEUP_FLAG(uspi) ( ((uspi)->WKSTS & USPI_WKSTS_WKF_Msk) == USPI_WKSTS_WKF_Msk ? 1:0 )

/**
  * @brief Clear the USCI_SPI wakeup flag.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @return None
  * \hideinitializer
  */
#define USPI_CLR_WAKEUP_FLAG(uspi)  ( (uspi)->WKSTS |= USPI_WKSTS_WKF_Msk )

/**
  * @brief Get protocol interrupt flag/status.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @return The interrupt flag/status of protocol status register.
  * \hideinitializer
  */
#define USPI_GET_PROT_STATUS(uspi)    ( (uspi)->PROTSTS )

/**
  * @brief Clear specified protocol interrupt flag.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @param[in] u32IntTypeFlag Interrupt Type Flag, should be
  *                                  - \ref USPI_PROTSTS_SSACTIF_Msk
  *                                  - \ref USPI_PROTSTS_SSINAIF_Msk
  *                                  - \ref USPI_PROTSTS_SLVBEIF_Msk
  *                                  - \ref USPI_PROTSTS_SLVTOIF_Msk
  *                                  - \ref USPI_PROTSTS_RXENDIF_Msk
  *                                  - \ref USPI_PROTSTS_RXSTIF_Msk
  *                                  - \ref USPI_PROTSTS_TXENDIF_Msk
  *                                  - \ref USPI_PROTSTS_TXSTIF_Msk
  * @return None
  * \hideinitializer
  */
#define USPI_CLR_PROT_INT_FLAG(uspi, u32IntTypeFlag)    ( (uspi)->PROTSTS = (u32IntTypeFlag) )

/**
  * @brief Get buffer interrupt flag/status.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @return The interrupt flag/status of buffer status register.
  * \hideinitializer
  */
#define USPI_GET_BUF_STATUS(uspi)    ( (uspi)->BUFSTS )

/**
  * @brief Clear specified buffer interrupt flag.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @param[in] u32IntTypeFlag Interrupt Type Flag, should be
  *                                  - \ref USPI_BUFSTS_TXUDRIF_Msk
  *                                  - \ref USPI_BUFSTS_RXOVIF_Msk
  * @return None
  * \hideinitializer
  */
#define USPI_CLR_BUF_INT_FLAG(uspi, u32IntTypeFlag)    ( (uspi)->BUFSTS = (u32IntTypeFlag) )

/**
  * @brief Enable specified protocol interrupt.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @param[in] u32IntSel Interrupt Type, should be
  *                                  - \ref USPI_PROTIEN_SLVBEIEN_Msk
  *                                  - \ref USPI_PROTIEN_SLVTOIEN_Msk
  *                                  - \ref USPI_PROTIEN_SSACTIEN_Msk
  *                                  - \ref USPI_PROTIEN_SSINAIEN_Msk
  * @return None
  * \hideinitializer
  */
#define USPI_ENABLE_PROT_INT(uspi, u32IntSel)    ( (uspi)->PROTIEN |= (u32IntSel) )

/**
  * @brief Disable specified protocol interrupt.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @param[in] u32IntSel Interrupt Type, should be
  *                                  - \ref USPI_PROTIEN_SLVBEIEN_Msk
  *                                  - \ref USPI_PROTIEN_SLVTOIEN_Msk
  *                                  - \ref USPI_PROTIEN_SSACTIEN_Msk
  *                                  - \ref USPI_PROTIEN_SSINAIEN_Msk
  * @return None
  * \hideinitializer
  */
#define USPI_DISABLE_PROT_INT(uspi, u32IntSel)    ( (uspi)->PROTIEN &= ~ (u32IntSel) )

/**
  * @brief Enable specified buffer interrupt.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @param[in] u32IntSel Interrupt Type, should be
  *                                  - \ref USPI_BUFCTL_RXOVIEN_Msk
  *                                  - \ref USPI_BUFCTL_TXUDRIEN_Msk
  * @return None
  * \hideinitializer
  */
#define USPI_ENABLE_BUF_INT(uspi, u32IntSel)    ( (uspi)->BUFCTL |= (u32IntSel) )

/**
  * @brief Disable specified buffer interrupt.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @param[in] u32IntSel Interrupt Type, should be
  *                                  - \ref USPI_BUFCTL_RXOVIEN_Msk
  *                                  - \ref USPI_BUFCTL_TXUDRIEN_Msk
  * @return None
  * \hideinitializer
  */
#define USPI_DISABLE_BUF_INT(uspi, u32IntSel)    ( (uspi)->BUFCTL &= ~ (u32IntSel) )

/**
  * @brief Enable specified transfer interrupt.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @param[in] u32IntSel Interrupt Type, should be
  *                                  - \ref USPI_INTEN_RXENDIEN_Msk
  *                                  - \ref USPI_INTEN_RXSTIEN_Msk
  *                                  - \ref USPI_INTEN_TXENDIEN_Msk
  *                                  - \ref USPI_INTEN_TXSTIEN_Msk
  * @return None
  * \hideinitializer
  */
#define USPI_ENABLE_TRANS_INT(uspi, u32IntSel)    ( (uspi)->INTEN |= (u32IntSel) )

/**
  * @brief Disable specified transfer interrupt.
  * @param[in] uspi The pointer of the specified USCI_SPI module.
  * @param[in] u32IntSel Interrupt Type, should be
  *                                  - \ref USPI_INTEN_RXENDIEN_Msk
  *                                  - \ref USPI_INTEN_RXSTIEN_Msk
  *                                  - \ref USPI_INTEN_TXENDIEN_Msk
  *                                  - \ref USPI_INTEN_TXSTIEN_Msk
  * @return None
  * \hideinitializer
  */
#define USPI_DISABLE_TRANS_INT(uspi, u32IntSel)    ( (uspi)->INTEN &= ~ (u32IntSel) )

/**
  * @brief      Trigger RX PDMA function.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return     None.
  * @details    Set RXPDMAEN bit of USPI_PDMACTL register to enable RX PDMA transfer function.
  */
#define USPI_TRIGGER_RX_PDMA(uspi)   ( (uspi)->PDMACTL |= USPI_PDMACTL_RXPDMAEN_Msk | USPI_PDMACTL_PDMAEN_Msk )

/**
  * @brief      Trigger TX PDMA function.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return     None.
  * @details    Set TXPDMAEN bit of USPI_PDMACTL register to enable TX PDMA transfer function.
  */
#define USPI_TRIGGER_TX_PDMA(uspi)   ( (uspi)->PDMACTL |= USPI_PDMACTL_TXPDMAEN_Msk | USPI_PDMACTL_PDMAEN_Msk )

/**
  * @brief      Disable RX PDMA transfer.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return     None.
  * @details    Clear RXPDMAEN bit of USPI_PDMACTL register to disable RX PDMA transfer function.
  */
#define USPI_DISABLE_RX_PDMA(uspi) ( (uspi)->PDMACTL &= ~USPI_PDMACTL_RXPDMAEN_Msk )

/**
  * @brief      Disable TX PDMA transfer.
  * @param[in]  uspi The pointer of the specified USCI_SPI module.
  * @return     None.
  * @details    Clear TXPDMAEN bit of USPI_PDMACTL register to disable TX PDMA transfer function.
  */
#define USPI_DISABLE_TX_PDMA(uspi) ( (uspi)->PDMACTL &= ~USPI_PDMACTL_TXPDMAEN_Msk )

uint32_t USPI_Open(USPI_T *uspi, uint32_t u32MasterSlave, uint32_t u32SPIMode,  uint32_t u32DataWidth, uint32_t u32BusClock);
void USPI_Close(USPI_T *uspi);
void USPI_ClearRxBuf(USPI_T *uspi);
void USPI_ClearTxBuf(USPI_T *uspi);
void USPI_DisableAutoSS(USPI_T *uspi);
void USPI_EnableAutoSS(USPI_T *uspi, uint32_t u32SSPinMask, uint32_t u32ActiveLevel);
uint32_t USPI_SetBusClock(USPI_T *uspi, uint32_t u32BusClock);
uint32_t USPI_GetBusClock(USPI_T *uspi);
void USPI_EnableInt(USPI_T *uspi, uint32_t u32Mask);
void USPI_DisableInt(USPI_T *uspi, uint32_t u32Mask);
uint32_t USPI_GetIntFlag(USPI_T *uspi, uint32_t u32Mask);
void USPI_ClearIntFlag(USPI_T *uspi, uint32_t u32Mask);
uint32_t USPI_GetStatus(USPI_T *uspi, uint32_t u32Mask);
void USPI_EnableWakeup(USPI_T *uspi);
void USPI_DisableWakeup(USPI_T *uspi);

/*@}*/ /* end of group USCI_SPI_EXPORTED_FUNCTIONS */

/*@}*/ /* end of group USCI_SPI_Driver */

/*@}*/ /* end of group Standard_Driver */

#ifdef __cplusplus
}
#endif

#endif /* __USCI_SPI_H__ */

/*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/


text:
package org.multibit.action;

import java.util.List;

import org.multibit.controller.MultiBitController;
import org.multibit.model.DataProvider;
import org.multibit.model.MultiBitModel;
import org.multibit.model.PerWalletModelData;

/**
 * exit the application
 *
 * @author jim
 *
 */
public class ExitAction implements Action {
    private MultiBitController controller;

    public ExitAction(MultiBitController controller) {
        this.controller = controller;
    }

    public void execute(DataProvider dataProvider) {
        // write the user properties
        // save all the wallets and put their filenames in the user preferences
        if (controller.getModel().getPerWalletModelDataList() != null) {
            List<PerWalletModelData> perWalletModelDataList = controller.getModel().getPerWalletModelDataList();

            int numberOfWallets = perWalletModelDataList.size();
            controller.getModel().setUserPreference(MultiBitModel.NUMBER_OF_WALLETS, numberOfWallets + "");
            controller.getModel().setUserPreference(MultiBitModel.ACTIVE_WALLET_FILENAME,
                    controller.getModel().getActiveWalletFilename());
            if (numberOfWallets > 0) {
                for (int i = 1; i <= numberOfWallets; i++) {
                    PerWalletModelData perWalletModelData = perWalletModelDataList.get(i - 1);
                    if (perWalletModelData.getWalletFilename() != null) {
                        controller.getModel().setUserPreference(MultiBitModel.WALLET_FILENAME_PREFIX + i,
                                perWalletModelData.getWalletFilename());
                        // save the ith wallet, including the wallet info
                        controller.getFileHandler().savePerWalletModelData(perWalletModelData, false);
                    }
                }

            }

        }

        controller.getFileHandler().writeUserPreferences();

        // shut down the PeerGroup
        if (controller.getMultiBitService() != null && controller.getMultiBitService().getPeerGroup() != null) {
            controller.getMultiBitService().getPeerGroup().stop();
        }

        System.exit(0);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.gdn.x.beirut.domain.event.model;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.gdn.common.base.entity.GdnBaseDomainEventModel;

@JsonIgnoreProperties(ignoreUnknown = true)
public class CandidateNewInsert extends GdnBaseDomainEventModel {

  private String storeId;

  private String idPosition;

  private String idCandidate;

  private String emailAddress;

  private String firstName;

  private String lastName;

  private String jobDivision;

  private String jobType;

  private String phoneNumber;

  private Date createdDate;

  private String title;

  private String status;

  public Date getCreatedDate() {
    return createdDate;
  }

  public String getEmailAddress() {
    return emailAddress;
  }

  public String getFirstName() {
    return firstName;
  }

  public String getIdCandidate() {
    return idCandidate;
  }

  public String getIdPosition() {
    return idPosition;
  }

  public String getJobDivision() {
    return jobDivision;
  }

  public String getJobType() {
    return jobType;
  }

  public String getLastName() {
    return lastName;
  }

  public String getPhoneNumber() {
    return phoneNumber;
  }

  public String getStatus() {
    return status;
  }

  public String getStoreId() {
    return storeId;
  }

  public String getTitle() {
    return title;
  }

  public void setCreatedDate(Date createdDate) {
    this.createdDate = createdDate;
  }

  public void setEmailAddress(String emailAddress) {
    this.emailAddress = emailAddress;
  }

  public void setFirstName(String firstName) {
    this.firstName = firstName;
  }

  public void setIdCandidate(String idCandidate) {
    this.idCandidate = idCandidate;
  }

  public void setIdPosition(String idPosition) {
    this.idPosition = idPosition;
  }

  public void setJobDivision(String jobDivision) {
    this.jobDivision = jobDivision;
  }

  public void setJobType(String jobType) {
    this.jobType = jobType;
  }

  public void setLastName(String lastName) {
    this.lastName = lastName;
  }

  public void setPhoneNumber(String phoneNumber) {
    this.phoneNumber = phoneNumber;
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public void setStoreId(String storeId) {
    this.storeId = storeId;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  @Override
  public String toString() {
    return "CandidateNewInsert [storeId=" + storeId + ", idPosition=" + idPosition
        + ", idCandidate=" + idCandidate + ", emailAddress=" + emailAddress + ", firstName="
        + firstName + ", lastName=" + lastName + ", jobDivision=" + jobDivision + ", jobType="
        + jobType + ", phoneNumber=" + phoneNumber + ", createdDate=" + createdDate + ", title="
        + title + ", status=" + status + ", toString()=" + super.toString() + "]";
  }

}


text:
@interface OCURLSessionUploadTask : NSURLSessionUploadTask

@end


text:
<?php declare(strict_types=1);

namespace Users\Fixtures;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use blitzik\Authorization\Privilege;

class UsersFixture extends AbstractFixture
{
    /**
     * Load data fixtures with the passed EntityManager
     *
     * @param ObjectManager $manager
     */
    public function load(ObjectManager $manager): void
    {
        $this->loadDefaultPrivileges($manager);

        $manager->flush();
    }

    private function loadDefaultPrivileges(ObjectManager $manager): void
    {
        $create = new Privilege(Privilege::CREATE);
        $manager->persist($create);
        $this->setReference('privilege_create', $create);

        $edit = new Privilege(Privilege::EDIT);
        $manager->persist($edit);
        $this->setReference('privilege_edit', $edit);

        $remove = new Privilege(Privilege::REMOVE);
        $manager->persist($remove);
        $this->setReference('privilege_remove', $remove);

        $view = new Privilege(Privilege::VIEW);
        $manager->persist($view);
        $this->setReference('privilege_view', $view);
    }

}


text:
<?php namespace Pixiu\Commerce;

use Backend;
use Carbon\Carbon;
use Pixiu\Commerce\api\Classes\CategoryTreeAdapter;
use Pixiu\Commerce\api\Classes\CheckoutApi;
use Pixiu\Commerce\api\Enums\CartStatusEnum;
use Pixiu\Commerce\api\Tasks\CheckCarts;
use Pixiu\Commerce\Classes\Invoice\NormalInvoiceManager;
use Pixiu\Commerce\Classes\TaxHandler;
use Pixiu\Commerce\Models\Cart;
use System\Classes\PluginBase;
use Illuminate\Support\Facades\Event;
use RainLab\User\Models\User;
use Barryvdh\DomPDF\ServiceProvider;
use Pixiucz\Invoices\InvoicesServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\Facades\Lang;
use Pixiu\Commerce\Classes\CurrencyHandler;

/**
 * Commerce Plugin Information File
 */
class Plugin extends PluginBase
{
    public $require = [
        'RainLab.User'
    ];
    /**
     * Returns information about this plugin.
     *
     * @return array
     */
    public function pluginDetails()
    {
        return [
            'name'        => 'Commerce',
            'description' => 'No description provided yet...',
            'author'      => 'Pixiu',
            'icon'        => 'icon-leaf'
        ];
    }

    /**
     * Register method, called when the plugin is first registered.
     *
     * @return void
     */
    public function register()
    {
        \App::bind('CurrencyHandler', function($app) {
            return new CurrencyHandler;
        });
        \App::bind('TaxHandler', function($app) {
            return new TaxHandler;
        });
        \App::bind('CategoryTreeAdapter', function($app) {
            return new CategoryTreeAdapter;
        });
        \App::bind('CheckoutApi', function ($app) {
            return new CheckoutApi;
        });

        $this->app->register(InvoicesServiceProvider::class);
    }

    /**
     * Boot method, called right before the request route.
     *
     * @return array
     */
    public function boot()
    {
        // $this->logQueries();

        Event::listen('backend.menu.extendItems', function($manager) {
            $manager->removeMainMenuItem('RainLab.User', 'user');
        });

        User::extend(function($model) {
            $model->hasMany['addresses'] = ['Pixiu\Commerce\Models\Address'];
            $model->hasMany['orders'] = ['Pixiu\Commerce\Models\Order'];
        });

        $this->app->register(ServiceProvider::class);

        AliasLoader::getInstance()->alias('PDF', 'Barryvdh\DomPDF\Facade');
    }

    /**
     * Registers any front-end components implemented in this plugin.
     *
     * @return array
     */
    public function registerComponents()
    {
        return []; // Remove this line to activate

        return [
            'Pixiu\Commerce\Components\MyComponent' => 'myComponent',
        ];
    }

    /**
     * Registers any back-end permissions used by this plugin.
     *
     * @return array
     */
    public function registerPermissions()
    {
        return []; // Remove this line to activate

        return [
            'pixiu.commerce.some_permission' => [
                'tab' => 'Commerce',
                'label' => 'Some permission'
            ],
        ];
    }

    /**
     * Registers back-end navigation items for this plugin.
     *
     * @return array
     */
    public function registerNavigation()
    {
        return [
            'commerce' => [
                'label'       => 'Commerce',
                'url'         => Backend::url('pixiu/commerce/Orders'),
                'icon'        => 'icon-balance-scale',
                'permissions' => ['pixiu.commerce.*'],
                'order' => 500,
                'sideMenu' => [
                    'orders' => [
                        'label'       => Lang::get('pixiu.commerce::lang.menu.orders'),
                        'url'         => Backend::url('pixiu/commerce/Orders'),
                        'icon'        => 'icon-shopping-basket',
                        'permissions' => ['pixiu.commerce.*']
                    ],
                    'products' => [
                        'label'     => Lang::get('pixiu.commerce::lang.menu.products'),
                        'url'         => Backend::url('pixiu/commerce/Products'),
                        'icon'        => 'icon-cube',
                        'permissions' => ['pixiu.commerce.*']
                    ],
                    'categories' => [
                        'label' => Lang::get('pixiu.commerce::lang.menu.categories'),
                        'url'         => Backend::url('pixiu/commerce/Categories'),
                        'icon'        => 'icon-cubes',
                        'permissions' => ['pixiu.commerce.*']
                    ],
                    'brands' => [
                        'label' => Lang::get('pixiu.commerce::lang.menu.brands'),
                        'url'         => Backend::url('pixiu/commerce/Brands'),
                        'icon'        => 'icon-diamond',
                        'permissions' => ['pixiu.commerce.*']
                    ],
                    'users' => [
                        'label' => Lang::get('pixiu.commerce::lang.menu.users'),
                        'url'         => Backend::url('pixiu/commerce/Users'),
                        'icon'        => 'icon-male',
                        'permissions' => ['pixiu.commerce.*']
                    ],
                    'taxes' => [
                        'label' => Lang::get('pixiu.commerce::lang.menu.taxes'),
                        'url'         => Backend::url('pixiu/commerce/Taxes'),
                        'icon'        => 'icon-money',
                        'permissions' => ['pixiu.commerce.*']
                    ],
                ]
            ]
        ];
    }

    public function registerSettings()
    {
        return [
            'commerce_settings' => [
                'label' => 'eShop settings',
                'description' => 'Názov, adresa, IČO,...',
                'category'    => 'Všeobecné nastavenia',
                'icon'        => 'icon-cog',
                'class'       => 'Pixiu\Commerce\Models\CommerceSettings',
                'order'       => 500,
                'keywords'    => 'security location',
                'permissions' => ['pixiu.turistickeznamky.*']
            ]
        ];
    }

    public function registerSchedule($schedule)
    {
        $schedule->call(function() {
            CheckCarts::run();
        })->daily();
    }

    public function registerFormWidgets()
    {
        return [
            'Pixiu\Commerce\FormWidgets\Currency' => 'currencywidget',
            'Pixiu\Commerce\FormWidgets\VariantsWidget' => 'variantswidget'
        ];
    }

    private function logQueries()
    {
        \DB::listen(function($query) {
            \Log::info(
                $query->sql,
                $query->bindings,
                $query->time
            );
        });
    }

}


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

namespace Karbon.Cms.Core.Models
{
    public interface ISoundFile : IFile
    { }
}


text:
package org.kaaproject.kaa.server.transports.tcp.transport.commands;

import org.kaaproject.kaa.server.transports.tcp.transport.netty.AbstractKaaTcpCommandProcessor;

public class KaaTcpCommand extends AbstractKaaTcpCommandProcessor{

    static final String KAA_TCP = "KaaTcp";

    @Override
    public String getName() {
        return KAA_TCP;
    }

}


text:
status: publish
tags:
- fredericiana
- mozilla
- osl
- tech
- twitter
published: true
title: Tweeeeet
type: post
meta:
  _edit_last: "2"
layout: post
---
Now it has happened: As an effect of the urgent need for a weekend, I registered with twitter. Only adding people I could think of easily, I am not "following" 37 people ;)

Of course, my twitter experience started all peachy right off the bat, by first giving me site errors:

(hey, at least they are pretty)

... and then I noticed something weird about the times they show on every page:

"ungefähr 1 Stunde ago from web..." ... is that... Germenglish? Englerman?

But let's not be discouraged. They probably just started their announced maintenance window four hours early ;)

Anyone else think I forgot to "follow" them on twitter? Leave a comment.


text:
NSString* const accessUrl=@"www.google.com";
NSString* const accessString=@"globalString";
@implementation NPKGlobalAccess

@end


text:
import { AboutWork_artwork$data } from "__generated__/AboutWork_artwork.graphql"
import { renderWithWrappers } from "app/tests/renderWithWrappers"
import { AboutWork } from "./AboutWork"

jest.mock("app/utils/hardware", () => ({
  truncatedTextLimit: jest.fn(),
}))

import { truncatedTextLimit } from "app/utils/hardware"

describe("AboutWork", () => {
  beforeEach(() => {
    ;(truncatedTextLimit as jest.Mock).mockReset()
  })

  it("renders the AboutWork correctly if all info is present", () => {
    const { queryByText } = renderWithWrappers(<AboutWork artwork={aboutWorkArtwork} />)
    expect(queryByText("About the work")).toBeTruthy()
    expect(queryByText("From Artsy Specialist:")).toBeTruthy()
  })

  it("renders the AboutWork correctly if only additional information is present", () => {
    const artworkNoDescription = { ...aboutWorkArtwork, description: null }

    const { queryByText } = renderWithWrappers(<AboutWork artwork={artworkNoDescription} />)
    expect(queryByText("About the work")).toBeTruthy()
    expect(queryByText("From Artsy Specialist:")).toBeFalsy()
  })

  it("renders the AboutWork correctly if only description is present", () => {
    const artworkNoAdditionalInfo = { ...aboutWorkArtwork, additionalInformation: null }

    const { queryByText } = renderWithWrappers(<AboutWork artwork={artworkNoAdditionalInfo} />)
    expect(queryByText("About the work")).toBeTruthy()
    expect(queryByText("From Artsy Specialist:")).toBeTruthy()
  })

  it("renders nothing if no information is present", () => {
    const artworkNoInfo = { ...aboutWorkArtwork, additionalInformation: null, description: null }

    const { queryByText } = renderWithWrappers(<AboutWork artwork={artworkNoInfo} />)
    expect(queryByText("About the work")).toBeFalsy()
    expect(queryByText("From Artsy Specialist:")).toBeFalsy()
  })

  it("hides 'From Artsy Specialist:' for auction works", () => {
    const artworkInAuction = { ...aboutWorkArtwork, isInAuction: true }

    const { queryByText } = renderWithWrappers(<AboutWork artwork={artworkInAuction} />)
    expect(queryByText("From Artsy Specialist:")).toBeFalsy()
  })
})

const aboutWorkArtwork: AboutWork_artwork$data = {
  additionalInformation:
    "This is some information about the artwork by the gallery. It has to be at least 320 characters in order to test that the read more component truncates possibly. So here is soem lorem ipsum: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
  description: "This is some information about the artwork by Artsy.",
  isInAuction: false,
  " $fragmentType": "AboutWork_artwork",
}


text:
<!DOCTYPE html>
<meta charset="utf-8">
<title>Named access on the window object</title>
<link rel="author" title="Matthew Phillips" href="mailto:matthew@matthewphillips.info">
<link rel="help" href="https://html.spec.whatwg.org/#named-access-on-the-window-object">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<body>

<script>
"use strict";

test(() => {
  const img = document.createElement("img");
  img.setAttribute("name", "namedimage");
  document.body.appendChild(img);

  assert_equals(img, window.namedimage);
}, "A named property should return an element as-is if its name " +
 "attribute matches");

test(() => {
  const img = document.createElement("img");
  img.setAttribute("name", "foo");

  assert_false("foo" in window);
}, "A named property should not be set if the element is not reachable from the Document");

test(() => {
  const img = document.createElement("img");
  img.setAttribute("name", "enumerable-foo");
  document.body.appendChild(img);

  let found = false;
  for (const key in window) {
    if (key === "enumerable-foo") {
      found = true;
    }
  }

  assert_true(found);
}, "A named property should be enumerable");

test(() => {
  const img = document.createElement("img");
  img.setAttribute("id", "foo-id");
  document.body.appendChild(img);

  assert_equals(img, window["foo-id"]);
}, "A named property should returns any element for which the id " +
  "attribute matches");

test(() => {
  document.body.appendChild(document.createTextNode("foo"));

  const img = document.createElement("img");
  img.setAttribute("id", "with-non-element");
  document.body.appendChild(img);

  assert_equals(window["with-non-element"], img);
}, "A non element node in the document should not cause errors");

test(() => {
  const img = document.createElement("img");
  document.body.appendChild(img);
  img.setAttribute("name", "dupe");
  img.setAttribute("id", "dupe");
  assert_equals(window.dupe, img);

  const img2 = document.createElement("img");
  document.body.appendChild(img2);
  img2.setAttribute("name", "dupe");
  img2.setAttribute("id", "dupe");

  assert_equals(window.dupe.length, 2);
  assert_equals(window.dupe[0], img);
  assert_equals(window.dupe[1], img2);
}, "An element with identical name and id attributes should occur in " +
  "the value once, not twice");
</script>
</body>


text:
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import LabelEncoder
def main():
    # loading training data
    print('Loading training data')
    traindata = pd.read_csv('C:/Users/sound/Desktop/Kaggle/Leaf Classfication/Data/train.csv')#read csv file into dataframe
    x_tr = traindata.values[:, 2:]#The other columns are the pixels of each image and we have 28,000 images
    y_tr = traindata.values[:, 1]#The first column is the label that drawn by user

    le = LabelEncoder().fit(traindata['species'])
    scaler = StandardScaler().fit(x_tr)
    x_tr = scaler.transform(x_tr)

    print('Loading test data')
    testdata = pd.read_csv('C:/Users/sound/Desktop/Kaggle/Leaf Classfication/Data/test.csv')

    #x_test = testdata.values[:, 1:].astype(float)
    #x_test = scaler.transform(x_test)
    x_test = testdata.drop(['id'], axis=1).values
    x_test = scaler.transform(x_test)
    test_ids = testdata.pop('id')
    print('Start learning...')
    random_forest = RandomForestClassifier(n_estimators=1000)
    random_forest.fit(x_tr, y_tr)
    y_pred = random_forest.predict_proba(x_test)

    submission = pd.DataFrame(y_pred, index=test_ids, columns=le.classes_)
    submission.to_csv('submission.csv')

if __name__ == '__main__':
    main()


text:
{% extends "base.html" %}

{% block body %}

Home

Server List

User List

    {% include "messages.html" %}

Login to upTee

        <form action="" method="post">
            <input type="hidden" name="csrfmiddlewaretoken" value="{% with csrf_token as csrf_token_clean %}{{ csrf_token_clean }}{% endwith %}">

                <input class="iconUsername" type="text" name="username" value="" id="username" required="" placeholder="Username">

                <input class="iconPassword" type="password" name="password" value="" id="password" required="" placeholder="Password">

                <input class="button positive bgGreen"  type="submit" value="Login">
                <input type="hidden" name="next" value="{{ next }}">

        </form>

{% endblock body %}


text:
#ifndef _asn_bits_h_
#define _asn_bits_h_

typedef struct AsnBits
{
    int   bitLen;
    char* bits;
} AsnBits;

extern char numToHexCharTblG[];

#define TO_HEX(fourBits) (numToHexCharTblG[(fourBits) & 0x0f])

#define ASNBITS_PRESENT(abits) ((abits)->bits != NULL)

AsnLen BEncAsnBits PROTO((BUF_TYPE b, AsnBits* data));

void BDecAsnBits PROTO((BUF_TYPE b, AsnBits* result, AsnLen* bytesDecoded,
                       ENV_TYPE env));

AsnLen BEncAsnBitsContent PROTO((BUF_TYPE b, AsnBits* bits));

void BDecAsnBitsContent PROTO((BUF_TYPE    b,
                        AsnLen len,
                        AsnTag tagId,
                        AsnBits* result,
                        AsnLen* bytesDecoded,
                        ENV_TYPE env));

void FreeAsnBits PROTO((AsnBits* v));

void PrintAsnBits PROTO((FILE* f, AsnBits* b, unsigned short int indent));

int AsnBitsEquiv PROTO((AsnBits* b1, AsnBits* b2));

void SetAsnBit PROTO((AsnBits* b1, unsigned long int bit));

void ClrAsnBit PROTO((AsnBits* b1, unsigned long int bit));

int GetAsnBit PROTO((AsnBits* b1, unsigned long int bit));

#endif /* conditional include */


text:
//
//  RKLevel1DiagnosticResponse.h
//  RobotKit
//
//  Created by Jon Carroll on 10/14/11.
//  Copyright (c) 2011 Orbotix Inc. All rights reserved.
//

/*! @file */

#import <RobotCommandKit/RKDeviceResponse.h>

/*!
 * @brief Class that encapsulates the response from a level 1 diagnostic command.
 *
 * A simple response that provides the error code from a level 1 diagnostic command.
 * The level 1 diagnostic data is returned in an asynchronous data packet as human readable
 * ASCII string.
 *
 * @sa RKLevel1DiagnosticCommand
 * @sa RKLevel1DiagnosticAsyncData
 */
@interface FWLevel1DiagnosticResponse : RKDeviceResponse

@end


text:
package com.tangyu.component.service.remind;

import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.Vibrator;

import java.util.Calendar;

/**
 * @author binliu
 */
public class RemindWay {

    public static final String APP_NAME = "com.tangyu.app";
    public final static String ACT_REMIND_NEWDAY = ".NEWDAY_REMIND";
    public final static String ACT_REMIND_WAKEUP = ".WAKEUP";

    public final static String ACTION_NEWDAY_REMIND = APP_NAME + ACT_REMIND_NEWDAY;

    public final static String ACTION_WAKEUP = APP_NAME + ACT_REMIND_WAKEUP;

    private Context mCtx;
    private NotificationManager mNotify;
    private AlarmManager mAlarm;
    private Vibrator mVibrator;
    private PowerManager mPower;
    private WakeLock mNewWakeLock;

    public RemindWay(Context context) {
        mCtx = context;
        mNotify = (NotificationManager) mCtx
                .getSystemService(Context.NOTIFICATION_SERVICE);
        mAlarm = (AlarmManager) mCtx.getSystemService(Context.ALARM_SERVICE);
        mVibrator = (Vibrator) mCtx.getSystemService(Context.VIBRATOR_SERVICE);
        mPower = (PowerManager) mCtx.getSystemService(Context.POWER_SERVICE);
        mNewWakeLock = mPower.newWakeLock(PowerManager.FULL_WAKE_LOCK
                | PowerManager.ON_AFTER_RELEASE
                | PowerManager.ACQUIRE_CAUSES_WAKEUP, "Tangyu");
    }

    public void notify(int id, Notification notification) {
        if (notification == null) throw new NullPointerException("param notification should not be null");
        mNotify.notify(id, notification);
    }

    public void notify(Intent rIntent, Class destinyCls, NotifyMsg msg, int id) {
        if (rIntent == null) throw new NullPointerException("intent is null");
        if (destinyCls == null) throw new NullPointerException("destiny class is null");
        if (msg == null) throw new NullPointerException("msg is null");

        Intent intent = rIntent.cloneFilter();
        intent.putExtras(rIntent);
        intent.setClass(mCtx, destinyCls);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent pi = PendingIntent.getActivity(mCtx, 0, intent, 0);

		/* *
         * modify by: bin time: 2012-9-12 reason: Builder is need more than API
		 * 11
		 *
		 * Builder builder = new Notification.Builder(mContext);
		 * builder.setTicker(tickerText); builder.setContentTitle(contentTitle);
		 * builder.setContentText(contentText); builder.setSmallIcon(icon);
		 * builder.setWhen(when); builder.setDefaults(Notification.DEFAULT_ALL);
		 * builder.setContentIntent(pi); Notification notification =
		 * builder.getNotification();
		 */

        // ----modify start
        Notification notification = new Notification(msg.icon, msg.tickerText, msg.when);
        notification.defaults = Notification.DEFAULT_ALL;
        notification.setLatestEventInfo(mCtx, msg.contentTitle, msg.contentText, pi);
        // ----modify end

        mNotify.notify(id, notification);
    }

    public void notify(Intent rIntent, Class destinyCls, NotifyMsg msg, int id, Notification notification) {
        if (rIntent == null) throw new NullPointerException("intent is null");
        if (destinyCls == null) throw new NullPointerException("destiny class is null");
        if (msg == null) throw new NullPointerException("msg is null");

        Intent intent = rIntent.cloneFilter();
        intent.putExtras(rIntent);
        intent.setClass(mCtx, destinyCls);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent pi = PendingIntent.getActivity(mCtx, 0, intent, 0);

		/* *
		 * modify by: bin time: 2012-9-12 reason: Builder is need more than API
		 * 11
		 *
		 * Builder builder = new Notification.Builder(mContext);
		 * builder.setTicker(tickerText); builder.setContentTitle(contentTitle);
		 * builder.setContentText(contentText); builder.setSmallIcon(icon);
		 * builder.setWhen(when); builder.setDefaults(Notification.DEFAULT_ALL);
		 * builder.setContentIntent(pi); Notification notification =
		 * builder.getNotification();
		 */

        // ----modify start
        if (notification == null) {
            notification = new Notification(msg.icon, msg.tickerText, msg.when);
            notification.defaults = Notification.DEFAULT_ALL;
        }
        notification.setLatestEventInfo(mCtx, msg.contentTitle, msg.contentText, pi);
        // ----modify end

        mNotify.notify(id, notification);
    }

    public void alarm(Intent intent, Calendar c) {
        PendingIntent pi = PendingIntent.getBroadcast(mCtx, 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);// .FLAG_ONE_SHOT);
        mAlarm.set(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pi);
    }

    public void alarm(Intent intent, long timeMills) {
        PendingIntent pi = PendingIntent.getBroadcast(mCtx, 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);// .FLAG_ONE_SHOT);
        mAlarm.set(AlarmManager.RTC_WAKEUP, timeMills, pi);
    }

    public void wakeup() {
        if (mNewWakeLock != null) {
            mNewWakeLock.acquire();
        }
    }

    public void cancelNofity(int id) {
        if (mNotify != null) {
            mNotify.cancel(id);
        }
    }

    public void cancelAll(Intent[] intents) {
        // if (mNotify != null) {
        // mNotify.cancelAll();
        // }
        // action, data, type, class, and categories
        PendingIntent operation = null;
        for (Intent intent : intents) {
            operation = PendingIntent.getBroadcast(mCtx, 0, intent,
                    PendingIntent.FLAG_UPDATE_CURRENT);// .FLAG_ONE_SHOT);
            mAlarm.cancel(operation);
        }
    }

    public static class NotifyMsg {
        public int icon = 0;
        public String tickerText = "", contentTitle = "", contentText = "";
        public long when = 0;

    }
}


text:
var process = function(){
    var name = $('#name').val();

    $.post( "/native", {name:name}, function( data ) {
        $( "#result" ).html( data.value );
    });
};


text:
package com.github.omadahealth.lollipin;

import android.app.Activity;
import android.os.Bundle;

import lollipin.orangegangsters.github.com.lollipin.R;

/**
 * Created by oliviergoutay on 1/13/15.
 */
public class NotLockedActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_not_locked);
    }

}


text:
你可以使用`@JsonTest`测试对象JSON序列化和反序列化是否工作正常。该注解将自动配置支持JSON映射器的可用库。可以是下列库里的一种:

- `Jackson ObjectMapper`,任何`@JsonComponent` bean,任何Jackson `模块`
- `Gson`
- `Jsonb`

使用`@AutoConfigureJsonTesters`可以配置auto-configuration的元素。

Spring Boot提供基于AssertJ的帮助类(helpers),可用来配合JSONassert和JsonPath库检测JSON是否和期望的一样。`JacksonTester`、`GsonTester`、`JsonbTester`和`BasicJsonTester`分别用于Jackson、Gson、Jsonb、Strings。当使用`@JsonTest`时,你可以在测试类中`@Autowired`任何helper字段。下面的例子展示了一个用于Jackson的测试类:
```java
import org.junit.*;
import org.junit.runner.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.boot.test.autoconfigure.json.*;
import org.springframework.boot.test.context.*;
import org.springframework.boot.test.json.*;
import org.springframework.test.context.junit4.*;

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

@RunWith(SpringRunner.class)
@JsonTest
public class MyJsonTests {

	@Autowired
	private JacksonTester<VehicleDetails> json;

	@Test
	public void testSerialize() throws Exception {
		VehicleDetails details = new VehicleDetails("Honda", "Civic");
		// Assert against a `.json` file in the same package as the test
		assertThat(this.json.write(details)).isEqualToJson("expected.json");
		// Or use JSON path based assertions
		assertThat(this.json.write(details)).hasJsonPathStringValue("@.make");
		assertThat(this.json.write(details)).extractingJsonPathStringValue("@.make")
				.isEqualTo("Honda");
	}

	@Test
	public void testDeserialize() throws Exception {
		String content = "{\"make\":\"Ford\",\"model\":\"Focus\"}";
		assertThat(this.json.parse(content))
				.isEqualTo(new VehicleDetails("Ford", "Focus"));
		assertThat(this.json.parseObject(content).getMake()).isEqualTo("Ford");
	}

}
```

**注** JSON帮助类可用于标准单元测试类,如果没有使用`@JsonTest`,你需要在`@Before`方法中调用帮助类的`initFields`方法。

在[附录](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#test-auto-configuration)中可以查看`@JsonTest`开启的自动配置列表。


text:
/* ###
 * IP: Public Domain
 */
package mobiledevices.dmg.btree;

import java.io.IOException;

import mobiledevices.dmg.ghidra.GBinaryReader;

/**
 * Represents a User Data Record.
 *
 * @see User Data Record
 */
public class BTreeUserDataRecord /*implements StructConverter*/ {

	private byte[] unused;

	BTreeUserDataRecord(GBinaryReader reader) throws IOException {
		this.unused = reader.readNextByteArray(128);
	}

	public byte[] getUnused() {
		return unused;
	}

//	@Override
//	public DataType toDataType() throws DuplicateNameException, IOException {
//		return StructConverterUtil.toDataType( this );
//	}
}


text:
import React from 'react'
import styled from 'styled-components'
import Icon, { IconName } from '../Common/Icon'
import UserDate from '../Common/UserDate'
import UserPicture from '../User/UserPicture'
import { Notification } from 'client/types/crowi'

const NotificationImage = styled.div`
  img {
    margin-right: 16px;
  }
`

const NotificationTime = styled.div`
  padding-top: 0.3em;
  font-size: small;
`

interface Props {
  children: React.ReactNode
  notification: Notification
  icon: IconName
}

export default class NotificationContent extends React.Component<Props> {
  static defaultProps = { icon: 'checkbox-blank-circle' }

  getUserImage() {
    const actionUsers = this.props.notification.actionUsers

    if (actionUsers.length < 1) {
      // what is this case?
      return ''
    }

    return <UserPicture user={actionUsers[0]} />
  }

  render() {
    const notification = this.props.notification

    return (
      <>
        <NotificationImage>{this.getUserImage()}</NotificationImage>

{this.props.children}

          <NotificationTime>
            <Icon name={this.props.icon} />
            <UserDate className="ml-1" dateTime={notification.createdAt} format="fromNow" />
          </NotificationTime>

      </>
    )
  }
}


text:
import { extra, autoService } from 'knifecycle';
import { readArgs } from '../libs/args.js';
import { YError } from 'yerror';
import camelCase from 'camelcase';
import { HANDLER_REG_EXP } from '@whook/whook';
import _inquirer from 'inquirer';
import path from 'path';
import { OPEN_API_METHODS, noop } from '@whook/whook';
import { default as fsExtra } from 'fs-extra';
import type { Answers } from 'inquirer';
import type {
  WhookCommandHandler,
  WhookCommandDefinition,
  PromptArgs,
} from '../services/promptArgs.js';
import type { LogService } from 'common-services';
import type { OpenAPIV3 } from 'openapi-types';

const {
  writeFile: _writeFile,
  ensureDir: _ensureDir,
  pathExists: _pathExists,
} = fsExtra;

// Currently, we rely on a static list of services but
// best would be to use TypeScript introspection and
// the autoloader to allow to retrieve a dynamic list
// of constants from the CONFIGS service, the WhookConfigs
// type and the autoloader service.
const commonServicesTypes = {
  time: 'TimeService',
  log: 'LogService',
  random: 'RandomService',
  delay: 'DelayService',
  process: 'ProcessService',
};
const whookSimpleTypes = {
  HOST: 'string',
  PORT: 'number',
  PROJECT_DIR: 'string',
  PROJECT_SRC: 'string',
  NODE_ENV: 'string',
  DEBUG_NODE_ENVS: 'string[]',
  WHOOK_PLUGINS_PATHS: 'string[]',
};
const whookServicesTypes = {
  API_DEFINITIONS: 'DelayService',
  ENV: 'ENVService',
  APM: 'APMService',
  CONFIGS: 'CONFIGSService',
};
const allTypes = {
  ...commonServicesTypes,
  ...whookSimpleTypes,
  ...whookServicesTypes,
};

export const definition: WhookCommandDefinition = {
  description: 'A command helping to create new Whook files easily',
  example: `whook create --type service --name "db"`,
  arguments: {
    type: 'object',
    additionalProperties: false,
    required: ['type', 'name'],
    properties: {
      type: {
        description: 'Type',
        type: 'string',
        enum: ['handler', 'service', 'provider', 'command'],
      },
      name: {
        description: 'Name',
        type: 'string',
      },
    },
  },
};

export default extra(definition, autoService(initCreateCommand));

async function initCreateCommand({
  PROJECT_DIR,
  API,
  inquirer = _inquirer,
  promptArgs,
  writeFile = _writeFile,
  ensureDir = _ensureDir,
  pathExists = _pathExists,
  log = noop,
}: {
  PROJECT_DIR: string;
  API: OpenAPIV3.Document;
  inquirer: typeof _inquirer;
  promptArgs: PromptArgs;
  writeFile: typeof _writeFile;
  ensureDir: typeof _ensureDir;
  pathExists: typeof _pathExists;
  log?: LogService;
}): Promise<WhookCommandHandler> {
  return async () => {
    const {
      namedArguments: { type, name },
    } = readArgs<{ type: string; name: string }>(
      definition.arguments,
      await promptArgs(),
    );
    const finalName = camelCase(name);

    if (name !== finalName) {
      log('warning', `🐪 - Camelized the name "${finalName}".`);
    }

    if (type === 'handler' && !HANDLER_REG_EXP.test(finalName)) {
      log(
        'error',
        `💥 - The handler name is invalid, "${finalName}" does not match "${HANDLER_REG_EXP}".`,
      );
      throw new YError('E_BAD_HANDLER_NAME', finalName, HANDLER_REG_EXP);
    }

    const { services } = (await inquirer.prompt([
      {
        name: 'services',
        type: 'checkbox',
        message: 'Which services do you want to use?',
        choices: [
          ...Object.keys(commonServicesTypes),
          ...Object.keys(whookSimpleTypes),
          ...Object.keys(whookServicesTypes),
        ],
      },
    ])) as { services: string[] };

    const servicesTypes = services
      .sort()
      .map((name) => ({
        name,
        type: allTypes[name],
      }))
      .concat(
        type === 'command' ? [{ name: 'promptArgs', type: 'PromptArgs' }] : [],
      );
    const parametersDeclaration = servicesTypes.length
      ? `{${servicesTypes
          .map(
            ({ name }) => `
  ${name},`,
          )
          .join('')}
}`
      : '';
    const typesDeclaration = servicesTypes.length
      ? `{${servicesTypes
          .map(
            ({ name, type }) => `
  ${name}: ${type};`,
          )
          .join('')}
}`
      : '';
    const commonServices = services.filter(
      (service) => commonServicesTypes[service],
    );
    const whookServices = services.filter(
      (service) => whookServicesTypes[service],
    );
    const imports = `${
      type === 'command'
        ? `
import {
  readArgs,
} from '@whook/cli';
import type {
  PromptArgs,
  WhookCommandArgs,
  WhookCommandDefinition,
  WhookCommandHandler,
} from '@whook/cli';`
        : ''
    }${
      commonServices.length
        ? `
import type { ${commonServices
            .map((name) => commonServicesTypes[name])
            .join(', ')} } from 'common-services';`
        : ''
    }${
      whookServices.length
        ? `
import type { ${whookServices
            .map((name) => whookServicesTypes[name])
            .join(', ')} } from '@whook/whook';`
        : ''
    }
`;
    let fileSource = '';

    if (type === 'handler') {
      let baseQuestions = [
        {
          name: 'method',
          type: 'list',
          message: 'Give the handler method',
          choices: OPEN_API_METHODS,
          default: [(HANDLER_REG_EXP.exec(finalName) as string[])[1]].filter(
            (maybeMethod) => OPEN_API_METHODS.includes(maybeMethod),
          )[0],
        },
        {
          name: 'path',
          type: 'input',
          message: 'Give the handler path',
        },
        {
          name: 'description',
          type: 'input',
          message: 'Give the handler description',
        },
      ] as Answers[];
      if (API.tags && API.tags.length) {
        baseQuestions = [
          ...baseQuestions,
          {
            name: 'tags',
            type: 'checkbox',
            message: 'Assing one or more tags to the handler',
            choices: API.tags.map(({ name }) => name),
          },
        ];
      }
      const { method, path, description, tags } = (await inquirer.prompt(
        baseQuestions,
      )) as {
        method: string;
        path: string;
        description: string;
        tags: string[];
      };
      fileSource = buildHandlerSource(
        name,
        path,
        method,
        description,
        tags,
        parametersDeclaration,
        typesDeclaration,
        imports,
      );
    } else if (type === 'service') {
      fileSource = buildServiceSource(
        name,
        parametersDeclaration,
        typesDeclaration,
        imports,
      );
    } else if (type === 'provider') {
      fileSource = buildProviderSource(
        name,
        parametersDeclaration,
        typesDeclaration,
        imports,
      );
    } else if (type === 'command') {
      const { description } = (await inquirer.prompt([
        {
          name: 'description',
          message: 'Give the command description',
        },
      ])) as { description: string };

      fileSource = buildCommandSource(
        name,
        description,
        parametersDeclaration,
        typesDeclaration,
        imports,
      );
    } else {
      throw new YError('E_UNEXPECTED_TYPE');
    }

    const fileDir = path.join(
      PROJECT_DIR,
      'src',
      ['service', 'provider'].includes(type)
        ? 'services'
        : type === 'handler'
        ? 'handlers'
        : 'commands',
    );
    await ensureDir(fileDir);
    const filePath = path.join(fileDir, `${name}.ts`);
    if (await pathExists(filePath)) {
      log('warning', '⚠ - The file already exists !');

      const { erase } = (await inquirer.prompt([
        {
          name: 'Erase ?',
          type: 'confirm',
        },
      ])) as {
        erase: boolean;
      };

      if (!erase) {
        return;
      }
    }
    await writeFile(filePath, fileSource);
  };
}

function buildHandlerSource(
  name: string,
  path: string,
  method: string,
  description = '',
  tags: string[] = [],
  parametersDeclaration,
  typesDeclaration,
  imports: string,
) {
  const APIHandlerName = name[0].toUpperCase() + name.slice(1);

  return `import { autoHandler } from 'knifecycle';
import type { WhookAPIHandlerDefinition } from '@whook/whook';${imports}

export const definition: WhookAPIHandlerDefinition = {
  path: '${path}',
  method: '${method}',
  operation: {
    operationId: '${name}',
    summary: '${description.replace(/'/g, "\\'")}',
    tags: [${tags.map((tag) => `'${tag}'`).join(', ')}],
    parameters: [
      {
        name: 'param',
        in: 'query',
        required: false,
        schema: { type: 'number' },
      },
    ],${
      ['post', 'put', 'patch'].includes(method)
        ? `
    requestBody: {
      required: true,
      content: {
        'application/json': {
          schema: {
            type: 'object',
          },
        },
      },
    },`
        : ''
    }
    responses: {
      200: {
        description: 'Success',
        content: {
          'application/json': {
            schema: {
              type: 'object',
            },
          },
        },
      },
    },
  },
};

type HandlerDependencies = ${typesDeclaration || '{}'};

export default autoHandler(${name});

async function ${name}(${parametersDeclaration || '_'}: HandlerDependencies, {
    param,${
      ['post', 'put'].includes(method)
        ? `
    body,`
        : ''
    }
  } : API.${APIHandlerName}.Input): Promise<API.${APIHandlerName}.Output> {
  return {
    status: 200,
    headers: {},
    body: { param },
  };
}
`;
}

function buildServiceSource(
  name: string,
  parametersDeclaration: string,
  typesDeclaration: string,
  imports: string,
) {
  const upperCamelizedName = name[0].toLocaleUpperCase() + name.slice(1);

  return `import { autoService } from 'knifecycle';${imports}

export type ${upperCamelizedName}Service = {};
export type ${upperCamelizedName}Dependencies = ${typesDeclaration || '{}'};

export default autoService(init${upperCamelizedName});

async function init${upperCamelizedName}(${
    parametersDeclaration || '_'
  }: ${upperCamelizedName}Dependencies): Promise<${upperCamelizedName}Service> {
  // Instantiate and return your service
  return {};
}
`;
}

function buildProviderSource(
  name: string,
  parametersDeclaration: string,
  typesDeclaration: string,
  imports: string,
) {
  const upperCamelizedName = name[0].toLocaleUpperCase() + name.slice(1);

  return `import { autoProvider, Provider } from 'knifecycle';${imports}

export type ${upperCamelizedName}Service = {};
export type ${upperCamelizedName}Provider = Provider<${upperCamelizedName}Service>;
export type ${upperCamelizedName}Dependencies = ${typesDeclaration || '{}'};

export default autoProvider(init${upperCamelizedName});

async function init${upperCamelizedName}(${
    parametersDeclaration || '_'
  }: ${upperCamelizedName}Dependencies): Promise<${upperCamelizedName}Provider> {
  // Instantiate and return your service
  return {
    service: {},
    dispose: async () => {
      // Do any action before the process shutdown
      // (closing db connections... etc)
    },
    // You can also set a promise for unexpected errors
    //  that shutdown the app when it happens
    // errorPromise: new Promise(),
  };
}
`;
}

function buildCommandSource(
  name: string,
  description: string,
  parametersDeclaration: string,
  typesDeclaration: string,
  imports: string,
) {
  const upperCamelizedName = name[0].toLocaleUpperCase() + name.slice(1);

  return `import { extra, autoService } from 'knifecycle';${imports}

export const definition: WhookCommandDefinition = {
  description: '${description.replace(/'/g, "\\'")}',
  example: \`whook ${name} --param "value"\`,
  arguments: {
    type: 'object',
    additionalProperties: false,
    required: ['param'],
    properties: {
      param: {
        description: 'A parameter',
        type: 'string',
        default: 'A default value',
      },
    },
  },
};

export default extra(definition, autoService(init${upperCamelizedName}Command));

async function init${upperCamelizedName}Command(${
    parametersDeclaration || '_'
  }: ${typesDeclaration || {}}): Promise<WhookCommandHandler> {
  return async () => {
    const { param } = readArgs(
      definition.arguments,
      await promptArgs(),
    ) as { param: string; };

  // Implement your command here
  }
}
`;
}


text:
<?php

namespace Perfumer\Component\Auth;

use Perfumer\Helper\Text;
use Stash\Pool as Cache;

class Session
{
    /**
     * @var Cache
     */
    protected $cache;

    /**
     * @var int
     */
    protected $lifetime = 3600;

    /**
     * @var string
     */
    protected $cache_prefix = '_session';

    /**
     * @param Cache $cache
     * @param array $options
     */
    public function __construct(Cache $cache, array $options = [])
    {
        $this->cache = $cache;

        if (isset($options['lifetime'])) {
            $this->lifetime = (int) $options['lifetime'];
        }

        if (isset($options['cache_prefix'])) {
            $this->cache_prefix = (string) $options['cache_prefix'];
        }
    }

    /**
     * @param string $id
     * @return mixed
     */
    public function get($id)
    {
        $item = $this->cache->getItem($this->cache_prefix . '/' . $id);

        return $item->isHit() ? $item->get() : null;
    }

    /**
     * @param string $id
     * @param string $shared_id
     */
    public function set($id, $shared_id)
    {
        $item = $this->cache->getItem($this->cache_prefix . '/' . $id);
        $item->set($shared_id);
        $item->expiresAfter($this->lifetime);
        $item->save();
    }

    /**
     * @param string $id
     * @return bool
     */
    public function has($id)
    {
        return $this->cache->getItem($this->cache_prefix . '/' . $id)->isHit();
    }

    /**
     * @param string $id
     */
    public function destroy($id)
    {
        $this->cache->getItem($this->cache_prefix . '/' . $id)->clear();
    }

    /**
     * @return string
     */
    public function generateId()
    {
        do {
            $id = Text::generateString(100);

            $item = $this->cache->getItem($this->cache_prefix . '/' . $id);
        } while ($item->isHit());

        return $id;
    }
}