text:
package thrift

// Autogenerated by Thrift Compiler (1.0.0-dev)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

/* THE FOLLOWING THRIFT FILE WAS USED TO CREATE THIS

enum MyTestEnum {
	FIRST = 1,
	SECOND = 2,
	THIRD = 3,
	FOURTH = 4,
}

struct MyTestStruct {
	1: bool on,
	2: byte b,
	3: i16 int16,
	4: i32 int32,
	5: i64 int64,
	6: double d,
	7: string st,
	8: binary bin,
	9: map<string, string> stringMap,
	10: list<string> stringList,
	11: set<string> stringSet,
	12: MyTestEnum e,
}
*/

import (
	"fmt"
)

// (needed to ensure safety because of naive import list construction.)
var _ = ZERO
var _ = fmt.Printf

var GoUnusedProtection__ int

type MyTestEnum int64

const (
	MyTestEnum_FIRST  MyTestEnum = 1
	MyTestEnum_SECOND MyTestEnum = 2
	MyTestEnum_THIRD  MyTestEnum = 3
	MyTestEnum_FOURTH MyTestEnum = 4
)

func (p MyTestEnum) String() string {
	switch p {
	case MyTestEnum_FIRST:
		return "FIRST"
	case MyTestEnum_SECOND:
		return "SECOND"
	case MyTestEnum_THIRD:
		return "THIRD"
	case MyTestEnum_FOURTH:
		return "FOURTH"
	}
	return "<UNSET>"
}

func MyTestEnumFromString(s string) (MyTestEnum, error) {
	switch s {
	case "FIRST":
		return MyTestEnum_FIRST, nil
	case "SECOND":
		return MyTestEnum_SECOND, nil
	case "THIRD":
		return MyTestEnum_THIRD, nil
	case "FOURTH":
		return MyTestEnum_FOURTH, nil
	}
	return MyTestEnum(0), fmt.Errorf("not a valid MyTestEnum string")
}

func MyTestEnumPtr(v MyTestEnum) *MyTestEnum { return &v }

type MyTestStruct struct {
	On         bool              `thrift:"on,1" json:"on"`
	B          int8              `thrift:"b,2" json:"b"`
	Int16      int16             `thrift:"int16,3" json:"int16"`
	Int32      int32             `thrift:"int32,4" json:"int32"`
	Int64      int64             `thrift:"int64,5" json:"int64"`
	D          float64           `thrift:"d,6" json:"d"`
	St         string            `thrift:"st,7" json:"st"`
	Bin        []byte            `thrift:"bin,8" json:"bin"`
	StringMap  map[string]string `thrift:"stringMap,9" json:"stringMap"`
	StringList []string          `thrift:"stringList,10" json:"stringList"`
	StringSet  map[string]bool   `thrift:"stringSet,11" json:"stringSet"`
	E          MyTestEnum        `thrift:"e,12" json:"e"`
}

func NewMyTestStruct() *MyTestStruct {
	return &MyTestStruct{}
}

func (p *MyTestStruct) GetOn() bool {
	return p.On
}

func (p *MyTestStruct) GetB() int8 {
	return p.B
}

func (p *MyTestStruct) GetInt16() int16 {
	return p.Int16
}

func (p *MyTestStruct) GetInt32() int32 {
	return p.Int32
}

func (p *MyTestStruct) GetInt64() int64 {
	return p.Int64
}

func (p *MyTestStruct) GetD() float64 {
	return p.D
}

func (p *MyTestStruct) GetSt() string {
	return p.St
}

func (p *MyTestStruct) GetBin() []byte {
	return p.Bin
}

func (p *MyTestStruct) GetStringMap() map[string]string {
	return p.StringMap
}

func (p *MyTestStruct) GetStringList() []string {
	return p.StringList
}

func (p *MyTestStruct) GetStringSet() map[string]bool {
	return p.StringSet
}

func (p *MyTestStruct) GetE() MyTestEnum {
	return p.E
}
func (p *MyTestStruct) Read(iprot TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return PrependError(fmt.Sprintf("%T read error: ", p), err)
	}
	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		case 2:
			if err := p.readField2(iprot); err != nil {
				return err
			}
		case 3:
			if err := p.readField3(iprot); err != nil {
				return err
			}
		case 4:
			if err := p.readField4(iprot); err != nil {
				return err
			}
		case 5:
			if err := p.readField5(iprot); err != nil {
				return err
			}
		case 6:
			if err := p.readField6(iprot); err != nil {
				return err
			}
		case 7:
			if err := p.readField7(iprot); err != nil {
				return err
			}
		case 8:
			if err := p.readField8(iprot); err != nil {
				return err
			}
		case 9:
			if err := p.readField9(iprot); err != nil {
				return err
			}
		case 10:
			if err := p.readField10(iprot); err != nil {
				return err
			}
		case 11:
			if err := p.readField11(iprot); err != nil {
				return err
			}
		case 12:
			if err := p.readField12(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *MyTestStruct) readField1(iprot TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return PrependError("error reading field 1: ", err)
	} else {
		p.On = v
	}
	return nil
}

func (p *MyTestStruct) readField2(iprot TProtocol) error {
	if v, err := iprot.ReadByte(); err != nil {
		return PrependError("error reading field 2: ", err)
	} else {
		temp := int8(v)
		p.B = temp
	}
	return nil
}

func (p *MyTestStruct) readField3(iprot TProtocol) error {
	if v, err := iprot.ReadI16(); err != nil {
		return PrependError("error reading field 3: ", err)
	} else {
		p.Int16 = v
	}
	return nil
}

func (p *MyTestStruct) readField4(iprot TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return PrependError("error reading field 4: ", err)
	} else {
		p.Int32 = v
	}
	return nil
}

func (p *MyTestStruct) readField5(iprot TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return PrependError("error reading field 5: ", err)
	} else {
		p.Int64 = v
	}
	return nil
}

func (p *MyTestStruct) readField6(iprot TProtocol) error {
	if v, err := iprot.ReadDouble(); err != nil {
		return PrependError("error reading field 6: ", err)
	} else {
		p.D = v
	}
	return nil
}

func (p *MyTestStruct) readField7(iprot TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return PrependError("error reading field 7: ", err)
	} else {
		p.St = v
	}
	return nil
}

func (p *MyTestStruct) readField8(iprot TProtocol) error {
	if v, err := iprot.ReadBinary(); err != nil {
		return PrependError("error reading field 8: ", err)
	} else {
		p.Bin = v
	}
	return nil
}

func (p *MyTestStruct) readField9(iprot TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return PrependError("error reading map begin: ", err)
	}
	tMap := make(map[string]string, size)
	p.StringMap = tMap
	for i := 0; i < size; i++ {
		var _key0 string
		if v, err := iprot.ReadString(); err != nil {
			return PrependError("error reading field 0: ", err)
		} else {
			_key0 = v
		}
		var _val1 string
		if v, err := iprot.ReadString(); err != nil {
			return PrependError("error reading field 0: ", err)
		} else {
			_val1 = v
		}
		p.StringMap[_key0] = _val1
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return PrependError("error reading map end: ", err)
	}
	return nil
}

func (p *MyTestStruct) readField10(iprot TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return PrependError("error reading list begin: ", err)
	}
	tSlice := make([]string, 0, size)
	p.StringList = tSlice
	for i := 0; i < size; i++ {
		var _elem2 string
		if v, err := iprot.ReadString(); err != nil {
			return PrependError("error reading field 0: ", err)
		} else {
			_elem2 = v
		}
		p.StringList = append(p.StringList, _elem2)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return PrependError("error reading list end: ", err)
	}
	return nil
}

func (p *MyTestStruct) readField11(iprot TProtocol) error {
	_, size, err := iprot.ReadSetBegin()
	if err != nil {
		return PrependError("error reading set begin: ", err)
	}
	tSet := make(map[string]bool, size)
	p.StringSet = tSet
	for i := 0; i < size; i++ {
		var _elem3 string
		if v, err := iprot.ReadString(); err != nil {
			return PrependError("error reading field 0: ", err)
		} else {
			_elem3 = v
		}
		p.StringSet[_elem3] = true
	}
	if err := iprot.ReadSetEnd(); err != nil {
		return PrependError("error reading set end: ", err)
	}
	return nil
}

func (p *MyTestStruct) readField12(iprot TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return PrependError("error reading field 12: ", err)
	} else {
		temp := MyTestEnum(v)
		p.E = temp
	}
	return nil
}

func (p *MyTestStruct) Write(oprot TProtocol) error {
	if err := oprot.WriteStructBegin("MyTestStruct"); err != nil {
		return PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := p.writeField2(oprot); err != nil {
		return err
	}
	if err := p.writeField3(oprot); err != nil {
		return err
	}
	if err := p.writeField4(oprot); err != nil {
		return err
	}
	if err := p.writeField5(oprot); err != nil {
		return err
	}
	if err := p.writeField6(oprot); err != nil {
		return err
	}
	if err := p.writeField7(oprot); err != nil {
		return err
	}
	if err := p.writeField8(oprot); err != nil {
		return err
	}
	if err := p.writeField9(oprot); err != nil {
		return err
	}
	if err := p.writeField10(oprot); err != nil {
		return err
	}
	if err := p.writeField11(oprot); err != nil {
		return err
	}
	if err := p.writeField12(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *MyTestStruct) writeField1(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("on", BOOL, 1); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 1:on: ", p), err)
	}
	if err := oprot.WriteBool(bool(p.On)); err != nil {
		return PrependError(fmt.Sprintf("%T.on (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 1:on: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField2(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("b", BYTE, 2); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 2:b: ", p), err)
	}
	if err := oprot.WriteByte(byte(p.B)); err != nil {
		return PrependError(fmt.Sprintf("%T.b (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 2:b: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField3(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("int16", I16, 3); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 3:int16: ", p), err)
	}
	if err := oprot.WriteI16(int16(p.Int16)); err != nil {
		return PrependError(fmt.Sprintf("%T.int16 (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 3:int16: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField4(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("int32", I32, 4); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 4:int32: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.Int32)); err != nil {
		return PrependError(fmt.Sprintf("%T.int32 (4) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 4:int32: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField5(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("int64", I64, 5); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 5:int64: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Int64)); err != nil {
		return PrependError(fmt.Sprintf("%T.int64 (5) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 5:int64: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField6(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("d", DOUBLE, 6); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 6:d: ", p), err)
	}
	if err := oprot.WriteDouble(float64(p.D)); err != nil {
		return PrependError(fmt.Sprintf("%T.d (6) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 6:d: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField7(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("st", STRING, 7); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 7:st: ", p), err)
	}
	if err := oprot.WriteString(string(p.St)); err != nil {
		return PrependError(fmt.Sprintf("%T.st (7) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 7:st: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField8(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("bin", STRING, 8); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 8:bin: ", p), err)
	}
	if err := oprot.WriteBinary(p.Bin); err != nil {
		return PrependError(fmt.Sprintf("%T.bin (8) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 8:bin: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField9(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("stringMap", MAP, 9); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 9:stringMap: ", p), err)
	}
	if err := oprot.WriteMapBegin(STRING, STRING, len(p.StringMap)); err != nil {
		return PrependError("error writing map begin: ", err)
	}
	for k, v := range p.StringMap {
		if err := oprot.WriteString(string(k)); err != nil {
			return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
		}
		if err := oprot.WriteString(string(v)); err != nil {
			return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return PrependError("error writing map end: ", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 9:stringMap: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField10(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("stringList", LIST, 10); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 10:stringList: ", p), err)
	}
	if err := oprot.WriteListBegin(STRING, len(p.StringList)); err != nil {
		return PrependError("error writing list begin: ", err)
	}
	for _, v := range p.StringList {
		if err := oprot.WriteString(string(v)); err != nil {
			return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return PrependError("error writing list end: ", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 10:stringList: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField11(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("stringSet", SET, 11); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 11:stringSet: ", p), err)
	}
	if err := oprot.WriteSetBegin(STRING, len(p.StringSet)); err != nil {
		return PrependError("error writing set begin: ", err)
	}
	for v, _ := range p.StringSet {
		if err := oprot.WriteString(string(v)); err != nil {
			return PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
		}
	}
	if err := oprot.WriteSetEnd(); err != nil {
		return PrependError("error writing set end: ", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 11:stringSet: ", p), err)
	}
	return err
}

func (p *MyTestStruct) writeField12(oprot TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("e", I32, 12); err != nil {
		return PrependError(fmt.Sprintf("%T write field begin error 12:e: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.E)); err != nil {
		return PrependError(fmt.Sprintf("%T.e (12) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return PrependError(fmt.Sprintf("%T write field end error 12:e: ", p), err)
	}
	return err
}

func (p *MyTestStruct) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MyTestStruct(%+v)", *p)
}


text:
<?php

namespace Gedmo\Blameable\Mapping\Driver;

use Doctrine\Persistence\Mapping\ClassMetadata;
use Gedmo\Exception\InvalidMappingException;
use Gedmo\Mapping\Driver\Xml as BaseXml;

/**
 * This is a xml mapping driver for Blameable
 * behavioral extension. Used for extraction of extended
 * metadata from xml specifically for Blameable
 * extension.
 *
 * @author David Buchmann <mail@davidbu.ch>
 */
class Xml extends BaseXml
{
    /**
     * List of types which are valid for blame
     *
     * @var array
     */
    private $validTypes = [
        'one',
        'string',
        'int',
    ];

    public function readExtendedMetadata($meta, array &$config)
    {
        /**
         * @var \SimpleXmlElement
         */
        $mapping = $this->_getMapping($meta->getName());

        if (isset($mapping->field)) {
            /**
             * @var \SimpleXmlElement
             */
            foreach ($mapping->field as $fieldMapping) {
                $fieldMappingDoctrine = $fieldMapping;
                $fieldMapping = $fieldMapping->children(self::GEDMO_NAMESPACE_URI);
                if (isset($fieldMapping->blameable)) {
                    /**
                     * @var \SimpleXmlElement
                     */
                    $data = $fieldMapping->blameable;

                    $field = $this->_getAttribute($fieldMappingDoctrine, 'name');
                    if (!$this->isValidField($meta, $field)) {
                        throw new InvalidMappingException("Field - [{$field}] type is not valid and must be 'string' or a reference in class - {$meta->getName()}");
                    }
                    if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'], true)) {
                        throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
                    }

                    if ('change' === $this->_getAttribute($data, 'on')) {
                        if (!$this->_isAttributeSet($data, 'field')) {
                            throw new InvalidMappingException("Missing parameters on property - {$field}, field must be set on [change] trigger in class - {$meta->getName()}");
                        }
                        $trackedFieldAttribute = $this->_getAttribute($data, 'field');
                        $valueAttribute = $this->_isAttributeSet($data, 'value') ? $this->_getAttribute($data, 'value') : null;
                        $field = [
                            'field' => $field,
                            'trackedField' => $trackedFieldAttribute,
                            'value' => $valueAttribute,
                        ];
                    }
                    $config[$this->_getAttribute($data, 'on')][] = $field;
                }
            }
        }

        if (isset($mapping->{'many-to-one'})) {
            foreach ($mapping->{'many-to-one'} as $fieldMapping) {
                $field = $this->_getAttribute($fieldMapping, 'field');
                $fieldMapping = $fieldMapping->children(self::GEDMO_NAMESPACE_URI);
                if (isset($fieldMapping->blameable)) {
                    $data = $fieldMapping->blameable;
                    if (!$meta->isSingleValuedAssociation($field)) {
                        throw new InvalidMappingException("Association - [{$field}] is not valid, it must be a one-to-many relation or a string field - {$meta->getName()}");
                    }
                    if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'], true)) {
                        throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
                    }

                    if ('change' === $this->_getAttribute($data, 'on')) {
                        if (!$this->_isAttributeSet($data, 'field')) {
                            throw new InvalidMappingException("Missing parameters on property - {$field}, field must be set on [change] trigger in class - {$meta->getName()}");
                        }
                        $trackedFieldAttribute = $this->_getAttribute($data, 'field');
                        $valueAttribute = $this->_isAttributeSet($data, 'value') ? $this->_getAttribute($data, 'value') : null;
                        $field = [
                            'field' => $field,
                            'trackedField' => $trackedFieldAttribute,
                            'value' => $valueAttribute,
                        ];
                    }
                    $config[$this->_getAttribute($data, 'on')][] = $field;
                }
            }
        }
    }

    /**
     * Checks if $field type is valid
     *
     * @param ClassMetadata $meta
     * @param string        $field
     *
     * @return bool
     */
    protected function isValidField($meta, $field)
    {
        $mapping = $meta->getFieldMapping($field);

        return $mapping && in_array($mapping['type'], $this->validTypes, true);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php namespace App\Events;

use App\Events\Event;

use Illuminate\Queue\SerializesModels;

class UserWasRegistered extends Event {

	use SerializesModels;

	public $userId;

	/**
	 * Create a new event instance.
	 *
	 * @return void
	 */
	public function __construct($data)
	{
		$this->name = $data['name'];
		$this->email = $data['email'];
	}

}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.dialogflow.v3.model;

/**
 * Represents the result of a conversational query.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Dialogflow API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class GoogleCloudDialogflowCxV3QueryResult extends com.google.api.client.json.GenericJson {

  /**
   * The current Page. Some, not all fields are filled in this message, including but not limited to
   * `name` and `display_name`.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3Page currentPage;

  /**
   * The free-form diagnostic info. For example, this field could contain webhook call latency. The
   * fields of this data can change without notice, so you should not write code that depends on its
   * structure. One of the fields is called "Alternative Matched Intents", which may aid with
   * debugging. The following describes these intent results: - The list is empty if no intent was
   * matched to end-user input. - Only intents that are referenced in the currently active flow are
   * included. - The matched intent is included. - Other intents that could have matched end-user
   * input, but did not match because they are referenced by intent routes that are out of
   * [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope), are included. -
   * Other intents referenced by intent routes in scope that matched end-user input, but had a lower
   * confidence score.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, java.lang.Object> diagnosticInfo;

  /**
   * If a DTMF was provided as input, this field will contain a copy of the DTMFInput.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3DtmfInput dtmf;

  /**
   * The Intent that matched the conversational query. Some, not all fields are filled in this
   * message, including but not limited to: `name` and `display_name`. This field is deprecated,
   * please use QueryResult.match instead.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3Intent intent;

  /**
   * The intent detection confidence. Values range from 0.0 (completely uncertain) to 1.0
   * (completely certain). This value is for informational purpose only and is only used to help
   * match the best intent within the classification threshold. This value may change for the same
   * end-user expression at any time due to a model retraining or change in implementation. This
   * field is deprecated, please use QueryResult.match instead.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Float intentDetectionConfidence;

  /**
   * The language that was triggered during intent detection. See [Language
   * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) for a list of the
   * currently supported language codes.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String languageCode;

  /**
   * Intent match result, could be an intent or an event.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3Match match;

  /**
   * The collected session parameters. Depending on your protocol or client library language, this
   * is a map, associative array, symbol table, dictionary, or JSON object composed of a collection
   * of (MapKey, MapValue) pairs: * MapKey type: string * MapKey value: parameter name * MapValue
   * type: If parameter's entity type is a composite entity then use map, otherwise, depending on
   * the parameter value type, it could be one of string, number, boolean, null, list or map. *
   * MapValue value: If parameter's entity type is a composite entity then use map from composite
   * entity property names to property values, otherwise, use parameter value.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, java.lang.Object> parameters;

  /**
   * The list of rich messages returned to the client. Responses vary from simple text messages to
   * more sophisticated, structured payloads used to drive complex logic.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<GoogleCloudDialogflowCxV3ResponseMessage> responseMessages;

  /**
   * The sentiment analyss result, which depends on `analyze_query_text_sentiment`, specified in the
   * request.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudDialogflowCxV3SentimentAnalysisResult sentimentAnalysisResult;

  /**
   * If natural language text was provided as input, this field will contain a copy of the text.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String text;

  /**
   * If natural language speech audio was provided as input, this field will contain the transcript
   * for the audio.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String transcript;

  /**
   * If an event was provided as input, this field will contain the name of the event.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String triggerEvent;

  /**
   * If an intent was provided as input, this field will contain a copy of the intent identifier.
   * Format: `projects//locations//agents//intents/`.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String triggerIntent;

  /**
   * The list of webhook payload in WebhookResponse.payload, in the order of call sequence. If some
   * webhook call fails or doesn't return any payload, an empty `Struct` would be used instead.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<java.util.Map<String, java.lang.Object>> webhookPayloads;

  /**
   * The list of webhook call status in the order of call sequence.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<GoogleRpcStatus> webhookStatuses;

  /**
   * The current Page. Some, not all fields are filled in this message, including but not limited to
   * `name` and `display_name`.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3Page getCurrentPage() {
    return currentPage;
  }

  /**
   * The current Page. Some, not all fields are filled in this message, including but not limited to
   * `name` and `display_name`.
   * @param currentPage currentPage or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setCurrentPage(GoogleCloudDialogflowCxV3Page currentPage) {
    this.currentPage = currentPage;
    return this;
  }

  /**
   * The free-form diagnostic info. For example, this field could contain webhook call latency. The
   * fields of this data can change without notice, so you should not write code that depends on its
   * structure. One of the fields is called "Alternative Matched Intents", which may aid with
   * debugging. The following describes these intent results: - The list is empty if no intent was
   * matched to end-user input. - Only intents that are referenced in the currently active flow are
   * included. - The matched intent is included. - Other intents that could have matched end-user
   * input, but did not match because they are referenced by intent routes that are out of
   * [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope), are included. -
   * Other intents referenced by intent routes in scope that matched end-user input, but had a lower
   * confidence score.
   * @return value or {@code null} for none
   */
  public java.util.Map<String, java.lang.Object> getDiagnosticInfo() {
    return diagnosticInfo;
  }

  /**
   * The free-form diagnostic info. For example, this field could contain webhook call latency. The
   * fields of this data can change without notice, so you should not write code that depends on its
   * structure. One of the fields is called "Alternative Matched Intents", which may aid with
   * debugging. The following describes these intent results: - The list is empty if no intent was
   * matched to end-user input. - Only intents that are referenced in the currently active flow are
   * included. - The matched intent is included. - Other intents that could have matched end-user
   * input, but did not match because they are referenced by intent routes that are out of
   * [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope), are included. -
   * Other intents referenced by intent routes in scope that matched end-user input, but had a lower
   * confidence score.
   * @param diagnosticInfo diagnosticInfo or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setDiagnosticInfo(java.util.Map<String, java.lang.Object> diagnosticInfo) {
    this.diagnosticInfo = diagnosticInfo;
    return this;
  }

  /**
   * If a DTMF was provided as input, this field will contain a copy of the DTMFInput.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3DtmfInput getDtmf() {
    return dtmf;
  }

  /**
   * If a DTMF was provided as input, this field will contain a copy of the DTMFInput.
   * @param dtmf dtmf or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setDtmf(GoogleCloudDialogflowCxV3DtmfInput dtmf) {
    this.dtmf = dtmf;
    return this;
  }

  /**
   * The Intent that matched the conversational query. Some, not all fields are filled in this
   * message, including but not limited to: `name` and `display_name`. This field is deprecated,
   * please use QueryResult.match instead.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3Intent getIntent() {
    return intent;
  }

  /**
   * The Intent that matched the conversational query. Some, not all fields are filled in this
   * message, including but not limited to: `name` and `display_name`. This field is deprecated,
   * please use QueryResult.match instead.
   * @param intent intent or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setIntent(GoogleCloudDialogflowCxV3Intent intent) {
    this.intent = intent;
    return this;
  }

  /**
   * The intent detection confidence. Values range from 0.0 (completely uncertain) to 1.0
   * (completely certain). This value is for informational purpose only and is only used to help
   * match the best intent within the classification threshold. This value may change for the same
   * end-user expression at any time due to a model retraining or change in implementation. This
   * field is deprecated, please use QueryResult.match instead.
   * @return value or {@code null} for none
   */
  public java.lang.Float getIntentDetectionConfidence() {
    return intentDetectionConfidence;
  }

  /**
   * The intent detection confidence. Values range from 0.0 (completely uncertain) to 1.0
   * (completely certain). This value is for informational purpose only and is only used to help
   * match the best intent within the classification threshold. This value may change for the same
   * end-user expression at any time due to a model retraining or change in implementation. This
   * field is deprecated, please use QueryResult.match instead.
   * @param intentDetectionConfidence intentDetectionConfidence or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setIntentDetectionConfidence(java.lang.Float intentDetectionConfidence) {
    this.intentDetectionConfidence = intentDetectionConfidence;
    return this;
  }

  /**
   * The language that was triggered during intent detection. See [Language
   * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) for a list of the
   * currently supported language codes.
   * @return value or {@code null} for none
   */
  public java.lang.String getLanguageCode() {
    return languageCode;
  }

  /**
   * The language that was triggered during intent detection. See [Language
   * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) for a list of the
   * currently supported language codes.
   * @param languageCode languageCode or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setLanguageCode(java.lang.String languageCode) {
    this.languageCode = languageCode;
    return this;
  }

  /**
   * Intent match result, could be an intent or an event.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3Match getMatch() {
    return match;
  }

  /**
   * Intent match result, could be an intent or an event.
   * @param match match or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setMatch(GoogleCloudDialogflowCxV3Match match) {
    this.match = match;
    return this;
  }

  /**
   * The collected session parameters. Depending on your protocol or client library language, this
   * is a map, associative array, symbol table, dictionary, or JSON object composed of a collection
   * of (MapKey, MapValue) pairs: * MapKey type: string * MapKey value: parameter name * MapValue
   * type: If parameter's entity type is a composite entity then use map, otherwise, depending on
   * the parameter value type, it could be one of string, number, boolean, null, list or map. *
   * MapValue value: If parameter's entity type is a composite entity then use map from composite
   * entity property names to property values, otherwise, use parameter value.
   * @return value or {@code null} for none
   */
  public java.util.Map<String, java.lang.Object> getParameters() {
    return parameters;
  }

  /**
   * The collected session parameters. Depending on your protocol or client library language, this
   * is a map, associative array, symbol table, dictionary, or JSON object composed of a collection
   * of (MapKey, MapValue) pairs: * MapKey type: string * MapKey value: parameter name * MapValue
   * type: If parameter's entity type is a composite entity then use map, otherwise, depending on
   * the parameter value type, it could be one of string, number, boolean, null, list or map. *
   * MapValue value: If parameter's entity type is a composite entity then use map from composite
   * entity property names to property values, otherwise, use parameter value.
   * @param parameters parameters or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setParameters(java.util.Map<String, java.lang.Object> parameters) {
    this.parameters = parameters;
    return this;
  }

  /**
   * The list of rich messages returned to the client. Responses vary from simple text messages to
   * more sophisticated, structured payloads used to drive complex logic.
   * @return value or {@code null} for none
   */
  public java.util.List<GoogleCloudDialogflowCxV3ResponseMessage> getResponseMessages() {
    return responseMessages;
  }

  /**
   * The list of rich messages returned to the client. Responses vary from simple text messages to
   * more sophisticated, structured payloads used to drive complex logic.
   * @param responseMessages responseMessages or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setResponseMessages(java.util.List<GoogleCloudDialogflowCxV3ResponseMessage> responseMessages) {
    this.responseMessages = responseMessages;
    return this;
  }

  /**
   * The sentiment analyss result, which depends on `analyze_query_text_sentiment`, specified in the
   * request.
   * @return value or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3SentimentAnalysisResult getSentimentAnalysisResult() {
    return sentimentAnalysisResult;
  }

  /**
   * The sentiment analyss result, which depends on `analyze_query_text_sentiment`, specified in the
   * request.
   * @param sentimentAnalysisResult sentimentAnalysisResult or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setSentimentAnalysisResult(GoogleCloudDialogflowCxV3SentimentAnalysisResult sentimentAnalysisResult) {
    this.sentimentAnalysisResult = sentimentAnalysisResult;
    return this;
  }

  /**
   * If natural language text was provided as input, this field will contain a copy of the text.
   * @return value or {@code null} for none
   */
  public java.lang.String getText() {
    return text;
  }

  /**
   * If natural language text was provided as input, this field will contain a copy of the text.
   * @param text text or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setText(java.lang.String text) {
    this.text = text;
    return this;
  }

  /**
   * If natural language speech audio was provided as input, this field will contain the transcript
   * for the audio.
   * @return value or {@code null} for none
   */
  public java.lang.String getTranscript() {
    return transcript;
  }

  /**
   * If natural language speech audio was provided as input, this field will contain the transcript
   * for the audio.
   * @param transcript transcript or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setTranscript(java.lang.String transcript) {
    this.transcript = transcript;
    return this;
  }

  /**
   * If an event was provided as input, this field will contain the name of the event.
   * @return value or {@code null} for none
   */
  public java.lang.String getTriggerEvent() {
    return triggerEvent;
  }

  /**
   * If an event was provided as input, this field will contain the name of the event.
   * @param triggerEvent triggerEvent or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setTriggerEvent(java.lang.String triggerEvent) {
    this.triggerEvent = triggerEvent;
    return this;
  }

  /**
   * If an intent was provided as input, this field will contain a copy of the intent identifier.
   * Format: `projects//locations//agents//intents/`.
   * @return value or {@code null} for none
   */
  public java.lang.String getTriggerIntent() {
    return triggerIntent;
  }

  /**
   * If an intent was provided as input, this field will contain a copy of the intent identifier.
   * Format: `projects//locations//agents//intents/`.
   * @param triggerIntent triggerIntent or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setTriggerIntent(java.lang.String triggerIntent) {
    this.triggerIntent = triggerIntent;
    return this;
  }

  /**
   * The list of webhook payload in WebhookResponse.payload, in the order of call sequence. If some
   * webhook call fails or doesn't return any payload, an empty `Struct` would be used instead.
   * @return value or {@code null} for none
   */
  public java.util.List<java.util.Map<String, java.lang.Object>> getWebhookPayloads() {
    return webhookPayloads;
  }

  /**
   * The list of webhook payload in WebhookResponse.payload, in the order of call sequence. If some
   * webhook call fails or doesn't return any payload, an empty `Struct` would be used instead.
   * @param webhookPayloads webhookPayloads or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setWebhookPayloads(java.util.List<java.util.Map<String, java.lang.Object>> webhookPayloads) {
    this.webhookPayloads = webhookPayloads;
    return this;
  }

  /**
   * The list of webhook call status in the order of call sequence.
   * @return value or {@code null} for none
   */
  public java.util.List<GoogleRpcStatus> getWebhookStatuses() {
    return webhookStatuses;
  }

  /**
   * The list of webhook call status in the order of call sequence.
   * @param webhookStatuses webhookStatuses or {@code null} for none
   */
  public GoogleCloudDialogflowCxV3QueryResult setWebhookStatuses(java.util.List<GoogleRpcStatus> webhookStatuses) {
    this.webhookStatuses = webhookStatuses;
    return this;
  }

  @Override
  public GoogleCloudDialogflowCxV3QueryResult set(String fieldName, Object value) {
    return (GoogleCloudDialogflowCxV3QueryResult) super.set(fieldName, value);
  }

  @Override
  public GoogleCloudDialogflowCxV3QueryResult clone() {
    return (GoogleCloudDialogflowCxV3QueryResult) super.clone();
  }

}


text:
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef HEAP_HEAP_TESTER_H_
#define HEAP_HEAP_TESTER_H_

#include "src/handles.h"
#include "src/heap/spaces.h"

// Tests that should have access to private methods of {v8::internal::Heap}.
// Those tests need to be defined using HEAP_TEST(Name) { ... }.
#define HEAP_TEST_METHODS(V)                              \
  V(CompactionFullAbortedPage)                            \
  V(CompactionPartiallyAbortedPage)                       \
  V(CompactionPartiallyAbortedPageIntraAbortedPointers)   \
  V(CompactionPartiallyAbortedPageWithStoreBufferEntries) \
  V(CompactionSpaceDivideMultiplePages)                   \
  V(CompactionSpaceDivideSinglePage)                      \
  V(GCFlags)                                              \
  V(MarkCompactCollector)                                 \
  V(NoPromotion)                                          \
  V(NumberStringCacheSize)                                \
  V(ObjectGroups)                                         \
  V(Promotion)                                            \
  V(Regression39128)                                      \
  V(ResetWeakHandle)                                      \
  V(StressHandles)                                        \
  V(TestMemoryReducerSampleJsCalls)                       \
  V(TestSizeOfObjects)                                    \
  V(Regress587004)                                        \
  V(Regress589413)                                        \
  V(WriteBarriersInCopyJSObject)

#define HEAP_TEST(Name)                                                       \
  CcTest register_test_##Name(v8::internal::HeapTester::Test##Name, __FILE__, \
                              #Name, true, true);                             \
  void v8::internal::HeapTester::Test##Name()

#define THREADED_HEAP_TEST(Name)                                             \
  RegisterThreadedTest register_##Name(v8::internal::HeapTester::Test##Name, \
                                       #Name);                               \
  /* */ HEAP_TEST(Name)

namespace v8 {
namespace internal {

class HeapTester {
 public:
#define DECLARE_STATIC(Name) static void Test##Name();

  HEAP_TEST_METHODS(DECLARE_STATIC)
#undef HEAP_TEST_METHODS

  /* test-alloc.cc */
  static AllocationResult AllocateAfterFailures();
  static Handle<Object> TestAllocateAfterFailures();

  /* test-api.cc */
  static void ResetWeakHandle(bool global_gc);
};

}  // namespace internal
}  // namespace v8

#endif  // HEAP_HEAP_TESTER_H_


text:
namespace CustomWorkoutPlanner.Services
{
    using Microsoft.AspNetCore.Mvc;
    using Microsoft.Extensions.Options;
    using CustomWorkoutPlanner.Settings;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;

    public class ManifestService : IManifestService
    {
        private readonly IOptions<AppSettings> appSettings;
        private readonly IUrlHelper urlHelper;

        public ManifestService(
            IOptions<AppSettings> appSettings,
            IUrlHelper urlHelper)
        {
            this.appSettings = appSettings;
            this.urlHelper = urlHelper;
        }

        /// <summary>
        /// Gets the manifest JSON for the current site. This allows you to customize the icon and other browser
        /// settings for Chrome/Android and FireFox (FireFox support is coming). See https://w3c.github.io/manifest/
        /// for the official W3C specification. See http://html5doctor.com/web-manifest-specification/ for more
        /// information. See https://developer.chrome.com/multidevice/android/installtohomescreen for Chrome's
        /// implementation.
        /// </summary>
        /// <returns>The manifest JSON for the current site.</returns>
        public string GetManifestJson()
        {
            JObject document = new JObject(
                new JProperty("short_name", this.appSettings.Value.SiteShortTitle),
                new JProperty("name", this.appSettings.Value.SiteTitle),
                new JProperty("icons",
                    new JArray(
                        GetIconJObject("~/img/icons/android-chrome-36x36.png", "36x36", "image/png", "0.75"),
                        GetIconJObject("~/img/icons/android-chrome-48x48.png", "48x48", "image/png", "1.0"),
                        GetIconJObject("~/img/icons/android-chrome-72x72.png", "72x72", "image/png", "1.5"),
                        GetIconJObject("~/img/icons/android-chrome-96x96.png", "96x96", "image/png", "2.0"),
                        GetIconJObject("~/img/icons/android-chrome-144x144.png", "144x144", "image/png", "3.0"),
                        GetIconJObject("~/img/icons/android-chrome-192x192.png", "192x192", "image/png", "4.0"))));

            return document.ToString(Formatting.Indented);
        }

        /// <summary>
        /// Gets a <see cref="JObject"/> containing the specified image details.
        /// </summary>
        /// <param name="iconPath">The path to the icon image.</param>
        /// <param name="sizes">The size of the image in the format AxB.</param>
        /// <param name="type">The MIME type of the image.</param>
        /// <param name="density">The pixel density of the image.</param>
        /// <returns>A <see cref="JObject"/> containing the image details.</returns>
        private JObject GetIconJObject(string iconPath, string sizes, string type, string density)
        {
            return new JObject(
                new JProperty("src", this.urlHelper.Content(iconPath)),
                new JProperty("sizes", sizes),
                new JProperty("type", type),
                new JProperty("density", density));
        }
    }
}


text:
package cn.nsx.yaoyiyao;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import cn.nsx.yaoyiyao.R;
import cn.nsx.yaoyiyao.util.HTTPUtil;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.LevelListDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

/**
 * ÁÄÌì»î¶¯
 */
public class ChatActivity extends Activity implements OnClickListener{
    /** Called when the activity is first created. */

	private boolean ComMsg = true;
	private boolean ToMsg = false;

	private Button mBtnSend;//·¢ËÍÏûÏ¢°´Å¥
	private Button mBtnBack;//·µ»Ø°´Å¥
	private EditText mEditTextContent;//ÏûÏ¢±à¼¿ò
	private ListView mListView;
	private ChatMsgViewAdapter mAdapter;//ÊÊÅäÆ÷
	private List<ChatMsgEntity> mDataArrays = null;//´æ·ÅÊý¾ÝÔ´

	private Handler mHandler = new Handler()
	{
		public void handleMessage(android.os.Message msg) {
			//µÈ´ý½ÓÊÜ×ÓÏß³ÌÍê³ÉÊý¾Ý·µ»Ø
			ChatMsgEntity fromMassage = (ChatMsgEntity) msg.obj;
			mDataArrays.add(fromMassage);
			mAdapter.notifyDataSetChanged();//¸üнçÃæ
		};
	};

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.chat_xiaohei);
        //Æô¶¯activityʱ²»×Ô¶¯µ¯³öÈí¼üÅÌ
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

        initView();//Íê³É±äÁ¿µÄ³õ'»¯

        initData();//Íê³ÉÊý¾ÝµÄ³õ'»¯

    }

	//Íê³É±äÁ¿µÄ³õ'»¯
    public void initView()
    {
    	mListView = (ListView) findViewById(R.id.listview);
    	mBtnSend = (Button) findViewById(R.id.btn_send);
    	mBtnSend.setOnClickListener(this);
    	mBtnBack = (Button) findViewById(R.id.btn_back);
    	mBtnBack.setOnClickListener(this);
    	mEditTextContent = (EditText) findViewById(R.id.et_sendmessage);
    }

    //³õ'»¯Êý¾Ý£¨¿ªÊ¼ÏÔʾµÄÁÄÌìÊý¾Ý£©
    public void initData()
    {
    	mDataArrays = new ArrayList<ChatMsgEntity>();//ÏûÏ¢Êý¾Ý¼¯
    	ChatMsgEntity entity = new ChatMsgEntity();//ʵÀýÒ»¸öÏûÏ¢Àà
    	entity.setDate(new Date());//ÉèÖÃʱ¼ä
    	entity.setMsgType(true);//ÉèÖÃÏûÏ¢ÀàÐÍ£¬true´ú±í½ÓÊÕ,false´ú±í·¢ËÍ
    	entity.setText("ÄãºÃ£¬Ð¡Ä½ÎªÄú·þÎñ");//ÏûÏ¢ÄÚÈÝ
    	mDataArrays.add(entity);//½«ÏûϢʵÌåÌí¼Ó¸øÊý¾Ý¼¯

    	//½«ÏûÏ¢Êý¾Ý  ͨ¹ýÊÊÅäÆ÷ÉèÖõ½ListViewÖÐ
    	mAdapter = new ChatMsgViewAdapter(this, mDataArrays);
    	mListView.setAdapter(mAdapter);
    }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId())
		{
		case R.id.btn_send:
			send();
			break;
		case R.id.btn_back:
			finish();
			break;
		}
	}

	private void send()
	{
		final String contString = mEditTextContent.getText().toString();//»ñÈ¡·¢Ëͱ༭¿òÄÚÈÝ
		if (contString.length() > 0)//ÄÚÈݲ»Îª¿Õ,
		{
			//½«ÎÒÃÇ·¢Ë͵ÄÏûÏ¢·â×°µ½ChatMsgEntityÀàÖУ¬Í¬Ê±ÏÔʾµ½ListViewÖÐ
			ChatMsgEntity toMessage = new ChatMsgEntity(new Date(), contString,ToMsg);
			mDataArrays.add(toMessage);
			mAdapter.notifyDataSetChanged();

			mEditTextContent.setText("");//ÊäÈë¿òÇå¿Õ

			new Thread(){//ÔÚÏß³ÌÖÐÍê³ÉÍøÂçÇëÇó
				public void run() {
					//½«ÏûÏ¢ÄÚÈÝ·¢Ë͵½Í¼Áé»úÆ÷ÈË,Êý¾Ý·µ»ØfromMessage
					ChatMsgEntity fromMessage = HTTPUtil.sendMessage(contString);
					Message m = Message.obtain();
					m.obj = fromMessage;
					mHandler.sendMessage(m);//ͨ¹ýHandlerÍê³É½çÃæ¸üÐÂ
				};
			}.start();
		}
		else {//Èç¹ûÏûϢΪ¿Õ
			Toast.makeText(ChatActivity.this, "·¢ËÍÏûÏ¢²»ÄÜΪ¿Õ", Toast.LENGTH_SHORT).show();
			return;
		}
	}

	//»ñÈ¡µ±Ç°Ê±¼ä
    private String getDate() {
        Calendar c = Calendar.getInstance();

        String year = String.valueOf(c.get(Calendar.YEAR));
        String month = String.valueOf(c.get(Calendar.MONTH));
        String day = String.valueOf(c.get(Calendar.DAY_OF_MONTH) + 1);
        String hour = String.valueOf(c.get(Calendar.HOUR_OF_DAY));
        String mins = String.valueOf(c.get(Calendar.MINUTE));

        StringBuffer sbBuffer = new StringBuffer();
        sbBuffer.append(year + "-" + month + "-" + day + " " + hour + ":" + mins);

        return sbBuffer.toString();
    }

    public void head_xiaohei(View v) {     //µã»÷Í·ÏñÏêϸÐÅÏ¢
    	Intent intent = new Intent (ChatActivity.this,InfoXiaohei.class);
		startActivity(intent);
      }
}


text:
require 'bundler/setup'
require 'database_cleaner'
require 'dodgy_stalker'
require 'pry'

DatabaseCleaner.strategy = :transaction
RSpec.configure do |config|
  config.mock_with :rspec
  config.order = "random"
  config.before(:suite) { DatabaseCleaner.clean_with(:truncation) }

  config.around do |example|
    DatabaseCleaner.start
    example.run
    DatabaseCleaner.clean
  end
end

ActiveRecord::Base.establish_connection(
  adapter: 'postgresql',
  database: 'dodgy_stalker',
  username: 'rob',
  host: 'localhost'
)

ActiveRecord::Migrator.migrate(File.expand_path('../migrations', __FILE__))


text:
function Validator(attrs) {
  this.attrs = attrs;
  this.successfulChecks = [];
  this.failedChecks = [];
  return this;
}

Validator.prototype.checkExist = function (field) {
  if (this.attrs[field] != null) {
    this.successfulChecks.push({ check: 'exist', field: field });
  } else {
    this.failedChecks.push({ check: 'exist', field: field });
  }
  return this;
};

Validator.prototype.checkType = function (field, type) {
  if (typeof this.attrs[field] === type) {
    this.successfulChecks.push({ check: 'type', field: field, type: type });
  } else {
    this.failedChecks.push({ check: 'type', field: field, type: type });
  }
  return this;
};

Validator.prototype.checkOnlyFields = function (fields) {
  var currentFields = Object.keys(this.attrs),
      pass = currentFields.length === fields.length;
  fields.forEach(function (field) {
    if (currentFields[field] == null) {
      pass = false;
    }
  });
  if (pass) {
    this.successfulChecks.push({ check: 'only', fields: fields });
  } else {
    this.failedChecks.push({ check: 'only', fields: fields });
  }
  return this;
};

Validator.prototype.checkCustom = function (fn) {
  if (fn(this.attrs)) {
    this.successfulChecks.push({ check: 'custom' });
  } else {
    this.failedChecks.push({ check: 'custom' });
  }
  return this;
};

Validator.prototype.getFailedChecks = function () {
  return this.failedChecks.slice();
};

module.exports = function (attrs) {
  return new Validator(attrs);
};


text: bq query --format=prettyjson --use_legacy_sql=false 'SELECT * FROM `ems-data-platform.dataflow_errors.mobileeventspipeline` LIMIT 1000'


text:
'use strict';

/* jshint -W110 */
var Utils = require('../../utils')
  , DataTypes = require('../../data-types')
  , AbstractQueryGenerator = require('../abstract/query-generator')
  , semver = require('semver');

/* istanbul ignore next */
var throwMethodUndefined = function(methodName) {
  throw new Error('The method "' + methodName + '" is not defined! Please add it to your sql dialect.');
};

var QueryGenerator = {
  options: {},
  dialect: 'mssql',

  createSchema: function(schema) {
    return [
      'IF NOT EXISTS (SELECT schema_name',
      'FROM information_schema.schemata',
      'WHERE schema_name =', wrapSingleQuote(schema), ')',
      'BEGIN',
        "EXEC sp_executesql N'CREATE SCHEMA",
        this.quoteIdentifier(schema),
        ";'",
      'END;'
    ].join(' ');
  },

  showSchemasQuery: function() {
    return [
      'SELECT "name" as "schema_name" FROM sys.schemas as s',
      'WHERE "s"."name" NOT IN (',
        "'INFORMATION_SCHEMA', 'dbo', 'guest', 'sys', 'archive'",
      ')', 'AND', '"s"."name" NOT LIKE', "'db_%'"
    ].join(' ');
  },

  versionQuery: function() {
    // Uses string manipulation to convert the MS Maj.Min.Patch.Build to semver Maj.Min.Patch
    return [
      'DECLARE @ms_ver NVARCHAR(20);',
      "SET @ms_ver = REVERSE(CONVERT(NVARCHAR(20), SERVERPROPERTY('ProductVersion')));",
      "SELECT REVERSE(SUBSTRING(@ms_ver, CHARINDEX('.', @ms_ver)+1, 20)) AS 'version'"
    ].join(' ');
  },

  createTableQuery: function(tableName, attributes, options) {
    var query = "IF OBJECT_ID('<%= table %>', 'U') IS NULL CREATE TABLE <%= table %> (<%= attributes %>)"
      , primaryKeys = []
      , foreignKeys = {}
      , attrStr = []
      , self = this;

    for (var attr in attributes) {
      if (attributes.hasOwnProperty(attr)) {
        var dataType = attributes[attr]
          , match;

        if (Utils._.includes(dataType, 'PRIMARY KEY')) {
          primaryKeys.push(attr);

          if (Utils._.includes(dataType, 'REFERENCES')) {
             // MSSQL doesn't support inline REFERENCES declarations: move to the end
            match = dataType.match(/^(.+) (REFERENCES.*)$/);
            attrStr.push(this.quoteIdentifier(attr) + ' ' + match[1].replace(/PRIMARY KEY/, ''));
            foreignKeys[attr] = match[2];
          } else {
            attrStr.push(this.quoteIdentifier(attr) + ' ' + dataType.replace(/PRIMARY KEY/, ''));
          }
        } else if (Utils._.includes(dataType, 'REFERENCES')) {
          // MSSQL doesn't support inline REFERENCES declarations: move to the end
          match = dataType.match(/^(.+) (REFERENCES.*)$/);
          attrStr.push(this.quoteIdentifier(attr) + ' ' + match[1]);
          foreignKeys[attr] = match[2];
        } else {
          attrStr.push(this.quoteIdentifier(attr) + ' ' + dataType);
        }
      }
    }

    var values = {
      table: this.quoteTable(tableName),
      attributes: attrStr.join(', '),
    }
    , pkString = primaryKeys.map(function(pk) { return this.quoteIdentifier(pk); }.bind(this)).join(', ');

    if (!!options.uniqueKeys) {
      Utils._.each(options.uniqueKeys, function(columns, indexName) {
        if (!Utils._.isString(indexName)) {
          indexName = 'uniq_' + tableName + '_' + columns.fields.join('_');
        }
        values.attributes += ', CONSTRAINT ' + self.quoteIdentifier(indexName) + ' UNIQUE (' + Utils._.map(columns.fields, self.quoteIdentifier).join(', ') + ')';
      });
    }

    if (pkString.length > 0) {
      values.attributes += ', PRIMARY KEY (' + pkString + ')';
    }

    for (var fkey in foreignKeys) {
      if (foreignKeys.hasOwnProperty(fkey)) {
        values.attributes += ', FOREIGN KEY (' + this.quoteIdentifier(fkey) + ') ' + foreignKeys[fkey];
      }
    }

    return Utils._.template(query)(values).trim() + ';';
  },

  describeTableQuery: function(tableName, schema) {
    var sql = [
      'SELECT',
        "c.COLUMN_NAME AS 'Name',",
        "c.DATA_TYPE AS 'Type',",
        "c.CHARACTER_MAXIMUM_LENGTH AS 'Length',",
        "c.IS_NULLABLE as 'IsNull',",
        "COLUMN_DEFAULT AS 'Default',",
        "tc.CONSTRAINT_TYPE AS 'Constraint'",
      'FROM',
        'INFORMATION_SCHEMA.TABLES t',
      'INNER JOIN',
        'INFORMATION_SCHEMA.COLUMNS c ON t.TABLE_NAME = c.TABLE_NAME AND t.TABLE_SCHEMA = c.TABLE_SCHEMA',
      'LEFT JOIN',
        'INFORMATION_SCHEMA.KEY_COLUMN_USAGE cu ON t.TABLE_NAME = cu.TABLE_NAME AND cu.COLUMN_NAME = c.COLUMN_NAME AND t.TABLE_SCHEMA = cu.TABLE_SCHEMA',
      'LEFT JOIN',
        'INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc ON t.TABLE_NAME = tc.TABLE_NAME AND cu.COLUMN_NAME = c.COLUMN_NAME AND tc.CONSTRAINT_TYPE = \'PRIMARY KEY\'',
      'WHERE t.TABLE_NAME =', wrapSingleQuote(tableName)
    ].join(' ');

    if (schema) {
      sql += 'AND t.TABLE_SCHEMA =' + wrapSingleQuote(schema);
    }

    return sql;
  },

  renameTableQuery: function(before, after) {
    var query = 'EXEC sp_rename <%= before %>, <%= after %>;';
    return Utils._.template(query)({
      before: this.quoteTable(before),
      after: this.quoteTable(after)
    });
  },

  showTablesQuery: function () {
    return 'SELECT TABLE_NAME, TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES;';
  },

  dropTableQuery: function(tableName) {
    var query = "IF OBJECT_ID('<%= table %>', 'U') IS NOT NULL DROP TABLE <%= table %>";
    var values = {
      table: this.quoteTable(tableName)
    };

    return Utils._.template(query)(values).trim() + ';';
  },

  addColumnQuery: function(table, key, dataType) {
    // FIXME: attributeToSQL SHOULD be using attributes in addColumnQuery
    //        but instead we need to pass the key along as the field here
    dataType.field = key;

    var query = 'ALTER TABLE <%= table %> ADD <%= attribute %>;'
      , attribute = Utils._.template('<%= key %> <%= definition %>')({
        key: this.quoteIdentifier(key),
        definition: this.attributeToSQL(dataType, {
          context: 'addColumn'
        })
      });

    return Utils._.template(query)({
      table: this.quoteTable(table),
      attribute: attribute
    });
  },

  removeColumnQuery: function(tableName, attributeName) {
    var query = 'ALTER TABLE <%= tableName %> DROP COLUMN <%= attributeName %>;';
    return Utils._.template(query)({
      tableName: this.quoteTable(tableName),
      attributeName: this.quoteIdentifier(attributeName)
    });
  },

  changeColumnQuery: function(tableName, attributes) {
    var query = 'ALTER TABLE <%= tableName %> <%= query %>;';
    var attrString = [], constraintString = [];

    for (var attributeName in attributes) {
      var definition = attributes[attributeName];
      if (definition.match(/REFERENCES/)) {
        constraintString.push(Utils._.template('<%= fkName %> FOREIGN KEY (<%= attrName %>) <%= definition %>')({
          fkName: this.quoteIdentifier(attributeName + '_foreign_idx'),
          attrName: this.quoteIdentifier(attributeName),
          definition: definition.replace(/.+?(?=REFERENCES)/,'')
        }));
      } else {
        attrString.push(Utils._.template('<%= attrName %> <%= definition %>')({
          attrName: this.quoteIdentifier(attributeName),
          definition: definition
        }));
      }
    }

    var finalQuery = '';
    if (attrString.length) {
      finalQuery += 'ALTER COLUMN ' + attrString.join(', ');
      finalQuery += constraintString.length ? ' ' : '';
    }
    if (constraintString.length) {
      finalQuery += 'ADD CONSTRAINT ' + constraintString.join(', ');
    }

    return Utils._.template(query)({
      tableName: this.quoteTable(tableName),
      query: finalQuery
    });
  },

  renameColumnQuery: function(tableName, attrBefore, attributes) {
    var query = "EXEC sp_rename '<%= tableName %>.<%= before %>', '<%= after %>', 'COLUMN';"
      , newName = Object.keys(attributes)[0];

    return Utils._.template(query)({
      tableName: this.quoteTable(tableName),
      before: attrBefore,
      after: newName
    });
  },

  bulkInsertQuery: function(tableName, attrValueHashes, options, attributes) {
    options = options || {};
    attributes = attributes || {};
    var query = 'INSERT INTO <%= table %> (<%= attributes %>)<%= output %> VALUES <%= tuples %>;'
      , emptyQuery = 'INSERT INTO <%= table %><%= output %> DEFAULT VALUES'
      , tuples = []
      , allAttributes = []
      , needIdentityInsertWrapper = false
      , allQueries = []
      , outputFragment;

    if (options.returning) {
      outputFragment = ' OUTPUT INSERTED.*';
    }

    Utils._.forEach(attrValueHashes, function(attrValueHash) {
      // special case for empty objects with primary keys
      var fields = Object.keys(attrValueHash);
      var firstAttr = attributes[fields[0]];
      if (fields.length === 1 && firstAttr && firstAttr.autoIncrement && attrValueHash[fields[0]] === null) {
        allQueries.push(emptyQuery);
        return;
      }

      // normal case
      Utils._.forOwn(attrValueHash, function(value, key) {
        if (value !== null && attributes[key] && attributes[key].autoIncrement) {
          needIdentityInsertWrapper = true;
        }

        if (allAttributes.indexOf(key) === -1) {
          if (value === null && attributes[key].autoIncrement)
            return;

          allAttributes.push(key);
        }
      });
    });

    if (allAttributes.length > 0) {
      Utils._.forEach(attrValueHashes, function(attrValueHash) {
        tuples.push('(' +
          allAttributes.map(function(key) {
            return this.escape(attrValueHash[key]);
          }.bind(this)).join(',') +
        ')');
      }.bind(this));

      allQueries.push(query);
    }

    var replacements = {
      table: this.quoteTable(tableName),
      attributes: allAttributes.map(function(attr) {
                    return this.quoteIdentifier(attr);
                  }.bind(this)).join(','),
      tuples: tuples,
      output: outputFragment
    };

    var generatedQuery = Utils._.template(allQueries.join(';'))(replacements);
    if (needIdentityInsertWrapper) {
      generatedQuery = [
        'SET IDENTITY_INSERT', this.quoteTable(tableName), 'ON;',
        generatedQuery,
        'SET IDENTITY_INSERT', this.quoteTable(tableName), 'OFF;',
      ].join(' ');
    }

    return generatedQuery;
  },

  upsertQuery: function(tableName, insertValues, updateValues, where, rawAttributes, options) {
    var query = 'MERGE INTO <%= tableNameQuoted %> WITH(HOLDLOCK) AS <%= targetTableAlias %> USING (<%= sourceTableQuery %>) AS <%= sourceTableAlias%>(<%=insertKeysQuoted%>) ON <%= joinCondition %>';
    query += ' WHEN MATCHED THEN UPDATE SET <%= updateSnippet %> WHEN NOT MATCHED THEN INSERT <%= insertSnippet %> OUTPUT $action, INSERTED.*;';

    var targetTableAlias = this.quoteTable(tableName + '_target')
      , sourceTableAlias = this.quoteTable(tableName + '_source')
      , primaryKeysAttrs = []
      , identityAttrs = []
      , uniqueAttrs = []
      , tableNameQuoted = this.quoteTable(tableName)
      , joinCondition
      , needIdentityInsertWrapper = false;

    //Obtain primaryKeys, uniquekeys and identity attrs from rawAttributes as model is not passed
    for (var key in rawAttributes) {
      if (rawAttributes[key].primaryKey) {
        primaryKeysAttrs.push(rawAttributes[key].field || key);
      }
      if (rawAttributes[key].unique) {
        uniqueAttrs.push(rawAttributes[key].field || key);
      }
      if (rawAttributes[key].autoIncrement) {
        identityAttrs.push(rawAttributes[key].field || key);
      }
    }

    var updateKeys = Object.keys(updateValues)
      , insertKeys = Object.keys(insertValues);

    var insertKeysQuoted = Utils._.map(insertKeys, function(key) {
      return this.quoteIdentifier(key);
    }.bind(this)).join(', ');

    var insertValuesEscaped = Utils._.map(insertKeys, function(key) {
      return this.escape(insertValues[key]);
    }.bind(this)).join(', ');

    var sourceTableQuery = 'VALUES(' + insertValuesEscaped + ')'; //Virtual Table

    //IDENTITY_INSERT Condition
    identityAttrs.forEach(function(key) {
      if (updateValues[key] && updateValues[key] !== null) {
        needIdentityInsertWrapper = true;
        /*
         * IDENTITY_INSERT Column Cannot be updated, only inserted
         * http://stackoverflow.com/a/30176254/2254360
         */
      }
    });

    //Filter NULL Clauses
    var clauses = where.$or.filter(function(clause) {
      var valid = true;
      /*
       * Exclude NULL Composite PK/UK. Partial Composite clauses should also be excluded as it doesn't guarantee a single row
       */
      for (var key in clause) {
        if (!clause[key]) {
          valid = false;
          break;
        }
      }
      return valid;
    });

    /*
     * Generate ON condition using PK(s).
     * If not, generate using UK(s). Else throw error
     */
    var getJoinSnippet = function(array) {
      return Utils._.map(array, function(key) {
        key = this.quoteIdentifier(key);
        return targetTableAlias + '.' + key + ' = ' + sourceTableAlias + '.' + key;
      }.bind(this));
    };

    if (clauses.length === 0) {
      throw new Error('Primary Key or Unique key should be passed to upsert query');
    } else {
      // Search for primary key attribute in clauses -- Model can have two separate unique keys
      for (key in clauses) {
        var keys = Object.keys(clauses[key]);
        if (primaryKeysAttrs.indexOf(keys[0]) !== -1) {
          joinCondition = getJoinSnippet.bind(this)(primaryKeysAttrs).join(' AND ');
          break;
        }
      }
      if (!joinCondition) {
        joinCondition = getJoinSnippet.bind(this)(uniqueAttrs).join(' AND ');
      }
    }

    // Remove the IDENTITY_INSERT Column from update
    var updateSnippet = updateKeys.filter(function(key) {
      if (identityAttrs.indexOf(key) === -1) {
        return true;
      } else {
        return false;
      }
    });

    updateSnippet = Utils._.map(updateSnippet, function(key) {
      var value = this.escape(updateValues[key]);
      key = this.quoteIdentifier(key);
      return targetTableAlias + '.' + key + ' = ' + value;
    }.bind(this)).join(', ');

    var insertSnippet = '(' + insertKeysQuoted + ') VALUES(' + insertValuesEscaped + ')';

    var replacements = {
      tableNameQuoted: tableNameQuoted,
      targetTableAlias: targetTableAlias,
      sourceTableQuery: sourceTableQuery,
      sourceTableAlias: sourceTableAlias,
      insertKeysQuoted: insertKeysQuoted,
      joinCondition: joinCondition,
      updateSnippet: updateSnippet,
      insertSnippet: insertSnippet
    };

    query = Utils._.template(query)(replacements);

    if (needIdentityInsertWrapper) {
      query = [
        'SET IDENTITY_INSERT', this.quoteTable(tableName), 'ON;',
        query,
        'SET IDENTITY_INSERT', this.quoteTable(tableName), 'OFF;',
      ].join(' ');
    }
    return query;
  },

  deleteQuery: function(tableName, where, options) {
    options = options || {};

    var table = this.quoteTable(tableName);
    if (options.truncate === true) {
      // Truncate does not allow LIMIT and WHERE
      return 'TRUNCATE TABLE ' + table;
    }

    where = this.getWhereConditions(where);
    var limit = ''
      , query = 'DELETE<%= limit %> FROM <%= table %><%= where %>; ' +
                'SELECT @@ROWCOUNT AS AFFECTEDROWS;';

    if (Utils._.isUndefined(options.limit)) {
      options.limit = 1;
    }

    if (!!options.limit) {
      limit = ' TOP(' + this.escape(options.limit) + ')';
    }

    var replacements = {
      limit: limit,
      table: table,
      where: where,
    };

    if (replacements.where) {
      replacements.where = ' WHERE ' + replacements.where;
    }

    return Utils._.template(query)(replacements);
  },

  showIndexesQuery: function(tableName) {
    var sql = "EXEC sys.sp_helpindex @objname = N'<%= tableName %>';";
    return Utils._.template(sql)({
      tableName: this.quoteTable(tableName)
    });
  },

  removeIndexQuery: function(tableName, indexNameOrAttributes) {
    var sql = 'DROP INDEX <%= indexName %> ON <%= tableName %>'
      , indexName = indexNameOrAttributes;

    if (typeof indexName !== 'string') {
      indexName = Utils.inflection.underscore(tableName + '_' + indexNameOrAttributes.join('_'));
    }

    var values = {
      tableName: this.quoteIdentifiers(tableName),
      indexName: indexName
    };

    return Utils._.template(sql)(values);
  },

  attributeToSQL: function(attribute) {
    if (!Utils._.isPlainObject(attribute)) {
      attribute = {
        type: attribute
      };
    }

    // handle self referential constraints
    if (attribute.references) {
      attribute = Utils.formatReferences(attribute);

      if (attribute.Model && attribute.Model.tableName === attribute.references.model) {
        this.sequelize.log('MSSQL does not support self referencial constraints, '
          + 'we will remove it but we recommend restructuring your query');
        attribute.onDelete = '';
        attribute.onUpdate = '';
      }
    }

    var template;

    if (attribute.type instanceof DataTypes.ENUM) {
      if (attribute.type.values && !attribute.values) attribute.values = attribute.type.values;

      // enums are a special case
      template = attribute.type.toSql();
      template += ' CHECK (' + attribute.field + ' IN(' + Utils._.map(attribute.values, function(value) {
        return this.escape(value);
      }.bind(this)).join(', ') + '))';
      return template;
    } else {
      template = attribute.type.toString();
    }

    if (attribute.allowNull === false) {
      template += ' NOT NULL';
    } else if (!attribute.primaryKey && !Utils.defaultValueSchemable(attribute.defaultValue)) {
      template += ' NULL';
    }

    if (attribute.autoIncrement) {
      template += ' IDENTITY(1,1)';
    }

    // Blobs/texts cannot have a defaultValue
    if (attribute.type !== 'TEXT' && attribute.type._binary !== true &&
        Utils.defaultValueSchemable(attribute.defaultValue)) {
      template += ' DEFAULT ' + this.escape(attribute.defaultValue);
    }

    if (attribute.unique === true) {
      template += ' UNIQUE';
    }

    if (attribute.primaryKey) {
      template += ' PRIMARY KEY';
    }

    if (attribute.references) {
      template += ' REFERENCES ' + this.quoteTable(attribute.references.model);

      if (attribute.references.key) {
        template += ' (' + this.quoteIdentifier(attribute.references.key) + ')';
      } else {
        template += ' (' + this.quoteIdentifier('id') + ')';
      }

      if (attribute.onDelete) {
        template += ' ON DELETE ' + attribute.onDelete.toUpperCase();
      }

      if (attribute.onUpdate) {
        template += ' ON UPDATE ' + attribute.onUpdate.toUpperCase();
      }
    }

    return template;
  },

  attributesToSQL: function(attributes, options) {
    var result = {}
      , key
      , attribute
      , existingConstraints = [];

    for (key in attributes) {
      attribute = attributes[key];

      if (attribute.references) {
        attribute = Utils.formatReferences(attributes[key]);

        if (existingConstraints.indexOf(attribute.references.model.toString()) !== -1) {
          // no cascading constraints to a table more than once
          attribute.onDelete = '';
          attribute.onUpdate = '';
        } else {
          existingConstraints.push(attribute.references.model.toString());

          // NOTE: this really just disables cascading updates for all
          //       definitions. Can be made more robust to support the
          //       few cases where MSSQL actually supports them
          attribute.onUpdate = '';
        }

      }

      if (key && !attribute.field) attribute.field = key;
      result[attribute.field || key] = this.attributeToSQL(attribute, options);
    }

    return result;
  },

  findAutoIncrementField: function(factory) {
    var fields = [];
    for (var name in factory.attributes) {
      if (factory.attributes.hasOwnProperty(name)) {
        var definition = factory.attributes[name];

        if (definition && definition.autoIncrement) {
          fields.push(name);
        }
      }
    }

    return fields;
  },

  createTrigger: function() {
    throwMethodUndefined('createTrigger');
  },

  dropTrigger: function() {
    throwMethodUndefined('dropTrigger');
  },

  renameTrigger: function() {
    throwMethodUndefined('renameTrigger');
  },

  createFunction: function() {
    throwMethodUndefined('createFunction');
  },

  dropFunction: function() {
    throwMethodUndefined('dropFunction');
  },

  renameFunction: function() {
    throwMethodUndefined('renameFunction');
  },

  quoteIdentifier: function(identifier, force) {
      if (identifier === '*') return identifier;
      return '[' + identifier.replace(/[\[\]']+/g,'') + ']';
  },

  getForeignKeysQuery: function(table) {
    var tableName = table.tableName || table;
    var sql = [
      'SELECT',
        'constraint_name = C.CONSTRAINT_NAME',
      'FROM',
        'INFORMATION_SCHEMA.TABLE_CONSTRAINTS C',
      "WHERE C.CONSTRAINT_TYPE = 'FOREIGN KEY'",
      'AND C.TABLE_NAME =', wrapSingleQuote(tableName)
    ].join(' ');

    if (table.schema) {
      sql += ' AND C.TABLE_SCHEMA =' + wrapSingleQuote(table.schema);
    }

    return sql;
  },

  getForeignKeyQuery: function(table, attributeName) {
    var tableName = table.tableName || table;
    var sql = [
      'SELECT',
        'constraint_name = TC.CONSTRAINT_NAME',
      'FROM',
        'INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC',
        'JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE CCU',
          'ON TC.CONSTRAINT_NAME = CCU.CONSTRAINT_NAME',
      "WHERE TC.CONSTRAINT_TYPE = 'FOREIGN KEY'",
      'AND TC.TABLE_NAME =', wrapSingleQuote(tableName),
      'AND CCU.COLUMN_NAME =', wrapSingleQuote(attributeName),
    ].join(' ');

    if (table.schema) {
      sql += ' AND TC.TABLE_SCHEMA =' + wrapSingleQuote(table.schema);
    }

    return sql;
  },

  dropForeignKeyQuery: function(tableName, foreignKey) {
    return Utils._.template('ALTER TABLE <%= table %> DROP <%= key %>')({
      table: this.quoteTable(tableName),
      key: this.quoteIdentifier(foreignKey)
    });
  },

  getDefaultConstraintQuery: function (tableName, attributeName) {
    var sql = "SELECT name FROM SYS.DEFAULT_CONSTRAINTS " +
      "WHERE PARENT_OBJECT_ID = OBJECT_ID('<%= table %>', 'U') " +
      "AND PARENT_COLUMN_ID = (SELECT column_id FROM sys.columns WHERE NAME = ('<%= column %>') " +
      "AND object_id = OBJECT_ID('<%= table %>', 'U'));";
    return Utils._.template(sql)({
      table: this.quoteTable(tableName),
      column: attributeName
    });
  },

  dropConstraintQuery: function (tableName, constraintName) {
    var sql = 'ALTER TABLE <%= table %> DROP CONSTRAINT <%= constraint %>;';
    return Utils._.template(sql)({
      table: this.quoteTable(tableName),
      constraint: this.quoteIdentifier(constraintName)
    });
  },

  setAutocommitQuery: function(value) {
    return '';
    // return 'SET IMPLICIT_TRANSACTIONS ' + (!!value ? 'OFF' : 'ON') + ';';
  },

  setIsolationLevelQuery: function(value, options) {
    if (options.parent) {
      return;
    }

    return 'SET TRANSACTION ISOLATION LEVEL ' + value + ';';
  },

  startTransactionQuery: function(transaction, options) {
    if (transaction.parent) {
      return 'SAVE TRANSACTION ' + this.quoteIdentifier(transaction.name) + ';';
    }

    return 'BEGIN TRANSACTION;';
  },

  commitTransactionQuery: function(transaction) {
    if (transaction.parent) {
      return;
    }

    return 'COMMIT TRANSACTION;';
  },

  rollbackTransactionQuery: function(transaction, options) {
    if (transaction.parent) {
      return 'ROLLBACK TRANSACTION ' + this.quoteIdentifier(transaction.name) + ';';
    }

    return 'ROLLBACK TRANSACTION;';
  },

  selectFromTableFragment: function(options, model, attributes, tables, mainTableAs, where) {
    var topFragment = '';
    var mainFragment = 'SELECT ' + attributes.join(', ') + ' FROM ' + tables;

    // Handle SQL Server 2008 with TOP instead of LIMIT
    if (semver.valid(this.sequelize.options.databaseVersion) && semver.lt(this.sequelize.options.databaseVersion, '11.0.0')) {
      if (options.limit) {
        topFragment = 'TOP ' + options.limit + ' ';
      }
      if (options.offset) {
        var offset = options.offset || 0
          , isSubQuery = options.hasIncludeWhere || options.hasIncludeRequired || options.hasMultiAssociation
          , orders = { mainQueryOrder: [] };
        if (options.order) {
          orders = this.getQueryOrders(options, model, isSubQuery);
        }

        if(!orders.mainQueryOrder.length) {
          orders.mainQueryOrder.push(this.quoteIdentifier(model.primaryKeyField));
        }

        var tmpTable = (mainTableAs) ? mainTableAs : 'OffsetTable';
        var whereFragment = (where) ? ' WHERE ' + where : '';

        /*
         * For earlier versions of SQL server, we need to nest several queries
         * in order to emulate the OFFSET behavior.
         *
         * 1. The outermost query selects all items from the inner query block.
         *    This is due to a limitation in SQL server with the use of computed
         *    columns (e.g. SELECT ROW_NUMBER()...AS x) in WHERE clauses.
         * 2. The next query handles the LIMIT and OFFSET behavior by getting
         *    the TOP N rows of the query where the row number is > OFFSET
         * 3. The innermost query is the actual set we want information from
         */
        var fragment = 'SELECT TOP 100 PERCENT ' + attributes.join(', ') + ' FROM ' +
                        '(SELECT ' + topFragment + '*' +
                          ' FROM (SELECT ROW_NUMBER() OVER (ORDER BY ' + orders.mainQueryOrder.join(', ') + ') as row_num, * ' +
                            ' FROM ' + tables + ' AS ' + tmpTable + whereFragment + ')' +
                          ' AS ' + tmpTable + ' WHERE row_num > ' + offset + ')' +
                        ' AS ' + tmpTable;
        return fragment;
      } else {
        mainFragment = 'SELECT ' + topFragment + attributes.join(', ') + ' FROM ' + tables;
      }
    }

    if(mainTableAs) {
      mainFragment += ' AS ' + mainTableAs;
    }

    return mainFragment;
  },

  addLimitAndOffset: function(options, model) {
    // Skip handling of limit and offset as postfixes for older SQL Server versions
    if(semver.valid(this.sequelize.options.databaseVersion) && semver.lt(this.sequelize.options.databaseVersion, '11.0.0')) {
      return '';
    }

    var fragment = '';
    var offset = options.offset || 0
      , isSubQuery = options.hasIncludeWhere || options.hasIncludeRequired || options.hasMultiAssociation;

    var orders = {};
    if (options.order) {
      orders = this.getQueryOrders(options, model, isSubQuery);
    }

    if (options.limit || options.offset) {
      if (!options.order || (options.include && !orders.subQueryOrder.length)) {
        fragment += (options.order && !isSubQuery) ? ', ' : ' ORDER BY ';
        fragment += this.quoteIdentifier(model.primaryKeyField);
      }

      if (options.offset || options.limit) {
        fragment += ' OFFSET ' + this.escape(offset) + ' ROWS';
      }

      if (options.limit) {
        fragment += ' FETCH NEXT ' + this.escape(options.limit) + ' ROWS ONLY';
      }
    }

    return fragment;
  },

  booleanValue: function(value) {
    return !!value ? 1 : 0;
  }
};

// private methods
function wrapSingleQuote(identifier){
  return Utils.addTicks(identifier, "'");
}

module.exports = Utils._.extend(Utils._.clone(AbstractQueryGenerator), QueryGenerator);


text:
<?php
namespace gossi\trixionary\action\model;

use gossi\trixionary\domain\GroupDomain;
use keeko\framework\foundation\AbstractAction;
use keeko\framework\utils\Parameters;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
 * Paginates groups
 *
 * This code is automatically created. Modifications will probably be overwritten.
 *
 * @author Thomas Gossmann
 */
class GroupPaginateAction extends AbstractAction {

	/**
	 * @param OptionsResolver $resolver
	 */
	public function configureParams(OptionsResolver $resolver) {
		$resolver->setDefaults(['include' => [], 'fields' => [], 'sort' => [], 'filter' => [], 'page' => []]);
	}

	/**
	 * Automatically generated run method
	 *
	 * @param Request $request
	 * @return Response
	 */
	public function run(Request $request) {
		$params = new Parameters($request->query->all());
		$domain = new GroupDomain($this->getServiceContainer());
		$payload = $domain->paginate($params);
		return $this->responder->run($request, $payload);
	}
}


text:
namespace Iris2D {

	namespace Effect {
		class EffectBase;
	}

	class Bitmap;
	class Rect;
	class Color;
	class Viewport;
	typedef Color Tone;
	class ISprite {
	protected:
		virtual ~ISprite() = default;

	public:
		virtual ResultCode SetBitmap(Bitmap*& pBitmap) = 0;
		virtual Bitmap* GetBitmap() const = 0;

		virtual void SetX(float fX) = 0;
		virtual float GetX() const = 0;

		virtual void SetY(float fY) = 0;
		virtual float GetY() const = 0;

		virtual void SetZ(float fZ) = 0;
		virtual float GetZ() const = 0;

		virtual void SetAngle(float fAngle) = 0;
		virtual float GetAngle() const = 0;

		virtual void SetZoomX(float fZoomX) = 0;
		virtual float GetZoomX() const = 0;

		virtual void SetZoomY(float fZoomY) = 0;
		virtual float GetZoomY() const = 0;

		virtual void SetOX(float fOX) = 0;
		virtual float GetOX() const = 0;

		virtual void SetOY(float fOY) = 0;
		virtual float GetOY() const = 0;

		virtual void SetMirror(bool bMirror) = 0;
		virtual bool GetMirror() const = 0;

		virtual void SetVisible(bool bVisible) = 0;
		virtual bool GetVisible() const = 0;

		virtual void SetOpacity(float fOpacity) = 0;
		virtual float GetOpacity() const = 0;

		virtual void SetTone(Tone*& pTone) = 0;
		virtual Tone* GetTone() const = 0;

		virtual Viewport* GetViewport() = 0;

		virtual ResultCode Update() = 0;
		virtual ResultCode SetEffect(Effect::EffectBase* pEffect) = 0;
	};
}

#endif // !_H_ISPRITE_


text:
require 'spec_helper'

describe Comment do
  before(:each) do
    @comment_test = Comment.new(name: "John Smith",
      email: "john.smith@example.com",
      email_confirmation: "john.smith@example.com",
      subject: Comment::SUBJECTS[2],
      comment: "This is an RSpec test")
  end

  it "should validate if all fields are entered correctly" do
    @comment_test.should be_valid
  end

  it "should fail if the name is missing" do
    @comment_test.name = nil
    @comment_test.should_not be_valid
  end

  describe "Subject" do
    it "should fail if there is no subject" do
      @comment_test.subject = nil
      @comment_test.should_not be_valid
    end

    it "should fail if the subject is not in the list" do
      @comment_test.subject = 'Not in the list'
      @comment_test.should_not be_valid
    end
  end

  describe "Comments" do
    it "should fail if there is no comment" do
      @comment_test.comment = nil
      @comment_test.should_not be_valid
    end

    it "should strip out any unsafe HTML" do
      @comment_test.comment =
        "
But this is safe
"
      @comment_test.comment.should_not match /\


text:
#ifndef __DTASK__
#define __DTASK__

#include <stdint.h>
#include <stdbool.h>

// define NO_CLZ for targets that do not efficiently implement __builtin_clz()
#if defined(__TARGET_CPU_CORTEX_M0) || defined(__TARGET_CPU_CORTEX_M0PLUS)
#define NO_CLZ
#define NO_CTZ
#endif

/*-------------------- utility macros --------------------*/

// bits in a type
#define DTASK_BIT_WIDTH(type) (sizeof(type) * 8)

// number of elements in an array
#define DTASK_LENGTH(a) (sizeof(a) / sizeof((a)[0]))

/*-------------------- ids and sets --------------------*/

// each dtask has a unique id
typedef uint8_t dtask_id_t;

// sets of dtask ids
typedef unsigned int dtask_set_t;

// the maximum id that can fit in dtask_set_t
#define DTASK_MAX_ID (DTASK_BIT_WIDTH(dtask_set_t) - 1)

// all events with ids in x = (ID1 | ID2 ... | IDn) have succeeded
// can only be used inside a dtask
#define DTASK_AND(x) (!(~state->events & (x)))

// any event with an id in x = (ID1 | ID2 ... | IDn) has succeeded
// can only be used inside a dtask
#define DTASK_OR(x) (state->events & (x))

// convert an id to a singleton set (one bit)
static inline
dtask_set_t dtask_bit(dtask_id_t id) {
  return ((dtask_set_t)1 << DTASK_MAX_ID) >> id;
}

/*-------------------- state and config --------------------*/

typedef struct dtask_state dtask_state_t;
typedef struct dtask dtask_t;
typedef struct dtask_config dtask_config_t;
typedef struct dtask_select dtask_select_t;

// describes a dtask and its relations
// a static const dtask table will be generated that can be stored in ROM
struct dtask
{
#ifndef NO_CLZ
  // updates state
  bool (*func)(dtask_state_t *state);
#endif
  // run when enabled
  void (*enable_func)(dtask_state_t *state);
  // run when disabled
  void (*disable_func)(dtask_state_t *state);
#ifndef NO_CLZ
  // set of direct dependents
  dtask_set_t dependents;
#endif
  // (direct or indirect) dependencies and dependents
  dtask_set_t all_dependencies, all_dependents;
};

// members present in all generated dtask state types
// events: set of successful (i.e. returns true) dtask ids
// config & select: see below
#define DTASK_STATE_HEADER              \
  struct                                \
  {                                     \
    dtask_set_t events;                 \
    const dtask_config_t config;        \
    dtask_select_t select;              \
  }

// stores const static config data
struct dtask_config
{
  // dtask table
  const dtask_t *tasks;
  // parent state
  const dtask_state_t *parent;
#ifdef NO_CLZ
  // static dtask_run() function
  dtask_set_t (*const run)(dtask_state_t *state, dtask_set_t initial);
#endif
  // graph state id
  const unsigned int id;
};

// dtask selection state
struct dtask_select
{
  dtask_set_t
    enabled,  // explicitly enabled
    disabled, // explicitly disabled
    selected; // dtask will only run if selected
  bool dirty; // selection needs to be updated
};

// base state type
// the script will generate an extended version of this type for each group
struct dtask_state
{
  DTASK_STATE_HEADER;
};

// update state, running dtasks in the initial set
dtask_set_t dtask_run(dtask_state_t *state, dtask_set_t initial);

// request to enable dtasks in the set
void dtask_enable(dtask_state_t *state, dtask_set_t set);

// request to disable dtasks in the set
void dtask_disable(dtask_state_t *state, dtask_set_t set);

// clear requests for dtasks in the set, i.e. enable only if needed
void dtask_clear(dtask_state_t *state, dtask_set_t set);

// explicitly enable dtasks in set, clear others
void dtask_switch(dtask_state_t *state, dtask_set_t set);

// update selection state
// requests from dtask_enable/disable/clear/switch only take effect after calling this
void dtask_select(dtask_state_t *state);

/*-------------------- dtask definition macros --------------------*/

// disable macros when preprocessing for script
#ifndef DTASK_GEN

// define a dtask
#define DTASK(name, ...)  \
  bool __dtask_##name(dtask_state_t *state)

// define a group
#define DTASK_GROUP(group_name) \
typedef group_name##_state_t dref_t;

// get a reference (pointer) to a dependency
// can only be used inside a dtask
#define DREF(x) ((x##_t *)&((dref_t *)state)->x)

// weak version of DREF that doesn't force dependency to be enabled
#define DREF_WEAK(x) DREF(x)

// passive (doesn't trigger) version of DREF that doesn't force dependency to be enabled
#define DREF_PASS(x) DREF(x)

// define the enable function for a dtask
#define DTASK_ENABLE(name)  \
  void __dtask_enable_##name(dtask_state_t *state)

// define the disable function for a dtask
#define DTASK_DISABLE(name)  \
  void __dtask_disable_##name(dtask_state_t *state)

#endif

// convenient macros to create config/state with required const static members
#ifndef NO_CLZ
#define DTASK_CONFIG(name, parent, id) {(name), (dtask_state_t *)(parent), (id)}
#else
#define DTASK_CONFIG(name, parent, id) {(name), (dtask_state_t *)(parent), name##_run, (id)}
#endif

#define DTASK_STATE(name, parent, id) {{ .config = DTASK_CONFIG(name, parent, id) }}

/*-------------------- used by generated headers --------------------*/

// declare a dtask
#define DECLARE_DTASK(name, type...) \
  typedef type name##_t;             \
  bool __dtask_##name(dtask_state_t *state)

// declare enable function for a dtask
#define DECLARE_DTASK_ENABLE(name) \
  void __dtask_enable_##name(dtask_state_t *state)

// declare disable function for a dtask
#define DECLARE_DTASK_DISABLE(name) \
  void __dtask_disable_##name(dtask_state_t *state)

// default function for enable/disable
void __dtask_noop(dtask_state_t *state);

#endif


text:
require 'issuer/notifier'

# This is the guy that catches those pesky unhandled exceptions.
module Issuer
  module Catcher

    # Sets up an alias chain to catch exceptions when Rails does
    def self.included(base) #:nodoc:
      # base.send(:alias_method, :issuer_rescue_from, :rescue_from)
      base.send(:alias_method, :proceed_to_rescue_normally, :rescue_action)
      base.send(:alias_method, :rescue_action, :handle_exception_and_carry_on)
    end

    def handle_exception_and_carry_on(exception)
      Issuer::Notifier.notify(exception)
      proceed_to_rescue_normally(exception)
    end

    # notify then let it explode anyway
    def handle_exception_with_issuer(exception)
      Issuer::Notifier.notify(exception)
    end

  end
end


text:
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, UnboxedTuples #-}
{-# OPTIONS_HADDOCK hide #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  GHC.Pack
-- Copyright   :  (c) The University of Glasgow 1997-2002
-- License     :  see libraries/base/LICENSE
--
-- Maintainer  :  cvs-ghc@haskell.org
-- Stability   :  internal
-- Portability :  non-portable (GHC Extensions)
--
-- This module provides a small set of low-level functions for packing
-- and unpacking a chunk of bytes. Used by code emitted by the compiler
-- plus the prelude libraries.
--
-- The programmer level view of packed strings is provided by a GHC
-- system library PackedString.
--
-----------------------------------------------------------------------------

module GHC.Pack
       (
        -- (**) - emitted by compiler.

        packCString#,
        unpackCString,
        unpackCString#,
        unpackNBytes#,
        unpackFoldrCString#,  -- (**)
        unpackAppendCString#,  -- (**)
       )
        where

import GHC.Base
import GHC.List ( length )
import GHC.ST
import GHC.Ptr

data ByteArray ix              = ByteArray        ix ix ByteArray#
data MutableByteArray s ix     = MutableByteArray ix ix (MutableByteArray# s)

unpackCString :: Ptr a -> [Char]
unpackCString a@(Ptr addr)
  | a == nullPtr  = []
  | otherwise      = unpackCString# addr

packCString#         :: [Char]          -> ByteArray#
packCString# str = case (packString str) of { ByteArray _ _ bytes -> bytes }

packString :: [Char] -> ByteArray Int
packString str = runST (packStringST str)

packStringST :: [Char] -> ST s (ByteArray Int)
packStringST str =
  let len = length str  in
  packNBytesST len str

packNBytesST :: Int -> [Char] -> ST s (ByteArray Int)
packNBytesST (I# length#) str =
  {-
   allocate an array that will hold the string
   (not forgetting the NUL byte at the end)
  -}
 new_ps_array (length# +# 1#) >>= \ ch_array ->
   -- fill in packed string from "str"
 fill_in ch_array 0# str   >>
   -- freeze the puppy:
 freeze_ps_array ch_array length#
 where
  fill_in :: MutableByteArray s Int -> Int# -> [Char] -> ST s ()
  fill_in arr_in# idx [] =
   write_ps_array arr_in# idx (chr# 0#) >>
   return ()

  fill_in arr_in# idx (C# c : cs) =
   write_ps_array arr_in# idx c  >>
   fill_in arr_in# (idx +# 1#) cs

-- (Very :-) ``Specialised'' versions of some CharArray things...

new_ps_array    :: Int# -> ST s (MutableByteArray s Int)
write_ps_array  :: MutableByteArray s Int -> Int# -> Char# -> ST s ()
freeze_ps_array :: MutableByteArray s Int -> Int# -> ST s (ByteArray Int)

new_ps_array size = ST $ \ s ->
    case (newByteArray# size s)   of { (# s2#, barr# #) ->
    (# s2#, MutableByteArray bot bot barr# #) }
  where
    bot = error "new_ps_array"

write_ps_array (MutableByteArray _ _ barr#) n ch = ST $ \ s# ->
    case writeCharArray# barr# n ch s#  of { s2#   ->
    (# s2#, () #) }

-- same as unsafeFreezeByteArray
freeze_ps_array (MutableByteArray _ _ arr#) len# = ST $ \ s# ->
    case unsafeFreezeByteArray# arr# s# of { (# s2#, frozen# #) ->
    (# s2#, ByteArray 0 (I# len#) frozen# #) }