text:
package com.akjava.gwt.three.client.gwt.loader;
import com.akjava.gwt.three.client.js.core.Geometry;
import com.akjava.gwt.three.client.js.materials.Material;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
public class JSONLoaderObject extends JavaScriptObject{
protected JSONLoaderObject(){}

public final native JsArray<Material> getMaterials()/*-{
return this.materials;
}-*/;

public final  native Geometry getGeometry()/*-{
return this.geometry;
}-*/;

}

redpajama_set_name: RedPajamaGithub


text:
package com.beiyelin.shop.modules.shop.service;

import com.beiyelin.shop.common.service.CrudService;
import com.beiyelin.shop.common.utils.StrUtils;
import com.beiyelin.shop.modules.shop.entity.CollectProduct;
import com.beiyelin.shop.modules.shop.entity.ShopProduct;
import com.beiyelin.shop.modules.shop.utils.ShopProductUtils;
import com.beiyelin.shop.modules.sys.entity.User;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.beiyelin.shop.modules.shop.dao.CollectProductDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

/**
 * 收藏商品Service
 * @author Tony Wong
 * @version 2015-07-16
 */
@Service
@Transactional(readOnly = true)
public class CollectProductService extends CrudService<CollectProductDao, CollectProduct> {

    /**
     * 查找用户的所有收藏商品
     * @param userId
     * @return
     */
    public List<CollectProduct> findByUserId(String userId) {
        CollectProduct cp = new CollectProduct();
        cp.setUser(new User(userId));
        List<CollectProduct> list = dao.findList(cp);
        for (CollectProduct collectProduct : list) {
            ShopProduct product = ShopProductUtils.getProduct(collectProduct.getProduct().getId());
            if (product != null && StrUtils.isNotBlank(product.getId()))
                collectProduct.setProduct(product);
            else
                collectProduct.setProduct(null);
        }
        return list;
    }
    /**
     * 查找用户的所有收藏商品
     * @param userId
     * @return
     */
    public List<Map<String, Object>> findByUserId4SimpleObj(String userId) {
        List<Map<String, Object>> oList = Lists.newArrayList();
        CollectProduct cp = new CollectProduct();
        cp.setUser(new User(userId));
        List<CollectProduct> list = dao.findList(cp);
        for (CollectProduct collectProduct : list) {
            Map<String, Object> oCollectProduct = collectProduct.toSimpleObj();
            Map<String, Object> oProduct = Maps.newHashMap();
            ShopProduct product = ShopProductUtils.getProduct(collectProduct.getProduct().getId());
            if (product != null && StrUtils.isNotBlank(product.getId())) {
                oProduct = product.toSimpleObj();
            }
            oCollectProduct.put("product", oProduct);
            oList.add(oCollectProduct);
        }
        return oList;
    }

    /**
     * 用户是否收藏了该商品
     */
    public boolean hasCollected(String userId, String productId) {
        if (StrUtils.isBlank(userId) || StrUtils.isBlank(productId))
            return false;

        CollectProduct collectProduct = new CollectProduct();
        collectProduct.setProduct(new ShopProduct(productId));
        collectProduct.setUser(new User(userId));
        Map<String, Object> result = dao.hasCollected(collectProduct);
        long count = 0;
        if (result != null)
            count = Long.valueOf(result.get("count").toString());

        if (count > 0)
            return true;
        else
            return false;
    }
}


text:
// Type definitions for node-usb 1.5
// Project: https://github.com/tessel/node-usb
// Definitions by: Eric Brody <https://github.com/underscorebrody>
//                 Rob Moran <https://github.com/thegecko>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference types="node" />

import { EventEmitter } from "events";

export class LibUSBException extends Error {
  errno: number;
}

/** Represents a USB device. */
export class Device {
  /** Timeout in milliseconds to use for control transfers. */
  timeout: number;

  /** Integer USB device number */
  busNumber: number;

  /** Integer USB device address */
  deviceAddress: number;

  /** Array containing the USB device port numbers, or `undefined` if not supported on this platform. */
  portNumbers: number[];

  /** Object with properties for the fields of the device descriptor. */
  deviceDescriptor: DeviceDescriptor;

  /** Object with properties for the fields of the configuration descriptor. */
  configDescriptor: ConfigDescriptor;

  /** Contains all config descriptors of the device (same structure as .configDescriptor above) */
  allConfigDescriptors: ConfigDescriptor[];

  /** Contains the parent of the device, such as a hub. If there is no parent this property is set to `null`. */
  parent: Device;

  /** List of Interface objects for the interfaces of the default configuration of the device. */
  interfaces: Interface[];

  __open(): void;
  __claimInterface(addr: number): void;

  /**
   * Open the device.
   * @param defaultConfig
   */
  open(defaultConfig?: boolean): void;

  /**
   * Close the device.
   *
   * The device must be open to use this method.
   */
  close(): void;

  /**
   * Return the interface with the specified interface number.
   *
   * The device must be open to use this method.
   * @param addr
   */
  interface(addr: number): Interface;

  /**
   * Perform a control transfer with `libusb_control_transfer`.
   *
   * Parameter `data_or_length` can be a integer length for an IN transfer, or a Buffer for an out transfer. The type must match the direction specified in the MSB of bmRequestType.
   *
   * The `data` parameter of the callback is always undefined for OUT transfers, or will be passed a Buffer for IN transfers.
   *
   * The device must be open to use this method.
   * @param bmRequestType
   * @param bRequest
   * @param wValue
   * @param wIndex
   * @param data_or_length
   * @param callback
   */
  controlTransfer(bmRequestType: number, bRequest: number, wValue: number, wIndex: number, data_or_length: any, callback: (error?: LibUSBException, buf?: Buffer) => void): Device;

  /**
   * Perform a control transfer to retrieve a string descriptor
   *
   * The device must be open to use this method.
   * @param desc_index
   * @param callback
   */
  getStringDescriptor(desc_index: number, callback: (error?: string, buf?: Buffer) => void): void;

  /**
   * Perform a control transfer to retrieve an object with properties for the fields of the Binary Object Store descriptor.
   *
   * The device must be open to use this method.
   * @param callback
   */
  getBosDescriptor(callback: (error?: string, descriptor?: BosDescriptor) => void): void;

  /**
   * Retrieve a list of Capability objects for the Binary Object Store capabilities of the device.
   *
   * The device must be open to use this method.
   * @param callback
   */
  getCapabilities(callback: (error?: string, capabilities?: Capability[]) => void): void;

  /**
   * Set the device configuration to something other than the default (0). To use this, first call `.open(false)` (which tells it not to auto configure),
   * then before claiming an interface, call this method.
   *
   * The device must be open to use this method.
   * @param desired
   * @param cb
   */
  setConfiguration(desired: number, cb: (err?: string) => void): void;

  /**
   * Performs a reset of the device. Callback is called when complete.
   *
   * The device must be open to use this method.
   * @param callback
   */
  reset(callback: (err?: string) => void): void;
}

/** A structure representing the standard USB device descriptor */
export class DeviceDescriptor {
  /** Size of this descriptor (in bytes) */
  bLength: number;

  /** Descriptor type. */
  bDescriptorType: number;

  /** USB specification release number in binary-coded decimal. */
  bcdUSB: number;

  /** USB-IF class code for the device. */
  bDeviceClass: number;

  /** USB-IF subclass code for the device, qualified by the bDeviceClass value. */
  bDeviceSubClass: number;

  /** USB-IF protocol code for the device, qualified by the bDeviceClass and bDeviceSubClass values. */
  bDeviceProtocol: number;

  /** Maximum packet size for endpoint 0. */
  bMaxPacketSize0: number;

  /** USB-IF vendor ID. */
  idVendor: number;

  /** USB-IF product ID. */
  idProduct: number;

  /** Device release number in binary-coded decimal. */
  bcdDevice: number;

  /** Index of string descriptor describing manufacturer. */
  iManufacturer: number;

  /** Index of string descriptor describing product. */
  iProduct: number;

  /** Index of string descriptor containing device serial number. */
  iSerialNumber: number;

  /** Number of possible configurations. */
  bNumConfigurations: number;
}

/** A structure representing the standard USB configuration descriptor */
export class ConfigDescriptor {
  /** Size of this descriptor (in bytes) */
  bLength: number;

  /** Descriptor type. */
  bDescriptorType: number;

  /** Total length of data returned for this configuration. */
  wTotalLength: number;

  /** Number of interfaces supported by this configuration. */
  bNumInterfaces: number;

  /** Identifier value for this configuration. */
  bConfigurationValue: number;

  /** Index of string descriptor describing this configuration. */
  iConfiguration: number;

  /** Configuration characteristics. */
  bmAttributes: number;

  /** Maximum power consumption of the USB device from this bus in this configuration when the device is fully operation. */
  bMaxPower: number;

  /** Extra descriptors. */
  extra: Buffer;

  /** Array of interfaces supported by this configuration. */
  interfaces: InterfaceDescriptor[][];
}

/** A structure representing the Binary Device Object Store (BOS) descriptor */
export class BosDescriptor {
  /** Size of this descriptor (in bytes) */
  bLength: number;

  /** Descriptor type. */
  bDescriptorType: number;

  /** Length of this descriptor and all of its sub descriptors. */
  wTotalLength: number;

  /** The number of separate device capability descriptors in the BOS. */
  bNumDeviceCaps: number;

  /** Device Capability Descriptors */
  capabilities: CapabilityDescriptor[];
}

/** A generic representation of a BOS Device Capability descriptor */
export class CapabilityDescriptor {
  /** Size of this descriptor (in bytes) */
  bLength: number;

  /** Descriptor type. */
  bDescriptorType: number;

  /** Device Capability type. */
  bDevCapabilityType: number;

  /** Device Capability data (bLength - 3 bytes) */
  dev_capability_data: Buffer;
}

export class Capability {
  /** Object with fields from the capability descriptor -- see libusb documentation or USB spec. */
  descriptor: CapabilityDescriptor;

  /** Integer capability type. */
  type: number;

  /** Buffer capability data. */
  data: Buffer;
}

export class Interface {
  /** Integer interface number. */
  interfaceNumber: number;

  /** Integer alternate setting number. */
  altSetting: number;

  /** Object with fields from the interface descriptor -- see libusb documentation or USB spec. */
  descriptor: InterfaceDescriptor;

  /** List of endpoints on this interface: InEndpoint and OutEndpoint objects. */
  endpoints: Endpoint[];

  constructor(device: Device, id: number);

  /**
   * Claims the interface. This method must be called before using any endpoints of this interface.
   *
   * The device must be open to use this method.
   */
  claim(): void;

  /**
   * Releases the interface and resets the alternate setting. Calls callback when complete.
   *
   * It is an error to release an interface with pending transfers.
   *
   * The device must be open to use this method.
   * @param cb
   */
  release(cb?: (err?: string) => void): void;

  /**
   * Releases the interface and resets the alternate setting. Calls callback when complete.
   *
   * It is an error to release an interface with pending transfers. If the optional closeEndpoints
   * parameter is true, any active endpoint streams are stopped (see `Endpoint.stopStream`),
   * and the interface is released after the stream transfers are cancelled. Transfers submitted
   * individually with `Endpoint.transfer` are not affected by this parameter.
   *
   * The device must be open to use this method.
   * @param closeEndpoints
   * @param cb
   */
  release(closeEndpoints?: boolean, cb?: (err?: string) => void): void;

  /**
   * Returns `false` if a kernel driver is not active; `true` if active.
   *
   * The device must be open to use this method.
   */
  isKernelDriverActive(): boolean;

  /**
   * Detaches the kernel driver from the interface.
   *
   * The device must be open to use this method.
   */
  detachKernelDriver(): number;

  /**
   * Re-attaches the kernel driver for the interface.
   *
   * The device must be open to use this method.
   */
  attachKernelDriver(): number;

  /**
   * Sets the alternate setting. It updates the `interface.endpoints` array to reflect the endpoints found in the alternate setting.
   *
   * The device must be open to use this method.
   * @param altSetting
   * @param cb
   */
  setAltSetting(altSetting: number, cb: (err?: string) => void): void;

  /**
   * Return the InEndpoint or OutEndpoint with the specified address.
   *
   * The device must be open to use this method.
   * @param addr
   */
  endpoint(addr: number): Endpoint;
}

/** A structure representing the standard USB interface descriptor */
export class InterfaceDescriptor {
  /** Size of this descriptor (in bytes) */
  bLength: number;

  /** Descriptor type. */
  bDescriptorType: number;

  /** Number of this interface. */
  bInterfaceNumber: number;

  /** Value used to select this alternate setting for this interface. */
  bAlternateSetting: number;

  /** Number of endpoints used by this interface (excluding the control endpoint). */
  bNumEndpoints: number;

  /** USB-IF class code for this interface. */
  bInterfaceClass: number;

  /** USB-IF subclass code for this interface, qualified by the bInterfaceClass value. */
  bInterfaceSubClass: number;

  /** USB-IF protocol code for this interface, qualified by the bInterfaceClass and bInterfaceSubClass values. */
  bInterfaceProtocol: number;

  /** Index of string descriptor describing this interface. */
  iInterface: number;

  /** Extra descriptors. */
  extra: Buffer;

  /** Array of endpoint descriptors. */
  endpoints: EndpointDescriptor[];
}

/** Common base for InEndpoint and OutEndpoint. */
export interface Endpoint extends EventEmitter {
  /** Endpoint direction: `"in"` or `"out"`. */
  direction: string;

  /** Endpoint type: `usb.LIBUSB_TRANSFER_TYPE_BULK`, `usb.LIBUSB_TRANSFER_TYPE_INTERRUPT`, or `usb.LIBUSB_TRANSFER_TYPE_ISOCHRONOUS`. */
  transferType: number;

  /** Sets the timeout in milliseconds for transfers on this endpoint. The default, `0`, is infinite timeout. */
  timeout: number;

  /** Object with fields from the endpoint descriptor -- see libusb documentation or USB spec. */
  descriptor: EndpointDescriptor;
}

/** Endpoints in the IN direction (device->PC) have this type. */
export class InEndpoint extends EventEmitter implements Endpoint {
  direction: string;
  transferType: number;
  timeout: number;
  descriptor: EndpointDescriptor;

  constructor(device: Device, descriptor: EndpointDescriptor);

  /**
   * Perform a transfer to read data from the endpoint.
   *
   * If length is greater than maxPacketSize, libusb will automatically split the transfer in multiple packets, and you will receive one callback with all data once all packets are complete.
   *
   * `this` in the callback is the InEndpoint object.
   *
   * The device must be open to use this method.
   * @param length
   * @param callback
   */
  transfer(length: number, callback: (error: LibUSBException, data: Buffer) => void): InEndpoint;

  /**
   * Start polling the endpoint.
   *
   * The library will keep `nTransfers` transfers of size `transferSize` pending in the kernel at all times to ensure continuous data flow.
   * This is handled by the libusb event thread, so it continues even if the Node v8 thread is busy. The `data` and `error` events are emitted as transfers complete.
   *
   * The device must be open to use this method.
   * @param nTransfers
   * @param transferSize
   */
  startPoll(nTransfers?: number, transferSize?: number): void;

  /**
   * Stop polling.
   *
   * Further data may still be received. The `end` event is emitted and the callback is called once all transfers have completed or canceled.
   *
   * The device must be open to use this method.
   * @param cb
   */
  stopPoll(cb?: () => void): void;
}

/** Endpoints in the OUT direction (PC->device) have this type. */
export class OutEndpoint extends EventEmitter implements Endpoint {
  direction: string;
  transferType: number;
  timeout: number;
  descriptor: EndpointDescriptor;

  constructor(device: Device, descriptor: EndpointDescriptor);

  /**
   * Perform a transfer to write `data` to the endpoint.
   *
   * If length is greater than maxPacketSize, libusb will automatically split the transfer in multiple packets, and you will receive one callback once all packets are complete.
   *
   * `this` in the callback is the OutEndpoint object.
   *
   * The device must be open to use this method.
   * @param buffer
   * @param cb
   */
  transfer(buffer: Buffer, cb: (err?: LibUSBException) => void): OutEndpoint;
  transferWithZLP(buf: Buffer, cb: (err?: LibUSBException) => void): void;
}

/** A structure representing the standard USB endpoint descriptor */
export class EndpointDescriptor {
  /** Size of this descriptor (in bytes) */
  bLength: number;

  /** Descriptor type. */
  bDescriptorType: number;

  /** The address of the endpoint described by this descriptor. */
  bEndpointAddress: number;

  /** Attributes which apply to the endpoint when it is configured using the bConfigurationValue. */
  bmAttributes: number;

  /** Maximum packet size this endpoint is capable of sending/receiving. */
  wMaxPacketSize: number;

  /** Interval for polling endpoint for data transfers. */
  bInterval: number;

  /** For audio devices only: the rate at which synchronization feedback is provided. */
  bRefresh: number;

  /** For audio devices only: the address if the synch endpoint. */
  bSynchAddress: number;

  /**
   * Extra descriptors.
   *
   * If libusb encounters unknown endpoint descriptors, it will store them here, should you wish to parse them.
   */
  extra: Buffer;
}

/**
 * Convenience method to get the first device with the specified VID and PID, or `undefined` if no such device is present.
 * @param vid
 * @param pid
 */
export function findByIds(vid: number, pid: number): Device;

/**
 * Adds a callback to an event handler.
 * @param event The event to add to
 * @param callback The callback to add
 */
export function on(event: string, callback: (device: Device) => void): void;

/**
 * Removes a callback from an event handler
 * @param event The event to remove from
 * @param callback The callback to remove
 */
export function removeListener(event: string, callback: (device: Device) => void): void;

/**
 * Return a list of `Device` objects for the USB devices attached to the system.
 */
export function getDeviceList(): Device[];

/**
 * Set the libusb debug level (between 0 and 4)
 * @param level libusb debug level (between 0 and 4)
 */
export function setDebugLevel(level: number): void;

/**
 * In the context of a \ref libusb_device_descriptor "device descriptor",
 * this bDeviceClass value indicates that each interface specifies its
 * own class information and all interfaces operate independently.
 */
export const LIBUSB_CLASS_PER_INTERFACE: number;
/** Audio class */
export const LIBUSB_CLASS_AUDIO: number;
/** Communications class */
export const LIBUSB_CLASS_COMM: number;
/** Human Interface Device class */
export const LIBUSB_CLASS_HID: number;
/** Printer class */
export const LIBUSB_CLASS_PRINTER: number;
/** Image class */
export const LIBUSB_CLASS_PTP: number;
/** Mass storage class */
export const LIBUSB_CLASS_MASS_STORAGE: number;
/** Hub class */
export const LIBUSB_CLASS_HUB: number;
/** Data class */
export const LIBUSB_CLASS_DATA: number;
/** Wireless class */
export const LIBUSB_CLASS_WIRELESS: number;
/** Application class */
export const LIBUSB_CLASS_APPLICATION: number;
/** Class is vendor-specific */
export const LIBUSB_CLASS_VENDOR_SPEC: number;

// libusb_standard_request
/** Request status of the specific recipient */
export const LIBUSB_REQUEST_GET_STATUS: number;
/** Clear or disable a specific feature */
export const LIBUSB_REQUEST_CLEAR_FEATURE: number;
/** Set or enable a specific feature */
export const LIBUSB_REQUEST_SET_FEATURE: number;
/** Set device address for all future accesses */
export const LIBUSB_REQUEST_SET_ADDRESS: number;
/** Get the specified descriptor */
export const LIBUSB_REQUEST_GET_DESCRIPTOR: number;
/** Used to update existing descriptors or add new descriptors */
export const LIBUSB_REQUEST_SET_DESCRIPTOR: number;
/** Get the current device configuration value */
export const LIBUSB_REQUEST_GET_CONFIGURATION: number;
/** Set device configuration */
export const LIBUSB_REQUEST_SET_CONFIGURATION: number;
/** Return the selected alternate setting for the specified interface */
export const LIBUSB_REQUEST_GET_INTERFACE: number;
/** Select an alternate interface for the specified interface */
export const LIBUSB_REQUEST_SET_INTERFACE: number;
/** Set then report an endpoint's synchronization frame */
export const LIBUSB_REQUEST_SYNCH_FRAME: number;

// libusb_descriptor_type
/** Device descriptor. See libusb_device_descriptor. */
export const LIBUSB_DT_DEVICE: number;
/** Configuration descriptor. See libusb_config_descriptor. */
export const LIBUSB_DT_CONFIG: number;
/** String descriptor */
export const LIBUSB_DT_STRING: number;
/** Interface descriptor. See libusb_interface_descriptor. */
export const LIBUSB_DT_INTERFACE: number;
/** Endpoint descriptor. See libusb_endpoint_descriptor. */
export const LIBUSB_DT_ENDPOINT: number;
/** HID descriptor */
export const LIBUSB_DT_HID: number;
/** HID report descriptor */
export const LIBUSB_DT_REPORT: number;
/** Physical descriptor */
export const LIBUSB_DT_PHYSICAL: number;
/** Hub descriptor */
export const LIBUSB_DT_HUB: number;

// libusb_endpoint_direction
/** In: device-to-host */
export const LIBUSB_ENDPOINT_IN: number;
/** Out: host-to-device */
export const LIBUSB_ENDPOINT_OUT: number;

// libusb_transfer_type
/** Control endpoint */
export const LIBUSB_TRANSFER_TYPE_CONTROL: number;
/** Isochronous endpoint */
export const LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: number;
/** Bulk endpoint */
export const LIBUSB_TRANSFER_TYPE_BULK: number;
/** Interrupt endpoint */
export const LIBUSB_TRANSFER_TYPE_INTERRUPT: number;

// libusb_iso_sync_type
/** No synchronization */
export const LIBUSB_ISO_SYNC_TYPE_NONE: number;
/** Asynchronous */
export const LIBUSB_ISO_SYNC_TYPE_ASYNC: number;
/** Adaptive */
export const LIBUSB_ISO_SYNC_TYPE_ADAPTIVE: number;
/** Synchronous */
export const LIBUSB_ISO_SYNC_TYPE_SYNC: number;

// libusb_iso_usage_type
/** Data endpoint */
export const LIBUSB_ISO_USAGE_TYPE_DATA: number;
/** Feedback endpoint */
export const LIBUSB_ISO_USAGE_TYPE_FEEDBACK: number;
/** Implicit feedback Data endpoint */
export const LIBUSB_ISO_USAGE_TYPE_IMPLICIT: number;

// libusb_transfer_status
/**
 * Transfer completed without error. Note that this does not indicate
 * that the entire amount of requested data was transferred.
 */
export const LIBUSB_TRANSFER_COMPLETED: number;
/** Transfer failed */
export const LIBUSB_TRANSFER_ERROR: number;
/** Transfer timed out */
export const LIBUSB_TRANSFER_TIMED_OUT: number;
/** Transfer was cancelled */
export const LIBUSB_TRANSFER_CANCELLED: number;
/**
 * For bulk/interrupt endpoints: halt condition detected (endpoint
 * stalled). For control endpoints: control request not supported.
 */
export const LIBUSB_TRANSFER_STALL: number;
/** Device was disconnected */
export const LIBUSB_TRANSFER_NO_DEVICE: number;
/** Device sent more data than requested */
export const LIBUSB_TRANSFER_OVERFLOW: number;

// libusb_transfer_flags
/** Report short frames as errors */
export const LIBUSB_TRANSFER_SHORT_NOT_OK: number;
/**
 * Automatically free() transfer buffer during libusb_free_transfer().
 * Note that buffers allocated with libusb_dev_mem_alloc() should not
 * be attempted freed in this way, since free() is not an appropriate
 * way to release such memory.
 */
export const LIBUSB_TRANSFER_FREE_BUFFER: number;
/**
 * Automatically call libusb_free_transfer() after callback returns.
 * If this flag is set, it is illegal to call libusb_free_transfer()
 * from your transfer callback, as this will result in a double-free
 * when this flag is acted upon.
 */
export const LIBUSB_TRANSFER_FREE_TRANSFER: number;

// libusb_request_type
/** Standard */
export const LIBUSB_REQUEST_TYPE_STANDARD: number;
/** Class */
export const LIBUSB_REQUEST_TYPE_CLASS: number;
/** Vendor */
export const LIBUSB_REQUEST_TYPE_VENDOR: number;
/** Reserved */
export const LIBUSB_REQUEST_TYPE_RESERVED: number;

// libusb_request_recipient
/** Device */
export const LIBUSB_RECIPIENT_DEVICE: number;
/** Interface */
export const LIBUSB_RECIPIENT_INTERFACE: number;
/** Endpoint */
export const LIBUSB_RECIPIENT_ENDPOINT: number;
/** Other */
export const LIBUSB_RECIPIENT_OTHER: number;

export const LIBUSB_CONTROL_SETUP_SIZE: number;

// libusb_error
/** Input/output error */
export const LIBUSB_ERROR_IO: number;
/** Invalid parameter */
export const LIBUSB_ERROR_INVALID_PARAM: number;
/** Access denied (insufficient permissions) */
export const LIBUSB_ERROR_ACCESS: number;
/** No such device (it may have been disconnected) */
export const LIBUSB_ERROR_NO_DEVICE: number;
/** Entity not found */
export const LIBUSB_ERROR_NOT_FOUND: number;
/** Resource busy */
export const LIBUSB_ERROR_BUSY: number;
/** Operation timed out */
export const LIBUSB_ERROR_TIMEOUT: number;
/** Overflow */
export const LIBUSB_ERROR_OVERFLOW: number;
/** Pipe error */
export const LIBUSB_ERROR_PIPE: number;
/** System call interrupted (perhaps due to signal) */
export const LIBUSB_ERROR_INTERRUPTED: number;
/** Insufficient memory */
export const LIBUSB_ERROR_NO_MEM: number;
/** Operation not supported or unimplemented on this platform */
export const LIBUSB_ERROR_NOT_SUPPORTED: number;
/** Other error */
export const LIBUSB_ERROR_OTHER: number;


text:
require "rails_helper"

module RailsVoter
  RSpec.describe VotingResultsController, type: :controller do
  end
end


text:
<form>
    <field>
        <id>healthcheck.name</id>
        Name
        <type>text</type>
        <help>Name to identify this Health Monitor.</help>
    </field>
    <field>
        <id>healthcheck.description</id>
        Description
        <type>text</type>
        <help>Description for this Health Monitor.</help>
    </field>
    <field>
        <id>healthcheck.type</id>
        Check type
        <type>dropdown</type>
        <help><![CDATA[Select type of health check.]]></help>
    </field>
    <field>
        <id>healthcheck.interval</id>
        Check interval
        <type>text</type>
        <help><![CDATA[Select interval (in milliseconds) between two consecutive health checks. This value can be overriden in backend pool and real server configuration.]]></help>
    </field>
    <field>
        <id>healthcheck.force_ssl</id>
        Force SSL
        <type>checkbox</type>
        <help><![CDATA[This option forces encryption of all health checks over SSL, regardless of whether the server uses SSL or not for the normal traffic.]]></help>
    </field>
    <field>
        <id>healthcheck.checkport</id>
        Port to check
        <type>text</type>
        <help><![CDATA[Provide the TCP communication port to use during check, i.e. 80 or 443.]]></help>
        <advanced>true</advanced>
    </field>
    <field>
        HTTP check options
        <type>header</type>

    </field>
    <field>
        <id>healthcheck.http_method</id>
        HTTP method
        <type>dropdown</type>
        <help><![CDATA[Select HTTP method for health check.]]></help>
    </field>
    <field>
        <id>healthcheck.http_uri</id>
        Request URI
        <type>text</type>
        <help><![CDATA[Specify HTTP request URI for health check.]]></help>
    </field>
    <field>
        <id>healthcheck.http_version</id>
        HTTP version
        <type>dropdown</type>
        <help><![CDATA[Select HTTP version for a HTTP health check.]]></help>
    </field>
    <field>
        <id>healthcheck.http_host</id>
        HTTP host
        <type>text</type>
        <help><![CDATA[Specify HTTP host to use for health check. Requires HTTP/1.1.]]></help>
    </field>
    <field>
        Custom HTTP check
        <type>header</type>

    </field>
    <field>
        <id>healthcheck.http_expressionEnabled</id>
        Enabled
        <type>checkbox</type>
    </field>
    <field>
        <id>healthcheck.http_expression</id>
        Expression
        <type>dropdown</type>
        <help><![CDATA[Select health check expression.]]></help>
    </field>
    <field>
        <id>healthcheck.http_negate</id>
        Negate condition
        <type>checkbox</type>
        <help><![CDATA[Use this to invert the meaning of the expression.]]></help>
    </field>
    <field>
        <id>healthcheck.http_value</id>
        Value
        <type>text</type>
        <help><![CDATA[Specify a value to match with the expression.

NOTE: It is important to note that the responses will be limited to a certain size defined by the global "tune.chksize" option, which defaults to 16384 bytes.
]]></help>
    </field>
    <field>
        Custom TCP check
        <type>header</type>

    </field>
    <field>
        <id>healthcheck.tcp_enabled</id>
        Enabled
        <type>checkbox</type>
    </field>
    <field>
        <id>healthcheck.tcp_sendValue</id>
        Send data
        <type>text</type>
        <help><![CDATA[Specify a value to match with the expression.

NOTE: It is important to note that the responses will be limited to a certain size defined by the global "tune.chksize" option, which defaults to 16384 bytes.
]]></help>
    </field>
    <field>
        <id>healthcheck.tcp_matchType</id>
        Match response
        <type>dropdown</type>
        <help><![CDATA[Select how to look for a specific pattern in the response.]]></help>
    </field>
    <field>
        <id>healthcheck.tcp_negate</id>
        Negate condition
        <type>checkbox</type>
        <help><![CDATA[Use this to invert the meaning of the expression.]]></help>
    </field>
    <field>
        <id>healthcheck.tcp_matchValue</id>
        Match pattern
        <type>text</type>
        <help><![CDATA[Specify the pattern to look for in the response buffer. If the match is set to binary, then the pattern must be passed as a serie of hexadecimal digits in an even number.]]></help>
    </field>
    <field>
        Agent check
        <type>header</type>

    </field>
    <field>
        <id>healthcheck.agent_port</id>
        Agent port
        <type>text</type>
        <help><![CDATA[Specify the TCP port used for agent checks.]]></help>
    </field>
    <field>
        MySQL check
        <type>header</type>

    </field>
    <field>
        <id>healthcheck.mysql_user</id>
        MySQL user
        <type>text</type>
        <help><![CDATA[Specify the username to be used for database health checks.]]></help>
    </field>
    <field>
        <id>healthcheck.mysql_post41</id>
        MySQL 4.1+
        <type>checkbox</type>
        <help><![CDATA[Send checks compatible with MySQL server 4.1 and later.]]></help>
    </field>
    <field>
        PostgreSQL check
        <type>header</type>

    </field>
    <field>
        <id>healthcheck.pgsql_user</id>
        PostgreSQL user
        <type>text</type>
        <help><![CDATA[Specify the username to be used for database health checks.]]></help>
    </field>
    <field>
        SMTP check
        <type>header</type>

    </field>
    <field>
        <id>healthcheck.smtp_domain</id>
        SMTP domain
        <type>text</type>
        <help><![CDATA[Specify the domain name to present to the server for SMTP health checks.]]></help>
    </field>
    <field>
        ESMTP check
        <type>header</type>

    </field>
    <field>
        <id>healthcheck.esmtp_domain</id>
        ESMTP domain
        <type>text</type>
        <help><![CDATA[Specify the domain name to present to the server for ESMTP health checks.]]></help>
    </field>
</form>


text:
using System;

namespace Eluant
{
    public class LuaUserdata : LuaReference
    {
        internal LuaUserdata(LuaRuntime runtime, int reference) : base(runtime, reference) { }

        public override bool ToBoolean()
        {
            return true;
        }

        public override double? ToNumber()
        {
            return null;
        }

        public override string ToString()
        {
            return "[LuaUserdata]";
        }

        new public LuaWeakReference<LuaUserdata> CreateWeakReference()
        {
            CheckDisposed();

            return Runtime.CreateWeakReference(this);
        }
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.sena.ejemplojsf2.controller.ebjs;

import co.edu.sena.ejemplojsf2.model.entities.RespuestaGrupo;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Enrique
 */
@Stateless
public class RespuestaGrupoFacade extends AbstractFacade<RespuestaGrupo> {

    @PersistenceContext(unitName = "co.edu.sena_ejemploJSF2_war_1.0.0PU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public RespuestaGrupoFacade() {
        super(RespuestaGrupo.class);
    }

}


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/api/apikeys/v2/resources.proto

namespace Google\Cloud\ApiKeys\V2;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * The representation of a key managed by the API Keys API.
 *
 * Generated from protobuf message google.api.apikeys.v2.Key
 */
class Key extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. The resource name of the key.
     * The `name` has the form:
     * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
     * For example:
     * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
     * NOTE: Key is a global resource; hence the only supported value for
     * location is `global`.
     *
     * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     */
    private $name = '';
    /**
     * Output only. Unique id in UUID4 format.
     *
     * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
     */
    private $uid = '';
    /**
     * Human-readable display name of this key that you can modify.
     * The maximum length is 63 characters.
     *
     * Generated from protobuf field string display_name = 2;
     */
    private $display_name = '';
    /**
     * Output only. An encrypted and signed value held by this key.
     * This field can be accessed only through the `GetKeyString` method.
     *
     * Generated from protobuf field string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
     */
    private $key_string = '';
    /**
     * Output only. A timestamp identifying the time this key was originally
     * created.
     *
     * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
     */
    private $create_time = null;
    /**
     * Output only. A timestamp identifying the time this key was last
     * updated.
     *
     * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
     */
    private $update_time = null;
    /**
     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
     * this must be empty.
     *
     * Generated from protobuf field .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
     */
    private $delete_time = null;
    /**
     * Annotations is an unstructured key-value map stored with a policy that
     * may be set by external tools to store and retrieve arbitrary metadata.
     * They are not queryable and should be preserved when modifying objects.
     *
     * Generated from protobuf field map<string, string> annotations = 8;
     */
    private $annotations;
    /**
     * Key restrictions.
     *
     * Generated from protobuf field .google.api.apikeys.v2.Restrictions restrictions = 9;
     */
    private $restrictions = null;
    /**
     * Output only. A checksum computed by the server based on the current value of the Key
     * resource. This may be sent on update and delete requests to ensure the
     * client has an up-to-date value before proceeding.
     * See https://google.aip.dev/154.
     *
     * Generated from protobuf field string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
     */
    private $etag = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Output only. The resource name of the key.
     *           The `name` has the form:
     *           `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
     *           For example:
     *           `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
     *           NOTE: Key is a global resource; hence the only supported value for
     *           location is `global`.
     *     @type string $uid
     *           Output only. Unique id in UUID4 format.
     *     @type string $display_name
     *           Human-readable display name of this key that you can modify.
     *           The maximum length is 63 characters.
     *     @type string $key_string
     *           Output only. An encrypted and signed value held by this key.
     *           This field can be accessed only through the `GetKeyString` method.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           Output only. A timestamp identifying the time this key was originally
     *           created.
     *     @type \Google\Protobuf\Timestamp $update_time
     *           Output only. A timestamp identifying the time this key was last
     *           updated.
     *     @type \Google\Protobuf\Timestamp $delete_time
     *           Output only. A timestamp when this key was deleted. If the resource is not deleted,
     *           this must be empty.
     *     @type array|\Google\Protobuf\Internal\MapField $annotations
     *           Annotations is an unstructured key-value map stored with a policy that
     *           may be set by external tools to store and retrieve arbitrary metadata.
     *           They are not queryable and should be preserved when modifying objects.
     *     @type \Google\Cloud\ApiKeys\V2\Restrictions $restrictions
     *           Key restrictions.
     *     @type string $etag
     *           Output only. A checksum computed by the server based on the current value of the Key
     *           resource. This may be sent on update and delete requests to ensure the
     *           client has an up-to-date value before proceeding.
     *           See https://google.aip.dev/154.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Api\Apikeys\V2\Resources::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. The resource name of the key.
     * The `name` has the form:
     * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
     * For example:
     * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
     * NOTE: Key is a global resource; hence the only supported value for
     * location is `global`.
     *
     * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Output only. The resource name of the key.
     * The `name` has the form:
     * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
     * For example:
     * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
     * NOTE: Key is a global resource; hence the only supported value for
     * location is `global`.
     *
     * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Output only. Unique id in UUID4 format.
     *
     * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @return string
     */
    public function getUid()
    {
        return $this->uid;
    }

    /**
     * Output only. Unique id in UUID4 format.
     *
     * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @param string $var
     * @return $this
     */
    public function setUid($var)
    {
        GPBUtil::checkString($var, True);
        $this->uid = $var;

        return $this;
    }

    /**
     * Human-readable display name of this key that you can modify.
     * The maximum length is 63 characters.
     *
     * Generated from protobuf field string display_name = 2;
     * @return string
     */
    public function getDisplayName()
    {
        return $this->display_name;
    }

    /**
     * Human-readable display name of this key that you can modify.
     * The maximum length is 63 characters.
     *
     * Generated from protobuf field string display_name = 2;
     * @param string $var
     * @return $this
     */
    public function setDisplayName($var)
    {
        GPBUtil::checkString($var, True);
        $this->display_name = $var;

        return $this;
    }

    /**
     * Output only. An encrypted and signed value held by this key.
     * This field can be accessed only through the `GetKeyString` method.
     *
     * Generated from protobuf field string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @return string
     */
    public function getKeyString()
    {
        return $this->key_string;
    }

    /**
     * Output only. An encrypted and signed value held by this key.
     * This field can be accessed only through the `GetKeyString` method.
     *
     * Generated from protobuf field string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @param string $var
     * @return $this
     */
    public function setKeyString($var)
    {
        GPBUtil::checkString($var, True);
        $this->key_string = $var;

        return $this;
    }

    /**
     * Output only. A timestamp identifying the time this key was originally
     * created.
     *
     * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    public function hasCreateTime()
    {
        return isset($this->create_time);
    }

    public function clearCreateTime()
    {
        unset($this->create_time);
    }

    /**
     * Output only. A timestamp identifying the time this key was originally
     * created.
     *
     * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->create_time = $var;

        return $this;
    }

    /**
     * Output only. A timestamp identifying the time this key was last
     * updated.
     *
     * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getUpdateTime()
    {
        return $this->update_time;
    }

    public function hasUpdateTime()
    {
        return isset($this->update_time);
    }

    public function clearUpdateTime()
    {
        unset($this->update_time);
    }

    /**
     * Output only. A timestamp identifying the time this key was last
     * updated.
     *
     * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setUpdateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->update_time = $var;

        return $this;
    }

    /**
     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
     * this must be empty.
     *
     * Generated from protobuf field .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getDeleteTime()
    {
        return $this->delete_time;
    }

    public function hasDeleteTime()
    {
        return isset($this->delete_time);
    }

    public function clearDeleteTime()
    {
        unset($this->delete_time);
    }

    /**
     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
     * this must be empty.
     *
     * Generated from protobuf field .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setDeleteTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->delete_time = $var;

        return $this;
    }

    /**
     * Annotations is an unstructured key-value map stored with a policy that
     * may be set by external tools to store and retrieve arbitrary metadata.
     * They are not queryable and should be preserved when modifying objects.
     *
     * Generated from protobuf field map<string, string> annotations = 8;
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getAnnotations()
    {
        return $this->annotations;
    }

    /**
     * Annotations is an unstructured key-value map stored with a policy that
     * may be set by external tools to store and retrieve arbitrary metadata.
     * They are not queryable and should be preserved when modifying objects.
     *
     * Generated from protobuf field map<string, string> annotations = 8;
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setAnnotations($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->annotations = $arr;

        return $this;
    }

    /**
     * Key restrictions.
     *
     * Generated from protobuf field .google.api.apikeys.v2.Restrictions restrictions = 9;
     * @return \Google\Cloud\ApiKeys\V2\Restrictions|null
     */
    public function getRestrictions()
    {
        return $this->restrictions;
    }

    public function hasRestrictions()
    {
        return isset($this->restrictions);
    }

    public function clearRestrictions()
    {
        unset($this->restrictions);
    }

    /**
     * Key restrictions.
     *
     * Generated from protobuf field .google.api.apikeys.v2.Restrictions restrictions = 9;
     * @param \Google\Cloud\ApiKeys\V2\Restrictions $var
     * @return $this
     */
    public function setRestrictions($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\ApiKeys\V2\Restrictions::class);
        $this->restrictions = $var;

        return $this;
    }

    /**
     * Output only. A checksum computed by the server based on the current value of the Key
     * resource. This may be sent on update and delete requests to ensure the
     * client has an up-to-date value before proceeding.
     * See https://google.aip.dev/154.
     *
     * Generated from protobuf field string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @return string
     */
    public function getEtag()
    {
        return $this->etag;
    }

    /**
     * Output only. A checksum computed by the server based on the current value of the Key
     * resource. This may be sent on update and delete requests to ensure the
     * client has an up-to-date value before proceeding.
     * See https://google.aip.dev/154.
     *
     * Generated from protobuf field string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * @param string $var
     * @return $this
     */
    public function setEtag($var)
    {
        GPBUtil::checkString($var, True);
        $this->etag = $var;

        return $this;
    }

}


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">

  <title>Qt 4.3: mdichild.cpp Example File (mainwindows/mdi/mdichild.cpp)</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />

  	Home · All Classes · Main Classes · Grouped Classes · Modules · Functions

mdichild.cpp Example File
mainwindows/mdi/mdichild.cpp

 #include <QtGui>

 #include "mdichild.h"

 MdiChild::MdiChild()
 {
     setAttribute(Qt::WA_DeleteOnClose);
     isUntitled = true;
 }

 void MdiChild::newFile()
 {
     static int sequenceNumber = 1;

     isUntitled = true;
     curFile = tr("document%1.txt").arg(sequenceNumber++);
     setWindowTitle(curFile + "[*]");

     connect(document(), SIGNAL(contentsChanged()),
             this, SLOT(documentWasModified()));
 }

 bool MdiChild::loadFile(const QString &fileName)
 {
     QFile file(fileName);
     if (!file.open(QFile::ReadOnly | QFile::Text)) {
         QMessageBox::warning(this, tr("MDI"),
                              tr("Cannot read file %1:\n%2.")
                              .arg(fileName)
                              .arg(file.errorString()));
         return false;
     }

     QTextStream in(&file);
     QApplication::setOverrideCursor(Qt::WaitCursor);
     setPlainText(in.readAll());
     QApplication::restoreOverrideCursor();

     setCurrentFile(fileName);

     connect(document(), SIGNAL(contentsChanged()),
             this, SLOT(documentWasModified()));

     return true;
 }

 bool MdiChild::save()
 {
     if (isUntitled) {
         return saveAs();
     } else {
         return saveFile(curFile);
     }
 }

 bool MdiChild::saveAs()
 {
     QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),
                                                     curFile);
     if (fileName.isEmpty())
         return false;

     return saveFile(fileName);
 }

 bool MdiChild::saveFile(const QString &fileName)
 {
     QFile file(fileName);
     if (!file.open(QFile::WriteOnly | QFile::Text)) {
         QMessageBox::warning(this, tr("MDI"),
                              tr("Cannot write file %1:\n%2.")
                              .arg(fileName)
                              .arg(file.errorString()));
         return false;
     }

     QTextStream out(&file);
     QApplication::setOverrideCursor(Qt::WaitCursor);
     out << toPlainText();
     QApplication::restoreOverrideCursor();

     setCurrentFile(fileName);
     return true;
 }

 QString MdiChild::userFriendlyCurrentFile()
 {
     return strippedName(curFile);
 }

 void MdiChild::closeEvent(QCloseEvent *event)
 {
     if (maybeSave()) {
         event->accept();
     } else {
         event->ignore();
     }
 }

 void MdiChild::documentWasModified()
 {
     setWindowModified(document()->isModified());
 }

 bool MdiChild::maybeSave()
 {
     if (document()->isModified()) {
         QMessageBox::StandardButton ret;
         ret = QMessageBox::warning(this, tr("MDI"),
                      tr("'%1' has been modified.\n"
                         "Do you want to save your changes?")
                      .arg(userFriendlyCurrentFile()),
                      QMessageBox::Save | QMessageBox::Discard
                      | QMessageBox::Cancel);
         if (ret == QMessageBox::Save)
             return save();
         else if (ret == QMessageBox::Cancel)
             return false;
     }
     return true;
 }

 void MdiChild::setCurrentFile(const QString &fileName)
 {
     curFile = QFileInfo(fileName).canonicalFilePath();
     isUntitled = false;
     document()->setModified(false);
     setWindowModified(false);
     setWindowTitle(userFriendlyCurrentFile() + "[*]");
 }

 QString MdiChild::strippedName(const QString &fullFileName)
 {
     return QFileInfo(fullFileName).fileName();
 }

<address>

Copyright © 2008 Trolltech
Trademarks

Qt 4.3.5

</address>


text:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.majimena.petical</groupId>
        <artifactId>petical-backend</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>

    <groupId>org.majimena.petical</groupId>
    <artifactId>petical-domain</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>petical.io: Domain Module</name>
    <packaging>jar</packaging>

    <dependencies>
        <!-- JEE -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>

        <!-- Spring Framework -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>

        <!-- Spring Boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-loader-tools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                    <groupId>org.springframework.boot</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>

        <!-- Bugfix for Spring Boot v4 -->
        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>2.2.4</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>javax.el</artifactId>
            <version>2.2.4</version>
        </dependency>

        <!-- Spring Security for OAuth2 -->
        <!--<dependency>-->
            <!--<groupId>org.springframework.security</groupId>-->
            <!--<artifactId>spring-security-data</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
        </dependency>

        <!-- Spring Extension -->
        <!--<dependency>-->
            <!--<groupId>cz.jirutka.spring</groupId>-->
            <!--<artifactId>spring-rest-exception-handler</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>com.ryantenney.metrics</groupId>
            <artifactId>metrics-spring</artifactId>
        </dependency>

        <!-- AWS -->
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-ses</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
        </dependency>

        <!-- Reporting -->
        <dependency>
            <groupId>fr.ippon.spark.metrics</groupId>
            <artifactId>metrics-spark-reporter</artifactId>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-annotation</artifactId>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-ehcache</artifactId>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-graphite</artifactId>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-healthchecks</artifactId>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-json</artifactId>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-jvm</artifactId>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-servlet</artifactId>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-servlets</artifactId>
        </dependency>

        <!-- JPA and DataSource -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-envers</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
        </dependency>

        <!-- Jackson -->
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-hibernate4</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-hppc</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-json-org</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>

        <!-- Commons -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
        </dependency>

        <!-- Lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Google -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.bgee.log4jdbc-log4j2</groupId>
            <artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
        </dependency>

        <!-- Liquibase -->
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.mattbertolini</groupId>
            <artifactId>liquibase-slf4j</artifactId>
        </dependency>

        <!-- Unit Test Framework -->
        <dependency>
            <groupId>org.jmockit</groupId>
            <artifactId>jmockit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.dbunit</groupId>
            <artifactId>dbunit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.springtestdbunit</groupId>
            <artifactId>spring-test-dbunit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core-java8</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!-- Build not executable jar configuration -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <classifier>exec</classifier>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>exec</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>exec</classifier>
                        </configuration>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <!-- Need this to ensure application.yml is excluded -->
                            <forceCreation>true</forceCreation>
                            <excludes>
                                <exclude>application.yml</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>


text:
@interface YRSignalBus : NSObject
+ (instancetype)shared;
- (void)addYRSignalObserver:(NSObject *)observer name:(NSString*)signalName;
- (void)removeYRSignalObserver:(NSObject *)observer name:(NSString*)signalName;
- (void)removeYRSignalObserver:(NSObject *)observer;
- (void)sendYRSignal:(YRSignal *)signal;
@end

@implementation NSObject(YRSignal)

- (void)addObserverForYRSignalName:(NSString *)name{
    [[YRSignalBus shared] addYRSignalObserver:self name:name];
}

- (void)removeObserverForYRSignalName:(NSString *)name{
    [[YRSignalBus shared] removeYRSignalObserver:self name:name];
}

- (void)removeObserverForYRSignal{
    [[YRSignalBus shared] removeYRSignalObserver:self];
}

- (void)sendYRSignalName:(NSString *)name{
    [self sendYRSignalName:name userInfo:nil option:YRSignalOptionALL callBack:nil];
}

- (void)sendYRSignalName:(NSString *)name userInfo:(id)userInfo{
    [self sendYRSignalName:name userInfo:userInfo option:YRSignalOptionALL callBack:nil];
}

- (void)sendYRSignalName:(NSString *)name userInfo:(id)userInfo callBack:(YRSignalCallBack)callback{
    [self sendYRSignalName:name userInfo:userInfo option:YRSignalOptionALL callBack:callback];
}

- (void)sendYRSignalName:(NSString *)name userInfo:(id)userInfo option:(YRSignalOption)option callBack:(YRSignalCallBack)callback{
    YRSignal *signal = [[YRSignal alloc]init];
    signal.name = name;
    signal.userInfo = userInfo;
    signal.sender = self;
    signal.option = option;
    signal.callBack = callback;
    [self sendYRSignal:signal];
}
- (void)sendYRSignal:(YRSignal *)signal{
    [[YRSignalBus shared] sendYRSignal:signal];
}

- (id)handleYRSignal:(YRSignal *)signal{
    return nil;
}
@end

@implementation YRSignal
@end

@implementation YRSignalBus{
    NSMutableDictionary *_signalBusDic;
}

+ (instancetype)shared{
    static id instance=nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[[self class] alloc]init];
    });
    return instance;
}

- (instancetype)init{
    if (self=[super init]) {
        _signalBusDic = [NSMutableDictionary dictionaryWithCapacity:50];
    }
    return self;
}

- (void)addYRSignalObserver:(NSObject *)observer name:(NSString*)signalName{
    if (!signalName) {
        return;
    }
    NSPointerArray *array = [_signalBusDic objectForKey:signalName];
    if (!array) {
        array = [NSPointerArray pointerArrayWithOptions:NSPointerFunctionsWeakMemory];
        [_signalBusDic setObject:array forKey:signalName];
    }
    [array addPointer:(__bridge void * _Nullable)(observer)];
}

- (void)removeYRSignalObserver:(NSObject *)observer name:(NSString*)signalName{
    if (!signalName) {
        return;
    }
    NSPointerArray *array = [_signalBusDic objectForKey:signalName];
    for (NSInteger i = array.count - 1; i > 0; i--) {
        if ([array pointerAtIndex:i]==(__bridge void * _Nullable)(observer)) {
            [array removePointerAtIndex:i];
        }
    }
    if (array.count==0) {
        [_signalBusDic removeObjectForKey:signalName];
    }
}

- (void)removeYRSignalObserver:(NSObject *)observer{
    if (!observer) {
        return;
    }
    [_signalBusDic enumerateKeysAndObjectsUsingBlock:^(id key, NSPointerArray * observers, BOOL *stop) {
        for (NSInteger i = observers.count - 1; i > 0; i--) {
            if ([observers pointerAtIndex:i]==(__bridge void * _Nullable)(observer)) {
                [observers removePointerAtIndex:i];
            }
        }
    }];
}

- (void)sendYRSignal:(YRSignal *)signal{
    NSPointerArray *observers = [_signalBusDic objectForKey:signal.name];
    [observers addPointer:NULL];//不加这句,无法清除nil值
    [observers compact];//删除数组中的nil值
    if (observers.count == 0) {
        return;
    }
    switch (signal.option) {
        case YRSignalOptionALL:{
            for (NSInteger i = observers.count - 1; i >= 0; i--) {
                id obj = [observers pointerAtIndex:i];
                id data = [obj handleYRSignal:signal];
                if (signal.callBack) {
                    signal.callBack(obj,data);
                }
            }
            break;}
        case YRSignalOptionOnlyToLast:{
            id obj = [observers pointerAtIndex:observers.count-1];
            id data = [obj handleYRSignal:signal];
            if (signal.callBack) {
                signal.callBack(obj,data);
            }
            break;}
        case YRSignalOptionOnlyToFirst:{
            id obj = [observers pointerAtIndex:0];
            id data = [obj handleYRSignal:signal];
            if (signal.callBack) {
                signal.callBack(obj,data);
            }
            break;}
        default:
            break;
    }
}

@end


text:
package com.fork4.return2me.twilio;

public class TwilioBase {
	protected static final String NUMBER = "[Your Twilio Number]";

    /* Twilio REST API version */
	protected static final String ACCOUNTSID = "[Your Twilio SID]";
	protected static final String AUTHTOKEN = "[Your auth token]";

}


text:
package com.unipad.brain.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnKeyListener;
import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.unipad.brain.R;
import com.unipad.brain.personal.PersonalRecordFragment;

/**
 *
 * @author 张超
 *
 */
public class ShowDialog {
	private Dialog dialog;

	public ShowDialog(PersonalRecordFragment personalRecordFragment) {

	}

	public Dialog getDialog(){
		return dialog;
	};

	private Context context;
	/**
	 * TYPE_CENTER :dialog居中显示
	 * */
	public final static int TYPE_CENTER = 1;
	/**
	 * TYPE_CENTER :dialog居底部显示
	 * */
	public final static int TYPE_BOTTOM = 0;

	public final static int TYPE_RIGHT = 2;

	// 返回Dialog
	public Dialog getAlertDialog() {
		return dialog;
	}

	/* 构造方法 */
	public ShowDialog(Context argActivity) {
		this.context = argActivity;
	}

	/**
	 *  显示自定义屏幕宽高的  dialog
	 * @param v  需要显示的视图
	 * @param type  位置
	 * @param m 屏幕管理器
	 * @param h dialog 显示的高度 0.0f:全屏
	 * @param w dialog 显示的宽度 0.0f: 全屏
	 */
	public void showDialog(View v, int type,WindowManager m,float h,float w) {
		h = h <= 0.0f ? 1.0f : h;

		w = w <= 0.0f ? 1.0f : w;
		dialog = new Dialog(context, R.style.DialogTheme);
		Window window = dialog.getWindow();
		if (TYPE_BOTTOM == type) {
			window.setGravity(Gravity.BOTTOM); // dialog底部显示
			//window.setWindowAnimations(R.style.animation); // 动漫显示dialog
			window.setWindowAnimations(R.style.mystyle);
		} else if(TYPE_RIGHT == type){
			window.setGravity(Gravity.RIGHT); // dialog底部显示
			//window.setWindowAnimations(R.style.animation); // 动漫显示dialog
			window.setWindowAnimations(R.style.mystyle);
		} else {
			window.setGravity(Gravity.CENTER); // dialog居中显示
			//window.setWindowAnimations(R.style.animation); // 动漫显示dialog
			window.setWindowAnimations(R.style.mystyle);
		}
		dialog.setContentView(v);
		dialog.show();

		Display d = m.getDefaultDisplay();  //为获取屏幕宽、高
		WindowManager.LayoutParams p = dialog.getWindow().getAttributes();  //获取对话框当前的参数值
		p.height = (int) (d.getHeight() * h );   //高度设置为屏幕的
		p.width = (int) (d.getWidth() * w );    //宽度设置为屏幕的
		dialog.getWindow().setAttributes(p);     //设置生效
	}

	/**
	 *  显示自定义屏幕宽高的  dialog
	 * @param v  需要显示的视图
	 * @param type  位置
	 * @param m 屏幕管理器
	 * @param w dialog 显示的宽度 0.0f: 全屏
	 */
	public void showDialog(View v, int type,WindowManager m,float w) {

		w = w <= 0.0f ? 1.0f : w;
		dialog = new Dialog(context, R.style.DialogTheme);
		Window window = dialog.getWindow();
		if (TYPE_BOTTOM == type) {
			window.setGravity(Gravity.BOTTOM); // dialog底部显示
			window.setWindowAnimations(R.style.animation); // 动漫显示dialog
		} else if(TYPE_RIGHT == type){
			window.setGravity(Gravity.RIGHT); // dialog底部显示
			//window.setWindowAnimations(R.style.animation); // 动漫显示dialog
			window.setWindowAnimations(R.style.mystyle);
		} else {
			window.setGravity(Gravity.CENTER); // dialog居中显示
			//window.setWindowAnimations(R.style.animation); // 动漫显示dialog
			window.setWindowAnimations(R.style.mystyle);
		}
		dialog.setContentView(v);
		dialog.show();

		Display d = m.getDefaultDisplay();  //为获取屏幕宽、高
		WindowManager.LayoutParams p = dialog.getWindow().getAttributes();  //获取对话框当前的参数值
		p.height = WindowManager.LayoutParams.WRAP_CONTENT;   //高度设置为屏幕的

		p.width = (int) (d.getWidth() * w );    //宽度设置为屏幕的
		dialog.getWindow().setAttributes(p);     //设置生效
	}

	/**
	 *  显示自定义屏幕宽高的  dialog
	 * @param v  需要显示的视图
	 * @param type  位置
	 * @param m 屏幕管理器
	 */
	public void showDialog(View v, int type,WindowManager m) {
		dialog = new Dialog(context,R.style.DialogTheme);
		Window window = dialog.getWindow();
		if (TYPE_BOTTOM == type) {
			window.setGravity(Gravity.BOTTOM); // dialog底部显示
			window.setWindowAnimations(R.style.animation); // 动漫显示dialog
		} else {
			window.setGravity(Gravity.CENTER); // dialog居中显示
			window.setWindowAnimations(R.style.animation); // 动漫显示dialog
		}
		dialog.setContentView(v);
		dialog.show();

		Display d = m.getDefaultDisplay();  //为获取屏幕宽、高
		WindowManager.LayoutParams p = dialog.getWindow().getAttributes();  //获取对话框当前的参数值
		p.height = WindowManager.LayoutParams.WRAP_CONTENT;
		p.width=d.getWidth()-24;
		dialog.getWindow().setAttributes(p);     //设置生效
	}

	/**
	 * 显示自定义视图
	 * @param v  需要显示的视图
	 * @param type  位置
	 */
	public void showDialog(View v, int type) {
		dialog = new Dialog(context, R.style.DialogTheme);
		Window window = dialog.getWindow();
		if (TYPE_BOTTOM == type) {
			window.setGravity(Gravity.BOTTOM); // dialog底部显示
			window.setWindowAnimations(R.style.animation); // 动漫显示dialog
		} else {
			window.setGravity(Gravity.CENTER); // dialog居中显示
			window.setWindowAnimations(R.style.animation); // 动漫显示dialog
		}
		dialog.setContentView(v);
		dialog.show();
	}

	// 关闭dialog
	public void dismiss() {
		if(dialog!=null && dialog.isShowing())dialog.dismiss();
	}
	public boolean isShowing(){
		return null!=dialog&&dialog.isShowing();
	}
	public void setCancelable(boolean cancelable,boolean canceledOnTouchOutside){
		if(null!=dialog){
			dialog.setCancelable(cancelable);
			dialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
		}
	}
	/**
	 *  弹出带 确定键的 dialog
	 * @param str  需要显示的文本
	 * @param context
	 */
	public static void showErrorDialog(String str,Context context){
		Dialog dialog =  new ConfirmDialog(context, str, "确定",
				"",new BaseConfirmDialog.OnActionClickListener() {
					@Override
					public void onActionRight(BaseConfirmDialog dialog) {

					}
					@Override
					public void onActionLeft(BaseConfirmDialog dialog) {
						dialog.dismiss();
					}
				});
//		dialog.setOnKeyListener(keylistener); // 点击返回键不让dialog 消失
		dialog.setCanceledOnTouchOutside(false);  // 触摸屏幕外让 dialog 消失
		dialog.show();
	 }

	/**
	 *   描述 :   点击返回键不让dialog 消失.
	 *         让返回键失效
	 */
	static OnKeyListener keylistener = new OnKeyListener() {
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
				return true;
			} else {
				return false;
			}
		}
	};

	/**
	 *  绑定一个View 控件的点击事件
	 */
	public void bindOnClickListener(View view,int[] ids){
		if(ids == null)
			return;
		for(int i = 0 ; i < ids.length;i++) {
			view.findViewById(ids[i]).setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					if(null != onShowDialogClick)
						onShowDialogClick.dialogClick(v.getId());
				}
			});
		}
	}

	/**
	 *
	 *
	 *   此接口  返回自定义dialog中所有的点击事件
	 */
	public interface OnShowDialogClick{
		 void dialogClick(int id);
	}

	private OnShowDialogClick onShowDialogClick;

	public void setOnShowDialogClick( OnShowDialogClick onShowDialogClick){
		this.onShowDialogClick = onShowDialogClick;
	}

}


text:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using Windows.Media.Capture;
using Windows.Media.Capture.Frames;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace SDKTemplate
{
    public sealed partial class Scenario1_DisplayDepthColorIR : Page
    {
        private MediaCapture _mediaCapture;

        private MediaFrameReader[] _sourceReaders = new MediaFrameReader[3];
        private IReadOnlyDictionary<MediaFrameSourceKind, FrameRenderer> _frameRenderers;

        private int _groupSelectionIndex;
        private readonly SimpleLogger _logger;

        public Scenario1_DisplayDepthColorIR()
        {
            InitializeComponent();
            _logger = new SimpleLogger(outputTextBlock);

            // This sample reads three kinds of frames: Color, Depth, and Infrared.
            _frameRenderers = new Dictionary<MediaFrameSourceKind, FrameRenderer>()
            {
                { MediaFrameSourceKind.Color, new FrameRenderer(colorPreviewImage) },
                { MediaFrameSourceKind.Depth, new FrameRenderer(depthPreviewImage)},
                { MediaFrameSourceKind.Infrared, new FrameRenderer(infraredPreviewImage)},
            };
        }

        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            await PickNextMediaSourceAsync();
        }

        protected override async void OnNavigatedFrom(NavigationEventArgs e)
        {
            await CleanupMediaCaptureAsync();
        }

        private async void NextButton_Click(object eventSender, RoutedEventArgs eventArgs)
        {
            await PickNextMediaSourceAsync();
        }

        /// <summary>
        /// Disables the "Next Group" button while we switch to the next camera
        /// source and start reading frames.
        /// </summary>
        private async Task PickNextMediaSourceAsync()
        {
            try
            {
                this.NextButton.IsEnabled = false;
                await PickNextMediaSourceWorkerAsync();
            }
            finally
            {
                this.NextButton.IsEnabled = true;
            }
        }

        /// <summary>
        /// Switches to the next camera source and starts reading frames.
        /// </summary>
        private async Task PickNextMediaSourceWorkerAsync()
        {
            await CleanupMediaCaptureAsync();

            // Identify the color, depth, and infrared sources of each group,
            // and keep only the groups that have at least one recognized source.
            var allGroups = await MediaFrameSourceGroup.FindAllAsync();
            var eligibleGroups = allGroups.Select(g => new
            {
                Group = g,

                // For each source kind, find the source which offers that kind of media frame,
                // or null if there is no such source.
                SourceInfos = new MediaFrameSourceInfo[]
                {
                    g.SourceInfos.FirstOrDefault(info => info.SourceKind == MediaFrameSourceKind.Color),
                    g.SourceInfos.FirstOrDefault(info => info.SourceKind == MediaFrameSourceKind.Depth),
                    g.SourceInfos.FirstOrDefault(info => info.SourceKind == MediaFrameSourceKind.Infrared),
                }
            }).Where(g => g.SourceInfos.Any(info => info != null)).ToList();

            if (eligibleGroups.Count == 0)
            {
                _logger.Log("No source group with color, depth or infrared found.");
                return;
            }

            // Pick next group in the array after each time the Next button is clicked.
            _groupSelectionIndex = (_groupSelectionIndex + 1) % eligibleGroups.Count;
            var selected = eligibleGroups[_groupSelectionIndex];

            _logger.Log($"Found {eligibleGroups.Count} groups and selecting index [{_groupSelectionIndex}]: {selected.Group.DisplayName}");

            try
            {
                // Initialize MediaCapture with selected group.
                // This can raise an exception if the source no longer exists,
                // or if the source could not be initialized.
                await InitializeMediaCaptureAsync(selected.Group);
            }
            catch (Exception exception)
            {
                _logger.Log($"MediaCapture initialization error: {exception.Message}");
                await CleanupMediaCaptureAsync();
                return;
            }

            // Set up frame readers, register event handlers and start streaming.
            for (int i = 0; i < selected.SourceInfos.Length; i++)
            {
                MediaFrameSourceInfo info = selected.SourceInfos[i];
                if (info != null)
                {
                    // Access the initialized frame source by looking up the the ID of the source found above.
                    // Verify that the Id is present, because it may have left the group while were were
                    // busy deciding which group to use.
                    MediaFrameSource frameSource = null;
                    if (_mediaCapture.FrameSources.TryGetValue(info.Id, out frameSource))
                    {
                        MediaFrameReader frameReader = await _mediaCapture.CreateFrameReaderAsync(frameSource);
                        frameReader.FrameArrived += FrameReader_FrameArrived;

                        MediaFrameReaderStartStatus status = await frameReader.StartAsync();
                        if (status != MediaFrameReaderStartStatus.Success)
                        {
                            _logger.Log($"Unable to start {info.SourceKind} reader. Error: {status}");
                        }
                    }
                    else
                    {
                        _logger.Log($"Unable to start {info.SourceKind} reader. Frame source not found");
                    }
                }
                else
                {
                    string frameKind = (i == 0 ? "Color" : i == 1 ? "Depth" : "Infrared");
                    _logger.Log($"No {frameKind} source in group '{selected.Group.DisplayName}'.");
                }
            }
        }

        /// <summary>
        /// Initializes the MediaCapture object with the given source group.
        /// </summary>
        /// <param name="sourceGroup">SourceGroup with which to initialize.</param>
        private async Task InitializeMediaCaptureAsync(MediaFrameSourceGroup sourceGroup)
        {
            if (_mediaCapture != null)
            {
                return;
            }

            // Initialize mediacapture with the source group.
            _mediaCapture = new MediaCapture();
            var settings = new MediaCaptureInitializationSettings
            {
                SourceGroup = sourceGroup,

                // This media capture can share streaming with other apps.
                SharingMode = MediaCaptureSharingMode.SharedReadOnly,

                // Only stream video and don't initialize audio capture devices.
                StreamingCaptureMode = StreamingCaptureMode.Video,

                // Set to CPU to ensure frames always contain CPU SoftwareBitmap images
                // instead of preferring GPU D3DSurface images.
                MemoryPreference = MediaCaptureMemoryPreference.Cpu
            };

            await _mediaCapture.InitializeAsync(settings);
            _logger.Log("MediaCapture is successfully initialized in shared mode.");
        }

        /// <summary>
        /// Unregisters FrameArrived event handlers, stops and disposes frame readers
        /// and disposes the MediaCapture object.
        /// </summary>
        private async Task CleanupMediaCaptureAsync()
        {
            if (_mediaCapture != null)
            {
                using (var mediaCapture = _mediaCapture)
                {
                    _mediaCapture = null;

                    foreach (var reader in _sourceReaders)
                    {
                        if (reader != null)
                        {
                            reader.FrameArrived -= FrameReader_FrameArrived;
                            await reader.StopAsync();
                            reader.Dispose();
                        }
                    }
                }
            }
        }

        /// <summary>
        /// Handles a frame arrived event and renders the frame to the screen.
        /// </summary>
        private void FrameReader_FrameArrived(MediaFrameReader sender, MediaFrameArrivedEventArgs args)
        {
            // TryAcquireLatestFrame will return the latest frame that has not yet been acquired.
            // This can return null if there is no such frame, or if the reader is not in the
            // "Started" state. The latter can occur if a FrameArrived event was in flight
            // when the reader was stopped.
            using (var frame = sender.TryAcquireLatestFrame())
            {
                if (frame != null)
                {
                    var renderer = _frameRenderers[frame.SourceKind];
                    renderer.ProcessFrame(frame);
                }
            }
        }
    };
}


text:
<TITLE> Demonstration data sets </TITLE>

[Return to Master Index]

-------- Demonstration data sets --------
All of these .dat files have an associated .txt file that describes the data

agriculture.dat : data on 24,473 zip codes land usage, animal inventories
agriculture.txt : Documentation

anselin.dat     : Anselin's Columbus OH 49 observation data set
wmat.dat        : 1st order standardized contiguity matrix in sparse format
anselin.txt     : Anselin.data Documentation
wmat.txt        : 1st order contiguity matrix Documentation

boston.dat      : Harrison and Rubinfeld Boston census tract data
boston.txt      : Documentation

crime.dat       : Ehrlich crime data
crime.txt       : Documentation

countyg.dat      : US county-level growth data set from C. H. Wheeler, J. Applied Econometrics
countyg.txt      : Documentation

elect.dat        : 1980 Presidential election 3,107 US counties, Pace and Barry, 1997
elect.txt        : Documentation

election.dat     : 1996 Presidential election 3,110 US counties, Clinton vs. Dole
election.txt     : Documentation

growthley.dat    : Fernandez, Ley and Steel, 72 countries and their growth rates
growthley.txt    : Documentation

grunfeld.dat     : Grunfeld investment data
grunfeld.txt     : Documentation

htoledo.dat      : Housing values 98 Census tracts Toledo, Ohio
htoledo.txt      : Documentation

house.dat        : data on 25,357 single family homes sold in Lucas County, Ohio, 1993-1998
house.txt        : Documentation

love.dat         : survey of MBA students feelings about being loved
love.txt         : Documentation

nelsonp.dat      : Nelson-Plosser time-series data
nelsonp.txt      : Documentation

ohioschool.dat   : data set on 1,965 Ohio Elementary School buildings for 2001-02 year
ohioschool.txt   : Documentation

school.dat       : 610 Ohio School districts proficiency tests
school.txt       : Documentation

spector.dat       : Spector and Mazzeo, 1980 probit data
spector.txt       : Documentation


text:
@class SummaryToolbar;

// Summary view types.
enum SummaryType {
  SUMMARY_CONTACT_TRAPDOORS,
  SUMMARY_CONVERSATIONS,
  SUMMARY_CONVERSATION_PICKER,
  SUMMARY_EVENTS,
  SUMMARY_EVENT_TRAPDOORS,
  SUMMARY_PHOTO_PICKER,
  SUMMARY_PHOTO_TRAPDOORS,
};

extern const float kStatsHeight;

struct SummaryLayoutRow : public LayoutRow {
  SummaryRow summary_row;
};

struct DisabledPhoto {
  int64_t photo_id;
  bool selected;

  DisabledPhoto()
      : photo_id(0), selected(true) {}
  DisabledPhoto(int64_t p, bool s)
      : photo_id(p), selected(s) {}
};

enum EditMode {
  EDIT_MODE_INACTIVE,
  EDIT_MODE_EDIT,
  EDIT_MODE_SHARE,
};

extern const WallTime kScrollLoadImagesDelay;

typedef std::pair<int, int> RowRange;
typedef void (^ActivatedCallback)(bool);
typedef CallbackSet1<bool> ActivatedCallbackSet;
typedef CallbackSet2<int64_t, PhotoView*> ViewpointSelectedCallbackSet;

@interface SummaryView : UIView<NavbarEnv,
                                UIGestureRecognizerDelegate,
                                UIScrollViewDelegate,
                                SinglePhotoViewEnv,
                                ViewfinderToolEnv> {
 @protected
  UIAppState* state_;
  SummaryType type_;
  int day_table_epoch_;
  int64_t expanded_row_id_;
  ViewfinderTool* viewfinder_;
  __weak SummaryToolbar* toolbar_;
  DayTable::SnapshotHandle snapshot_;
  PhotoSelectionSet selection_;
  TwoFingerSwipeScrollView* scroll_view_;
  SinglePhotoView* single_photo_view_;
  ControllerState controller_state_;

 @private
  bool initialized_;
  bool network_paused_;
  bool animating_rows_;
  int expanded_row_index_;
  float expanded_row_height_;
  float toolbar_bottom_;
  NSMutableAttributedString* stats_attr_str_;
  vector<DisabledPhoto> disabled_photos_;
  std::unordered_map<int, SummaryLayoutRow> row_cache_;
  RowRange visible_rows_;
  RowRange cache_rows_;
  bool edit_mode_active_;
  CallbackSet selection_callback_;
  CallbackSet scroll_to_top_callback_;
  ActivatedCallbackSet modal_callback_;
  ActivatedCallbackSet toolbar_callback_;
  ViewpointSelectedCallbackSet viewpoint_callback_;
  UIView* stats_view_;
  TextLayer* stats_text_;
  UIView* login_entry_;
  UITapGestureRecognizer* single_tap_recognizer_;
  UISwipeGestureRecognizer* swipe_left_recognizer_;
  UISwipeGestureRecognizer* swipe_right_recognizer_;
  PhotoQueue photo_queue_;
  WallTime load_images_delay_;
  WallTime load_thumbnails_wait_time_;
  float cache_bounds_percentage_;
  WallTimer viewfinder_timer_;
  std::unordered_map<int, float> offset_map_;
}

@property (nonatomic) SummaryType type;
@property (nonatomic, weak) SummaryToolbar* toolbar;
@property (nonatomic, readonly) ViewfinderTool* viewfinder;
@property (nonatomic, readonly) EditMode editMode;
@property (nonatomic, readonly) bool editModeActive;
@property (nonatomic, readonly) bool isModal;
@property (nonatomic, readonly) bool isScrolling;
@property (nonatomic, readonly) bool zeroState;
@property (nonatomic, readonly) float rowWidth;
@property (nonatomic, readonly) CGRect visibleBounds;
@property (nonatomic) ControllerState controllerState;
@property (nonatomic, readonly) bool isRowExpanded;
@property (nonatomic, readonly) int numSelected;
@property (nonatomic) const PhotoSelectionSet& selection;
@property (nonatomic) const vector<DisabledPhoto>& disabledPhotos;
@property (nonatomic, readonly) CallbackSet* selectionCallback;
@property (nonatomic, readonly) CallbackSet* scrollToTopCallback;
@property (nonatomic, readonly) ActivatedCallbackSet* modalCallback;
@property (nonatomic, readonly) ActivatedCallbackSet* toolbarCallback;
@property (nonatomic, readonly) ViewpointSelectedCallbackSet* viewpointCallback;
@property (nonatomic) WallTime loadImagesDelay;
@property (nonatomic, readonly) float contentHeight;
@property (nonatomic, readonly) int expandedRowIndex;
@property (nonatomic, readonly) float expandedRowHeight;
@property (nonatomic) float toolbarBottom;

- (id)initWithState:(UIAppState*)state
           withType:(SummaryType)type;

- (void)clear;
- (bool)rebuild:(bool)force;
- (bool)rebuild;
- (void)animateTransitionPrepare:(LayoutTransitionState*)transition;
- (void)viewDidAppear;
- (void)viewDidDisappear;
- (void)pauseNetwork;
- (void)resumeNetwork;
- (void)scrollToRow:(int)row_index;
- (void)scrollToTop;
- (void)animateExpandRow:(int)row_index
              completion:(void (^)(void))completion;
- (void)clearExpandedRow;
- (void)setSelectionBadgesForAllRows;

// Methods and properties below this point are to be implemented in subclasses.

@property (nonatomic, readonly) string name;
@property (nonatomic, readonly) float defaultScrollCacheBoundsPercentage;
@property (nonatomic, readonly) float contentInsetBottom;
@property (nonatomic, readonly) float contentInsetTop;
@property (nonatomic, readonly) int numRows;
@property (nonatomic, readonly) float totalHeight;
@property (nonatomic, readonly) bool singlePhotoSelectionEnabled;
@property (nonatomic, readonly) bool singleViewpointSelectionEnabled;
@property (nonatomic, readonly) bool displayPositionIndicator;
@property (nonatomic, readonly) bool searching;
@property (nonatomic, readonly) NSString* searchTitle;

- (bool)rowSelectionEnabled:(int)row_index;
- (bool)photoSelectionEnabled:(int)row_index;
- (void)setModal:(bool)modal;
- (void)activateEditMode:(EditMode)edit_mode;
- (void)cancelEditMode;
- (void)exitModal;
- (void)hideToolbar;
- (void)showToolbar;
- (void)initLayoutRow:(SummaryLayoutRow*)row
          forRowIndex:(int)row_index;
- (void)updateLayoutRow:(SummaryLayoutRow*)row
            forRowIndex:(int)row_index;
// Called on rebuild to set the current position.
- (int)getCurrentRowIndex;
- (int64_t)getIdForRowIndex:(int)row_index;
// This pair of methods are used for row expansion, to map back and forth between a row index and a stable id.
// Subclasses that don't support expansion don't need to implement them.
- (int64_t)getIdForSummaryRow:(const SummaryRow&)row;
- (int)getRowIndexForId:(int64_t)row_id;
- (bool)getSummaryRow:(int)row_index
              rowSink:(SummaryRow*)row
         withSnapshot:(const DayTable::SnapshotHandle&)snapshot;
- (bool)displayStats;
- (NSMutableAttributedString*)getStatsAttrStrWithAttributes:(const Dict&)attrs
                                       withNumberAttributes:(const Dict&)num_attrs;
- (CGPoint)rowTextOffset:(int)row_index;
- (CompositeTextLayer*)getTextLayer:(const SummaryRow&)summary_row;
- (void)initPlaceholder;
- (void)clearPlaceholder;
- (void)showTutorial;
- (void)hideTutorial;
- (void)scrollToCurrentPhotoInRowView:(RowView*)row_view;

// Called when the user selects a photo (event summary only).
- (void)selectPhoto:(PhotoView*)photo_view inRow:(int)row_index;

// Updates the size of the scroll view insets.
- (void)updateScrollView;

// Updates the DayTable snapshot; returns true if it has changed.
// May be overridden by subclasses to update derived data when the snapshot changes.
- (bool)resetSnapshot:(bool)force;

@end  // SummaryView

#endif  // VIEWFINDER_SUMMARY_VIEW_H

// local variables:
// mode: objc
// end:


text:
var util = require('util/');

util.inherits = require('inherits/inherits_browser');

module.exports = util;