text:
package com.ociweb.iot.maker;

import com.ociweb.iot.camera.Camera;
import com.ociweb.iot.camera.ProxyCam;
import com.ociweb.iot.camera.RaspiCam;
import com.ociweb.pronghorn.pipe.PipeWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ociweb.pronghorn.image.schema.ImageSchema;
import com.ociweb.pronghorn.pipe.Pipe;
import com.ociweb.pronghorn.stage.PronghornStage;
import com.ociweb.pronghorn.stage.scheduling.GraphManager;

import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Time-based image listener backing for Linux backed by V4L2.
 *
 * This stage passes image frames line-by-line to its consumers.
 *
 * @author Brandon Sanders [brandon@alicorn.io]
 */
public class LinuxImageCaptureStage extends PronghornStage {

    private static final Logger logger = LoggerFactory.getLogger(LinuxImageCaptureStage.class);

    // Frame buffer state constants.
    private static final int FRAME_EMPTY = -1;
    private static final int FRAME_BUFFERED = -2;

    // Output pipe for image data.
    private final Pipe<ImageSchema> output;

    // Camera system.
    private final int width;
    private final int height;
    private final int rowSize;
    private Camera camera;
    private int cameraFd;

    // Image buffer information; we only process one image at a time.
    private ByteBuffer frameBytes = null;
    private long frameBytesTimestamp = -1;
    private int frameBytesHead = FRAME_EMPTY;

    // Default frame size data.
    public static final int DEFAULT_FRAME_WIDTH = 640;
    public static final int DEFAULT_FRAME_HEIGHT = 480;
    public static final int DEFAULT_ROW_SIZE = DEFAULT_FRAME_WIDTH * 3;

    // Proxy data directory.
    public static final String PROXY_CAMERA_DIRECTORY = "./src/test/images";

    // Output encoding.
    public static final byte[] OUTPUT_ENCODING = "RGB24".getBytes(StandardCharsets.US_ASCII);

    /**
     * Creates a new image listener stage.
     *
     * @param graphManager Graph manager this stage is a part of.
     * @param output Output pipe which images are published to.
     * @param triggerRateMilliseconds Interval in milliseconds that this stage will run.
     * @param width Width of images captures from the camera.
     * @param height Height of images captured from the camera.
     */
    public LinuxImageCaptureStage(GraphManager graphManager, Pipe<ImageSchema> output, int triggerRateMilliseconds, int width, int height) {
        this(graphManager, output, triggerRateMilliseconds, width, height, null);
    }

    /**
     * Creates a new image listener stage in test mode that uses a proxy camera.
     *
     * @param graphManager Graph manager this stage is a part of.
     * @param output Output pipe which images are published to.
     * @param triggerRateMicroseconds Interval in microseconds that this stage will run.
     * @param width Width of images captures from the camera.
     * @param height Height of images captured from the camera.
     * @param imageSource Directory or file to read images from using a proxy camera.
     */
    public LinuxImageCaptureStage(GraphManager graphManager, Pipe<ImageSchema> output, int triggerRateMicroseconds, int width, int height, Path imageSource) {
        super(graphManager, NONE, output);

        // Attach to our output pipe.
        this.output = output;

        // Add this listener to the graph.
        GraphManager.addNota(graphManager, GraphManager.SCHEDULE_RATE, triggerRateMicroseconds * 1_000L, this);

        // Configure height data.
        this.width = width;
        this.height = height;
        this.rowSize = width * 3;

        // Configure test camera data if provided.
        if (imageSource != null) {
            this.camera = new ProxyCam();
            this.cameraFd = this.camera.open(imageSource.toString(), width, height);
        }

        if (output.maxVarLen<this.rowSize) {
        	throw new UnsupportedOperationException("Input pipe must accept blocks as large as "+rowSize+" but it only takes "+output.maxVarLen);
        }

    }

    @Override
    public void startup() {

        // Automatically detect a camera if one is not already set.
        if (camera == null) {

            // Get a file for the default camera device.
            File cameraFile = Paths.get(RaspiCam.DEFAULT_CAMERA_DEVICE).toFile();

            // Open /dev/video0 on Raspberry Pi.
            if (!cameraFile.exists()) {

                // Load V4L2 module.
                try {
                    Runtime.getRuntime().exec("modprobe bcm2835-v4l2").waitFor();
                } catch (IOException | InterruptedException e) {
                    logger.warn("Could not load V4L2 driver via modprobe. Proxy camera will be used.");
                }
            }

            // Open camera interface if the camera is available.
            if (cameraFile.exists()) {
                camera = new RaspiCam();
                cameraFd = camera.open(RaspiCam.DEFAULT_CAMERA_DEVICE, width, height);
                logger.info("Opened camera device {} with FD {}.", RaspiCam.DEFAULT_CAMERA_DEVICE, cameraFd);

                // Otherwise, use a proxy camera.
            } else {
                camera = new ProxyCam();
                cameraFd = camera.open(PROXY_CAMERA_DIRECTORY, width, height);
                logger.info("Opened proxy camera in directory {} with FD {}.", PROXY_CAMERA_DIRECTORY, cameraFd);
            }
        }

        assert cameraFd != -1;

        // Configure byte array for camera frames.
        frameBytes = camera.getFrameBuffer(cameraFd);
    }

    @Override
    public void shutdown() {
		if (Pipe.hasRoomForWrite(output, Pipe.EOF_SIZE)) {
			Pipe.publishEOF(output);
		}

		// Close camera.
        camera.close(cameraFd);
    }

    @Override
    public void run() {

        // Capture a frame if we have no bytes left to transmit.
        if (frameBytesHead == FRAME_EMPTY) {

            // Get the timestamp of the image.
            frameBytesTimestamp = camera.readFrame(cameraFd);

            // If the timestamp was not -1 (valid), we now have a frame buffered.
            if (frameBytesTimestamp != -1) {
                frameBytesHead = FRAME_BUFFERED;
            }
        }

        // Publish a frame start if we have bytes to transmit and room to transmit.
        if (frameBytesHead == FRAME_BUFFERED &&
            PipeWriter.tryWriteFragment(output, ImageSchema.MSG_FRAMESTART_1)) {
            PipeWriter.writeInt(output, ImageSchema.MSG_FRAMESTART_1_FIELD_WIDTH_101, width);
            PipeWriter.writeInt(output, ImageSchema.MSG_FRAMESTART_1_FIELD_HEIGHT_201, height);
            PipeWriter.writeLong(output, ImageSchema.MSG_FRAMESTART_1_FIELD_TIMESTAMP_301, frameBytesTimestamp);
            PipeWriter.writeInt(output, ImageSchema.MSG_FRAMESTART_1_FIELD_FRAMEBYTES_401, frameBytes.capacity());
            PipeWriter.writeInt(output, ImageSchema.MSG_FRAMESTART_1_FIELD_BITSPERPIXEL_501, 24);
            PipeWriter.writeBytes(output, ImageSchema.MSG_FRAMESTART_1_FIELD_ENCODING_601, OUTPUT_ENCODING);
            PipeWriter.publishWrites(output);
            frameBytesHead = 0;
        }

        // Write rows while there are bytes to write and room for those bytes.
        while (frameBytesHead >= 0 &&
               PipeWriter.tryWriteFragment(output, ImageSchema.MSG_FRAMECHUNK_2)) {

            // Write bytes.
            frameBytes.position(frameBytesHead);
            PipeWriter.writeBytes(output, ImageSchema.MSG_FRAMECHUNK_2_FIELD_ROWBYTES_102, frameBytes, rowSize);

            PipeWriter.publishWrites(output);

            // Progress head.
            frameBytesHead += rowSize;

            // If the head exceeds the size of the frame bytes, we're done writing.
            if (frameBytesHead >= frameBytes.capacity()) {
                frameBytesHead = FRAME_EMPTY;
            }
        }
    }
}


text:
package fixtures.url;

import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceResponse;
import com.squareup.okhttp.ResponseBody;
import fixtures.url.models.ErrorException;
import fixtures.url.models.UriColor;
import java.io.IOException;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import retrofit.Call;
import retrofit.http.GET;
import retrofit.http.Path;

/**
 * An instance of this class provides access to all the operations defined
 * in Paths.
 */
public interface Paths {
    /**
     * The interface defining all the services for Paths to be
     * used by Retrofit to perform actually REST calls.
     */
    interface PathsService {
        @GET("/paths/bool/true/{boolPath}")
        Call<ResponseBody> getBooleanTrue(@Path("boolPath") boolean boolPath);

        @GET("/paths/bool/false/{boolPath}")
        Call<ResponseBody> getBooleanFalse(@Path("boolPath") boolean boolPath);

        @GET("/paths/int/1000000/{intPath}")
        Call<ResponseBody> getIntOneMillion(@Path("intPath") int intPath);

        @GET("/paths/int/-1000000/{intPath}")
        Call<ResponseBody> getIntNegativeOneMillion(@Path("intPath") int intPath);

        @GET("/paths/long/10000000000/{longPath}")
        Call<ResponseBody> getTenBillion(@Path("longPath") long longPath);

        @GET("/paths/long/-10000000000/{longPath}")
        Call<ResponseBody> getNegativeTenBillion(@Path("longPath") long longPath);

        @GET("/paths/float/1.034E+20/{floatPath}")
        Call<ResponseBody> floatScientificPositive(@Path("floatPath") double floatPath);

        @GET("/paths/float/-1.034E-20/{floatPath}")
        Call<ResponseBody> floatScientificNegative(@Path("floatPath") double floatPath);

        @GET("/paths/double/9999999.999/{doublePath}")
        Call<ResponseBody> doubleDecimalPositive(@Path("doublePath") double doublePath);

        @GET("/paths/double/-9999999.999/{doublePath}")
        Call<ResponseBody> doubleDecimalNegative(@Path("doublePath") double doublePath);

        @GET("/paths/string/unicode/{stringPath}")
        Call<ResponseBody> stringUnicode(@Path("stringPath") String stringPath);

        @GET("/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}")
        Call<ResponseBody> stringUrlEncoded(@Path("stringPath") String stringPath);

        @GET("/paths/string/empty/{stringPath}")
        Call<ResponseBody> stringEmpty(@Path("stringPath") String stringPath);

        @GET("/paths/string/null/{stringPath}")
        Call<ResponseBody> stringNull(@Path("stringPath") String stringPath);

        @GET("/paths/enum/green%20color/{enumPath}")
        Call<ResponseBody> enumValid(@Path("enumPath") String enumPath);

        @GET("/paths/string/null/{enumPath}")
        Call<ResponseBody> enumNull(@Path("enumPath") String enumPath);

        @GET("/paths/byte/multibyte/{bytePath}")
        Call<ResponseBody> byteMultiByte(@Path("bytePath") String bytePath);

        @GET("/paths/byte/empty/{bytePath}")
        Call<ResponseBody> byteEmpty(@Path("bytePath") String bytePath);

        @GET("/paths/byte/null/{bytePath}")
        Call<ResponseBody> byteNull(@Path("bytePath") String bytePath);

        @GET("/paths/date/2012-01-01/{datePath}")
        Call<ResponseBody> dateValid(@Path("datePath") String datePath);

        @GET("/paths/date/null/{datePath}")
        Call<ResponseBody> dateNull(@Path("datePath") String datePath);

        @GET("/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}")
        Call<ResponseBody> dateTimeValid(@Path("dateTimePath") String dateTimePath);

        @GET("/paths/datetime/null/{dateTimePath}")
        Call<ResponseBody> dateTimeNull(@Path("dateTimePath") String dateTimePath);

    }
    /**
     * Get true Boolean value on path.
     *
     * @param boolPath true boolean value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> getBooleanTrue(boolean boolPath) throws ErrorException, IOException;

    /**
     * Get true Boolean value on path.
     *
     * @param boolPath true boolean value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> getBooleanTrueAsync(boolean boolPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get false Boolean value on path.
     *
     * @param boolPath false boolean value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> getBooleanFalse(boolean boolPath) throws ErrorException, IOException;

    /**
     * Get false Boolean value on path.
     *
     * @param boolPath false boolean value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> getBooleanFalseAsync(boolean boolPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '1000000' integer value.
     *
     * @param intPath '1000000' integer value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> getIntOneMillion(int intPath) throws ErrorException, IOException;

    /**
     * Get '1000000' integer value.
     *
     * @param intPath '1000000' integer value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> getIntOneMillionAsync(int intPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '-1000000' integer value.
     *
     * @param intPath '-1000000' integer value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> getIntNegativeOneMillion(int intPath) throws ErrorException, IOException;

    /**
     * Get '-1000000' integer value.
     *
     * @param intPath '-1000000' integer value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> getIntNegativeOneMillionAsync(int intPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '10000000000' 64 bit integer value.
     *
     * @param longPath '10000000000' 64 bit integer value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> getTenBillion(long longPath) throws ErrorException, IOException;

    /**
     * Get '10000000000' 64 bit integer value.
     *
     * @param longPath '10000000000' 64 bit integer value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> getTenBillionAsync(long longPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '-10000000000' 64 bit integer value.
     *
     * @param longPath '-10000000000' 64 bit integer value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> getNegativeTenBillion(long longPath) throws ErrorException, IOException;

    /**
     * Get '-10000000000' 64 bit integer value.
     *
     * @param longPath '-10000000000' 64 bit integer value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> getNegativeTenBillionAsync(long longPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '1.034E+20' numeric value.
     *
     * @param floatPath '1.034E+20'numeric value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> floatScientificPositive(double floatPath) throws ErrorException, IOException;

    /**
     * Get '1.034E+20' numeric value.
     *
     * @param floatPath '1.034E+20'numeric value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> floatScientificPositiveAsync(double floatPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '-1.034E-20' numeric value.
     *
     * @param floatPath '-1.034E-20'numeric value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> floatScientificNegative(double floatPath) throws ErrorException, IOException;

    /**
     * Get '-1.034E-20' numeric value.
     *
     * @param floatPath '-1.034E-20'numeric value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> floatScientificNegativeAsync(double floatPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '9999999.999' numeric value.
     *
     * @param doublePath '9999999.999'numeric value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> doubleDecimalPositive(double doublePath) throws ErrorException, IOException;

    /**
     * Get '9999999.999' numeric value.
     *
     * @param doublePath '9999999.999'numeric value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> doubleDecimalPositiveAsync(double doublePath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '-9999999.999' numeric value.
     *
     * @param doublePath '-9999999.999'numeric value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> doubleDecimalNegative(double doublePath) throws ErrorException, IOException;

    /**
     * Get '-9999999.999' numeric value.
     *
     * @param doublePath '-9999999.999'numeric value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> doubleDecimalNegativeAsync(double doublePath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value.
     *
     * @param stringPath '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for this parameter include: '啊齄丂狛狜隣郎隣兀﨩'
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> stringUnicode(String stringPath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value.
     *
     * @param stringPath '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Possible values for this parameter include: '啊齄丂狛狜隣郎隣兀﨩'
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> stringUnicodeAsync(String stringPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get 'begin!*'();:@ &=+$,/?#[]end.
     *
     * @param stringPath 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end'
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> stringUrlEncoded(String stringPath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get 'begin!*'();:@ &=+$,/?#[]end.
     *
     * @param stringPath 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. Possible values for this parameter include: 'begin!*'();:@ &=+$,/?#[]end'
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> stringUrlEncodedAsync(String stringPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get ''.
     *
     * @param stringPath '' string value. Possible values for this parameter include: ''
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> stringEmpty(String stringPath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get ''.
     *
     * @param stringPath '' string value. Possible values for this parameter include: ''
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> stringEmptyAsync(String stringPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get null (should throw).
     *
     * @param stringPath null string value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> stringNull(String stringPath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get null (should throw).
     *
     * @param stringPath null string value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> stringNullAsync(String stringPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get using uri with 'green color' in path parameter.
     *
     * @param enumPath send the value green. Possible values for this parameter include: 'red color', 'green color', 'blue color'
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> enumValid(UriColor enumPath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get using uri with 'green color' in path parameter.
     *
     * @param enumPath send the value green. Possible values for this parameter include: 'red color', 'green color', 'blue color'
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> enumValidAsync(UriColor enumPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get null (should throw on the client before the request is sent on wire).
     *
     * @param enumPath send null should throw. Possible values for this parameter include: 'red color', 'green color', 'blue color'
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> enumNull(UriColor enumPath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get null (should throw on the client before the request is sent on wire).
     *
     * @param enumPath send null should throw. Possible values for this parameter include: 'red color', 'green color', 'blue color'
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> enumNullAsync(UriColor enumPath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array.
     *
     * @param bytePath '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> byteMultiByte(byte[] bytePath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array.
     *
     * @param bytePath '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> byteMultiByteAsync(byte[] bytePath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '' as byte array.
     *
     * @param bytePath '' as byte array
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> byteEmpty(byte[] bytePath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get '' as byte array.
     *
     * @param bytePath '' as byte array
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> byteEmptyAsync(byte[] bytePath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get null as byte array (should throw).
     *
     * @param bytePath null as byte array (should throw)
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> byteNull(byte[] bytePath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get null as byte array (should throw).
     *
     * @param bytePath null as byte array (should throw)
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> byteNullAsync(byte[] bytePath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '2012-01-01' as date.
     *
     * @param datePath '2012-01-01' as date
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> dateValid(LocalDate datePath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get '2012-01-01' as date.
     *
     * @param datePath '2012-01-01' as date
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> dateValidAsync(LocalDate datePath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get null as date - this should throw or be unusable on the client side, depending on date representation.
     *
     * @param datePath null as date (should throw)
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> dateNull(LocalDate datePath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get null as date - this should throw or be unusable on the client side, depending on date representation.
     *
     * @param datePath null as date (should throw)
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> dateNullAsync(LocalDate datePath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get '2012-01-01T01:01:01Z' as date-time.
     *
     * @param dateTimePath '2012-01-01T01:01:01Z' as date-time
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> dateTimeValid(DateTime dateTimePath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get '2012-01-01T01:01:01Z' as date-time.
     *
     * @param dateTimePath '2012-01-01T01:01:01Z' as date-time
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> dateTimeValidAsync(DateTime dateTimePath, final ServiceCallback<Void> serviceCallback);

    /**
     * Get null as date-time, should be disallowed or throw depending on representation of date-time.
     *
     * @param dateTimePath null as date-time
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> dateTimeNull(DateTime dateTimePath) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Get null as date-time, should be disallowed or throw depending on representation of date-time.
     *
     * @param dateTimePath null as date-time
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @return the {@link Call} object
     */
    Call<ResponseBody> dateTimeNullAsync(DateTime dateTimePath, final ServiceCallback<Void> serviceCallback);

}

redpajama_set_name: RedPajamaGithub


text:
import {Injectable} from 'angular2/core';
import {Storage, LocalStorage, Events} from 'ionic-angular';

@Injectable()
export class UserData {
  _sessionsFavorites = [];
  _sportmenFavorites = [];

  HAS_LOGGED_IN = 'hasLoggedIn';
  storage = new Storage(LocalStorage);

  constructor(public events: Events) {console.log("user data config");}

  public hasFavorite(topicName,Name) {
    if (topicName == 'sportmen') {
      return (this._sportmenFavorites.indexOf(Name) > -1);
    }
    else {
      return (this._sessionsFavorites.indexOf(Name) > -1);
    }
  }

  public addFavorite(topicName, Name) {
    if (topicName == 'sportmen') {
      this._sportmenFavorites.push(Name);
    } else{
      this._sessionsFavorites.push(Name);
    }
  }

  public removeFavorite(topicName, Name) {
    if (topicName === "sportmen") {
      let index = this._sportmenFavorites.indexOf(Name)
      if (index > -1) {
        this._sportmenFavorites.splice(index, 1);
      }
    } else {
      let index = this._sessionsFavorites.indexOf(Name)
      if (index > -1) {
        this._sessionsFavorites.splice(index, 1);
      }
    }
  }

  public login(user?: ISportman, password?) {
    this.storage.set(this.HAS_LOGGED_IN, true);
    this.storage.set("username", user.name);
    this.events.publish("user:login");
  }

  public signup(user?: ISportman, password?) {
    this.storage.set(this.HAS_LOGGED_IN, true);
    this.storage.set("username", user.name);
    this.events.publish("user:signup");
  }

  public logout() {
    this.storage.remove(this.HAS_LOGGED_IN);
    this.events.publish("user:logout");
  }

  // return a promise
  public hasLoggedIn() {
    return this.storage.get(this.HAS_LOGGED_IN).then((value) => {
      return value;
    });
  }

  public getUserName() {
      return this.storage.get("username").then((value) => {
    return value ? value : "Brandy Carney";
    });
  }
}


text:
package net.sourceforge.plantuml.bpm;

import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;

public class CommandGoto extends SingleLineCommand2<BpmDiagram> {

	public CommandGoto() {
		super(getRegexConcat());
	}

	static IRegex getRegexConcat() {
		return RegexConcat.build(CommandGoto.class.getName(), RegexLeaf.start(), //
				new RegexLeaf("goto"), //
				RegexLeaf.spaceOneOrMore(), //
				new RegexLeaf("ID", "([%pLN_.@]+)"), //
				RegexLeaf.end());
	}

	@Override
	protected CommandExecutionResult executeArg(BpmDiagram diagram, LineLocation location, RegexResult arg) {
		final BpmEvent event = new BpmEventGoto(arg.get("ID", 0));
		return diagram.addEvent(event);
	}

}


text:
<?php namespace Anomaly\Streams\Platform\Ui\Table\Component\Action\Contract;

use Anomaly\Streams\Platform\Ui\Table\TableBuilder;

/**
 * Interface ActionHandlerInterface
 *
 * @link   http://pyrocms.com/
 * @author PyroCMS, Inc. <support@pyrocms.com>
 * @author Ryan Thompson <ryan@pyrocms.com>
 */
interface ActionHandlerInterface
{

    /**
     * Handle the action.
     *
     * @param  TableBuilder $builder
     * @param  array        $selected
     * @return mixed
     */
    public function handle(TableBuilder $builder, array $selected);
}


text:
<?php
/**
 * This file is part of BraincraftedBootstrapBundle.
 *
 * (c) 2012-2013 by Florian Eckerstorfer
 */

namespace Braincrafted\Bundle\BootstrapBundle\DependencyInjection;

/**
 * AsseticConfiguration
 *
 * @package    BraincraftedBootstrapBundle
 * @subpackage DependencyInjection
 * @author     Florian Eckerstorfer <florian@eckerstorfer.co>
 * @copyright  2012-2013 Florian Eckerstorfer
 * @license    http://opensource.org/licenses/MIT The MIT License
 * @link       http://bootstrap.braincrafted.com Bootstrap for Symfony2
 */
class AsseticConfiguration
{
    /**
     * Builds the assetic configuration.
     *
     * @param array $config
     *
     * @return array
     */
    public function build(array $config)
    {
        $output = array();

        // Fix path in output dir
        if ('/' !== substr($config['output_dir'], -1) && strlen($config['output_dir']) > 0) {
            $config['output_dir'] .= '/';
        }

        if (in_array($config['less_filter'], array('sass', 'scssphp'))) {
            $output['bootstrap_css'] = $this->buildCssWithSass($config);
        } elseif ('none' !== $config['less_filter']) {
            $output['bootstrap_css'] = $this->buildCssWithLess($config);
        } else {
            $output['bootstrap_css'] = $this->buildCssWithoutLess($config);
        }

        $output['bootstrap_js'] = $this->buildJs($config);
        $output['jquery'] = $this->buildJquery($config);

        return $output;
    }

    /**
     * @param array $config
     *
     * @return array
     */
    protected function buildCssWithoutLess(array $config)
    {
        $inputs = array(
            $config['assets_dir'].'/dist/css/bootstrap.css',
        );
        if ('fa' === $config['icon_prefix']) {
            $inputs[] = $config['fontawesome_dir'].'/css/font-awesome.css';
        }

        return array(
            'inputs'  => $inputs,
            'filters' => array('cssrewrite'),
            'output'  => $config['output_dir'].'css/bootstrap.css'
        );
    }

    /**
     * @param array $config
     *
     * @return array
     */
    protected function buildCssWithLess(array $config)
    {
        $bootstrapFile = $config['assets_dir'].'/less/bootstrap.less';
        if (true === isset($config['customize']['variables_file']) &&
            null !== $config['customize']['variables_file']) {
            $bootstrapFile = $config['customize']['bootstrap_output'];
        }

        $inputs = array(
            $bootstrapFile,
            __DIR__.'/../Resources/less/form.less'
        );
        if ('fa' === $config['icon_prefix']) {
            $inputs[] = $config['fontawesome_dir'].'/less/font-awesome.less';
        }

        return array(
            'inputs'  => $inputs,
            'filters' => array($config['less_filter']),
            'output'  => $config['output_dir'].'css/bootstrap.css'
        );
    }

    /**
     * @param array $config
     *
     * @return array
     */
    protected function buildCssWithSass(array $config)
    {
        $bootstrapFile = $config['assets_dir'].'/stylesheets/bootstrap.scss';
        if (true === isset($config['customize']['variables_file']) &&
            null !== $config['customize']['variables_file']) {
            $bootstrapFile = $config['customize']['bootstrap_output'];
        }

        $inputs = array(
            $bootstrapFile,
            __DIR__.'/../Resources/sass/form.scss'
        );
        if ('fa' === $config['icon_prefix']) {
            $inputs[] = $config['fontawesome_dir'].'/scss/font-awesome.scss';
        }

        return array(
            'inputs'  => $inputs,
            'filters' => array($config['less_filter']),
            'output'  => $config['output_dir'].'css/bootstrap.css'
        );
    }

    /**
     * @param array $config
     *
     * @return array
     */
    protected function buildJs(array $config)
    {
        $path = !in_array($config['less_filter'], array('sass', 'scssphp')) ? "/js" : "/javascripts/bootstrap";
        return array(
            'inputs'  => array(
                $config['assets_dir'].$path.'/transition.js',
                $config['assets_dir'].$path.'/alert.js',
                $config['assets_dir'].$path.'/button.js',
                $config['assets_dir'].$path.'/carousel.js',
                $config['assets_dir'].$path.'/collapse.js',
                $config['assets_dir'].$path.'/dropdown.js',
                $config['assets_dir'].$path.'/modal.js',
                $config['assets_dir'].$path.'/tooltip.js',
                $config['assets_dir'].$path.'/popover.js',
                $config['assets_dir'].$path.'/scrollspy.js',
                $config['assets_dir'].$path.'/tab.js',
                $config['assets_dir'].$path.'/affix.js',
                __DIR__.'/../Resources/js/bc-bootstrap-collection.js'
            ),
            'output'        => $config['output_dir'].'js/bootstrap.js'
        );
    }

    /**
     * @param array $config
     *
     * @return array
     */
    protected function buildJquery(array $config)
    {
        return array(
            'inputs' => array($config['jquery_path']),
            'output' => $config['output_dir'].'js/jquery.js'
        );
    }
}


text:
package no.priv.bang.ukelonn.api.beans;

public class LoginCredentials {
    private String username;
    private String password;

    private LoginCredentials() {}

    public static LoginCredentialsBuilder with() {
        return new LoginCredentialsBuilder();
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public static class LoginCredentialsBuilder {
        private String username;
        private String password;

        private LoginCredentialsBuilder() {}

        public LoginCredentials build() {
            LoginCredentials loginCredentials = new LoginCredentials();
            loginCredentials.username = this.username;
            loginCredentials.password = this.password;
            return loginCredentials;
        }

        public LoginCredentialsBuilder username(String username) {
            this.username = username;
            return this;
        }

        public LoginCredentialsBuilder password(String password) {
            this.password = password;
            return this;
        }
    }
}


text:
title: spring容器的ConfigurableListableBeanFactory集成接口
tags: [spring]
---

1)介绍(查看类的英文注释)

提供beandefinition的解析,注册功能,再对单例来个预加载(解决循环依赖问题)。

该类是一个重要的类,ConfigurableListableBeanFactory是一个集成接口,提供解析、修改bean定义的设置。实现了ListableBeanFactory,AutowireCapableBeanFactory,ConfigurableBeanFactory接口,即综合了很多的功能。

其中ListableBeanFactory用于提供容器内bean实例的枚举功能。AutowireCapableBeanFactory提供容器的自动配置功能,ConfigurableBeanFactory接口提供了定义BeanFactory的配置,如类加载器,类型转化,属性编辑器等。

注:具体使用的容器大多也都是以该接口作为基础接口进一步实现的。

2)接口方法

```
public interface ConfigurableListableBeanFactory
        extends ListableBeanFactory, AutowireCapableBeanFactory, ConfigurableBeanFactory {

    //忽略给定类型的依赖自动装配,如String类型的变量装配默认为null
    void ignoreDependencyType(Class<?> type);

    //忽略指定的接口类型的自动装配,如applicationContexts的自动装配忽略掉,而是使用ApplicationContextAware的方式对bean进行applicationContexts的装配
    void ignoreDependencyInterface(Class<?> ifc);

    //针对特定的依赖类型,自动装配指定对象
    void registerResolvableDependency(Class<?> dependencyType, Object autowiredValue);

    //判断给定的beanname是否是特定依赖(特定依赖对象通过DependencyDescriptor对象描述来指定)自动装配的候选对象
    boolean isAutowireCandidate(String beanName, DependencyDescriptor descriptor) throws NoSuchBeanDefinitionException;

    //获取beanname的BeanDefiniton对象定义
    BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException;

    //冻结BeanDefinition信息,即不允许再对BeanDefinition定义信息进行修改
    void freezeConfiguration();

    boolean isConfigurationFrozen();

    //处理非懒加载的单例对象的实例化
    void preInstantiateSingletons() throws BeansException;
}
```


text:
(function() {
    'use strict';

    angular
        .module('app.project')
        .controller('UploadFileController', UploadFileController);

    /** @ngInject */
    function UploadFileController($scope, $rootScope, $mdDialog, projectService, selectedProject) {

        var vm = this;
        var select_project = selectedProject;

        vm.closeDialog = closeDialog;

        $scope.files;
        var warningType = $rootScope.warningType;
        $scope.$watch('files.length', function(newVal, oldVal) {
            $scope.checkFileSize = false;
            $scope.checkFileType = false;
            if ($scope.files != undefined) {
                if ($scope.files.length > 0) {
                    var fileType = $scope.files[0].lfFile.name.split('.');
                    $scope.types = fileType[fileType.length - 1];
                    angular.forEach(warningType, function(e) {
                        if ($scope.types == e) {
                            $scope.checkFileType = true;
                        } else {
                            if ($scope.files[0].lfFile.size > 25600000) {
                                $scope.checkFileSize = true;
                            } else {
                                $scope.checkFileSize = false;
                            }
                        }
                    })
                }
            }

        });

        function closeDialog() {
            $mdDialog.hide();
        }

        $scope.uploadFile = function() {

            var fileName = "";
            var formData = new FormData();
            angular.forEach($scope.files, function(obj) {
                var fileType = obj.lfFile.name.split('.');
                var type = fileType[fileType.length - 1];

                fileName = select_project.ProjectCode + "_PD_" + $scope.file_name + "." + type;
                formData.append('files[]', obj.lfFile, fileName);

            });

            // projectService.upLoadFile(formData).then(function(response) {

            //     console.log('upload success.' + JSON.stringify(response));
            //     $rootScope.getFileList();
            //     closeDialog();

            // }, function(err) {

            //     console.log('upload error.' + JSON.stringify(err));

            // })

            closeDialog();

        }
    }
})();


text:
class Case::ICO::SARPolicy < Case::ICO::BasePolicy

  class Scope
    def initialize(user, scope, feature = nil)
      @policy_scope = Case::SARPolicy::Scope.new(user, scope, feature)
    end

    def resolve
      @policy_scope.resolve
    end
  end

  def show?
    defer_to_existing_policy(Case::SARPolicy, :show?)
  end

end


text:
<?php

namespace Spiritix\HtmlToPdf\Input;

/**
 * Input handler interface.
 *
 * @package Spiritix\HtmlToPdf\Input
 * @author  Matthias Isler <mi@matthias-isler.ch>
 */
interface InputInterface
{
    /**
     * Must return the input HTML markup.
     *
     * @return string
     */
    public function getHtml();
}


text:
from AudioPython.dsp import *

channels = ((pink_noise(amplitude=0.01),),)


text:
var define;
define(function () {
    "use strict";
    var IndexModelModule = {
        run: function () {
            var Model = function($log, headline, from, copyr) {
                /* Filterung/Formatierung von Daten etc.  */
                $log.log("IndexModelModule obj created");
                return {
                    text: "Grumpy wizards make toxic brew for the evil Queen and Jack. One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin." +
                    "He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections." +
                    "The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs," +
                    "pitifully thin compared with the size of the rest of him, waved about helplessly as he looked." +
                    "One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin." +
                    "He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections." +
                    "The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him," +
                    "waved about helplessly as he looked. Greetz Tom",
                    getSampleData: function() {
                        return "Hello AngularJS";
                    },
                    getHeadline: function() {
                        return headline;
                    },
                    setHeadline: function(param) {
                        headline = param;
                    },
                    getFrom: function() {
                        return from;
                    },
                    getCopy: function() {
                        return "" + copyr + "";
                    }
                };
            };
            angular.module('index_model_module', ['ngSanitize']).value("headline", "AngularJS").constant("from", "by Tom").constant("copyr", "© 2015").run(function ($log) {
                $log.log("index_model_module started");
            }).factory("Model", Model);
            /*
            angular.module('index.values', []).value("headline", "AngularJS").constant("from", "by Tom").run(function ($log) {
                $log.log("index_application_module started");
            }).service("Model", Model);
            */
        }
    };
    return IndexModelModule;
});


text:
using Domain.Common;

namespace Infrastructure.Persistence.Common
{
    public interface IRepository
    {
        IQueryBuilder<TEntity> Query<TEntity>() where TEntity : IEntity;
    }
}


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

using System.IO;
using System.Diagnostics;
using Microsoft.Build.Construction;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Exceptions;

namespace netmf_msbuild_parse
{
    // 引数:プロジェクトファイル
    class Program
    {
        /*
         *
         */
        /// <summary>環境変数の設定(setenv_base.cmd, init.cmd を参考に)</summary>
        /// <remarks>
        /// 前提:
        ///   ターゲット gcc のバージョン 4.6.2
        ///   ターゲット gcc のターゲット arm-none-eabi
        ///   ターゲット gcc のインストール先 c:\gnu\gcc
        ///   Visual Studio 2010 を使用
        ///   gcc の存在確認はしているが,visual studio はしていないので注意
        /// </remarks>
        /// <returns>正常終了 true, 異常終了 false</returns>
        static bool setup_environments()
        {
            // setenv_base.cmd の引数として与えるパラメータ({GCC, 4.6.2,c:\gnu\gcc} できめうち)
            String compiler_tool = "GCC";
            String compiler_tool_version_num = "4.6.2";
            String arg3 = Environment.GetEnvironmentVariable("SystemDrive") + "\\gnu\\gcc";
            Debug.WriteLine("arg3 = " + arg3);

            Environment.SetEnvironmentVariable("COMPILER_TOOL", compiler_tool);
            Environment.SetEnvironmentVariable("COMPILER_TOOL_VERSION_NUM", compiler_tool_version_num);
            Environment.SetEnvironmentVariable("COMPILER_TOOL_VERSION",
                Environment.GetEnvironmentVariable("COMPILER_TOOL")
                + Environment.GetEnvironmentVariable("COMPILER_TOOL_VERSION_NUM"));
            Environment.SetEnvironmentVariable("ARG3", arg3);

            Environment.SetEnvironmentVariable("TFSCONFIG", "MFConfig.xml");

            if (Environment.GetEnvironmentVariable("COMPILER_TOOL").Equals("RVDS", StringComparison.OrdinalIgnoreCase) == false
                && Environment.GetEnvironmentVariable("COMPILER_TOOL").Equals("ADS", StringComparison.OrdinalIgnoreCase) == false)
            {
                Environment.SetEnvironmentVariable("NO_ADS_WRAPPER", "1");
            }

            // この辺から init.cmd 相当の処理
            Environment.SetEnvironmentVariable("CLRROOT", Directory.GetCurrentDirectory());

            Environment.SetEnvironmentVariable("FLAVOR_WIN", "Release");
            Environment.SetEnvironmentVariable("FLAVOR_DAT", "Release");
            Environment.SetEnvironmentVariable("FLAVOR_ARM", "Release");
            Environment.SetEnvironmentVariable("FLAVOR_PLATFORM", "iMXS");
            Environment.SetEnvironmentVariable("FLAVOR_MEMORY", "Flash");
            Environment.SetEnvironmentVariable("OEM_NAME", "Microsoft");
            Environment.SetEnvironmentVariable("FX_35", Environment.GetEnvironmentVariable("WINDIR") + "\\Microsoft.NET\\Framework\\v3.5");
            Environment.SetEnvironmentVariable("FX_40", Environment.GetEnvironmentVariable("WINDIR") + "\\Microsoft.NET\\Framework\\v4.0");
            Environment.SetEnvironmentVariable("MSBUILD_EXE", Environment.GetEnvironmentVariable("FX_40") + "\\msbuild.exe");

            Environment.SetEnvironmentVariable("Path", Environment.GetEnvironmentVariable("Path") + ";" + Environment.GetEnvironmentVariable("FX_40"));

            Environment.SetEnvironmentVariable("COMMON_BUILD_ROOT", Environment.GetEnvironmentVariable("CLRROOT"));
            Environment.SetEnvironmentVariable("BUILD_ROOT_BASE", Environment.GetEnvironmentVariable("COMMON_BUILD_ROOT") + "\\BuildOutput");
            Environment.SetEnvironmentVariable("BUILD_ROOT", Environment.GetEnvironmentVariable("BUILD_ROOT_BASE") + "\\public");

            Environment.SetEnvironmentVariable("BUILD_TREE", Environment.GetEnvironmentVariable("BUILD_ROOT") + "\\"
                + Environment.GetEnvironmentVariable("FLAVOR_DAT"));
            Environment.SetEnvironmentVariable("BUILD_TREE_CLIENT", Environment.GetEnvironmentVariable("BUILD_TREE") + "\\client");
            Environment.SetEnvironmentVariable("BUILD_TREE_SERVER", Environment.GetEnvironmentVariable("BUILD_ROOT") + "\\"
                + Environment.GetEnvironmentVariable("FLAVOR_WIN") + "\\" + "server");
            Environment.SetEnvironmentVariable("DEVPATH", Environment.GetEnvironmentVariable("BUILD_TREE_SERVER") + "\\dll");

            Environment.SetEnvironmentVariable("MDP_EXE", Environment.GetEnvironmentVariable("BUILD_TREE_SERVER") + "\\dll\\MetadataProcessor.exe");
            Environment.SetEnvironmentVariable("BHL_EXE", Environment.GetEnvironmentVariable("BUILD_TREE_SERVER") + "\\dll\\BuildHelper.exe");

            Environment.SetEnvironmentVariable("BUILD_TEST_ROOT", Environment.GetEnvironmentVariable("BUILD_ROOT") + "\\"
                + Environment.GetEnvironmentVariable("FLAVOR_DAT") + "\\Test");
            Environment.SetEnvironmentVariable("BUILD_TEST_TREE", Environment.GetEnvironmentVariable("BUILD_TEST_ROOT"));
            Environment.SetEnvironmentVariable("BUILD_TEST_TREE_CLIENT", Environment.GetEnvironmentVariable("BUILD_TEST_ROOT") + "\\client");
            Environment.SetEnvironmentVariable("BUILD_TEST_TREE_SERVER", Environment.GetEnvironmentVariable("BUILD_TEST_ROOT") + "\\server");

            Environment.SetEnvironmentVariable("OEM_PATH", Environment.GetEnvironmentVariable("OEM_ROOT") + "\\" + Environment.GetEnvironmentVariable("OEM_NAME"));
            Environment.SetEnvironmentVariable("CLRLIB", Environment.GetEnvironmentVariable("CLRROOT") + "\\Tools\\Libraries");

            Environment.SetEnvironmentVariable("TARGETCURRENT", Environment.GetEnvironmentVariable("CLRROOT") + "_BUILD\\arm\\"
                + Environment.GetEnvironmentVariable("FLAVOR_MEMORY") + "\\"
                + Environment.GetEnvironmentVariable("FLAVOR_ARM") + "\\"
                + Environment.GetEnvironmentVariable("FLAVOR_PLATFORM") + "\\bin");

            // ここから再度 setenv_base.cmd

            Environment.SetEnvironmentVariable("SPOCLIENT", Environment.GetEnvironmentVariable("CLRROOT"));
            Environment.SetEnvironmentVariable("SPOROOT", Path.GetFullPath(Environment.GetEnvironmentVariable("SPOCLIENT") + "\\.."));

            Environment.SetEnvironmentVariable("NetMfTargetsBaseDir", Environment.GetEnvironmentVariable("SPOCLIENT") + "\\Framework\\IDE\\Targets\\");

            Environment.SetEnvironmentVariable("_SDROOT_", Path.GetPathRoot(Directory.GetCurrentDirectory()).TrimEnd(new char[] { '\\' }));

            if (Environment.GetEnvironmentVariable("DOTNETMF_OLD_PATH") == null)
            {
                Environment.SetEnvironmentVariable("DOTNETMF_OLD_PATH", Environment.GetEnvironmentVariable("Path"));
            }
            else
            {
                Environment.SetEnvironmentVariable("Path", Environment.GetEnvironmentVariable("DOTNETMF_OLD_PATH"));
            }

            Environment.SetEnvironmentVariable("Path", Environment.GetEnvironmentVariable("SPOROOT") + "\\tools\\NUnit;"
                + Environment.GetEnvironmentVariable("SPOROOT") + "\\tools\\SDPack;"
                + Environment.GetEnvironmentVariable("SPOROOT") + "\\bin;"
                + Environment.GetEnvironmentVariable("Path"));

            Environment.SetEnvironmentVariable("Path", Environment.GetEnvironmentVariable("SPOROOT") + "\\tools\\x86\\perl\\bin;"
                + Environment.GetEnvironmentVariable("SPOROOT") + "\\tools\\x86\\bin;"
                + Environment.GetEnvironmentVariable("CLRROOT") + "\\tools\\bin;"
                + Environment.GetEnvironmentVariable("Path") + ";"
                + Environment.GetEnvironmentVariable("CLRROOT") + "\\tools\\scripts");

            Environment.SetEnvironmentVariable("Path", Environment.GetEnvironmentVariable("CLRROOT")
                + "\\BuildOutput\\Public\\" + Environment.GetEnvironmentVariable("FLAVOR_WIN") + "\\Test\\Server\\dll;"
                + Environment.GetEnvironmentVariable("Path"));

            // vsvars32.bat でセットしている環境変数.
            // Visual Studioの存在確認はしていない.
            Environment.SetEnvironmentVariable("VCINSTALLDIR", "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\");
            Environment.SetEnvironmentVariable("VSINSTALLDIR", "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\");
            Environment.SetEnvironmentVariable("WindowsSdkDir", "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\");

            Environment.SetEnvironmentVariable("Framework35Version", "v3.5");
            Environment.SetEnvironmentVariable("FrameworkDir", "C:\\Windows\\Microsoft.NET\\Framework\\");
            Environment.SetEnvironmentVariable("FrameworkDIR32", "C:\\Windows\\Microsoft.NET\\Framework\\");
            Environment.SetEnvironmentVariable("FrameworkVersion", "v4.0.30319");
            Environment.SetEnvironmentVariable("FrameworkVersion32", "v4.0.30319");
            Environment.SetEnvironmentVariable("DevEnvDir", "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\");
            Environment.SetEnvironmentVariable("INCLUDE", "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include;");
            Environment.SetEnvironmentVariable("LIB", "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\LIB;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\lib;");
            Environment.SetEnvironmentVariable("LIBPATH", "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;C:\\Windows\\Microsoft.NET\\Framework\\v3.5;c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\LIB;");
            Environment.SetEnvironmentVariable("Path", "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VSTSDB\\Deploy"
                + ";" + "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\"
                + ";" + "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN"
                + ";" + "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\Tools"
                + ";" + "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\VCPackages"
                + ";" + "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\NETFX 4.0 Tools"
                + ";" + "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin"
                + ";" + "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319"
                + ";" + "C:\\Windows\\Microsoft.NET\\Framework\\v3.5"
                + ";" + Environment.GetEnvironmentVariable("Path"));

            // 再び setenv_base.cmd
            Environment.SetEnvironmentVariable("TINYCLR_USE_MSBUILD", "1");
            Environment.SetEnvironmentVariable("GNU_VERSION", Environment.GetEnvironmentVariable("COMPILER_TOOL_VERSION_NUM"));
            Environment.SetEnvironmentVariable("COMPILER_TOOL_VERSION_NUM", Environment.GetEnvironmentVariable("COMPILER_TOOL_VERSION_NUM").Substring(0, 3));
            Environment.SetEnvironmentVariable("COMPILER_TOOL_VERSION", Environment.GetEnvironmentVariable("COMPILER_TOOL")
                + Environment.GetEnvironmentVariable("COMPILER_TOOL_VERSION_NUM").Substring(0, 3));
            Environment.SetEnvironmentVariable("DOTNETMF_COMPILER", Environment.GetEnvironmentVariable("COMPILER_TOOL_VERSION"));

            // gccが存在するかどうか
            if (Directory.Exists(Environment.GetEnvironmentVariable("ARG3") + "\\lib\\gcc\\arm-none-eabi\\"
                + Environment.GetEnvironmentVariable("GNU_VERSION")))
            {
                Environment.SetEnvironmentVariable("ARMINC", Environment.GetEnvironmentVariable("ARG3") + "\\lib\\gcc\\arm-none-eabi\\"
                + Environment.GetEnvironmentVariable("GNU_VERSION") + "\\include");
                Environment.SetEnvironmentVariable("ARMLIB", Environment.GetEnvironmentVariable("ARG3") + "\\lib\\gcc\\arm-none-eabi\\"
                + Environment.GetEnvironmentVariable("GNU_VERSION"));

                Environment.SetEnvironmentVariable("GNU_TOOLS", Environment.GetEnvironmentVariable("ARG3"));
                Environment.SetEnvironmentVariable("GNU_TOOLS_BIN", Environment.GetEnvironmentVariable("ARG3") + "\\bin");
                Environment.SetEnvironmentVariable("GNU_TARGET", "arm-none-eabi");
            }
            else
            {
                Debug.WriteLine("Could not found " + Environment.GetEnvironmentVariable("ARG3") + "\\lib\\gcc\\arm-none-eabi\\"
                + Environment.GetEnvironmentVariable("GNU_VERSION"));
                return false;
            }

            // 確認
            // foreach (String s in Environment.GetEnvironmentVariables().Keys){Debug.WriteLine(s + "=" + Environment.GetEnvironmentVariable(s));}

            return true;
        }

        static void Main(string[] args)
        {
            // for debug
            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

            // 引数チェック
            if (args.Length == 0)
            {
                Debug.WriteLine("build file is needed. exit.");
                return;
            }

            // PKのプロジェクトファイル
            String netmfPkBuildFile = Path.GetFileName(args[0]);
            // PKプロジェクトファイルが存在するディレクトリ
            String netmfPkBuildDir = Path.GetDirectoryName(Path.GetFullPath(args[0]));

            // 作業フォルダを設定
            Directory.SetCurrentDirectory(netmfPkBuildDir);

            Debug.WriteLine("Project file: " + netmfPkBuildFile);
            Debug.WriteLine("Build dir(working directory): " + netmfPkBuildDir);

            // 環境変数設定
            if (!setup_environments())
            {
                Debug.WriteLine("environment variable setup error");

                // 終了する
                return;
            }

            // プロジェクト
            Project testProj;

            try
            {
                testProj = new Project(netmfPkBuildFile);

                Debug.WriteLine("----- Import -----");
                Debug.WriteLine("Root Project File: " + netmfPkBuildFile);
                Debug.WriteLine("num of imported elements: " + testProj.Imports.Count);
                foreach (ResolvedImport ri in testProj.Imports)
                {
                    Debug.WriteLine("imported: "
                        + ri.ImportedProject.FullPath
                        + "(Condition=" + ri.ImportingElement.Condition + ")");
                }

                Debug.WriteLine("----- Target -----");
                Debug.WriteLine("num of target:" + testProj.Targets.Count);
                foreach (String s in testProj.Targets.Keys)
                {
                    Debug.WriteLine(s + "=" + testProj.Targets[s]);
                }

            }
            catch (InvalidProjectFileException e)
            {
                Debug.WriteLine(e.ToString());
            }

            /*
            testProj.Xml.AddTarget("BuildProjects");
            foreach (ProjectTargetElement pti in testProj.Xml.Targets.Where(pti => pti.Name == "BuildProjects"))
            {
                pti.AddTask("MSBuild");
            }
            testProj.Save(@"C:\testProj.proj");
 */
        }
    }
}


text:
<?php

/**
 * This is the model class for table "types".
 *
 * The followings are the available columns in table 'types':
 * @property integer $id
 * @property string $name
 * @property string $name_disp
 * @property string $name_ui
 * @property boolean $is_special
 */
class Type extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Type the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'types';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('id, name, name_disp, name_ui, is_special', 'required'),
			array('id', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, name, name_disp, name_ui, is_special', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'dias' => array(self::HAS_MANY, 'Dia', 'type_id'),
		);
	}

    public function defaultScope() {
        $self = $this->getTableAlias(false, false);
        return array(
            'order' => "{$self}.is_special ASC, {$self}.id ASC",
        );
    }

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'Id',
			'name' => 'Name',
			'name_disp' => 'Name Disp',
			'name_ui' => 'Name Ui',
			'is_special' => 'Is Special',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);

		$criteria->compare('name',$this->name,true);

		$criteria->compare('name_disp',$this->name_disp,true);

		$criteria->compare('name_ui',$this->name_ui,true);

		$criteria->compare('is_special',$this->is_special);

		return new CActiveDataProvider('Type', array(
			'criteria'=>$criteria,
		));
	}
}


text:
require 'ebay_trading/types/store_preferences'

module EbayTrading # :nodoc:
  module Responses # :nodoc:
    # == Attributes
    #  object_node :store_preferences, 'StorePreferences', :class => StorePreferences, :optional => true
    class GetStorePreferences < Abstract
      include XML::Mapping
      include Initializer
      root_element_name 'GetStorePreferencesResponse'
      object_node :store_preferences, 'StorePreferences', :class => StorePreferences, :optional => true
    end
  end
end


text:
require "dry-types"
require_relative "./types/callable"

module Kanji
  module Types
    include Dry::Types.module

    ID = String | Integer
    Email = String.constrained(format: /.+\@.+\..+/)
  end
end


text:
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Camunda.Api.Client.Migration
{
    public class MigrationInstruction
    {
        /// <summary>
        /// The activity ids from the source process definition being mapped.
        /// </summary>
        [JsonProperty("sourceActivityIds")]
        public List<string> SourceActivityIds;

        /// <summary>
        /// The activity ids from the target process definition being mapped.
        /// </summary>
        [JsonProperty("targetActivityIds")]
        public List<string> TargetActivityIds;

        /// <summary>
        /// Configuration flag whether event triggers defined are going to be updated during migration.
        /// </summary>
        [JsonProperty("updateEventTrigger")]
        public bool UpdateEventTrigger;
    }
}


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=type.RowVector2.html">

Redirecting to type.RowVector2.html...


text:
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    QStackedWidget* pages;

};

#endif // MAINWINDOW_H


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".ShopActivity" >

    <TextView
        android:id="@+id/act_game_text_charname_and_type"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="18dp" />

    <TextView
        android:id="@+id/act_shop_text_shopname"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="TextView" />

    <Button
        android:id="@+id/act_shop_btn_products"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/act_game_text_charname_and_type"
        android:layout_below="@+id/act_game_text_charname_and_type"
        android:layout_marginTop="20dp"
        android:text="@string/act_shop_btn_products" />

</RelativeLayout>


text:
namespace SoapCore.Tests.Wsdl.Services
{
	//[System.ServiceModel.MessageContractAttribute(IsWrapped = false)]
	public class EmptyMembers
	{
		public EmptyMembers()
		{
		}
	}
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml.Serialization;

using Amazon.ElasticTranscoder.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;

namespace Amazon.ElasticTranscoder.Model.Internal.MarshallTransformations
{
    /// <summary>
    /// Test Role Request Marshaller
    /// </summary>
    internal class TestRoleRequestMarshaller : IMarshaller<IRequest, TestRoleRequest>
    {

        public IRequest Marshall(TestRoleRequest testRoleRequest)
        {

            IRequest request = new DefaultRequest(testRoleRequest, "AmazonElasticTranscoder");
            string target = "EtsCustomerService.TestRole";
            request.Headers["X-Amz-Target"] = target;
            request.Headers["Content-Type"] = "application/x-amz-json-1.0";

            request.HttpMethod = "POST";

            string uriResourcePath = "2012-09-25/roleTests";

            if (uriResourcePath.Contains("?"))
            {
                string queryString = uriResourcePath.Substring(uriResourcePath.IndexOf("?") + 1);
                uriResourcePath    = uriResourcePath.Substring(0, uriResourcePath.IndexOf("?"));

                foreach (string s in queryString.Split('&', ';'))
                {
                    string[] nameValuePair = s.Split('=');
                    if (nameValuePair.Length == 2 && nameValuePair[1].Length > 0)
                    {
                        request.Parameters.Add(nameValuePair[0], nameValuePair[1]);
                    }
                    else
                    {
                        request.Parameters.Add(nameValuePair[0], null);
                    }
                }
            }

            request.ResourcePath = uriResourcePath;

            using (StringWriter stringWriter = new StringWriter())
            {
                JsonWriter writer = new JsonWriter(stringWriter);
                writer.WriteObjectStart();

                if (testRoleRequest != null && testRoleRequest.IsSetRole())
                {
                    writer.WritePropertyName("Role");
                    writer.Write(testRoleRequest.Role);
                }
                if (testRoleRequest != null && testRoleRequest.IsSetInputBucket())
                {
                    writer.WritePropertyName("InputBucket");
                    writer.Write(testRoleRequest.InputBucket);
                }
                if (testRoleRequest != null && testRoleRequest.IsSetOutputBucket())
                {
                    writer.WritePropertyName("OutputBucket");
                    writer.Write(testRoleRequest.OutputBucket);
                }

                if (testRoleRequest != null && testRoleRequest.Topics != null && testRoleRequest.Topics.Count > 0)
                {
                    List<string> topicsList = testRoleRequest.Topics;
                    writer.WritePropertyName("Topics");
                    writer.WriteArrayStart();

                    foreach (string topicsListValue in topicsList)
                    {
                        writer.Write(StringUtils.FromString(topicsListValue));
                    }

                    writer.WriteArrayEnd();
                }

                writer.WriteObjectEnd();

                string snippet = stringWriter.ToString();
                request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
            }

            return request;
        }
    }
}


text:
<?php

/** Zend_Controller_Router_Route_Abstract */
//require_once 'Zend/Controller/Router/Route/Abstract.php';

/**
 * Route
 *
 * @package    Zend_Controller
 * @subpackage Router
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @see        http://manuals.rubyonrails.com/read/chapter/65
 */
class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
{
    /**
     * Default translator
     *
     * @var Zend_Translate
     */
    protected static $_defaultTranslator;

    /**
     * Translator
     *
     * @var Zend_Translate
     */
    protected $_translator;

    /**
     * Default locale
     *
     * @var mixed
     */
    protected static $_defaultLocale;

    /**
     * Locale
     *
     * @var mixed
     */
    protected $_locale;

    /**
     * Wether this is a translated route or not
     *
     * @var boolean
     */
    protected $_isTranslated = false;

    /**
     * Translatable variables
     *
     * @var array
     */
    protected $_translatable = array();

    protected $_urlVariable = ':';
    protected $_urlDelimiter = self::URI_DELIMITER;
    protected $_regexDelimiter = '#';
    protected $_defaultRegex = null;

    /**
     * Holds names of all route's pattern variable names. Array index holds a position in URL.
     * @var array
     */
    protected $_variables = array();

    /**
     * Holds Route patterns for all URL parts. In case of a variable it stores it's regex
     * requirement or null. In case of a static part, it holds only it's direct value.
     * In case of a wildcard, it stores an asterisk (*)
     * @var array
     */
    protected $_parts = array();

    /**
     * Holds user submitted default values for route's variables. Name and value pairs.
     * @var array
     */
    protected $_defaults = array();

    /**
     * Holds user submitted regular expression patterns for route's variables' values.
     * Name and value pairs.
     * @var array
     */
    protected $_requirements = array();

    /**
     * Associative array filled on match() that holds matched path values
     * for given variable names.
     * @var array
     */
    protected $_values = array();

    /**
     * Associative array filled on match() that holds wildcard variable
     * names and values.
     * @var array
     */
    protected $_wildcardData = array();

    /**
     * Helper var that holds a count of route pattern's static parts
     * for validation
     * @var int
     */
    protected $_staticCount = 0;

    public function getVersion() {
        return 1;
    }

    /**
     * Instantiates route based on passed Zend_Config structure
     *
     * @param Zend_Config $config Configuration object
     */
    public static function getInstance(Zend_Config $config)
    {
        $reqs = ($config->reqs instanceof Zend_Config) ? $config->reqs->toArray() : array();
        $defs = ($config->defaults instanceof Zend_Config) ? $config->defaults->toArray() : array();
        return new self($config->route, $defs, $reqs);
    }

    /**
     * Prepares the route for mapping by splitting (exploding) it
     * to a corresponding atomic parts. These parts are assigned
     * a position which is later used for matching and preparing values.
     *
     * @param string $route Map used to match with later submitted URL path
     * @param array $defaults Defaults for map variables with keys as variable names
     * @param array $reqs Regular expression requirements for variables (keys as variable names)
     * @param Zend_Translate $translator Translator to use for this instance
     */
    public function __construct($route, $defaults = array(), $reqs = array(), Zend_Translate $translator = null, $locale = null)
    {
        $route               = trim($route, $this->_urlDelimiter);
        $this->_defaults     = (array) $defaults;
        $this->_requirements = (array) $reqs;
        $this->_translator   = $translator;
        $this->_locale       = $locale;

        if ($route !== '') {
            foreach (explode($this->_urlDelimiter, $route) as $pos => $part) {
                if (substr($part, 0, 1) == $this->_urlVariable && substr($part, 1, 1) != $this->_urlVariable) {
                    $name = substr($part, 1);

                    if (substr($name, 0, 1) === '@' && substr($name, 1, 1) !== '@') {
                        $name                  = substr($name, 1);
                        $this->_translatable[] = $name;
                        $this->_isTranslated   = true;
                    }

                    $this->_parts[$pos]     = (isset($reqs[$name]) ? $reqs[$name] : $this->_defaultRegex);
                    $this->_variables[$pos] = $name;
                } else {
                    if (substr($part, 0, 1) == $this->_urlVariable) {
                        $part = substr($part, 1);
                    }

                    if (substr($part, 0, 1) === '@' && substr($part, 1, 1) !== '@') {
                        $this->_isTranslated = true;
                    }

                    $this->_parts[$pos] = $part;

                    if ($part !== '*') {
                        $this->_staticCount++;
                    }
                }
            }
        }
    }

    /**
     * Matches a user submitted path with parts defined by a map. Assigns and
     * returns an array of variables on a successful match.
     *
     * @param string $path Path used to match against this routing map
     * @return array|false An array of assigned values or a false on a mismatch
     */
    public function match($path, $partial = false)
    {
        if ($this->_isTranslated) {
            $translateMessages = $this->getTranslator()->getMessages();
        }

        $pathStaticCount = 0;
        $values          = array();
        $matchedPath     = '';

        if (!$partial) {
            $path = trim($path, $this->_urlDelimiter);
        }

        if ($path !== '') {
            $path = explode($this->_urlDelimiter, $path);

            foreach ($path as $pos => $pathPart) {
                // Path is longer than a route, it's not a match
                if (!array_key_exists($pos, $this->_parts)) {
                    if ($partial) {
                        break;
                    } else {
                        return false;
                    }
                }

                $matchedPath .= $pathPart . $this->_urlDelimiter;

                // If it's a wildcard, get the rest of URL as wildcard data and stop matching
                if ($this->_parts[$pos] == '*') {
                    $count = count($path);
                    for($i = $pos; $i < $count; $i+=2) {
                        $var = urldecode($path[$i]);
                        if (!isset($this->_wildcardData[$var]) && !isset($this->_defaults[$var]) && !isset($values[$var])) {
                            $this->_wildcardData[$var] = (isset($path[$i+1])) ? urldecode($path[$i+1]) : null;
                        }
                    }

                    $matchedPath = implode($this->_urlDelimiter, $path);
                    break;
                }

                $name     = isset($this->_variables[$pos]) ? $this->_variables[$pos] : null;
                $pathPart = urldecode($pathPart);

                // Translate value if required
                $part = $this->_parts[$pos];
                if ($this->_isTranslated && (substr($part, 0, 1) === '@' && substr($part, 1, 1) !== '@' && $name === null) || $name !== null && in_array($name, $this->_translatable)) {
                    if (substr($part, 0, 1) === '@') {
                        $part = substr($part, 1);
                    }

                    if (($originalPathPart = array_search($pathPart, $translateMessages)) !== false) {
                        $pathPart = $originalPathPart;
                    }
                }

                if (substr($part, 0, 2) === '@@') {
                    $part = substr($part, 1);
                }

                // If it's a static part, match directly
                if ($name === null && $part != $pathPart) {
                    return false;
                }

                // If it's a variable with requirement, match a regex. If not - everything matches
                if ($part !== null && !preg_match($this->_regexDelimiter . '^' . $part . '$' . $this->_regexDelimiter . 'iu', $pathPart)) {
                    return false;
                }

                // If it's a variable store it's value for later
                if ($name !== null) {
                    $values[$name] = $pathPart;
                } else {
                    $pathStaticCount++;
                }
            }
        }

        // Check if all static mappings have been matched
        if ($this->_staticCount != $pathStaticCount) {
            return false;
        }

        $return = $values + $this->_wildcardData + $this->_defaults;

        // Check if all map variables have been initialized
        foreach ($this->_variables as $var) {
            if (!array_key_exists($var, $return)) {
                return false;
            } elseif ($return[$var] == '' || $return[$var] === null) {
                // Empty variable? Replace with the default value.
                $return[$var] = $this->_defaults[$var];
            }
        }

        $this->setMatchedPath(rtrim($matchedPath, $this->_urlDelimiter));

        $this->_values = $values;

        return $return;

    }

    /**
     * Assembles user submitted parameters forming a URL path defined by this route
     *
     * @param  array $data An array of variable and value pairs used as parameters
     * @param  boolean $reset Whether or not to set route defaults with those provided in $data
     * @return string Route path with user submitted parameters
     */
    public function assemble($data = array(), $reset = false, $encode = false, $partial = false)
    {
        if ($this->_isTranslated) {
            $translator = $this->getTranslator();

            if (isset($data['@locale'])) {
                $locale = $data['@locale'];
                unset($data['@locale']);
            } else {
                $locale = $this->getLocale();
            }
        }

        $url  = array();
        $flag = false;

        foreach ($this->_parts as $key => $part) {
            $name = isset($this->_variables[$key]) ? $this->_variables[$key] : null;

            $useDefault = false;
            if (isset($name) && array_key_exists($name, $data) && $data[$name] === null) {
                $useDefault = true;
            }

            if (isset($name)) {
                if (isset($data[$name]) && !$useDefault) {
                    $value = $data[$name];
                    unset($data[$name]);
                } elseif (!$reset && !$useDefault && isset($this->_values[$name])) {
                    $value = $this->_values[$name];
                } elseif (!$reset && !$useDefault && isset($this->_wildcardData[$name])) {
                    $value = $this->_wildcardData[$name];
                } elseif (array_key_exists($name, $this->_defaults)) {
                    $value = $this->_defaults[$name];
                } else {
                    //require_once 'Zend/Controller/Router/Exception.php';
                    throw new Zend_Controller_Router_Exception($name . ' is not specified');
                }

                if ($this->_isTranslated && in_array($name, $this->_translatable)) {
                    $url[$key] = $translator->translate($value, $locale);
                } else {
                    $url[$key] = $value;
                }
            } elseif ($part != '*') {
                if ($this->_isTranslated && substr($part, 0, 1) === '@') {
                    if (substr($part, 1, 1) !== '@') {
                        $url[$key] = $translator->translate(substr($part, 1), $locale);
                    } else {
                        $url[$key] = substr($part, 1);
                    }
                } else {
                    if (substr($part, 0, 2) === '@@') {
                        $part = substr($part, 1);
                    }

                    $url[$key] = $part;
                }
            } else {
                if (!$reset) $data += $this->_wildcardData;
                $defaults = $this->getDefaults();
                foreach ($data as $var => $value) {
                    if ($value !== null && (!isset($defaults[$var]) || $value != $defaults[$var])) {
                        $url[$key++] = $var;
                        $url[$key++] = $value;
                        $flag = true;
                    }
                }
            }
        }

        $return = '';

        foreach (array_reverse($url, true) as $key => $value) {
            $defaultValue = null;

            if (isset($this->_variables[$key])) {
                $defaultValue = $this->getDefault($this->_variables[$key]);

                if ($this->_isTranslated && $defaultValue !== null && isset($this->_translatable[$this->_variables[$key]])) {
                    $defaultValue = $translator->translate($defaultValue, $locale);
                }
            }

            if ($flag || $value !== $defaultValue || $partial) {
                if ($encode) $value = urlencode($value);
                $return = $this->_urlDelimiter . $value . $return;
                $flag = true;
            }
        }

        return trim($return, $this->_urlDelimiter);

    }

    /**
     * Return a single parameter of route's defaults
     *
     * @param string $name Array key of the parameter
     * @return string Previously set default
     */
    public function getDefault($name) {
        if (isset($this->_defaults[$name])) {
            return $this->_defaults[$name];
        }
        return null;
    }

    /**
     * Return an array of defaults
     *
     * @return array Route defaults
     */
    public function getDefaults() {
        return $this->_defaults;
    }

    /**
     * Get all variables which are used by the route
     *
     * @return array
     */
    public function getVariables()
    {
        return $this->_variables;
    }

    /**
     * Set a default translator
     *
     * @param  Zend_Translate $translator
     * @return void
     */
    public static function setDefaultTranslator(Zend_Translate $translator = null)
    {
        self::$_defaultTranslator = $translator;
    }

    /**
     * Get the default translator
     *
     * @return Zend_Translate
     */
    public static function getDefaultTranslator()
    {
        return self::$_defaultTranslator;
    }

    /**
     * Set a translator
     *
     * @param  Zend_Translate $translator
     * @return void
     */
    public function setTranslator(Zend_Translate $translator)
    {
        $this->_translator = $translator;
    }

    /**
     * Get the translator
     *
     * @throws Zend_Controller_Router_Exception When no translator can be found
     * @return Zend_Translate
     */
    public function getTranslator()
    {
        if ($this->_translator !== null) {
            return $this->_translator;
        } else if (($translator = self::getDefaultTranslator()) !== null) {
            return $translator;
        } else {
            try {
                $translator = Zend_Registry::get('Zend_Translate');
            } catch (Zend_Exception $e) {
                $translator = null;
            }

            if ($translator instanceof Zend_Translate) {
                return $translator;
            }
        }

        //require_once 'Zend/Controller/Router/Exception.php';
        throw new Zend_Controller_Router_Exception('Could not find a translator');
    }

    /**
     * Set a default locale
     *
     * @param  mixed $locale
     * @return void
     */
    public static function setDefaultLocale($locale = null)
    {
        self::$_defaultLocale = $locale;
    }

    /**
     * Get the default locale
     *
     * @return mixed
     */
    public static function getDefaultLocale()
    {
        return self::$_defaultLocale;
    }

    /**
     * Set a locale
     *
     * @param  mixed $locale
     * @return void
     */
    public function setLocale($locale)
    {
        $this->_locale = $locale;
    }

    /**
     * Get the locale
     *
     * @return mixed
     */
    public function getLocale()
    {
        if ($this->_locale !== null) {
            return $this->_locale;
        } else if (($locale = self::getDefaultLocale()) !== null) {
            return $locale;
        } else {
            try {
                $locale = Zend_Registry::get('Zend_Locale');
            } catch (Zend_Exception $e) {
                $locale = null;
            }

            if ($locale !== null) {
                return $locale;
            }
        }

        return null;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//Write a program that reads a string, reverses it and prints the result at the console.
namespace _02.ReverseString
{
    class ReverseString
    {
        static void Main()
        {
            string input = Console.ReadLine();
            char [] reverse = input.ToCharArray();
            Array.Reverse(reverse);
            Console.WriteLine(string.Join("",reverse));

        }
    }
}


text:
/*!
 * \file doc.h
 * \brief Documentation Header File
 */

/*!
 * \mainpage Dialog Control eXtension Documentation
 *
 * This is the source code documentation of the mIRC DCX DLL. It contains all the needed information needed to follow how this
 * DLL was implemented. You will find information related to the classes and their interfaces.
 *
 * This documentation is provided for learning purposes for anyone that wants to use this source in their projects.
 *
 * \note The Documentation is incomplete for the moment.
 *
 * \author David Legault ( clickhere at scriptsdb dot org )
 * \version 1.0
 *
 * \b Revisions
 *
 * © ScriptsDB.org - 2005
 */


text:
import log from './logger';

// Import some named exports. These get assigned to the name that they were
//  exported with.
import { warn } from './logger';

// We could combine the two lines to
// import log, { warn } from './logger';

// Or even
// import { default as log, warn } from './logger';

log('Hi!');
warn('Uh oh');

// You can also import all of a module's imports
import * as logger from './logger';
logger.warn('Still bad news');

// And you can change the name of specific imports
import { err as disaster }  from './logger';
disaster('Time to give up!')


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/firstditu" >
    <!-- 欢迎界面 layout 尹稳定 2014.11.17 -->

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="70dp"
        android:background="@drawable/welcome_yezi" />

</RelativeLayout>


text:
BACKUP = "scenario.backup_grp"
BACKUP_CREATE = "scenario.backup_create_grp"
BACKUP_DELETE = "scenario.backup_delete_grp"
BACKUP_INST = "scenario.backup_inst_grp"
BACKUP_INST_CREATE = "scenario.backup_inst_create_grp"
BACKUP_INST_CREATE_WAIT = "scenario.backup_inst_create_wait_grp"
BACKUP_INST_DELETE = "scenario.backup_inst_delete_grp"
BACKUP_INST_DELETE_WAIT = "scenario.backup_inst_delete_wait_grp"

BACKUP_INC = "scenario.backup_inc_grp"
BACKUP_INC_CREATE = "scenario.backup_inc_create_grp"
BACKUP_INC_DELETE = "scenario.backup_inc_delete_grp"
BACKUP_INC_INST = "scenario.backup_inc_inst_grp"
BACKUP_INC_INST_CREATE = "scenario.backup_inc_inst_create_grp"
BACKUP_INC_INST_CREATE_WAIT = "scenario.backup_inc_inst_create_wait_grp"
BACKUP_INC_INST_DELETE = "scenario.backup_inc_inst_delete_grp"
BACKUP_INC_INST_DELETE_WAIT = "scenario.backup_inc_inst_delete_wait_grp"

# Configuration Group
CFGGRP_CREATE = "scenario.cfggrp_create_grp"
CFGGRP_DELETE = "scenario.cfggrp_delete_grp"
CFGGRP_INST = "scenario.cfggrp_inst_grp"
CFGGRP_INST_CREATE = "scenario.cfggrp_inst_create_grp"
CFGGRP_INST_CREATE_WAIT = "scenario.cfggrp_inst_create_wait_grp"
CFGGRP_INST_DELETE = "scenario.cfggrp_inst_delete_grp"
CFGGRP_INST_DELETE_WAIT = "scenario.cfggrp_inst_delete_wait_grp"

# Database Actions Group
DB_ACTION_CREATE = "scenario.db_action_create_grp"
DB_ACTION_DELETE = "scenario.db_action_delete_grp"
DB_ACTION_INST = "scenario.db_action_inst_grp"
DB_ACTION_INST_CREATE = "scenario.db_action_inst_create_grp"
DB_ACTION_INST_CREATE_WAIT = "scenario.db_action_inst_create_wait_grp"
DB_ACTION_INST_DELETE = "scenario.db_action_inst_delete_grp"
DB_ACTION_INST_DELETE_WAIT = "scenario.db_action_inst_delete_wait_grp"

# Instance Actions Group
INST_ACTIONS = "scenario.inst_actions_grp"
INST_ACTIONS_RESIZE = "scenario.inst_actions_resize_grp"
INST_ACTIONS_RESIZE_WAIT = "scenario.inst_actions_resize_wait_grp"

# Instance Create Group
INST_CREATE = "scenario.inst_create_grp"
INST_CREATE_WAIT = "scenario.inst_create_wait_grp"
INST_INIT_DELETE = "scenario.inst_init_delete_grp"
INST_INIT_DELETE_WAIT = "scenario.inst_init_delete_wait_grp"

# Instance Delete Group
INST_DELETE = "scenario.inst_delete_grp"
INST_DELETE_WAIT = "scenario.inst_delete_wait_grp"

# Module Group
MODULE_CREATE = "scenario.module_create_grp"
MODULE_DELETE = "scenario.module_delete_grp"
MODULE_INST = "scenario.module_inst_grp"
MODULE_INST_CREATE = "scenario.module_inst_create_grp"
MODULE_INST_CREATE_WAIT = "scenario.module_inst_create_wait_grp"
MODULE_INST_DELETE = "scenario.module_inst_delete_grp"
MODULE_INST_DELETE_WAIT = "scenario.module_inst_delete_wait_grp"

# Replication Group
REPL_INST = "scenario.repl_inst_grp"
REPL_INST_CREATE = "scenario.repl_inst_create_grp"
REPL_INST_CREATE_WAIT = "scenario.repl_inst_create_wait_grp"
REPL_INST_MULTI_CREATE = "scenario.repl_inst_multi_create_grp"
REPL_INST_DELETE_NON_AFFINITY_WAIT = "scenario.repl_inst_delete_noaff_wait_grp"
REPL_INST_MULTI_CREATE_WAIT = "scenario.repl_inst_multi_create_wait_grp"
REPL_INST_DELETE = "scenario.repl_inst_delete_grp"
REPL_INST_DELETE_WAIT = "scenario.repl_inst_delete_wait_grp"

# Root Actions Group
ROOT_ACTION_ENABLE = "scenario.root_action_enable_grp"
ROOT_ACTION_DISABLE = "scenario.root_action_disable_grp"
ROOT_ACTION_INST = "scenario.root_action_inst_grp"
ROOT_ACTION_INST_CREATE = "scenario.root_action_inst_create_grp"
ROOT_ACTION_INST_CREATE_WAIT = "scenario.root_action_inst_create_wait_grp"
ROOT_ACTION_INST_DELETE = "scenario.root_action_inst_delete_grp"
ROOT_ACTION_INST_DELETE_WAIT = "scenario.root_action_inst_delete_wait_grp"

# User Actions Group
USER_ACTION_CREATE = "scenario.user_action_create_grp"
USER_ACTION_DELETE = "scenario.user_action_delete_grp"
USER_ACTION_INST = "scenario.user_action_inst_grp"
USER_ACTION_INST_CREATE = "scenario.user_action_inst_create_grp"
USER_ACTION_INST_CREATE_WAIT = "scenario.user_action_inst_create_wait_grp"
USER_ACTION_INST_DELETE = "scenario.user_action_inst_delete_grp"
USER_ACTION_INST_DELETE_WAIT = "scenario.user_action_inst_delete_wait_grp"


text:
namespace syncer {

ModelTypeRegistry::ModelTypeRegistry(
    const std::vector<scoped_refptr<ModelSafeWorker> >& workers,
    syncable::Directory* directory)
    : update_handler_deleter_(&update_handler_map_),
      commit_contributor_deleter_(&commit_contributor_map_),
      directory_(directory) {
  for (size_t i = 0u; i < workers.size(); ++i) {
    workers_map_.insert(
        std::make_pair(workers[i]->GetModelSafeGroup(), workers[i]));
  }
}

ModelTypeRegistry::~ModelTypeRegistry() {}

void ModelTypeRegistry::SetEnabledDirectoryTypes(
    const ModelSafeRoutingInfo& routing_info) {
  STLDeleteValues(&update_handler_map_);
  STLDeleteValues(&commit_contributor_map_);
  update_handler_map_.clear();
  commit_contributor_map_.clear();

  for (ModelSafeRoutingInfo::const_iterator routing_iter = routing_info.begin();
       routing_iter != routing_info.end(); ++routing_iter) {
    ModelType type = routing_iter->first;
    ModelSafeGroup group = routing_iter->second;
    std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker> >::iterator
        worker_it = workers_map_.find(group);
    DCHECK(worker_it != workers_map_.end());
    scoped_refptr<ModelSafeWorker> worker = worker_it->second;

    DirectoryCommitContributor* committer =
        new DirectoryCommitContributor(directory_, type);
    DirectoryUpdateHandler* updater =
        new DirectoryUpdateHandler(directory_, type, worker);

    bool inserted1 =
        update_handler_map_.insert(std::make_pair(type, updater)).second;
    DCHECK(inserted1) << "Attempt to override existing type handler in map";

    bool inserted2 =
        commit_contributor_map_.insert(std::make_pair(type, committer)).second;
    DCHECK(inserted2) << "Attempt to override existing type handler in map";

  }
}

UpdateHandlerMap* ModelTypeRegistry::update_handler_map() {
  return &update_handler_map_;
}

CommitContributorMap* ModelTypeRegistry::commit_contributor_map() {
  return &commit_contributor_map_;
}

}  // namespace syncer