text:
package com.sun.media.imageioimpl.plugins.pnm;

import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.ComponentColorModel;
import java.awt.image.ComponentSampleModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.DataBufferInt;
import java.awt.image.DataBufferUShort;
import java.awt.image.IndexColorModel;
import java.awt.image.MultiPixelPackedSampleModel;
import java.awt.image.PixelInterleavedSampleModel;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;

import javax.imageio.IIOException;
import javax.imageio.ImageReader;
import javax.imageio.ImageReadParam;
import javax.imageio.ImageTypeSpecifier;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;

import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;

import com.sun.media.imageioimpl.common.ImageUtil;

/** This class is the Java Image IO plugin reader for PNM images.
 *  It may subsample the image, clip the image, select sub-bands,
 *  and shift the decoded image origin if the proper decoding parameter
 *  are set in the provided PNMImageReadParam.
 */
public class PNMImageReader extends ImageReader {
    private static final int PBM_ASCII  = '1';
    private static final int PGM_ASCII  = '2';
    private static final int PPM_ASCII  = '3';
    private static final int PBM_RAW    = '4';
    private static final int PGM_RAW    = '5';
    private static final int PPM_RAW    = '6';

    private static final int LINE_FEED = 0x0A;
    private static byte[] lineSeparator;

    static {
        if (lineSeparator == null) {
            String ls = (String)java.security.AccessController.doPrivileged(
               new sun.security.action.GetPropertyAction("line.separator"));
            lineSeparator = ls.getBytes();
        }
    }

    /** File variant: PBM/PGM/PPM, ASCII/RAW. */
    private int variant;

    /** Maximum pixel value. */
    private int maxValue;

    /** The input stream where reads from */
    private ImageInputStream iis = null;

    /** Indicates whether the header is read. */
    private boolean gotHeader = false;

    /** The stream position where the image data starts. */
    private long imageDataOffset;

    /** The original image width. */
    private int width;

    /** The original image height. */
    private int height;

    private String aLine;
    private StringTokenizer token;

    private PNMMetadata metadata;

    /** Constructs PNMImageReader from the provided
     *  ImageReaderSpi.
     */
    public PNMImageReader(ImageReaderSpi originator) {
        super(originator);
    }

    /** Overrides the method defined in the superclass. */
    public void setInput(Object input,
                         boolean seekForwardOnly,
                         boolean ignoreMetadata) {
        super.setInput(input, seekForwardOnly, ignoreMetadata);
        iis = (ImageInputStream) input; // Always works
    }

    /** Overrides the method defined in the superclass. */
    public int getNumImages(boolean allowSearch) throws IOException {
        return 1;
    }

    public int getWidth(int imageIndex) throws IOException {
        checkIndex(imageIndex);
        readHeader();
        return width;
    }

    public int getHeight(int imageIndex) throws IOException {
        checkIndex(imageIndex);
        readHeader();
        return height;
    }

    public int getVariant() {
        return variant;
    }

    public int getMaxValue() {
        return maxValue;
    }

    private void checkIndex(int imageIndex) {
        if (imageIndex != 0) {
            throw new IndexOutOfBoundsException(I18N.getString("PNMImageReader1"));
        }
    }

    public synchronized void readHeader() throws IOException {
        if (gotHeader) {
	    // Seek to where the image data starts, since that is where
	    // the stream pointer should be after header is read
	    iis.seek(imageDataOffset);
            return;
	}

        if (iis != null) {
            if (iis.readByte() != 'P') {	// magic number
                throw new RuntimeException(I18N.getString("PNMImageReader0"));
            }

            variant = iis.readByte();	// file variant
            if ((variant < PBM_ASCII) || (variant > PPM_RAW)) {
                throw new RuntimeException(I18N.getString("PNMImageReader0"));
            }

            // Create the metadata object.
            metadata = new PNMMetadata();

            // Set the variant.
            metadata.setVariant(variant);

            // Read the line separator.
            iis.readLine();

            readComments(iis, metadata);

            width = readInteger(iis);	// width
            height = readInteger(iis);	// height

            if (variant == PBM_ASCII || variant == PBM_RAW) {
                maxValue = 1;
            } else {
                maxValue = readInteger(iis);	// maximum value
            }

            metadata.setWidth(width);
            metadata.setHeight(height);
            metadata.setMaxBitDepth(maxValue);

            gotHeader = true;

	    // Store the stream position where the image data starts
	    imageDataOffset = iis.getStreamPosition();
        }
    }

    public Iterator getImageTypes(int imageIndex)
        throws IOException {
        checkIndex(imageIndex);

        readHeader();
        int tmp = (variant - '1') % 3 ;

        ArrayList list = new ArrayList(1);
        int dataType = DataBuffer.TYPE_INT;
        // Determine data type based on maxValue.
        if (maxValue < 0x100) {
            dataType = DataBuffer.TYPE_BYTE;
        } else if (maxValue < 0x10000) {
            dataType = DataBuffer.TYPE_USHORT;
        }

        // Choose an appropriate SampleModel.
        SampleModel sampleModel = null;
        ColorModel colorModel = null;
        if ((variant == PBM_ASCII) || (variant == PBM_RAW)) {
            // Each pixel takes 1 bit, pack 8 pixels into a byte.
            sampleModel = new MultiPixelPackedSampleModel(
                              DataBuffer.TYPE_BYTE,
                              width,
                              height,
                              1);
            byte[] color = {(byte)0xFF, (byte)0};
            colorModel = new IndexColorModel(1, 2, color, color, color);
        } else {
            sampleModel =
                new PixelInterleavedSampleModel(dataType,
                                                width,
                                                height,
                                                tmp == 1 ? 1 : 3,
                                                width * (tmp == 1 ? 1 : 3),
                                                tmp == 1 ? new int[]{0} : new int[]{0, 1, 2});

            colorModel = ImageUtil.createColorModel(null, sampleModel);
        }

        list.add(new ImageTypeSpecifier(colorModel, sampleModel));

        return list.iterator();
    }

    public ImageReadParam getDefaultReadParam() {
        return new ImageReadParam();
    }

    public IIOMetadata getImageMetadata(int imageIndex)
        throws IOException {
        checkIndex(imageIndex);
        readHeader();
        return metadata;
    }

    public IIOMetadata getStreamMetadata() throws IOException {
        return null;
    }

    public boolean isRandomAccessEasy(int imageIndex) throws IOException {
        checkIndex(imageIndex);
        return true;
    }

    public BufferedImage read(int imageIndex, ImageReadParam param)
        throws IOException {
        checkIndex(imageIndex);
        clearAbortRequest();
        processImageStarted(imageIndex);

        if (param == null)
            param = getDefaultReadParam();

        //read header
        readHeader();

        Rectangle sourceRegion = new Rectangle(0, 0, 0, 0);
        Rectangle destinationRegion = new Rectangle(0, 0, 0, 0);

        computeRegions(param, this.width, this.height,
                       param.getDestination(),
                       sourceRegion,
                       destinationRegion);

        int scaleX = param.getSourceXSubsampling();
        int scaleY = param.getSourceYSubsampling();

        // If the destination band is set used it
        int[] sourceBands = param.getSourceBands();
        int[] destBands = param.getDestinationBands();

        boolean seleBand = (sourceBands != null) && (destBands != null);
	boolean	noTransform =
	    destinationRegion.equals(new Rectangle(0, 0, width, height)) ||
                              seleBand;

        // The RAWBITS format can only support byte image data, which means
        // maxValue should be less than 0x100. In case there's a conflict,
        // base the maxValue on variant.
        if (isRaw(variant) && maxValue >= 0x100) {
            maxValue = 0xFF;
        }

        int numBands = 1;
        // Determine number of bands: pixmap (PPM) is 3 bands,
        // bitmap (PBM) and greymap (PGM) are 1 band.
        if (variant == PPM_ASCII || variant == PPM_RAW) {
            numBands = 3;
        }

        if (!seleBand) {
            sourceBands = new int[numBands];
            destBands = new int[numBands];
            for (int i = 0; i < numBands; i++)
                destBands[i] = sourceBands[i] = i;
        }

        int dataType = DataBuffer.TYPE_INT;
        // Determine data type based on maxValue.
        if (maxValue < 0x100) {
            dataType = DataBuffer.TYPE_BYTE;
        } else if (maxValue < 0x10000) {
            dataType = DataBuffer.TYPE_USHORT;
        }

        // Choose an appropriate SampleModel.
        SampleModel sampleModel = null;
        ColorModel colorModel = null;
        if ((variant == PBM_ASCII) || (variant == PBM_RAW)) {
            // Each pixel takes 1 bit, pack 8 pixels into a byte.
            sampleModel = new MultiPixelPackedSampleModel(
                              DataBuffer.TYPE_BYTE,
                              destinationRegion.width,
                              destinationRegion.height,
                              1);
            byte[] color = {(byte)0xFF, (byte)0};
            colorModel = new IndexColorModel(1, 2, color, color, color);
        } else {
            sampleModel =
		new PixelInterleavedSampleModel(dataType,
						destinationRegion.width,
						destinationRegion.height,
						sourceBands.length,
						destinationRegion.width *
						sourceBands.length,
						destBands);

            colorModel = ImageUtil.createColorModel(null, sampleModel);
        }

        // If the destination is provided, then use it. Otherwise, create new
	// one
        BufferedImage bi = param.getDestination();

        // Get the image data.
        WritableRaster raster = null;

        if (bi == null) {
            sampleModel = sampleModel.createCompatibleSampleModel(
			       destinationRegion.x + destinationRegion.width,
			       destinationRegion.y + destinationRegion.height);
            if (seleBand)
                sampleModel = sampleModel.createSubsetSampleModel(sourceBands);

            raster = Raster.createWritableRaster(sampleModel, new Point());
            bi = new BufferedImage(colorModel, raster, false, null);
        } else {
            raster = bi.getWritableTile(0, 0);
            sampleModel = bi.getSampleModel();
            colorModel = bi.getColorModel();
	    noTransform &= destinationRegion.equals(raster.getBounds());
        }

        switch (variant) {
            case PBM_RAW:
            {

                // SampleModel for these cases should be MultiPixelPacked.
                DataBuffer dataBuffer = raster.getDataBuffer();

                // Read the entire image.
                byte[] buf = ((DataBufferByte)dataBuffer).getData();
                if (noTransform) {
                    iis.readFully(buf, 0, buf.length);
                    processImageUpdate(bi,
                                       0, 0,
                                       width, height, 1, 1,
                                       destBands);
                    processImageProgress(100.0F);
                } else if (scaleX == 1  && sourceRegion.x % 8 == 0) {
                    int skip = sourceRegion.x >> 3;
                    int originalLS = width + 7 >> 3;
                    int destLS = raster.getWidth() + 7 >> 3;

                    int readLength = sourceRegion.width + 7 >> 3;
                    int offset = sourceRegion.y * originalLS;
                    iis.skipBytes(offset + skip);
                    offset = originalLS * (scaleY - 1) + originalLS - readLength;
                    byte[] lineData = new byte[readLength];

                    int bitoff = destinationRegion.x & 7;
                    boolean reformat = !(bitoff == 0);

                    for (int i = 0, j = 0,
                        k = destinationRegion.y * destLS + (destinationRegion.x >> 3);
                        i < destinationRegion.height; i++, j += scaleY) {
                        if (reformat) {
                            iis.read(lineData, 0, readLength);
                            int mask1 = (255 << bitoff) & 255;
                            int mask2 = ~mask1 & 255;
                            int shift = 8 - bitoff;

                            int n = 0;
                            int m = k;
                            for (; n < readLength -1; n++, m++)
                                buf[m] = (byte)(((lineData[n] & mask2) << shift) |
                                                (lineData[n + 1] & mask1) >>bitoff);
                            buf[m] = (byte)((lineData[n] & mask2) << shift);
                        } else {
                            iis.read(buf, k, readLength);
                        }

                        iis.skipBytes(offset);
                        k += destLS;

                        processImageUpdate(bi,
                                           0, i,
                                           destinationRegion.width, 1, 1, 1,
                                           destBands);
                        processImageProgress(100.0F*i/destinationRegion.height);
                    }
                } else {
                    int originalLS = width + 7 >> 3;
                    byte[] data = new byte[originalLS];
                    iis.skipBytes(sourceRegion.y * originalLS);
                    int destLS = bi.getWidth() + 7 >> 3;
                    int offset = originalLS * (scaleY - 1);
                    int dsx = destLS * destinationRegion.y +
                              (destinationRegion.x >> 3);
                    for (int i = 0, j = 0, n = dsx;
                        i < destinationRegion.height; i++, j += scaleY) {
                        iis.read(data, 0, originalLS);
                        iis.skipBytes(offset);

                        int b = 0;
                        int pos = 7 - (destinationRegion.x & 7);
                        for (int m = sourceRegion.x;
                            m < sourceRegion.x + sourceRegion.width;
                            m += scaleX) {
                            b |= (data[m >> 3] >> (7 - (m & 7)) & 1) << pos;
                            pos--;
                            if (pos == -1) {
                                buf[n++] = (byte)b;
                                b = 0;
                                pos = 7;
                            }
                        }

                        if (pos != 7)
                            buf[n++] = (byte)b;

                        n += destinationRegion.x >> 3;
                        processImageUpdate(bi,
                                           0, i,
                                           destinationRegion.width, 1, 1, 1,
                                           destBands);
                        processImageProgress(100.0F*i/destinationRegion.height);
                    }
                }
                break;
            }
            case PBM_ASCII:
            {
                DataBuffer dataBuffer = raster.getDataBuffer();
                byte[] buf = ((DataBufferByte)dataBuffer).getData();
                if (noTransform)
                    for (int i = 0, n = 0; i < height; i++) {
                        int b = 0;
                        int pos = 7;
                        for (int j = 0; j < width; j++) {
                            b |= (readInteger(iis) & 1) << pos;
                            pos--;
                            if (pos == -1 ) {
                                buf[n++] = (byte)b;
                                b = 0;
                                pos = 7;
                            }
                        }
                        if (pos != 7)
                            buf[n++] = (byte)b;
                        processImageUpdate(bi,
                                           0, i,
                                           width, 1, 1, 1,
                                           destBands);
                        processImageProgress(100.0F * i / height);
                    }
                else {
                    skipInteger(iis, sourceRegion.y * width + sourceRegion.x);
                    int skipX = scaleX - 1;
                    int skipY = (scaleY - 1) * width +
                                width - destinationRegion.width * scaleX;
                    int dsx = (bi.getWidth() + 7 >> 3) *
                              destinationRegion.y + (destinationRegion.x >> 3);
                    for (int i = 0, n = dsx; i < destinationRegion.height; i++) {
                        int b = 0;
                        int pos = 7 - (destinationRegion.x & 7);
                        for (int j = 0; j < destinationRegion.width; j++) {
                            b |= (readInteger(iis) & 1) << pos;
                            pos--;
                            if (pos == -1 ) {
                                buf[n++] = (byte)b;
                                b = 0;
                                pos = 7;
                            }
                            skipInteger(iis, skipX);
                        }
                        if (pos != 7)
                            buf[n++] = (byte)b;

                        n += destinationRegion.x >> 3;
                        skipInteger(iis, skipY);
                        processImageUpdate(bi,
                                           0, i,
                                           destinationRegion.width, 1, 1, 1,
                                           destBands);
                        processImageProgress(100.0F*i/destinationRegion.height);
                    }
                }
                break;
            }
            case PGM_ASCII:
            case PGM_RAW:
            case PPM_ASCII:
            case PPM_RAW:
                // SampleModel for these cases should be PixelInterleaved.
                int skipX = (scaleX - 1) * numBands;
                int skipY = (scaleY * width -
                            destinationRegion.width * scaleX) * numBands;
                int dsx = (bi.getWidth() * destinationRegion. y +
                          destinationRegion.x) * numBands;
                switch (dataType) {
                case DataBuffer.TYPE_BYTE:
                    DataBufferByte bbuf =
                        (DataBufferByte)raster.getDataBuffer();
                    byte[] byteArray = bbuf.getData();
                    if (isRaw(variant)) {
                        if (noTransform) {
                            iis.readFully(byteArray);
                            processImageUpdate(bi,
                                           0, 0,
                                           width, height, 1, 1,
                                           destBands);
                            processImageProgress(100.0F);
                        } else {
                            iis.skipBytes(sourceRegion.y * width * numBands);
                            int skip = (scaleY - 1) * width * numBands;
                            byte[] data = new byte[width * numBands];
                            int pixelStride = scaleX * numBands;
                            int sx = sourceRegion.x * numBands;
                            int ex = width;
                            for (int i = 0, n = dsx ; i < destinationRegion.height; i++) {
                                iis.read(data);
                                for (int j = sourceRegion.x, k = sx;
                                    j < sourceRegion.x + sourceRegion.width;
                                    j+= scaleX, k += pixelStride) {
                                    for (int m = 0; m < sourceBands.length; m++)
                                        byteArray[n+ destBands[m]] = data[k + sourceBands[m]];
                                    n += sourceBands.length;
                                }
                                n += destinationRegion.x * numBands;
                                iis.skipBytes(skip);
                                processImageUpdate(bi,
                                                   0, i,
                                                   destinationRegion.width, 1, 1, 1,
                                                   destBands);
                                processImageProgress(100.0F*i/destinationRegion.height);
                            }
                        }
                    } else {
                        skipInteger(iis,
                                    (sourceRegion.y * width + sourceRegion.x) *
                                    numBands);

                        if (seleBand) {
                            byte[] data = new byte[numBands];
                            for (int i = 0, n = dsx; i < destinationRegion.height; i++) {
                                for (int j = 0; j < destinationRegion.width; j++) {
                                    for (int k = 0; k < numBands; k++)
                                        data[k] = (byte)readInteger(iis);
                                    for (int k = 0; k < sourceBands.length; k++)
                                        byteArray[n+destBands[k]] = data[sourceBands[k]];
                                    n += sourceBands.length;
                                    skipInteger(iis, skipX);
                                }
                                n += destinationRegion.x * sourceBands.length;
                                skipInteger(iis, skipY);
                                processImageUpdate(bi,
                                                   0, i,
                                                   destinationRegion.width, 1, 1, 1,
                                                   destBands);
                                processImageProgress(100.0F*i/destinationRegion.height);
                            }
                        } else
                            for (int i = 0, n = dsx; i < destinationRegion.height; i++) {
                                for (int j = 0; j < destinationRegion.width; j++) {
                                    for (int k = 0; k < numBands; k++)
                                        byteArray[n++] = (byte)readInteger(iis);
                                    skipInteger(iis, skipX);
                                }
                                n += destinationRegion.x * sourceBands.length;
                                skipInteger(iis, skipY);
                                processImageUpdate(bi,
                                                   0, i,
                                                   destinationRegion.width, 1, 1, 1,
                                                   destBands);
                                processImageProgress(100.0F*i/destinationRegion.height);
                            }
                    }
                    break;

                case DataBuffer.TYPE_USHORT:
                    DataBufferUShort sbuf =
                        (DataBufferUShort)raster.getDataBuffer();
                    short[] shortArray = sbuf.getData();
                    skipInteger(iis, sourceRegion.y * width * numBands + sourceRegion.x);

                    if (seleBand) {
                        short[] data = new short[numBands];
                        for (int i = 0, n = dsx; i < destinationRegion.height; i++) {
                            for (int j = 0; j < destinationRegion.width; j++) {
                                for (int k = 0; k < numBands; k++)
                                    data[k] = (short)readInteger(iis);
                                for (int k = 0; k < sourceBands.length; k++)
                                    shortArray[n+destBands[k]] = data[sourceBands[k]];
                                n += sourceBands.length;
                                skipInteger(iis, skipX);
                            }
                            n += destinationRegion.x * sourceBands.length;
                            skipInteger(iis, skipY);
                            processImageUpdate(bi,
                                               0, i,
                                               destinationRegion.width, 1, 1, 1,
                                               destBands);
                            processImageProgress(100.0F*i/destinationRegion.height);
                        }
                    } else
                        for (int i = 0, n = dsx; i < destinationRegion.height; i++) {
                            for (int j = 0; j < destinationRegion.width; j++) {
                                for (int k = 0; k < numBands; k++)
                                    shortArray[n++] = (short)readInteger(iis);
                                skipInteger(iis, skipX);
                            }
                            n += destinationRegion.x * sourceBands.length;
                            skipInteger(iis, skipY);
                            processImageUpdate(bi,
                                               0, i,
                                               destinationRegion.width, 1, 1, 1,
                                               destBands);
                            processImageProgress(100.0F*i/destinationRegion.height);
                        }
                    break;

                case DataBuffer.TYPE_INT:
                    DataBufferInt ibuf =
                        (DataBufferInt)raster.getDataBuffer();
                    int[] intArray = ibuf.getData();
                    skipInteger(iis, sourceRegion.y * width * numBands + sourceRegion.x);
                    if (seleBand) {
                        int[] data = new int[numBands];
                        for (int i = 0, n = dsx; i < destinationRegion.height; i++) {
                            for (int j = 0; j < destinationRegion.width; j++) {
                                for (int k = 0; k < numBands; k++)
                                    data[k] = readInteger(iis);
                                for (int k = 0; k < sourceBands.length; k++)
                                    intArray[n+destBands[k]] = data[sourceBands[k]];
                                n += sourceBands.length;
                                skipInteger(iis, skipX);
                            }
                            n += destinationRegion.x * sourceBands.length;
                            skipInteger(iis, skipY);
                            processImageUpdate(bi,
                                               0, i,
                                               destinationRegion.width, 1, 1, 1,
                                               destBands);
                            processImageProgress(100.0F*i/destinationRegion.height);
                        }
                    } else
                        for (int i = 0, n = dsx; i < destinationRegion.height; i++) {
                            for (int j = 0; j < destinationRegion.width; j++) {
                                for (int k = 0; k < numBands; k++)
                                    intArray[n++] = readInteger(iis);
                                skipInteger(iis, skipX);
                            }
                            n += destinationRegion.x * sourceBands.length;
                            skipInteger(iis, skipY);
                            processImageUpdate(bi,
                                               0, i,
                                               destinationRegion.width, 1, 1, 1,
                                               destBands);
                            processImageProgress(100.0F*i/destinationRegion.height);
                        }
                    break;
                }
                break;
        }

        if (abortRequested())
            processReadAborted();
        else
            processImageComplete();
        return bi;
    }

    public boolean canReadRaster() {
        return true;
    }

    public Raster readRaster(int imageIndex,
                             ImageReadParam param) throws IOException {
        BufferedImage bi = read(imageIndex, param);
        return bi.getData();
    }

    public void reset() {
        super.reset();
        iis = null;
        gotHeader = false;
        System.gc();
    }

    /** Returns true if file variant is raw format, false if ASCII. */
    private boolean isRaw(int v) {
        return (v >= PBM_RAW);
    }

    /** Reads the comments. */
    private void readComments(ImageInputStream stream,
                              PNMMetadata metadata) throws IOException {
        String line = null;
        int pos = -1;
        stream.mark();
        while ((line = stream.readLine()) != null &&
               (pos = line.indexOf("#")) >= 0) {
            metadata.addComment(line.substring(pos + 1).trim());
        }
        stream.reset();
    }

    /** Reads the next integer. */
    private int readInteger(ImageInputStream stream) throws IOException {
        boolean foundDigit = false;

        while (aLine == null) {
            aLine = stream.readLine();
            if (aLine == null)
                return 0;
            int pos = aLine.indexOf("#");
            if (pos == 0)
                aLine = null;
            else if (pos > 0)
                aLine = aLine.substring(0, pos - 1);

            if (aLine != null)
                token = new StringTokenizer(aLine);
        }

        while (token.hasMoreTokens()) {
            String s = token.nextToken();

            try {
                return new Integer(s).intValue();
            } catch (NumberFormatException e) {
                continue;
            }
        }

        if (!foundDigit) {
            aLine = null;
            return readInteger(stream);
        }

        return 0;
    }

    private void skipInteger(ImageInputStream stream, int num) throws IOException {
        for (int i = 0; i < num; i++)
            readInteger(stream);
    }
}


text:
package de.agilecoders.projects.scaspell.api

import com.twitter.util.{Await, Future}

/**
 * TODO miha: document class purpose
 *
 * @author miha
 */
object Aspell {

}

case class Aspell() extends Spellchecker {

    import scala.sys.process._

    private lazy val _availableLanguages: Seq[String] = {
        Await.result(availableLanguages())
    }

    private lazy val _availableModes: Seq[String] = {
        Await.result(availableModes()).map(_._1).toSeq
    }

    def availableLanguages(filter: Option[String] = None): Future[Seq[String]] = Future {
        val languages = Process("aspell dump dicts").lines.map(_.trim)

        filter.map {
            case "main" =>
                languages.filter(!_.contains("-"))
            case _ => languages
        }.getOrElse(languages)
    }

    def version(): Future[String] = Future {
        "aspell -v".!!.replace("@(#) ", "").trim
    }

    def checkWords(words: Seq[String], lang: Option[String] = None, limit: Option[Int] = None): Future[Map[String, Seq[String]]] = Future {
        exec(lang, limit) {
            Strings.toWordsList(words)
        }
    }

    private lazy val resultRegEx = """&\s([^\s]*)\s(\d*)\s(\d*):(.*)""".r

    private def parse(result: String, limit: Int): Option[(String, Seq[String])] = {
        resultRegEx.findAllIn(result).matchData.map(m => {
            (m.group(1), m.group(4).split(',').map(_.trim).take(limit).toSeq)
        }).toSeq.headOption
    }

    def checkHtml(html: String, lang: Option[String] = None, limit: Option[Int] = None): Future[Map[String, Seq[String]]] = Future {
        exec(lang, limit) {
            Strings.toHtml(html)
        }
    }

    private def exec(lang: Option[String] = None,
                     limit: Option[Int] = None,
                     mode:Option[String] = None)(f: => String): Map[String, Seq[String]] = {
        val l = Strings.toLanguageParameter(lang.filter(_availableLanguages.contains))
        val m = Strings.toModeParameter(mode.filter(_availableModes.contains))

        val echo = s"echo $f"
        val aspell = s"aspell pipe --encoding=utf-8 $l $m"
        val grep = """grep -v "\*|\@|^$""""

        val results = (echo #| aspell #| grep #| "uniq").lines_!

        results.filter(r => !r.isEmpty && r(0) == '&')
        results.map(parse(_, limit.getOrElse(25))).filter(_.isDefined).map(_.get).toMap
    }

    /**
     * Lists available modes
     *
     * @return
     */
    override def availableModes() = Future {
        "aspell --dump=modes".lines_!.map {
            line =>
                val s = line.split(" ", 2)

                (s(0).trim, s(1).trim)
        }.toMap
    }

    /**
     * Produce a list of misspelled words
     *
     * @param input
     * @param mode
     * @param lang
     * @param limit
     * @return
     */
    override def check(input: String, mode: Option[String], lang: Option[String], limit: Option[Int]) = Future {
        exec(lang, limit, mode) {
            mode.map {
                case "html" | "email" | "sgml" | "texinfo" | "perl" | "ccpp" |
                     "nroff" | "tex" | "comment" | "url" | "none" =>
                    Strings.toHtml(input)
                case _ =>
                    Strings.toWordsList(input.split(","))
            }.getOrElse("")
        }
    }
}

object Strings {

    def toWordsList(words: Seq[String]): String = {
        words.map(_.replaceAll(",", " ").replaceAll("|", " ").trim).filter(!_.isEmpty).mkString(",")
    }

    def toHtml(html: String): String = {
        html.replaceAll("|", " ")
    }

    def toLanguageParameter(lang: Option[String]): String = {
        lang.filter(!_.isEmpty).map(s => "--lang=" + s).getOrElse("")
    }

    def toModeParameter(lang: Option[String]): String = {
        lang.filter(!_.isEmpty).map(s => "--mode=" + s).getOrElse("")
    }

}

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace Slik\Uncia\Exception;

class NotImplemented extends \Slik\Uncia\Exception
{
}


text:
#pragma once

#include "il2cpp-config.h"

#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif

#include <stdint.h>
#include <assert.h>
#include <exception>

// UnityEngine.Networking.UploadHandler
struct UploadHandler_t4062689071;
// System.Byte[]
struct ByteU5BU5D_t4260760469;
// System.String
struct String_t;
struct UploadHandler_t4062689071_marshaled_pinvoke;
struct UploadHandler_t4062689071_marshaled_com;

#include "codegen/il2cpp-codegen.h"
#include "mscorlib_System_String7231557.h"

// System.Void UnityEngine.Networking.UploadHandler::.ctor()
extern "C"  void UploadHandler__ctor_m4145774046 (UploadHandler_t4062689071 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Networking.UploadHandler::InternalCreateRaw(System.Byte[])
extern "C"  void UploadHandler_InternalCreateRaw_m3364909982 (UploadHandler_t4062689071 * __this, ByteU5BU5D_t4260760469* ___data0, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Networking.UploadHandler::InternalDestroy()
extern "C"  void UploadHandler_InternalDestroy_m3840871545 (UploadHandler_t4062689071 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Networking.UploadHandler::Finalize()
extern "C"  void UploadHandler_Finalize_m777547204 (UploadHandler_t4062689071 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Networking.UploadHandler::Dispose()
extern "C"  void UploadHandler_Dispose_m2552457883 (UploadHandler_t4062689071 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Networking.UploadHandler::set_contentType(System.String)
extern "C"  void UploadHandler_set_contentType_m3087243632 (UploadHandler_t4062689071 * __this, String_t* ___value0, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Networking.UploadHandler::SetContentType(System.String)
extern "C"  void UploadHandler_SetContentType_m1034215851 (UploadHandler_t4062689071 * __this, String_t* ___newContentType0, const MethodInfo* method) IL2CPP_METHOD_ATTR;

// Methods for marshaling
struct UploadHandler_t4062689071;
struct UploadHandler_t4062689071_marshaled_pinvoke;

extern "C" void UploadHandler_t4062689071_marshal_pinvoke(const UploadHandler_t4062689071& unmarshaled, UploadHandler_t4062689071_marshaled_pinvoke& marshaled);
extern "C" void UploadHandler_t4062689071_marshal_pinvoke_back(const UploadHandler_t4062689071_marshaled_pinvoke& marshaled, UploadHandler_t4062689071& unmarshaled);
extern "C" void UploadHandler_t4062689071_marshal_pinvoke_cleanup(UploadHandler_t4062689071_marshaled_pinvoke& marshaled);

// Methods for marshaling
struct UploadHandler_t4062689071;
struct UploadHandler_t4062689071_marshaled_com;

extern "C" void UploadHandler_t4062689071_marshal_com(const UploadHandler_t4062689071& unmarshaled, UploadHandler_t4062689071_marshaled_com& marshaled);
extern "C" void UploadHandler_t4062689071_marshal_com_back(const UploadHandler_t4062689071_marshaled_com& marshaled, UploadHandler_t4062689071& unmarshaled);
extern "C" void UploadHandler_t4062689071_marshal_com_cleanup(UploadHandler_t4062689071_marshaled_com& marshaled);


text:
*   added `_truncate_exc`, defaulting to `True`, which tells our exceptions to truncate output.
*   bugfix for exceptions whose messages contained unicode
*   `_done` callback no longer assumes you want your command put in the background.
*   `_done` callback is now called asynchronously in a separate thread.
*   `_done` callback is called regardless of exception, which is necessary in order to release held resources, for example a process pool

## 1.10 - 12/30/14

*   partially applied functions with `functools.partial` have been fixed for `_out` and `_err` callbacks [#160](https://github.com/amoffat/sh/issues/160)
*   `_out` or `_err` being callables no longer puts the running command in the background.  to achieve the previous behavior, pass `_bg=True` to your command.
*   deprecated `_with` contexts [#195](https://github.com/amoffat/sh/issues/195)
*   `_timeout_signal` allows you to specify your own signal to kill a timed-out process with.  use a constant from the `signal` stdlib module. [#171](https://github.com/amoffat/sh/issues/171)
*   signal exceptions can now be caught by number or name.  `SignalException_9 == SignalException_SIGKILL`
*   child processes that timeout via `_timeout` raise `sh.TimeoutException` instead of `sh.SignalExeception_9` [#172](https://github.com/amoffat/sh/issues/172)
*   fixed `help(sh)` from the python shell and `pydoc sh` from the command line. [#173](https://github.com/amoffat/sh/issues/173)
*   program names can no longer be shadowed by names that sh.py defines internally. removed the requirement of trailing underscores for programs that could have their names shadowed, like `id`.
*   memory optimization when a child process's stdin is a newline-delimted string and our bufsize is newlines
*   feature, `_done` special keyword argument that accepts a callback to be called when the command completes successfully [#185](https://github.com/amoffat/sh/issues/185)
*   bugfix for being unable to print a baked command in python3+ [#176](https://github.com/amoffat/sh/issues/176)
*   bugfix for cwd not existing and causing the child process to continue running parent process code [#202](https://github.com/amoffat/sh/issues/202)
*   child process is now guaranteed to exit on exception between fork and exec.
*   fix python2 deprecation warning when running with -3 [PR #165](https://github.com/amoffat/sh/pull/165)
*   bugfix where sh.py was attempting to execute directories [#196](https://github.com/amoffat/sh/issues/196), [PR #189](https://github.com/amoffat/sh/pull/189)
*   only backgrounded processes will ignore SIGHUP
*   allowed `ok_code` to take a `range` object. [#PR 210](https://github.com/amoffat/sh/pull/210/files)
*   added `sh.args` with context which allows overriding of all command defaults for the duration of that context.
*   added `sh.pushd` with context which takes a directory name and changes to that directory for the duration of that with context. [PR #206](https://github.com/amoffat/sh/pull/206)
*   tests now include python 3.4 if available.  tests also stop on the first
    python that suite that fails.
*   SIGABRT, SIGBUS, SIGFPE, SIGILL, SIGPIPE, SIGSYS have been added to the list of signals that throw an exception [PR #201](https://github.com/amoffat/sh/pull/201)
*   "callable" builtin has been faked for python3.1, which lacks it.
*   "direct" option added to `_piped` special keyword argument, which allows sh to hand off a process's stdout fd directly to another process, instead of buffering its stdout internally, then handing it off.  [#119](https://github.com/amoffat/sh/issues/119)

## 1.09 - 9/08/13

*   Fixed encoding errors related to a system encoding "ascii". [#123](https://github.com/amoffat/sh/issues/123)
*   Added exit_code attribute to SignalException and ErrorReturnCode exception classes. [#127](https://github.com/amoffat/sh/issues/127)
*   Making the default behavior of spawned processes to not be explicitly killed when the parent python process ends. Also making the spawned process ignore SIGHUP. [#139](https://github.com/amoffat/sh/issues/139)
*   Made OSX sleep hack to apply to PY2 as well as PY3.

## 1.08 - 1/29/12

*	Added SignalException class and made all commands that end terminate by a signal defined in SIGNALS_THAT_SHOULD_THROW_EXCEPTION raise it. [#91](https://github.com/amoffat/sh/issues/91)
*   Bugfix where CommandNotFound was not being raised if Command was created by instantiation.  [#113](https://github.com/amoffat/sh/issues/113)
*   Bugfix for Commands that are wrapped with functools.wraps() [#121](https://github.com/amoffat/sh/issues/121]
*   Bugfix where input arguments were being assumed as ascii or unicode, but never as a string in a different encoding.
*   _long_sep keyword argument added joining together a dictionary of arguments passed in to a command
*   Commands can now be passed a dictionary of args, and the keys will be interpretted "raw", with no underscore-to-hyphen conversion
*   Reserved Python keywords can now be used as subcommands by appending an underscore `_` to them

## 1.07 - 11/21/12

*   Bugfix for PyDev when `locale.getpreferredencoding()` is empty.
*   Fixes for IPython3 that involve `sh.<tab>` and `sh?`
*   Added `_tee` special keyword argument to force stdout/stderr to store internally and make available for piping data that is being redirected.
*   Added `_decode_errors` to be passed to all stdout/stderr decoding of a process.
*   Added `_no_out`, `_no_err`, and `_no_pipe` special keyword arguments.  These are used for long-running processes with lots of output.
*   Changed custom loggers that were created for each process to fixed loggers, so there are no longer logger references laying around in the logging module after the process ends and it garbage collected.

## 1.06 - 11/10/12

*   Removed old undocumented cruft of ARG1..ARGN and ARGV.
*   Bugfix where `logging_enabled` could not be set from the importing module.
*   Disabled garbage collection before fork to prevent garbage collection in child process.
*   Major bugfix where cyclical references were preventing process objects (and their associated stdout/stderr buffers) from being garbage collected.
*   Bugfix in RunningCommand and OProc loggers, which could get really huge if a command was called that had a large number of arguments.

## 1.05 - 10/20/12

*   Changing status from alpha to beta.
*   Python 3.3 officially supported.
*   Documentation fix.  The section on exceptions now references the fact that signals do not raise an exception, even for signals that might seem like they should, e.g. segfault.
*   Bugfix with Python 3.3 where importing commands from the sh namespace resulted in an error related to `__path__`
*   Long-form and short-form options to commands may now be given False to disable the option from being passed into the command.  This is useful to pass in a boolean flag that you flip to either True or False to enable or disable some functionality at runtime.

## 1.04 - 10/07/12

*   Making `Command` class resolve the `path` parameter with `which` by default instead of expecting it to be resolved before it is passed in.  This change shouldn't affect backwards compatibility.
*   Fixing a bug when an exception is raised from a program, and the error output has non-ascii text.  This didn't work in Python < 3.0, because .decode()'s default encoding is typically ascii.


text:
'use strict';

var NativeModules = require('BatchedBridge').RemoteModules;

var nativeModulePrefixNormalizer = require('nativeModulePrefixNormalizer');

nativeModulePrefixNormalizer(NativeModules);

module.exports = NativeModules;


text:
module ObjectMomma
  VERSION = "0.9.2"
end


text:
package expreduce

const MaxUint = ^uint(0)
const MaxInt = int(MaxUint >> 1)
const MaxUint64 = ^uint64(0)
const MaxInt64 = int64(MaxUint64 >> 1)

type matchIter interface {
	// returns ismatch, pd, isdone
	next() (bool, *PDManager, bool)
}

type dummyMatchIter struct {
	pm *PDManager
}

func (this *dummyMatchIter) next() (bool, *PDManager, bool) {
	return true, this.pm, true
}

func NewMatchIter(a Ex, b Ex, pm *PDManager, es *EvalState) (matchIter, bool) {
	patternHead := ""
	patExpr, patIsExpr := b.(*Expression)
	if patIsExpr {
		sym, isSym := patExpr.Parts[0].(*Symbol)
		if isSym {
			patternHead = sym.Name
		}
	}
	if patternHead == "System`Except" {
		except := patExpr
		if len(except.Parts) == 2 {
			matchq, _ := IsMatchQ(a, except.Parts[1], pm, es)
			if !matchq {
				return &dummyMatchIter{pm}, true
			}
			return nil, false
		} else if len(except.Parts) == 3 {
			matchq, _ := IsMatchQ(a, except.Parts[1], pm, es)
			if !matchq {
				matchqb, newPm := IsMatchQ(a, except.Parts[2], pm, es)
				if matchqb {
					return &dummyMatchIter{newPm}, true
				}
			}
			return nil, false
		}
	} else if patternHead == "System`Alternatives" {
		alts := patExpr
		for _, alt := range alts.Parts[1:] {
			// I recently changed the third argument from EmptyPD() to pm
			// because MatchQ[{a, b}, {a_, k | a_}] was returning True, causing
			// problems in some of the boolean patterns. Might need to make
			// similar changes to the other pattern clauses.
			matchq, newPD := IsMatchQ(a, alt, pm, es)
			if matchq {
				return &dummyMatchIter{newPD}, true
			}
		}
		return nil, false
	} else if patternHead == "System`PatternTest" {
		patternTest := patExpr
		if len(patternTest.Parts) == 3 {
			matchq, newPD := IsMatchQ(a, patternTest.Parts[1], pm, es)
			if matchq {
				// Some Q functions are very simple and occur very often. For
				// some of these, skip the Eval() call and return the boolean
				// directly.
				testSym, testIsSym := patternTest.Parts[2].(*Symbol)
				if testIsSym {
					var qFunction singleParamQType
					if testSym.Name == "System`NumberQ" {
						qFunction = numberQ
					}
					if qFunction != nil {
						if qFunction(a) {
							return &dummyMatchIter{newPD}, true
						} else {
							return nil, false
						}
					}
				}
				// I used to create a NewEvalState here, but I have evidence
				// that the same evalstate is used:
				// MatchQ[1, a_?((mytestval = 999; NumberQ[#]) &)] // Timing
				//tmpEs := NewEvalStateNoLog(true)
				res := (NewExpression([]Ex{
					patternTest.Parts[2],
					a,
				})).Eval(es)
				resSymbol, resIsSymbol := res.(*Symbol)
				if resIsSymbol {
					if resSymbol.Name == "System`True" {
						return &dummyMatchIter{newPD}, true
					}
				}
			}
			return nil, false
		}
	} else if patternHead == "System`Condition" {
		condition := patExpr
		if len(condition.Parts) == 3 {
			mi, cont := NewMatchIter(a, condition.Parts[1], pm, es)
			for cont {
				matchq, newPD, done := mi.next()
				cont = !done
				if matchq {
					//tmpEs := NewEvalStateNoLog(true)
					res := condition.Parts[2].DeepCopy()
					res = ReplacePD(res, es, newPD).Eval(es)
					resSymbol, resIsSymbol := res.(*Symbol)
					if resIsSymbol {
						if resSymbol.Name == "System`True" {
							return &dummyMatchIter{newPD}, true
						}
					}
				}
			}
		}
	} else if patternHead == "System`Optional" {
		optional := patExpr
		if len(optional.Parts) == 2 {
			matchq, newPD := IsMatchQ(a, optional.Parts[1], pm, es)
			if matchq {
				return &dummyMatchIter{newPD}, true
			}
		}
	} else if patternHead == "System`HoldPattern" {
		holdPattern := patExpr
		if len(holdPattern.Parts) == 2 {
			return NewMatchIter(a, holdPattern.Parts[1], pm, es)
		}
	}

	// Continue normally
	_, aIsFlt := a.(*Flt)
	_, aIsInteger := a.(*Integer)
	_, aIsString := a.(*String)
	_, aIsSymbol := a.(*Symbol)
	aRational, aIsRational := a.(*Rational)
	bRational, bIsRational := b.(*Rational)
	aExpression, aIsExpression := a.(*Expression)
	bExpression, bIsExpression := b.(*Expression)

	// Special case for the operator form of Verbatim
	forceOrdered := false
	verbatimOp, opExpr, isVerbatimOp := OperatorAssertion(b, "System`Verbatim")
	if aIsExpression && isVerbatimOp {
		if len(opExpr.Parts) == 2 {
			if IsSameQ(aExpression.Parts[0], opExpr.Parts[1], &es.CASLogger) {
				b = NewExpression(append([]Ex{opExpr.Parts[1]}, verbatimOp.Parts[1:]...))
				bExpression, bIsExpression = b.(*Expression)
				forceOrdered = true
			}
		}
	}

	// This initial value is just a randomly chosen placeholder
	var headEx Ex
	if aIsFlt {
		headEx = NewSymbol("System`Real")
	} else if aIsInteger {
		headEx = NewSymbol("System`Integer")
	} else if aIsString {
		headEx = NewSymbol("System`String")
	} else if aIsExpression {
		headEx = aExpression.Parts[0]
	} else if aIsSymbol {
		headEx = NewSymbol("System`Symbol")
	} else if aIsRational {
		headEx = NewSymbol("System`Rational")
	}

	if IsBlankTypeOnly(b) {
		ibtc, ibtcNewPDs := IsBlankTypeCapturing(b, a, headEx, pm, &es.CASLogger)
		if ibtc {
			return &dummyMatchIter{ibtcNewPDs}, true
		}
		return nil, false
	}

	// Handle special case for matching Rational[a_Integer, b_Integer]
	if aIsRational && bIsExpression {
		matchq, newPm := isMatchQRational(aRational, bExpression, pm, es)
		if matchq {
			return &dummyMatchIter{newPm}, true
		}
		return nil, false
	} else if aIsExpression && bIsRational {
		matchq, newPm := isMatchQRational(bRational, aExpression, pm, es)
		if matchq {
			return &dummyMatchIter{newPm}, true
		}
		return nil, false
	}

	canAssumeHead := false
	assumingHead := false
	if bIsExpression {
		bExpressionSym, bExpressionSymOk := bExpression.Parts[0].(*Symbol)
		if bExpressionSymOk {
			oneIdentity := bExpressionSym.Attrs(&es.defined).OneIdentity
			hasDefaultExpr := bExpressionSym.Default(&es.defined) != nil
			containsOptional := false
			for _, part := range bExpression.Parts[1:] {
				if _, isOpt := HeadAssertion(part, "System`Optional"); isOpt {
					containsOptional = true
					break
				}
			}
			if oneIdentity && hasDefaultExpr && containsOptional {
				canAssumeHead = true
			}
		}

		// Handle special case where MatchQ[a,a+c_.] is True
		if canAssumeHead && !aIsExpression {
			// Normally this would always fail, but if the conditions are right,
			// let's configure the variables such that we at least try for a
			// sequence match.
			assumingHead = true
			aIsExpression = true
			aExpression = NewExpression([]Ex{bExpressionSym, a})
		}
		if aIsExpression {
			aExpressionSym, aExpressionSymOk := aExpression.Parts[0].(*Symbol)
			if canAssumeHead && aExpressionSymOk {
				if aExpressionSym.Name != bExpressionSym.Name {
					assumingHead = true
					aIsExpression = true
					aExpression = NewExpression([]Ex{bExpressionSym, a})
				}
			}
		}
	}

	if !assumingHead {
		if aIsFlt || aIsInteger || aIsString || aIsSymbol || aIsRational {
			if IsSameQ(a, b, &es.CASLogger) {
				return &dummyMatchIter{nil}, true
			}
			return nil, false
		} else if !(aIsExpression && bIsExpression) {
			return nil, false
		}
	}

	attrs := Attributes{}
	sequenceHead := "Sequence"
	startI := 0
	aExpressionSym, aExpressionSymOk := aExpression.Parts[0].(*Symbol)
	bExpressionSym, bExpressionSymOk := bExpression.Parts[0].(*Symbol)
	if aExpressionSymOk && bExpressionSymOk {
		if aExpressionSym.Name == bExpressionSym.Name {
			attrs = aExpressionSym.Attrs(&es.defined)
			sequenceHead = aExpressionSym.Name
			startI = 1
		}
	}

	isOrderless := attrs.Orderless && !forceOrdered
	isFlat := attrs.Flat && !forceOrdered
	nomi, ok := NewSequenceMatchIter(aExpression.Parts[startI:], bExpression.Parts[startI:], isOrderless, isFlat, sequenceHead, pm, es)
	if !ok {
		return nil, false
	}
	return nomi, true
}

func isMatchQRational(a *Rational, b *Expression, pm *PDManager, es *EvalState) (bool, *PDManager) {
	return IsMatchQ(
		NewExpression([]Ex{
			NewSymbol("System`Rational"),
			NewInteger(a.Num),
			NewInteger(a.Den),
		}),

		b, pm, es)
}

type assignedIterState struct {
	formI int
	assnI int
	pm    *PDManager
}

type assignedMatchIter struct {
	assn [][]int

	// Inherited from sequenceMatchIter
	components     []Ex
	lhs_components []parsedForm
	pm             *PDManager
	sequenceHead   string
	es             *EvalState
	stack          []assignedIterState
}

func NewAssignedMatchIter(assn [][]int, smi *sequenceMatchIter) assignedMatchIter {
	ami := assignedMatchIter{}
	ami.assn = assn
	ami.components = smi.components
	ami.lhs_components = smi.lhs_components
	ami.pm = smi.pm
	ami.sequenceHead = smi.sequenceHead
	ami.es = smi.es
	ami.stack = []assignedIterState{
		{0, 0, CopyPD(ami.pm)},
	}
	return ami
}

func (ami *assignedMatchIter) next() bool {
	for len(ami.stack) > 0 {
		var p assignedIterState
		l := len(ami.stack)
		ami.stack, p = ami.stack[:l-1], ami.stack[l-1]

		if p.formI >= len(ami.assn) {
			// We found a sequence match!
			ami.pm = p.pm
			return true
		}
		lhs := ami.lhs_components[p.formI]
		if p.assnI >= len(ami.assn[p.formI]) {
			// Reached end of form. Attempt to define the sequence and continue
			// on success.
			seq := make([]Ex, len(ami.assn[p.formI]))
			for i, assignedComp := range ami.assn[p.formI] {
				seq[i] = ami.components[assignedComp]
			}
			patOk := DefineSequence(lhs, seq, p.pm, ami.sequenceHead, ami.es)
			if patOk {
				ami.stack = append(ami.stack, assignedIterState{
					p.formI + 1, 0, p.pm,
				})
			}
			continue
		}

		//matches, newPm := IsMatchQ(comp, lhs.form, p.pm, ami.es)
		//if matches {
		comp := ami.components[ami.assn[p.formI][p.assnI]]
		toAddReversed := []*PDManager{}
		mi, cont := NewMatchIter(comp, lhs.form, p.pm, ami.es)
		for cont {
			matchq, submatches, done := mi.next()
			cont = !done
			if matchq {
				// TODO: Perhaps check if submatches are different before
				// adding?
				toAddReversed = append(toAddReversed, submatches)
			}
		}
		for i := len(toAddReversed) - 1; i >= 0; i-- {
			updatedPm := p.pm
			if toAddReversed[i] != nil && toAddReversed[i].Len() > 0 {
				if len(toAddReversed) > 1 {
					updatedPm = CopyPD(p.pm)
				}
				updatedPm.Update(toAddReversed[i])
			}
			ami.stack = append(ami.stack, assignedIterState{
				p.formI, p.assnI + 1, updatedPm,
			})
		}
	}
	return false
}

type sequenceMatchIter struct {
	components     []Ex
	lhs_components []parsedForm
	pm             *PDManager
	sequenceHead   string
	es             *EvalState
	ai             assnIter
	iteratingAmi   bool
	ami            assignedMatchIter
}

func NewSequenceMatchIter(components []Ex, lhs_components []Ex, isOrderless bool, isFlat bool, sequenceHead string, pm *PDManager, es *EvalState) (matchIter, bool) {
	headDefault := (NewSymbol(sequenceHead)).Default(&es.defined)
	fp_components := make([]parsedForm, len(lhs_components))
	for i, comp := range lhs_components {
		fp_components[i] = ParseForm(comp, isFlat, sequenceHead, headDefault, &es.CASLogger)
	}
	return NewSequenceMatchIterPreparsed(components, fp_components, isOrderless, sequenceHead, pm, es)
}

func NewSequenceMatchIterPreparsed(components []Ex, lhs_components []parsedForm, isOrderless bool, sequenceHead string, pm *PDManager, es *EvalState) (matchIter, bool) {
	nomi := &sequenceMatchIter{}
	nomi.components = components
	nomi.lhs_components = lhs_components
	nomi.pm = pm
	nomi.sequenceHead = sequenceHead
	nomi.es = es

	origFrozen := es.IsFrozen()
	es.SetFrozen(true)
	formMatches := make([][]bool, len(lhs_components))
	for i, mustContain := range lhs_components {
		// Right now I have this strange definition of "form". It's basically where I convert blank sequences to blanks at the bottom level. What if I did this at all levels and perhaps did something with patterns?
		// TODO: prevent the checks here from modifying state so I can use the "rm" function.
		formMatches[i] = make([]bool, len(components))
		num_matches := 0
		for j, part := range components {
			matchq, _ := IsMatchQ(part, mustContain.form, EmptyPD(), es)
			if matchq {
				num_matches++
			}
			formMatches[i][j] = matchq
		}
		if num_matches < mustContain.startI {
			es.SetFrozen(origFrozen)
			return nomi, false
		}
	}
	es.SetFrozen(origFrozen)

	nomi.ai = NewAssnIter(len(components), lhs_components, formMatches, isOrderless)

	return nomi, true
}

func (this *sequenceMatchIter) next() (bool, *PDManager, bool) {
	for {
		if this.iteratingAmi && this.ami.next() {
			return true, this.ami.pm, false
		}
		this.iteratingAmi = false
		if !this.ai.next() {
			break
		}
		this.ami = NewAssignedMatchIter(this.ai.assns, this)
		this.iteratingAmi = true
	}
	return false, this.pm, true
}

// HELPER FUNCTIONS

func ComponentsIsMatchQ(components []Ex, lhs_components []Ex, isOrderless bool, isFlat bool, sequenceHead string, pm *PDManager, es *EvalState) (bool, *PDManager) {
	omi, cont := NewSequenceMatchIter(components, lhs_components, isOrderless, isFlat, sequenceHead, pm, es)
	return GetMatchQ(omi, cont, pm)
}

func GetMatchQ(mi matchIter, cont bool, pm *PDManager) (bool, *PDManager) {
	for cont {
		matchq, newPd, done := mi.next()
		cont = !done
		// TODO: I could probably update my matchiters to only return if they
		// have a match or are done.
		if matchq {
			return true, newPd
		}
	}
	return false, pm
}

// TODO: do not export this
func IsMatchQ(a Ex, b Ex, pm *PDManager, es *EvalState) (bool, *PDManager) {
	mi, cont := NewMatchIter(a, b, pm, es)
	return GetMatchQ(mi, cont, pm)
}


text:
/*
	Document   : jquery.pnotify.default.css
	Created on : Nov 23, 2009, 3:14:10 PM
	Author     : Hunter Perrin
	Version    : 1.0.0
	Description:
		Default styling for Pines Notify jQuery plugin.
*/

/* Notice
----------------------------------*/
.ui-pnotify {
	top: 18px;
	right: 18px;
	position: absolute;
	height: auto;
	/* Ensure that the notices are on top of everything else. */
	z-index: 9999;
}
/* This hides position: fixed from IE6, which doesn't understand it. */
html > body .ui-pnotify {
	position: fixed;
}
.ui-pnotify .ui-pnotify-shadow {
	margin: 0;
	position: absolute;
	top: .1em;
	left: .1em;
	bottom: -.2em;
	right: -.2em;
	z-index: -1;
}
.ui-pnotify-container {
	background-position: 0 0;
	padding: .8em;
	height: 100%;
}
.ui-pnotify-closer {
	float: right;
	margin-left: .2em;
}
.ui-pnotify-title {
	display: block;
	font-size: 0.9em;
	font-weight: bold;
        line-height: 16px;
        margin-bottom: 0.5em;

}
.ui-pnotify-text {
	display: block;
        font-size: 0.85em;
}
.ui-pnotify-icon, .ui-pnotify-icon span {
	display: block;
	float: left;
	margin-right: .2em;
}
/* History Pulldown
----------------------------------*/
.ui-pnotify-history-container {
	position: absolute;
	top: 0;
	right: 18px;
	width: 70px;
	border-top: none;
	/* Ensure that the history container is on top of the notices. */
	z-index: 10000;
}
.ui-pnotify-history-container .ui-pnotify-history-header {
	padding: 2px;
        text-align: center;
}
.ui-pnotify-history-container button {
	cursor: pointer;
	display: block;
	width: 100%;
}
.ui-pnotify-history-container .ui-pnotify-history-pulldown {
	display: block;
	margin: 0 auto;
}


text:
package com.xyrotech.MarzecPro;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.TextView;

public class MainActivity extends FragmentActivity {

    MainLayout mLayout;
    private ListView lvMenu;
    private String[] lvMenuItems;
    Button btMenu;
    TextView tvTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mLayout = (MainLayout) this.getLayoutInflater().inflate(
                R.layout.activity_main, null);
        setContentView(mLayout);

        lvMenuItems = getResources().getStringArray(R.array.menu_items);
        lvMenu = (ListView) findViewById(R.id.menu_listview);
        lvMenu.setAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, lvMenuItems));
        lvMenu.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                                    int position, long id) {
                onMenuItemClick(parent, view, position, id);
            }

        });

        btMenu = (Button) findViewById(R.id.button_menu);
        btMenu.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // Show/hide the menu
                toggleMenu(v);
            }
        });

        tvTitle = (TextView) findViewById(R.id.activity_main_content_title);

        FragmentManager fm = MainActivity.this.getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        Layout1 fragment = new Layout1();
        ft.add(R.id.activity_main_content_fragment, fragment);
        ft.commit();

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    public void toggleMenu(View v) {
        mLayout.toggleMenu();
    }

    private void onMenuItemClick(AdapterView<?> parent, View view,
                                 int position, long id) {
        String selectedItem = lvMenuItems[position];
        String currentItem = tvTitle.getText().toString();
        if (selectedItem.compareTo(currentItem) == 0) {
            mLayout.toggleMenu();
            return;
        }

        FragmentManager fm = MainActivity.this.getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        Fragment fragment = null;

        if (selectedItem.compareTo("Layout 1") == 0) {
            fragment = new Layout1();
        } else if (selectedItem.compareTo("Layout 2") == 0) {
            fragment = new Layout2();
        }

        if (fragment != null) {
            ft.replace(R.id.activity_main_content_fragment, fragment);
            ft.commit();
            tvTitle.setText(selectedItem);
        }
        mLayout.toggleMenu();
    }

    @Override
    public void onBackPressed() {
        if (mLayout.isMenuShown()) {
            mLayout.toggleMenu();
        } else {
            super.onBackPressed();
        }
    }
}


text:
tinyMCELang['lang_theme_style_select'] = 'Styly';
tinyMCELang['lang_theme_code_desc'] = 'Zobrazit HTML';
tinyMCELang['lang_theme_code_title'] = 'Editace HTML';
tinyMCELang['lang_theme_code_wordwrap'] = 'Bez dìlení slov';
tinyMCELang['lang_theme_sub_desc'] = 'Dolní index';
tinyMCELang['lang_theme_sup_desc'] = 'Horní index';
tinyMCELang['lang_theme_hr_desc'] = 'Vložit vodorovný oddìlovaè';
tinyMCELang['lang_theme_removeformat_desc'] = 'Zrušit formátování';
tinyMCELang['lang_theme_custom1_desc'] = 'Libovolný popisek';
tinyMCELang['lang_insert_image_border'] = 'Rámeèek';
tinyMCELang['lang_insert_image_dimensions'] = 'Rozmìry';
tinyMCELang['lang_insert_image_vspace'] = 'Vertikální okraj';
tinyMCELang['lang_insert_image_hspace'] = 'Horizontální okraj';
tinyMCELang['lang_insert_image_align'] = 'Zarovnání';
tinyMCELang['lang_insert_image_align_default'] = 'Výchozí';
tinyMCELang['lang_insert_image_align_baseline'] = 'Na úèaøí';
tinyMCELang['lang_insert_image_align_top'] = 'Nahoru';
tinyMCELang['lang_insert_image_align_middle'] = 'Na støed';
tinyMCELang['lang_insert_image_align_bottom'] = 'Dolù';
tinyMCELang['lang_insert_image_align_texttop'] = 'Nejvyšší bod textu';
tinyMCELang['lang_insert_image_align_absmiddle'] = 'Støed øádku';
tinyMCELang['lang_insert_image_align_absbottom'] = 'Spodek øádku';
tinyMCELang['lang_insert_image_align_left'] = 'Vlevo';
tinyMCELang['lang_insert_image_align_right'] = 'Vpravo';
tinyMCELang['lang_theme_font_size'] = 'Font size';
tinyMCELang['lang_theme_fontdefault'] = 'Default';
tinyMCELang['lang_theme_paragraph'] = 'Odstavec';
tinyMCELang['lang_theme_div'] = 'Div';
tinyMCELang['lang_theme_address'] = 'Adresa';
tinyMCELang['lang_theme_pre'] = 'Pøedformát';
tinyMCELang['lang_theme_h1'] = 'Nadpis 1';
tinyMCELang['lang_theme_h2'] = 'Nadpis 2';
tinyMCELang['lang_theme_h3'] = 'Nadpis 3';
tinyMCELang['lang_theme_h4'] = 'Nadpis 4';
tinyMCELang['lang_theme_h5'] = 'Nadpis 5';
tinyMCELang['lang_theme_h6'] = 'Nadpis 6';
tinyMCELang['lang_theme_colorpicker_title'] = 'Výbìr barvy';
tinyMCELang['lang_theme_colorpicker_apply'] = 'Vybrat';
tinyMCELang['lang_theme_forecolor_desc'] = 'Barva popøedí';
tinyMCELang['lang_theme_backcolor_desc'] = 'Barva pozadí';
tinyMCELang['lang_theme_charmap_title'] = 'Výbìr uživ. znaku';
tinyMCELang['lang_theme_charmap_desc'] = 'Vložit znak';
tinyMCELang['lang_theme_visualaid_desc'] = 'Zapnout znaèky/neviditelné prvky';
tinyMCELang['lang_insert_anchor_title'] = 'Vložení/editace záložky';
tinyMCELang['lang_insert_anchor_name'] = 'Název';
tinyMCELang['lang_theme_anchor_desc'] = 'Vložit/editovat záložku';
tinyMCELang['lang_theme_insert_link_titlefield'] = 'Název';
tinyMCELang['lang_theme_clipboard_msg'] = 'Copy/Cut/Paste není použitelné v Mozille a Firefoxu.\nChcete více informací o tomto problému?';
tinyMCELang['lang_theme_path'] = 'Cesta';
tinyMCELang['lang_cut_desc'] = 'Vyjmout';
tinyMCELang['lang_copy_desc'] = 'Kopírovat';
tinyMCELang['lang_paste_desc'] = 'Vložit';
tinyMCELang['lang_link_list'] = 'Link list';
tinyMCELang['lang_image_list'] = 'Image list';
tinyMCELang['lang_link_list'] = 'Link list';
tinyMCELang['lang_image_list'] = 'Image list';
tinyMCELang['lang_browse'] = 'Browse';
tinyMCELang['lang_image_props_desc'] = 'Image properties';
tinyMCELang['lang_newdocument_desc'] = 'New document';


text:
import sys

import ylex
import yparse

from ply import *

if len(sys.argv) == 1:
    print "usage : yply.py [-nocode] inputfile"
    raise SystemExit

if len(sys.argv) == 3:
    if sys.argv[1] == '-nocode':
         yparse.emit_code = 0
    else:
         print "Unknown option '%s'" % sys.argv[1]
         raise SystemExit
    filename = sys.argv[2]
else:
    filename = sys.argv[1]

yacc.parse(open(filename).read())

print """
if __name__ == '__main__':
    from ply import *
    yacc.yacc()
"""


text:
package hr.zg.rus;

import java.util.Hashtable;

public class PublicKeyTest {
    public static void main(String[] args){
        Networks networks = new Networks();
        Hashtable<String, Hashtable> network = networks.getNetworks();

        PrivateKey private_key = new PrivateKey(network.get("bitcoin"));
        private_key.generatePrivateKey(false);
        PublicKey public_key = new PublicKey(private_key);

        if(public_key.isValid()){
            System.out.println("Public key should not be valid!");
        }
        if(public_key.isCompressed()){
            System.out.println("Public key should not be compressed since it's not valid!");
        }

        int[] decimal_key = public_key.generatePubKey();

        if(!public_key.isValid()){
            System.out.println("Public key should be valid!");
        }
        if(public_key.isCompressed()){
            System.out.println("Public key should not be compressed since private key isn't!");
        }
        if(decimal_key.length != 24){
            System.out.println("Invalid public key");
        }

        byte[] byte_key = public_key.toBin();

        if((byte_key.length != 65) && (byte_key[0] != 4)){
            System.out.println("Invalid byte representation!");
        }

        String hex_key = public_key.toHex();

        if((hex_key.length() != 130) && (!hex_key.substring(0, 1).equals("04"))){
            System.out.println("Invalid hex representation!");
        }

        String address = public_key.toAddress();

        if(!address.substring(0, 1).equals("1")){
            System.out.println("Invalid address!");
        }

        String script = public_key.makePubkeyScript();

        if(script.length() != 50){
            System.out.println("Invalid script!");
        }

        private_key.generatePrivateKey(true);
        public_key = new PublicKey(private_key);

        if(public_key.isValid()){
            System.out.println("Public key should not be valid!");
        }

        decimal_key = public_key.generatePubKey();

        if(!public_key.isValid()){
            System.out.println("Public key should be valid!");
        }
        if(!public_key.isCompressed()){
            System.out.println("Public key should be compressed since private key is!");
        }
        if(decimal_key.length != 24){
            System.out.println("Invalid public key");
        }

        byte_key = public_key.toBin();

        if((byte_key.length != 33) && (byte_key[0] != 2) && (byte_key[0] != 3)){
            System.out.println("Invalid byte representation!");
        }

        hex_key = public_key.toHex();

        if((hex_key.length() != 66) && (!hex_key.substring(0, 1).equals("02")) && (!hex_key.substring(0, 1).equals("03"))){
            System.out.println("Invalid hex representation!");
        }

        address = public_key.toAddress();

        if(!address.substring(0, 1).equals("1")){
            System.out.println("Invalid address!");
        }

        script = public_key.makePubkeyScript();

        if(script.length() != 50){
            System.out.println("Invalid script!");
        }

        PrivateKey pkey = new PrivateKey(network.get("bitcoin"));
        pkey.setHexKey("1111111111111111111111111111111111111111111111111111111111111111");
        hex_key = "044f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa385b6b1b8ead809ca67454d9683fcf2ba03456d6fe2c4abe2b07f0fbdbb2f1c1";
        address = "1MsHWS1BnwMc3tLE8G35UXsS58fKipzB7a";
        String scriptPubKey = "76a914e4e517ee07984a4000cd7b00cbcb545911c541c488ac";

        PublicKey pubkey = new PublicKey(pkey);
        pubkey.generatePubKey();

        if(!pubkey.toHex().equals(hex_key)){
            System.out.println("Wrong public key generation!");
        }
        if(!pubkey.toAddress().equals(address)){
            System.out.println("Invalid address generation!");
        }
        if(!pubkey.makePubkeyScript().equals(scriptPubKey)){
            System.out.println("Invalid scriptPubKey generation!");
        }

        pkey.setCompressed(true);
        PublicKey pub = new PublicKey(pkey);
        pub.generatePubKey();
        hex_key = "034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa";
        address = "1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9";
        scriptPubKey = "76a914fc7250a211deddc70ee5a2738de5f07817351cef88ac";

        if(!pub.toHex().equals(hex_key)){
            System.out.println("Wrong compressed public key generation!");
        }
        if(!pub.toAddress().equals(address)){
            System.out.println("Invalid compressed address generation!");
        }
        if(!pub.makePubkeyScript().equals(scriptPubKey)){
            System.out.println("Invalid compressed scriptPubKEy generation!");
        }

        PrivateKey private2 = new PrivateKey(network.get("testnet"));
        private2.setHexKey("1111111111111111111111111111111111111111111111111111111111111111");
        private2.setCompressed(false);
        PublicKey pub2 = new PublicKey(private2);
        pub2.generatePubKey();

        if(!pub2.toHex().equals("044f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa385b6b1b8ead809ca67454d9683fcf2ba03456d6fe2c4abe2b07f0fbdbb2f1c1")){
            System.out.println("Wrong public key generation!");
        }
        if((!pub2.toAddress().substring(0, 1).equals("m")) && !pub2.toAddress().substring(0, 1).equals("n")){
            System.out.println("Invalid address generation!");
        }
        if(!pub2.makePubkeyScript().equals("76a914e4e517ee07984a4000cd7b00cbcb545911c541c488ac")){
            System.out.println("Invalid scriptPubKey generation!");
        }
        private2.setCompressed(true);
        pub2 = new PublicKey(private2);
        pub2.generatePubKey();

        if(!pub2.toHex().equals(hex_key)){
            System.out.println("Wrong compressed public key generation!");
        }
        if((!pub2.toAddress().substring(0, 1).equals("m")) && !pub2.toAddress().substring(0, 1).equals("n")){
            System.out.println("Invalid address generation!");
        }
        if(!pub2.makePubkeyScript().equals(scriptPubKey)){
            System.out.println("Invalid compressed scriptPubKEy generation!");
        }
    }
}


text:
package com.github.amagat.model.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.github.amagat.model.entry.AccountEntry;
import com.github.amagat.model.mapper.AccountEntryMapper;

@Repository
public class AccountDao {

	@Autowired AccountEntryMapper mapper;
	public void insert(AccountEntry record){
		mapper.insert(record);
	}
}


text:
<!doctype html>

    <meta charset="utf-8">
    <title>%(title)s</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="reveal/css/reveal.min.css">
    <link rel="stylesheet" href="reveal/css/theme/%(theme)s.css" id="theme">
    <link rel="stylesheet" href="reveal/lib/css/zenburn.css">

        %(content)s


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Catherine's World</title>

    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <link href="css/clean-blog.min.css" rel="stylesheet">

    <link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation
                    Menu
                </button>
                Catherine's World

                        Home

                        About

                        Scholarship

                        Networks

                        People Files

                        Methods

                        Sources

                        Italian Map

Nanni di ser Vanni Savini

 Nanni di ser Vanni Savini was a Sienese man who had connections to families in power. William of Flete
                    introduced Nanni and Catherine and from that meeting, a lasting relationship ensued. Nanni was aligned
                    with the powerful Salimbeni family which resulted in Catherine strengthening   her relationship with them.
                    Historian Thomas Luongo claims, "By 1368-1371, Nanni had established himself as one of the most prominent
                    and wealthy citizens of Siena."1 Catherine's connection to Nanni
                    is not an accident, William of Flete, who knew Catherine's aspirations, connected them because of Nanni's
                    status within the Sienese community. Nanni was wealthy and prominent in government, but he was,
                    "imprisoned by the commune of Siena," several times throughout his life.2
                 Nanni became Catherine's benefactor and gifted a castle to her to establish a monastery.

 1. Thomas Luongo, The Saintly Politics of Catherine of Siena (Ithaca, New York: Cornell University Press, 2006), 133. ↩

 2. Suzanne Noffke, "Persons Associated with Catherine of Siena," in The Letters of Catherine of Siena, vol. 3. Trans by Suzanne Noffke (Tempe: Arizona Center for Medieval and Renaissance Studies, 2008), 363.↩

Banner Photo: Basilica Cateriniana di San Domenico in Siena, Italy. By Jessica Mills, 2014.


text:
import { Component, Input, OnChanges } from '@angular/core';
import { ICountry, IEmergencyPhoneNumber } from '../shared/interfaces/country';

@Component({
    moduleId: module.id,
    selector: 'country',
    templateUrl: 'country.component.html'
})

export class CountryComponent {

    @Input() country: ICountry;
    @Input() emergencies: IEmergencyPhoneNumber;

}


text:
=begin
#ARTIK Cloud API

#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

OpenAPI spec version: 2.0.0

Generated by: https://github.com/swagger-api/swagger-codegen.git

=end

require 'date'

module ArtikCloud
  # Action Information.
  class Action
    # Action name.
    attr_accessor :name

    # Parameters information
    attr_accessor :parameters

    # Attribute mapping from ruby-style variable name to JSON key.
    def self.attribute_map
      {
        :'name' => :'name',
        :'parameters' => :'parameters'
      }
    end

    # Attribute type mapping.
    def self.swagger_types
      {
        :'name' => :'String',
        :'parameters' => :'Hash<String, Object>'
      }
    end

    # Initializes the object
    # @param [Hash] attributes Model attributes in the form of hash
    def initialize(attributes = {})
      return unless attributes.is_a?(Hash)

      # convert string to symbol for hash key
      attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

      if attributes.has_key?(:'name')
        self.name = attributes[:'name']
      end

      if attributes.has_key?(:'parameters')
        if (value = attributes[:'parameters']).is_a?(Array)
          self.parameters = value
        end
      end

    end

    # Show invalid properties with the reasons. Usually used together with valid?
    # @return Array for valid properies with the reasons
    def list_invalid_properties
      invalid_properties = Array.new
      return invalid_properties
    end

    # Check to see if the all the properties in the model are valid
    # @return true if the model is valid
    def valid?
      return true
    end

    # Checks equality by comparing each attribute.
    # @param [Object] Object to be compared
    def ==(o)
      return true if self.equal?(o)
      self.class == o.class &&
          name == o.name &&
          parameters == o.parameters
    end

    # @see the `==` method
    # @param [Object] Object to be compared
    def eql?(o)
      self == o
    end

    # Calculates hash code according to all attributes.
    # @return [Fixnum] Hash code
    def hash
      [name, parameters].hash
    end

    # Builds the object from hash
    # @param [Hash] attributes Model attributes in the form of hash
    # @return [Object] Returns the model itself
    def build_from_hash(attributes)
      return nil unless attributes.is_a?(Hash)
      self.class.swagger_types.each_pair do |key, type|
        if type =~ /\AArray<(.*)>/i
          # check to ensure the input is an array given that the the attribute
          # is documented as an array but the input is not
          if attributes[self.class.attribute_map[key]].is_a?(Array)
            self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
          end
        elsif !attributes[self.class.attribute_map[key]].nil?
          self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
        end # or else data not found in attributes(hash), not an issue as the data can be optional
      end

      self
    end

    # Deserializes the data based on type
    # @param string type Data type
    # @param string value Value to be deserialized
    # @return [Object] Deserialized data
    def _deserialize(type, value)
      case type.to_sym
      when :DateTime
        DateTime.parse(value)
      when :Date
        Date.parse(value)
      when :String
        value.to_s
      when :Integer
        value.to_i
      when :Float
        value.to_f
      when :BOOLEAN
        if value.to_s =~ /\A(true|t|yes|y|1)\z/i
          true
        else
          false
        end
      when :Object
        # generic object (usually a Hash), return directly
        value
      when /\AArray<(?<inner_type>.+)>\z/
        inner_type = Regexp.last_match[:inner_type]
        value.map { |v| _deserialize(inner_type, v) }
      when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
        k_type = Regexp.last_match[:k_type]
        v_type = Regexp.last_match[:v_type]
        {}.tap do |hash|
          value.each do |k, v|
            hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
          end
        end
      else # model
        temp_model = ArtikCloud.const_get(type).new
        temp_model.build_from_hash(value)
      end
    end

    # Returns the string representation of the object
    # @return [String] String presentation of the object
    def to_s
      to_hash.to_s
    end

    # to_body is an alias to to_hash (backward compatibility)
    # @return [Hash] Returns the object in the form of hash
    def to_body
      to_hash
    end

    # Returns the object in the form of hash
    # @return [Hash] Returns the object in the form of hash
    def to_hash
      hash = {}
      self.class.attribute_map.each_pair do |attr, param|
        value = self.send(attr)
        next if value.nil?
        hash[param] = _to_hash(value)
      end
      hash
    end

    # Outputs non-array value in the form of hash
    # For object, use to_hash. Otherwise, just return the value
    # @param [Object] value Any valid value
    # @return [Hash] Returns the value in the form of hash
    def _to_hash(value)
      if value.is_a?(Array)
        value.compact.map{ |v| _to_hash(v) }
      elsif value.is_a?(Hash)
        {}.tap do |hash|
          value.each { |k, v| hash[k] = _to_hash(v) }
        end
      elsif value.respond_to? :to_hash
        value.to_hash
      else
        value
      end
    end

  end

end


text:
using System;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization.Utilities;

namespace YamlDotNet.Serialization.NodeDeserializers
{
    public sealed class ScalarNodeDeserializer : INodeDeserializer
    {
        private const string BooleanTruePattern = "^(true|y|yes|on)$";
        private const string BooleanFalsePattern = "^(false|n|no|off)$";

        bool INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func<IParser, Type, object> nestedObjectDeserializer, out object value)
        {
            var scalar = parser.Allow<Scalar>();
            if (scalar == null)
            {
                value = null;
                return false;
            }

            if (expectedType.IsEnum())
            {
                value = Enum.Parse(expectedType, scalar.Value, true);
            }
            else
            {
                var typeCode = expectedType.GetTypeCode();
                switch (typeCode)
                {
                    case TypeCode.Boolean:
                        value = DeserializeBooleanHelper(scalar.Value);
                        break;

                    case TypeCode.Byte:
                    case TypeCode.Int16:
                    case TypeCode.Int32:
                    case TypeCode.Int64:
                    case TypeCode.SByte:
                    case TypeCode.UInt16:
                    case TypeCode.UInt32:
                    case TypeCode.UInt64:
                        value = DeserializeIntegerHelper(typeCode, scalar.Value);
                        break;

                    case TypeCode.Single:
                        value = Single.Parse(scalar.Value, YamlFormatter.NumberFormat);
                        break;

                    case TypeCode.Double:
                        value = Double.Parse(scalar.Value, YamlFormatter.NumberFormat);
                        break;

                    case TypeCode.Decimal:
                        value = Decimal.Parse(scalar.Value, YamlFormatter.NumberFormat);
                        break;

                    case TypeCode.String:
                        value = scalar.Value;
                        break;

                    case TypeCode.Char:
                        value = scalar.Value[0];
                        break;

                    case TypeCode.DateTime:
                        // TODO: This is probably incorrect. Use the correct regular expression.
                        value = DateTime.Parse(scalar.Value, CultureInfo.InvariantCulture);
                        break;

                    default:
                        if (expectedType == typeof(object))
                        {
                            // Default to string
                            value = scalar.Value;
                        }
                        else
                        {
                            value = TypeConverter.ChangeType(scalar.Value, expectedType);
                        }
                        break;
                }
            }
            return true;
        }

        private object DeserializeBooleanHelper(string value)
        {
            bool result;

            if (Regex.IsMatch(value, ScalarNodeDeserializer.BooleanTruePattern, RegexOptions.IgnoreCase))
            {
                result = true;
            }
            else if (Regex.IsMatch(value, ScalarNodeDeserializer.BooleanFalsePattern, RegexOptions.IgnoreCase))
            {
                result = false;
            }
            else
            {
                throw new FormatException(String.Format("The value \"{0}\" is not a valid YAML Boolean", value));
            }

            return result;
        }

        private object DeserializeIntegerHelper(TypeCode typeCode, string value)
        {
            var numberBuilder = new StringBuilder();
            int currentIndex = 0;
            bool isNegative = false;
            int numberBase = 0;
            ulong result = 0;

            if (value[0] == '-')
            {
                currentIndex++;
                isNegative = true;
            }

            else if (value[0] == '+')
            {
                currentIndex++;
            }

            if (value[currentIndex] == '0')
            {
                // Could be binary, octal, hex, decimal (0)

                // If there are no characters remaining, it's a decimal zero
                if (currentIndex == value.Length - 1)
                {
                    numberBase = 10;
                    result = 0;
                }

                else
                {
                    // Check the next character
                    currentIndex++;

                    if (value[currentIndex] == 'b')
                    {
                        // Binary
                        numberBase = 2;

                        currentIndex++;
                    }

                    else if (value[currentIndex] == 'x')
                    {
                        // Hex
                        numberBase = 16;

                        currentIndex++;
                    }

                    else
                    {
                        // Octal
                        numberBase = 8;
                    }
                }

                // Copy remaining digits to the number buffer (skip underscores)
                while (currentIndex < value.Length)
                {
                    if (value[currentIndex] != '_')
                    {
                        numberBuilder.Append(value[currentIndex]);
                    }
                    currentIndex++;
                }

                // Parse the magnitude of the number
                switch (numberBase)
                {
                    case 2:
                    case 8:
                        // TODO: how to incorporate the numberFormat?
                        result = Convert.ToUInt64(numberBuilder.ToString(), numberBase);
                        break;

                    case 16:
                        result = ulong.Parse(numberBuilder.ToString(), NumberStyles.HexNumber, YamlFormatter.NumberFormat);
                        break;

                    case 10:
                        // Result is already zero
                        break;
                }
            }

            else
            {
                // Could be decimal or base 60
                var chunks = value.Substring(currentIndex).Split(':');
                result = 0;

                for (int chunkIndex = 0; chunkIndex < chunks.Length; chunkIndex++)
                {
                    result *= 60;

                    // TODO: verify that chunks after the first are non-negative and less than 60
                    result += ulong.Parse(chunks[chunkIndex].Replace("_", ""));
                }
            }

            if (isNegative)
            {
                return CastInteger(checked(-(long)result), typeCode);
            }
            else
            {
                return CastInteger(result, typeCode);
            }
        }

        private static object CastInteger(long number, TypeCode typeCode)
        {
            checked
            {
                switch (typeCode)
                {
                    case TypeCode.Byte:
                        return (byte)number;

                    case TypeCode.Int16:
                        return (short)number;

                    case TypeCode.Int32:
                        return (int)number;

                    case TypeCode.Int64:
                        return number;

                    case TypeCode.SByte:
                        return (sbyte)number;

                    case TypeCode.UInt16:
                        return (ushort)number;

                    case TypeCode.UInt32:
                        return (uint)number;

                    case TypeCode.UInt64:
                        return (ulong)number;

                    default:
                        return number;
                }
            }
        }

        private static object CastInteger(ulong number, TypeCode typeCode)
        {
            checked
            {
                switch (typeCode)
                {
                    case TypeCode.Byte:
                        return (byte)number;

                    case TypeCode.Int16:
                        return (short)number;

                    case TypeCode.Int32:
                        return (int)number;

                    case TypeCode.Int64:
                        return (long)number;

                    case TypeCode.SByte:
                        return (sbyte)number;

                    case TypeCode.UInt16:
                        return (ushort)number;

                    case TypeCode.UInt32:
                        return (uint)number;

                    case TypeCode.UInt64:
                        return number;

                    default:
                        return number;
                }
            }
        }
    }
}


text:
PRTG Tagger
===========

This is a command line interface to the [PRTG]("http://www.paessler.com/") API which allows bulk tagging, sensor, and device listing for use with [prtg-py]("https://github.com/kevinschoon/prtg-py").


text:
package org.chronopolis.ingest.messages;

import java.io.File;
import org.apache.pivot.wtk.Window;
import org.chronopolis.ingest.pkg.ChronPackage;

/**
 *
 * @author toaster
 */
public final class SaveBagMessage {

    private ChronPackage pkg;
    private File saveFile;
    private Window displayWindow;

    public SaveBagMessage(ChronPackage pkg, File saveFile, Window displayWindow) {
        this.pkg = pkg;
        this.saveFile = saveFile;
        this.displayWindow = displayWindow;
    }

    public ChronPackage getPkg() {
        return pkg;
    }

    public File getSaveFile() {
        return saveFile;
    }

    public Window getDisplayWindow() {
        return displayWindow;
    }

}


text:
class ExtensionProcessesEventRouter : public TaskManagerModelObserver {
 public:
  // Single instance of the event router.
  static ExtensionProcessesEventRouter* GetInstance();

  // Safe to call multiple times.
  void ObserveProfile(Profile* profile);

  // Called when an extension process wants to listen to process events.
  void ListenerAdded();

  // Called when an extension process with a listener exits or removes it.
  void ListenerRemoved();

 private:
  friend struct DefaultSingletonTraits<ExtensionProcessesEventRouter>;

  ExtensionProcessesEventRouter();
  virtual ~ExtensionProcessesEventRouter();

  // TaskManagerModelObserver methods.
  virtual void OnModelChanged() OVERRIDE {}
  virtual void OnItemsChanged(int start, int length) OVERRIDE;
  virtual void OnItemsAdded(int start, int length) OVERRIDE {}
  virtual void OnItemsRemoved(int start, int length) OVERRIDE {}

  void DispatchEvent(Profile* profile,
                     const char* event_name,
                     const std::string& json_args);

  // Used for tracking registrations to process related notifications.
  content::NotificationRegistrar registrar_;

  // Registered profiles.
  typedef std::set<Profile*> ProfileSet;
  ProfileSet profiles_;

  // TaskManager to observe for updates.
  TaskManagerModel* model_;

  DISALLOW_COPY_AND_ASSIGN(ExtensionProcessesEventRouter);
};

// This extension function returns the Process object for the renderer process
// currently in use by the specified Tab.
class GetProcessIdForTabFunction : public SyncExtensionFunction {
  virtual ~GetProcessIdForTabFunction() {}
  virtual bool RunImpl() OVERRIDE;
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.processes.getProcessIdForTab")
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESSES_API_H__


text:
This section will guide you through the process of setting up a new project with SpriteBuilder, Cocos2d and Xcode.

## Creating a Project for Cocos2d
To start a new SpriteBuilder project, simply select *New Project…* from the *File* menu. Choose a name for your project and save it. You can not use spaces or any special characters in your file name.

When creating a new project, SpriteBuilder will also automatically setup a Cocos2d Xcode project for you. Everything will be hooked up and ready to go!

## Publishing Your Project
Before any changes you make in SpriteBuilder show up in Xcode you will need to publish your project. Click on the Publish icon or select *Publish…* from the *File* menu and all your files and resources will be compiled, converted and copied.

![image](2-3.png?raw=true)