text:
package sliceTrick

import (
	//"log"
	"reflect"
)

var Equal = reflect.DeepEqual

func Len(a interface{}) int {
	return reflect.ValueOf(a).Len()
}

type T struct{ Val interface{} }

func (self T) In(slice interface{}) bool {
	return In(slice, self.Val)
}
func In(slice, val interface{}) bool {
	vov := reflect.ValueOf(val)
	sliceval := reflect.ValueOf(slice)
	for i := 0; i < sliceval.Len(); i++ {
		if Equal(sliceval.Index(i).Interface(), vov.Interface()) {
			return true
		}
	}
	return false
}

func InBool(slice []bool, val bool) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InInt(slice []int, val int) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InInt8(slice []int8, val int8) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InInt16(slice []int16, val int16) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InInt32(slice []int32, val int32) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InInt64(slice []int64, val int64) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InUint(slice []uint, val uint) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InUint8(slice []uint8, val uint8) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InUint16(slice []uint16, val uint16) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InUint32(slice []uint32, val uint32) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InUint64(slice []uint64, val uint64) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InUintptr(slice []uintptr, val uintptr) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InFloat32(slice []float32, val float32) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InFloat64(slice []float64, val float64) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InComplex64(slice []complex64, val complex64) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InComplex128(slice []complex128, val complex128) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func InStr(slice []string, val string) bool {
	for _, v := range slice {
		if v == val {
			return true
		}
	}
	return false
}

func Iif(test bool, onTrue interface{}, onFalse interface{}) interface{} {
	if test {
		return onTrue
	}
	return onFalse
}

func IifBool(test bool, onTrue bool, onFalse bool) bool {
	if test {
		return onTrue
	}
	return onFalse
}

func IifInt(test bool, onTrue int, onFalse int) int {
	if test {
		return onTrue
	}
	return onFalse
}

func IifInt8(test bool, onTrue int8, onFalse int8) int8 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifInt16(test bool, onTrue int16, onFalse int16) int16 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifInt32(test bool, onTrue int32, onFalse int32) int32 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifInt64(test bool, onTrue int64, onFalse int64) int64 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifUint(test bool, onTrue uint, onFalse uint) uint {
	if test {
		return onTrue
	}
	return onFalse
}

func IifUint8(test bool, onTrue uint8, onFalse uint8) uint8 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifUint16(test bool, onTrue uint16, onFalse uint16) uint16 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifUint32(test bool, onTrue uint32, onFalse uint32) uint32 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifUint64(test bool, onTrue uint64, onFalse uint64) uint64 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifUintptr(test bool, onTrue uintptr, onFalse uintptr) uintptr {
	if test {
		return onTrue
	}
	return onFalse
}

func IifFloat32(test bool, onTrue float32, onFalse float32) float32 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifFloat64(test bool, onTrue float64, onFalse float64) float64 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifComplex64(test bool, onTrue complex64, onFalse complex64) complex64 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifComplex128(test bool, onTrue complex128, onFalse complex128) complex128 {
	if test {
		return onTrue
	}
	return onFalse
}

func IifStr(test bool, onTrue string, onFalse string) string {
	if test {
		return onTrue
	}
	return onFalse
}


text:
Originally published: 2005-06-03 11:28:27
Last updated: 2005-06-03 11:28:27
Author: Chris Cornish

Here are a suite of hexadecimal to/from decimal conversion routines.
These have been used in an application, so there should not be any errors, I trust.

redpajama_set_name: RedPajamaGithub


text:
@charset "utf-8";
/* CSS Document */
#bottombar{display:none !important;}


text:
<?php

namespace Earls\RhinoReportBundle\Module\Table\TableObject;

use Earls\RhinoReportBundle\Module\Table\Definition\HeadDefinition;

/*
 * Earls\RhinoReportBundle\Module\Table\TableObject\Head
 */

class Head extends TableObject
{
    protected $columns;

    public function __construct($id, HeadDefinition $definition, Table $parent)
    {
        $this->type = 'head';

        parent::__construct($id, $definition, $parent);
    }

    public function getColumns()
    {
        return $this->columns;
    }

    public function setColumn($displayId, array $column)
    {
        $this->columns[$displayId] = $column;

        return $this;
    }

    public function setColumns(array $columnNames)
    {
        foreach ($columnNames as $id => $column) {
            $this->setColumn($id, $column);
        }

        return $this;
    }
}


text:
package pb

import (
	context "context"
	fmt "fmt"
	proto "github.com/golang/protobuf/proto"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	math "math"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package

type HeartbeatRequest struct {
	RequestId            string   `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *HeartbeatRequest) Reset()         { *m = HeartbeatRequest{} }
func (m *HeartbeatRequest) String() string { return proto.CompactTextString(m) }
func (*HeartbeatRequest) ProtoMessage()    {}
func (*HeartbeatRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_65d71fe0140170a2, []int{0}
}

func (m *HeartbeatRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_HeartbeatRequest.Unmarshal(m, b)
}
func (m *HeartbeatRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_HeartbeatRequest.Marshal(b, m, deterministic)
}
func (m *HeartbeatRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_HeartbeatRequest.Merge(m, src)
}
func (m *HeartbeatRequest) XXX_Size() int {
	return xxx_messageInfo_HeartbeatRequest.Size(m)
}
func (m *HeartbeatRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_HeartbeatRequest.DiscardUnknown(m)
}

var xxx_messageInfo_HeartbeatRequest proto.InternalMessageInfo

func (m *HeartbeatRequest) GetRequestId() string {
	if m != nil {
		return m.RequestId
	}
	return ""
}

type Heartbeat struct {
	Note                 string   `protobuf:"bytes,1,opt,name=note,proto3" json:"note,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *Heartbeat) Reset()         { *m = Heartbeat{} }
func (m *Heartbeat) String() string { return proto.CompactTextString(m) }
func (*Heartbeat) ProtoMessage()    {}
func (*Heartbeat) Descriptor() ([]byte, []int) {
	return fileDescriptor_65d71fe0140170a2, []int{1}
}

func (m *Heartbeat) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_Heartbeat.Unmarshal(m, b)
}
func (m *Heartbeat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_Heartbeat.Marshal(b, m, deterministic)
}
func (m *Heartbeat) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Heartbeat.Merge(m, src)
}
func (m *Heartbeat) XXX_Size() int {
	return xxx_messageInfo_Heartbeat.Size(m)
}
func (m *Heartbeat) XXX_DiscardUnknown() {
	xxx_messageInfo_Heartbeat.DiscardUnknown(m)
}

var xxx_messageInfo_Heartbeat proto.InternalMessageInfo

func (m *Heartbeat) GetNote() string {
	if m != nil {
		return m.Note
	}
	return ""
}

func init() {
	proto.RegisterType((*HeartbeatRequest)(nil), "pb.HeartbeatRequest")
	proto.RegisterType((*Heartbeat)(nil), "pb.Heartbeat")
}

func init() { proto.RegisterFile("pb/demo.proto", fileDescriptor_65d71fe0140170a2) }

var fileDescriptor_65d71fe0140170a2 = []byte{
	// 199 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x8f, 0x31, 0x4b, 0xc7, 0x30,
	0x10, 0x47, 0xad, 0x88, 0xd0, 0x93, 0x3f, 0x4a, 0x70, 0x10, 0x41, 0x94, 0x4e, 0x2e, 0x26, 0x5a,
	0x9d, 0x1c, 0xc5, 0xc1, 0x82, 0x53, 0xdd, 0x5c, 0x24, 0xd7, 0x9c, 0x31, 0x43, 0x72, 0x31, 0xb9,
	0x8a, 0x1f, 0x5f, 0xa8, 0x45, 0xd1, 0xed, 0xf1, 0xb8, 0xc7, 0xf1, 0x83, 0x4d, 0x46, 0xe3, 0x28,
	0xb2, 0xce, 0x85, 0x85, 0xd5, 0x76, 0xc6, 0xee, 0x0a, 0x0e, 0x1e, 0xc8, 0x16, 0x41, 0xb2, 0x32,
	0xd2, 0xfb, 0x4c, 0x55, 0xd4, 0x09, 0x40, 0xf9, 0xc6, 0x97, 0xe0, 0x8e, 0x9a, 0xb3, 0xe6, 0xbc,
	0x1d, 0xdb, 0xd5, 0x0c, 0xae, 0x3b, 0x85, 0xf6, 0x27, 0x51, 0x0a, 0x76, 0x12, 0x0b, 0xad, 0x57,
	0x0b, 0xf7, 0x03, 0xec, 0xdd, 0x53, 0xe4, 0x27, 0x2a, 0x1f, 0x61, 0x22, 0x75, 0x0b, 0xfb, 0x8f,
	0xa1, 0x0a, 0xa5, 0xdf, 0xea, 0x50, 0x67, 0xd4, 0xff, 0xff, 0x1e, 0x6f, 0xfe, 0xd8, 0x6e, 0xeb,
	0xb2, 0xb9, 0xbb, 0x79, 0xee, 0x7d, 0x90, 0xb7, 0x19, 0xf5, 0xc4, 0xd1, 0x90, 0x9f, 0xab, 0xd8,
	0xd7, 0xca, 0xc9, 0x54, 0x9b, 0x1c, 0xf2, 0xa7, 0xf1, 0x6c, 0x7c, 0xc9, 0xd3, 0x45, 0x95, 0x42,
	0x36, 0x86, 0xe4, 0x4d, 0x46, 0xdc, 0x5d, 0xf6, 0x5d, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x47,
	0x26, 0x70, 0x16, 0xf0, 0x00, 0x00, 0x00,
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4

// DemoServiceClient is the client API for DemoService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type DemoServiceClient interface {
	ListenHeartbeat(ctx context.Context, in *HeartbeatRequest, opts ...grpc.CallOption) (DemoService_ListenHeartbeatClient, error)
}

type demoServiceClient struct {
	cc *grpc.ClientConn
}

func NewDemoServiceClient(cc *grpc.ClientConn) DemoServiceClient {
	return &demoServiceClient{cc}
}

func (c *demoServiceClient) ListenHeartbeat(ctx context.Context, in *HeartbeatRequest, opts ...grpc.CallOption) (DemoService_ListenHeartbeatClient, error) {
	stream, err := c.cc.NewStream(ctx, &_DemoService_serviceDesc.Streams[0], "/pb.DemoService/ListenHeartbeat", opts...)
	if err != nil {
		return nil, err
	}
	x := &demoServiceListenHeartbeatClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type DemoService_ListenHeartbeatClient interface {
	Recv() (*Heartbeat, error)
	grpc.ClientStream
}

type demoServiceListenHeartbeatClient struct {
	grpc.ClientStream
}

func (x *demoServiceListenHeartbeatClient) Recv() (*Heartbeat, error) {
	m := new(Heartbeat)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// DemoServiceServer is the server API for DemoService service.
type DemoServiceServer interface {
	ListenHeartbeat(*HeartbeatRequest, DemoService_ListenHeartbeatServer) error
}

// UnimplementedDemoServiceServer can be embedded to have forward compatible implementations.
type UnimplementedDemoServiceServer struct {
}

func (*UnimplementedDemoServiceServer) ListenHeartbeat(req *HeartbeatRequest, srv DemoService_ListenHeartbeatServer) error {
	return status.Errorf(codes.Unimplemented, "method ListenHeartbeat not implemented")
}

func RegisterDemoServiceServer(s *grpc.Server, srv DemoServiceServer) {
	s.RegisterService(&_DemoService_serviceDesc, srv)
}

func _DemoService_ListenHeartbeat_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(HeartbeatRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(DemoServiceServer).ListenHeartbeat(m, &demoServiceListenHeartbeatServer{stream})
}

type DemoService_ListenHeartbeatServer interface {
	Send(*Heartbeat) error
	grpc.ServerStream
}

type demoServiceListenHeartbeatServer struct {
	grpc.ServerStream
}

func (x *demoServiceListenHeartbeatServer) Send(m *Heartbeat) error {
	return x.ServerStream.SendMsg(m)
}

var _DemoService_serviceDesc = grpc.ServiceDesc{
	ServiceName: "pb.DemoService",
	HandlerType: (*DemoServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ListenHeartbeat",
			Handler:       _DemoService_ListenHeartbeat_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "pb/demo.proto",
}


text:
require_relative "../lib/calculator.rb"
require_relative "../lib/wheel_size.rb"


text:
<?xml version="1.0"?>
<QuestsDefinitions
     level="testmap_hans"
     pxsl_line="3">
    <Quest
         name="__IBM_Hans_Movie_01"
         parent="Q_Start01"
         pxsl_line="5">
        <Phase
             type="go to"
             name="IBM Hans Movie 01"
             distance="2"
             show_locations="false"
             pxsl_line="6">
            <Destination
                 pxsl_line="6">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_01_starter"
                     pxsl_line="6" />
            </Destination>
            <DebugPlayerPosition
                 pxsl_line="7">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_01_starter"
                     pxsl_line="7" />
            </DebugPlayerPosition>
        </Phase>
        <Phase
             type="movie"
             name="_"
             movie="IBM_movie_01"
             pxsl_line="8" />
    </Quest>
    <Quest
         name="__IBM_Hans_Movie_02"
         parent="Q_Start01"
         pxsl_line="10">
        <Phase
             type="go to"
             name="IBM Hans Movie 02"
             distance="2"
             show_locations="false"
             pxsl_line="11">
            <Destination
                 pxsl_line="11">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_02_starter"
                     pxsl_line="11" />
            </Destination>
            <DebugPlayerPosition
                 pxsl_line="12">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_02_starter"
                     pxsl_line="12" />
            </DebugPlayerPosition>
        </Phase>
        <Phase
             type="movie"
             name="_"
             movie="IBM_movie_02"
             pxsl_line="13" />
    </Quest>
    <Quest
         name="__IBM_Hans_Movie_03"
         parent="Q_Start01"
         pxsl_line="15">
        <Phase
             type="go to"
             name="IBM Hans Movie 03"
             distance="2"
             show_locations="false"
             pxsl_line="16">
            <Destination
                 pxsl_line="16">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_03_starter"
                     pxsl_line="16" />
            </Destination>
            <DebugPlayerPosition
                 pxsl_line="17">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_03_starter"
                     pxsl_line="17" />
            </DebugPlayerPosition>
        </Phase>
        <Phase
             type="movie"
             name="_"
             movie="IBM_movie_03"
             pxsl_line="18" />
    </Quest>
    <Quest
         name="__IBM_Hans_Movie_04"
         parent="Q_Start01"
         pxsl_line="20">
        <Phase
             type="go to"
             name="IBM Hans Movie 04"
             distance="2"
             show_locations="false"
             pxsl_line="21">
            <Destination
                 pxsl_line="21">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_04_starter"
                     pxsl_line="21" />
            </Destination>
            <DebugPlayerPosition
                 pxsl_line="22">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_04_starter"
                     pxsl_line="22" />
            </DebugPlayerPosition>
        </Phase>
        <Phase
             type="movie"
             name="_"
             movie="IBM_movie_04"
             pxsl_line="23" />
    </Quest>
    <Quest
         name="__IBM_Hans_Movie_05"
         parent="Q_Start01"
         pxsl_line="25">
        <Phase
             type="go to"
             name="IBM Hans Movie 05"
             distance="2"
             show_locations="false"
             pxsl_line="26">
            <Destination
                 pxsl_line="26">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_05_starter"
                     pxsl_line="26" />
            </Destination>
            <DebugPlayerPosition
                 pxsl_line="27">
                <QuestObject
                     class="SpawnPoint"
                     name="ibm_movie_05_starter"
                     pxsl_line="27" />
            </DebugPlayerPosition>
        </Phase>
        <Phase
             type="movie"
             name="_"
             movie="IBM_movie_05"
             pxsl_line="28" />
    </Quest>
    <!-- quest __IBM_Movie_06 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 06>> SpawnPoint ibm_movie_06_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_06_starter -->
        <!-- ,movie _ IBM_movie_06 -->
    <!-- quest __IBM_Movie_07 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 07>> SpawnPoint ibm_movie_07_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_07_starter -->
        <!-- ,movie _ IBM_movie_07 -->
    <!-- quest __IBM_Movie_08 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 08>> SpawnPoint ibm_movie_08_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_08_starter -->
        <!-- ,movie _ IBM_movie_08 -->
    <!-- quest __IBM_Movie_09 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 09>> SpawnPoint ibm_movie_09_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_09_starter -->
        <!-- ,movie _ IBM_movie_09 -->
    <!-- quest __IBM_Movie_10 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 10>> SpawnPoint ibm_movie_10_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_10_starter -->
        <!-- ,movie _ IBM_movie_10 -->
    <!-- quest __IBM_Movie_11 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 11>> SpawnPoint ibm_movie_11_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_11_starter -->
        <!-- ,movie _ IBM_movie_11 -->
    <!-- quest __IBM_Movie_12 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 12>> SpawnPoint ibm_movie_12_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_12_starter -->
        <!-- ,movie _ IBM_movie_12 -->
    <!-- quest __IBM_Movie_13 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 13>> SpawnPoint ibm_movie_13_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_13_starter -->
        <!-- ,movie _ IBM_movie_13 -->
    <!-- quest __IBM_Movie_14 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 14>> SpawnPoint ibm_movie_14_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_14_starter -->
        <!-- ,movie _ IBM_movie_14 -->
    <!-- quest __IBM_Movie_15 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 15>> SpawnPoint ibm_movie_15_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_15_starter -->
        <!-- ,movie _ IBM_movie_15 -->
    <!-- quest __IBM_Movie_16 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 16>> SpawnPoint ibm_movie_16_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_16_starter -->
        <!-- ,movie _ IBM_movie_16 -->
    <!-- quest __IBM_Movie_17 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 17>> SpawnPoint ibm_movie_17_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_17_starter -->
        <!-- ,movie _ IBM_movie_17 -->
    <!-- quest __IBM_Movie_18 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 18>> SpawnPoint ibm_movie_18_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_18_starter -->
        <!-- ,movie _ IBM_movie_18 -->
    <!-- quest __IBM_Movie_19 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 19>> SpawnPoint ibm_movie_19_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_19_starter -->
        <!-- ,movie _ IBM_movie_19 -->
    <!-- quest __IBM_Movie_20 -parent=Q_Start01 -->
        <!-- ,goto <<IBM Movie 20>> SpawnPoint ibm_movie_20_starter -distance=2 -show=false -->
            <!-- ,debugpos SpawnPoint ibm_movie_20_starter -->
        <!-- ,movie _ IBM_movie_20 -->
</QuestsDefinitions>


text:
package ru.yandex.qatools.matchers.webdriver.driver;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static ru.yandex.qatools.matchers.webdriver.driver.CanFindElementMatcher.canFindElement;

public class CanFindElementMatcherTest {

    public static final By XPATH_EXISTS = By.xpath("//a");
    public static final By XPATH_NOT_EXISTS = By.xpath("//aa");

    @Test
    public void worksPositive() {
        WebDriver driver = mock(WebDriver.class);
        WebElement element = mock(WebElement.class);

        when(driver.findElement(XPATH_EXISTS)).thenReturn(element);

        assertThat("Element should be found", driver, canFindElement(XPATH_EXISTS));
    }

    @Test
    public void worksNegative() {
        WebDriver driver = mock(WebDriver.class);
        when(driver.findElement(XPATH_NOT_EXISTS)).thenThrow(new NoSuchElementException(""));

        assertThat("Element should not be found",
                driver, not(canFindElement(XPATH_NOT_EXISTS)));
    }
}


text:
/*************************************************************************
	> File Name: HeadStructMessage.h
	> Author: zhonghx
	> Mail: zhonghongxia@foxmail.com
	> Created Time: Sun 23 Aug 2015 06:57:52 AM UTC
 ************************************************************************/

#ifndef _HEADSTRUCTMESSAGE_H
#define _HEADSTRUCTMESSAGE_H
#include <stdint.h>
struct  HeadStructMessage
{
    uint32_t length;
    uint32_t type;
    HeadStructMessage():length(0) , type(0){}
    ~HeadStructMessage(){}
}__attribute__( ( packed )) ;
#endif


text:
using ProductsManagement.Domain.Contracts.Repository;
using ProductsManagement.Domain.Entities;
using ProductsManagement.Infra.Data.Context;
using System;

namespace ProductsManagement.Infra.Data.Repositories
{
    public sealed class ProductRepository:RepositoryBase<Guid,Product>,IProductRepository
    {

    }
}


text:
if File.exist?("#{RAILS_ROOT}/config/mini_wiki.yml")
  MINI_WIKI_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/mini_wiki.yml")['mini_wiki']
end

# Required modules
require 'redcloth'
require 'mini_wiki/commands'
require 'mini_wiki/routing'

# Load the models/controller/helpers
%w{ models controllers helpers }.each do |dir|
  path = File.join(File.dirname(__FILE__), 'app', dir)
  $LOAD_PATH << path
  ActiveSupport::Dependencies.load_paths << path
  ActiveSupport::Dependencies.load_once_paths.delete(path)
end


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace WPFDemo.ViewModels
{
    public interface IViewModel : IDataErrorInfo, INotifyPropertyChanged, IDisposable
    {
        bool IsValid { get; }
    }
}


text:
package org.chromium.content.browser;

import android.test.InstrumentationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;

import org.chromium.base.test.util.Feature;
import org.chromium.content.app.LibraryLoader;
import org.chromium.content.common.CommandLine;
import org.chromium.content.common.ProcessInitException;
import org.chromium.content_shell_apk.ContentShellActivity;
import org.chromium.content_shell_apk.ContentShellApplication;

public class CommandLineTest extends InstrumentationTestCase {
    // A reference command line. Note that switch2 is [brea\d], switch3 is [and "butter"],
    // and switch4 is [a "quoted" 'food'!]
    static final String INIT_SWITCHES[] = { "init_command", "--SWITCH", "Arg",
        "--switch2=brea\\d", "--switch3=and \"butter\"",
        "--switch4=a \"quoted\" 'food'!",
        "--", "--actually_an_arg" };

    // The same command line, but in quoted string format.
    static final char INIT_SWITCHES_BUFFER[] =
        ("init_command --SWITCH Arg --switch2=brea\\d --switch3=\"and \\\"butt\"er\\\"   "
        + "--switch4='a \"quoted\" \\'food\\'!' "
        + "-- --actually_an_arg").toCharArray();

    static final String CL_ADDED_SWITCH = "zappo-dappo-doggy-trainer";
    static final String CL_ADDED_SWITCH_2 = "username";
    static final String CL_ADDED_VALUE_2 = "bozo";

    @Override
    public void setUp() throws Exception {
        CommandLine.reset();
    }

    void loadJni() {
        assertFalse(CommandLine.getInstance().isNativeImplementation());
        getInstrumentation().runOnMainSync(new Runnable() {
            @Override
            public void run() {
                ContentShellApplication.initializeApplicationParameters();
                try {
                    LibraryLoader.ensureInitialized();
                } catch (ProcessInitException e) {
                    throw new Error(e);
                }
            }
        });
        assertTrue(CommandLine.getInstance().isNativeImplementation());
    }

    void checkInitSwitches() {
        CommandLine cl = CommandLine.getInstance();
        assertFalse(cl.hasSwitch("init_command"));
        assertFalse(cl.hasSwitch("switch"));
        assertTrue(cl.hasSwitch("SWITCH"));
        assertFalse(cl.hasSwitch("--SWITCH"));
        assertFalse(cl.hasSwitch("Arg"));
        assertFalse(cl.hasSwitch("actually_an_arg"));
        assertEquals("brea\\d", cl.getSwitchValue("switch2"));
        assertEquals("and \"butter\"", cl.getSwitchValue("switch3"));
        assertEquals("a \"quoted\" 'food'!", cl.getSwitchValue("switch4"));
        assertNull(cl.getSwitchValue("SWITCH"));
        assertNull(cl.getSwitchValue("non-existant"));
    }

    void checkSettingThenGetting() {
        CommandLine cl = CommandLine.getInstance();

        // Add a plain switch.
        assertFalse(cl.hasSwitch(CL_ADDED_SWITCH));
        cl.appendSwitch(CL_ADDED_SWITCH);
        assertTrue(cl.hasSwitch(CL_ADDED_SWITCH));

        // Add a switch paired with a value.
        assertFalse(cl.hasSwitch(CL_ADDED_SWITCH_2));
        assertNull(cl.getSwitchValue(CL_ADDED_SWITCH_2));
        cl.appendSwitchWithValue(CL_ADDED_SWITCH_2, CL_ADDED_VALUE_2);
        assertTrue(CL_ADDED_VALUE_2.equals(cl.getSwitchValue(CL_ADDED_SWITCH_2)));

        // Append a few new things.
        final String switchesAndArgs[] = { "dummy", "--superfast", "--speed=turbo" };
        assertFalse(cl.hasSwitch("dummy"));
        assertFalse(cl.hasSwitch("superfast"));
        assertNull(cl.getSwitchValue("speed"));
        cl.appendSwitchesAndArguments(switchesAndArgs);
        assertFalse(cl.hasSwitch("dummy"));
        assertFalse(cl.hasSwitch("command"));
        assertTrue(cl.hasSwitch("superfast"));
        assertTrue("turbo".equals(cl.getSwitchValue("speed")));
    }

    void checkAppendedSwitchesPassedThrough() {
        CommandLine cl = CommandLine.getInstance();
        assertTrue(cl.hasSwitch(CL_ADDED_SWITCH));
        assertTrue(cl.hasSwitch(CL_ADDED_SWITCH_2));
        assertTrue(CL_ADDED_VALUE_2.equals(cl.getSwitchValue(CL_ADDED_SWITCH_2)));
    }

    void checkTokenizer(String[] expected, String toParse) {
        String[] actual = CommandLine.tokenizeQuotedAruments(toParse.toCharArray());
        assertEquals(expected.length, actual.length);
        for (int i = 0; i < expected.length; ++i) {
            assertEquals("comparing element " + i, expected[i], actual[i]);
        }
    }

    @SmallTest
    @Feature({"Android-AppBase"})
    public void testJavaInitialization() {
        CommandLine.init(INIT_SWITCHES);
        checkInitSwitches();
        checkSettingThenGetting();
    }

    @MediumTest
    @Feature({"Android-AppBase"})
    public void testJavaNativeTransition() {
        CommandLine.init(INIT_SWITCHES);
        checkInitSwitches();
        loadJni();
        checkInitSwitches();
        checkSettingThenGetting();
    }

    @MediumTest
    @Feature({"Android-AppBase"})
    public void testJavaNativeTransitionAfterAppends() {
        CommandLine.init(INIT_SWITCHES);
        checkInitSwitches();
        checkSettingThenGetting();
        loadJni();
        checkInitSwitches();
        checkAppendedSwitchesPassedThrough();
    }

    @MediumTest
    @Feature({"Android-AppBase"})
    public void testNativeInitialization() {
        CommandLine.init(null);
        loadJni();
        // Drop the program name for use with appendSwitchesAndArguments.
        String[] args = new String[INIT_SWITCHES.length - 1];
        System.arraycopy(INIT_SWITCHES, 1, args, 0, args.length);
        CommandLine.getInstance().appendSwitchesAndArguments(args);
        checkInitSwitches();
        checkSettingThenGetting();
    }

    @SmallTest
    @Feature({"Android-AppBase"})
    public void testBufferInitialization() {
        CommandLine.init(CommandLine.tokenizeQuotedAruments(INIT_SWITCHES_BUFFER));
        checkInitSwitches();
        checkSettingThenGetting();
    }

    @SmallTest
    @Feature({"Android-AppBase"})
    public void testArgumentTokenizer() {
        String toParse = " a\"\\bc de\\\"f g\"\\h ij    k\" \"lm";
        String[] expected = { "a\\bc de\"f g\\h",
                              "ij",
                              "k lm" };
        checkTokenizer(expected, toParse);

        toParse = "";
        expected = new String[0];
        checkTokenizer(expected, toParse);

        toParse = " \t\n";
        checkTokenizer(expected, toParse);

        toParse = " \"a'b\" 'c\"d' \"e\\\"f\" 'g\\'h' \"i\\'j\" 'k\\\"l'" +
                  " m\"n\\'o\"p q'r\\\"s't";
        expected = new String[] { "a'b",
                                  "c\"d",
                                  "e\"f",
                                  "g'h",
                                  "i\\'j",
                                  "k\\\"l",
                                  "mn\\'op",
                                  "qr\\\"st",};
        checkTokenizer(expected, toParse);
    }

    @MediumTest
    @Feature({"Android-AppBase"})
    public void testFileInitialization() {
        CommandLine.initFromFile(ContentShellActivity.COMMAND_LINE_FILE);
        loadJni();
        checkSettingThenGetting();
    }
}


text:
interface A {
    int X = 1;            // implicitly public static final
    default void f() {}   // implicitly public
}

interface B {
    int X = 2;            // implicitly public static final
    default void f() {}   // implicitly public
}

// class C implements A, B {
//     // WILL NOT COMPILE: unrelated defaults for f()
//     public static void main(String[] args) {
//         // System.out.println(X); // WILL NOT COMPILE (X ambiguous)
//     }
// }

class D implements A, B {
    @Override
    public void f() {
        System.out.println(A.X + B.X);
    }
}


text:
/*
	A Simple multithreaded application that continually watches the read queue
	until the application exits.

gcc -o multi main.c -lpthread -lftd2xx -Wl,-rpath /usr/local/lib

*/
#include <pthread.h>
#include <stdio.h>
#include <stdint.h>
#include "../ftd2xx.h"

FT_HANDLE ftHandle;
int exit_reader = 0;

/*
	This is the main reader thread - continually waits for a read

*/
void *read_watch(void *pArgs)
{
	char buf[20];
	DWORD dwRet;
	FT_STATUS ftStatus;

	(void)pArgs; /* Deliberately unused parameter */

	while(exit_reader != 1) {
//		printf("Write\n");
		ftStatus = FT_Write(ftHandle, buf, 20, &dwRet);
		if (ftStatus != FT_OK)
			printf("Error: FT_Write returned %d\n", (int)ftStatus);
//		sleep(1);
	}
	(void)FT_Close(ftHandle);

	return NULL;
}

int main(int argc, char *argv[])
{
	pthread_t thread_id;
	int i;
	FT_STATUS ftStatus;

	(void)argc; /* Deliberately unused parameter */
	(void)argv; /* Deliberately unused parameter */

	exit_reader = 0;

	ftStatus = FT_Open(0, &ftHandle);
	pthread_create(&thread_id, NULL, &read_watch, NULL);

	for(i = 0; i < 1000; i++) {
		char buf[100];
		DWORD index = 0;

		ftStatus = FT_ListDevices((PVOID)(uintptr_t)index,
		                          (void*)buf,
		                          FT_LIST_BY_INDEX | FT_OPEN_BY_SERIAL_NUMBER);
		if(ftStatus == FT_OK) {
//			printf("FT_LIST_BY_INDEX = %s\n");
		}
		else {
			printf("FT_LIST_BY_INDEX failed(%d)\n", (int)ftStatus);
		}
	}

	exit_reader = 1;

	/* wait for it to exit */
	pthread_join(thread_id, NULL);

	return 0;
}


text:
from os.path import exists, join

from mojo.roboFont import RFont, RGlyph
from mutatorMath.objects.mutator import buildMutator

from fontMath.mathGlyph import MathGlyph
from fontMath.mathInfo import MathInfo
from fontMath.mathKerning import MathKerning

from jkRFTools.info import setFontInfo

from jkRFoTools.weight import getPanoseAndWeightForStyle

def notify(title, subtitle, message):
    from os import system
    t = '-title {!r}'.format(title)
    s = '-subtitle {!r}'.format(subtitle)
    m = '-message {!r}'.format(message)
    a = '-sender {!r}'.format("com.typemytype.robofont")
    system('terminal-notifier {}'.format(' '.join([m, t, s, a])))

class jkInstance(object):

    def __init__(self, location, style_name, features):
        self.features = features
        self.location = location
        self.style_name = style_name

        self.font = None

class jkInterpolator(object):

    def __init__(self, family_name, base_path=None, instance_dir=None, progressWindow=None, postInterpolateCallback=None):
        self.family_name = family_name
        self.base_path = base_path
        self.instance_dir = instance_dir

        self.masters = []
        self.instances = []
        self.target_glyphset = []

        if progressWindow is not None:
            self.progress = progressWindow
        else:
            self.progress = None

        self.postInterpolateCallback = postInterpolateCallback

        if exists("/usr/bin/terminal-notifier"):
            self.use_notifications = True
        else:
            self.use_notifications = False
            print "In order to use notifications, install the command line program with:"
            print "$ sudo gem install terminal-notifier"

    def add_master(self, font, location):
        self.masters.append((location, font))

    def add_instance(self, location, style_name, features):
        self.instances.append(jkInstance(location, style_name, features))

    def set_target_glyphset(self, glyphnames=[]):
        self.target_glyphset = glyphnames

    def get_font_at_location(self, location, showUI=False):
        #print("\nBuilding font at location %s" % location)
        i_font = RFont(showUI=showUI) # showUI=False
        if self.target_glyphset == []:
            glyphset = self.masters[0][1].glyphOrder
        else:
            glyphset = self.target_glyphset
        self.interpolate_font_info(location, self.masters, i_font)
        groups = self.masters[0][1].groups
        for k in groups.keys():
            i_font.groups[k] = groups[k]
        self.interpolate_kerning(location, self.masters, i_font)
        self.interpolate_glyph_set(location, glyphset, self.masters, i_font)
        i_font.glyphOrder = glyphset
        return i_font

    def interpolate(self):
        if self.progress is not None:
            p = self.progress("Interpolation", tickCount = len(self.instances))
        for instance in self.instances:
            if self.progress is not None:
                p.update("%s %s %s ..." % (
                    self.family_name,
                    instance.style_name,
                    instance.location
                ))
            font = self.get_font_at_location(instance.location)
            weight_class, panose_weight = getPanoseAndWeightForStyle(instance.style_name)
            setFontInfo(font, self.family_name, instance.style_name, weight_class)
            if font.info.openTypeOS2Panose is not None:
                font.info.openTypeOS2Panose[2] = panose_weight
            font.features.text = instance.features
            if self.postInterpolateCallback is not None:
                self.postInterpolateCallback(font)
            instance.font = font
        if self.progress is not None:
            p.close()

    def generate(self):
        if self.progress is not None:
            p = self.progress("Generation", tickCount = len(self.instances))
        i = 0
        for instance in self.instances:
            if instance.font is not None:
                font = instance.font
                ps_name = font.info.postscriptFontName
                if self.progress is not None:
                    p.update("Generating %s ..." % ps_name)

                # save space by removing unneeded layers
                for l in font.layerOrder:
                    font.removeLayer(l)

                # save UFO
                font.save(join(self.base_path, self.instance_dir, "%s.ufo" % ps_name))

                # save OTF
                font_path = join(self.base_path, self.instance_dir, "%s.otf" % ps_name)
                font.generate(
                    path=font_path,
                    format="otf",
                    decompose=True,
                    checkOutlines=True,
                    autohint=False,
                    releaseMode=True,
                    glyphOrder=None,
                    progressBar=None,
                    useMacRoman=False,
                )
                if self.use_notifications:
                    notify("Font was generated", ps_name, font_path)
                i += 1
        if self.use_notifications:
            notify(
                "Fonts Generated",
                "%i fonts were generated." % i,
                "%s" % join(self.base_path, self.instance_dir)
            )
        if self.progress is not None:
            p.close()

    def interpolate_font_info(self, instanceLocation, masters, targetFont):
        infoMasters = [
            (infoLocation, MathInfo(masterFont.info))
            for infoLocation, masterFont in masters
        ]
        try:
            bias, iM = buildMutator(infoMasters)
            instanceInfo = iM.makeInstance(instanceLocation)
            instanceInfo.extractInfo(targetFont.info)
        except:
            print(u'Couldn't interpolate font info')

    def interpolate_kerning(self, instanceLocation, masters, targetFont):
        kerningMasters = [
            (kerningLocation, MathKerning(masterFont.kerning))
            for kerningLocation, masterFont in masters
        ]
        try:
            bias, iK = buildMutator(kerningMasters)
            instanceKerning = iK.makeInstance(instanceLocation)
            instanceKerning.extractKerning(targetFont)
        except:
            print(u'Couldn't interpolate font kerning')

    def interpolate_glyph_set(self, instanceLocation, glyphSet, masters, targetFont):
        for glyphName in glyphSet:
            masterGlyphs = [
                (masterLocation, MathGlyph(masterFont[glyphName]))
                for masterLocation, masterFont in masters
            ]
            try:
                bias, gM = buildMutator(masterGlyphs)
                newGlyph = RGlyph()
                instanceGlyph = gM.makeInstance(instanceLocation)
                targetFont.insertGlyph(instanceGlyph.extractGlyph(newGlyph), glyphName)
                targetFont[glyphName].unicode = masterFont[glyphName].unicode
                targetFont[glyphName].round()
                self.fix_component_order(masterFont[glyphName], targetFont[glyphName])
            except:
                #print(u'Incompatible glyph: %s' % glyphName)
                targetFont.newGlyph(glyphName)
                continue
        targetFont.glyphOrder = glyphSet

    def fix_component_order(self, source_glyph, target_glyph):
        pass


text:
.class Landroid/net/wifi/WifiWatchdogStateMachine$DefaultState;
.super Lcom/android/internal/util/State;
.source "WifiWatchdogStateMachine.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/net/wifi/WifiWatchdogStateMachine;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = "DefaultState"
.end annotation

# instance fields
.field final synthetic this$0:Landroid/net/wifi/WifiWatchdogStateMachine;

# direct methods
.method constructor <init>(Landroid/net/wifi/WifiWatchdogStateMachine;)V
    .locals 0
    .parameter

    .prologue
    .line 554
    iput-object p1, p0, Landroid/net/wifi/WifiWatchdogStateMachine$DefaultState;->this$0:Landroid/net/wifi/WifiWatchdogStateMachine;

    invoke-direct {p0}, Lcom/android/internal/util/State;-><init>()V

    return-void
.end method

# virtual methods
.method public enter()V
    .locals 2

    .prologue
    .line 557
    invoke-static {}, Landroid/net/wifi/WifiWatchdogStateMachine;->access$200()Z

    move-result v0

    if-eqz v0, :cond_0

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {p0}, Landroid/net/wifi/WifiWatchdogStateMachine$DefaultState;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "\n"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    #calls: Landroid/net/wifi/WifiWatchdogStateMachine;->log(Ljava/lang/String;)V
    invoke-static {v0}, Landroid/net/wifi/WifiWatchdogStateMachine;->access$300(Ljava/lang/String;)V

    .line 558
    :cond_0
    return-void
.end method

.method public processMessage(Landroid/os/Message;)Z
    .locals 3
    .parameter "msg"

    .prologue
    .line 562
    iget v0, p1, Landroid/os/Message;->what:I

    packed-switch v0, :pswitch_data_0

    .line 583
    :pswitch_0
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Unhandled message "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " in state "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Landroid/net/wifi/WifiWatchdogStateMachine$DefaultState;->this$0:Landroid/net/wifi/WifiWatchdogStateMachine;

    #calls: Landroid/net/wifi/WifiWatchdogStateMachine;->getCurrentState()Lcom/android/internal/util/IState;
    invoke-static {v1}, Landroid/net/wifi/WifiWatchdogStateMachine;->access$700(Landroid/net/wifi/WifiWatchdogStateMachine;)Lcom/android/internal/util/IState;

    move-result-object v1

    invoke-interface {v1}, Lcom/android/internal/util/IState;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    #calls: Landroid/net/wifi/WifiWatchdogStateMachine;->log(Ljava/lang/String;)V
    invoke-static {v0}, Landroid/net/wifi/WifiWatchdogStateMachine;->access$300(Ljava/lang/String;)V

    .line 586
    :cond_0
    :goto_0
    :pswitch_1
    const/4 v0, 0x1

    return v0

    .line 564
    :pswitch_2
    iget-object v0, p0, Landroid/net/wifi/WifiWatchdogStateMachine$DefaultState;->this$0:Landroid/net/wifi/WifiWatchdogStateMachine;

    #calls: Landroid/net/wifi/WifiWatchdogStateMachine;->updateSettings()V
    invoke-static {v0}, Landroid/net/wifi/WifiWatchdogStateMachine;->access$400(Landroid/net/wifi/WifiWatchdogStateMachine;)V

    .line 565
    invoke-static {}, Landroid/net/wifi/WifiWatchdogStateMachine;->access$200()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 566
    const-string v0, "Updating wifi-watchdog secure settings"

    #calls: Landroid/net/wifi/WifiWatchdogStateMachine;->log(Ljava/lang/String;)V
    invoke-static {v0}, Landroid/net/wifi/WifiWatchdogStateMachine;->access$300(Ljava/lang/String;)V

    goto :goto_0

    .line 570
    :pswitch_3
    iget-object v0, p0, Landroid/net/wifi/WifiWatchdogStateMachine$DefaultState;->this$0:Landroid/net/wifi/WifiWatchdogStateMachine;

    iget-object v1, p0, Landroid/net/wifi/WifiWatchdogStateMachine$DefaultState;->this$0:Landroid/net/wifi/WifiWatchdogStateMachine;

    iget v2, p1, Landroid/os/Message;->arg1:I

    #calls: Landroid/net/wifi/WifiWatchdogStateMachine;->calculateSignalLevel(I)I
    invoke-static {v1, v2}, Landroid/net/wifi/WifiWatchdogStateMachine;->access$600(Landroid/net/wifi/WifiWatchdogStateMachine;I)I

    move-result v1

    #setter for: Landroid/net/wifi/WifiWatchdogStateMachine;->mCurrentSignalLevel:I
    invoke-static {v0, v1}, Landroid/net/wifi/WifiWatchdogStateMachine;->access$502(Landroid/net/wifi/WifiWatchdogStateMachine;I)I

    goto :goto_0

    .line 562
    :pswitch_data_0
    .packed-switch 0x21002
        :pswitch_1
        :pswitch_3
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_1
        :pswitch_1
        :pswitch_1
        :pswitch_1
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_1
        :pswitch_1
    .end packed-switch
.end method


text:
/**
 *
 */
package com.github.nnest.sparrow.command.document.query.fulltext;

import com.github.nnest.sparrow.command.document.query.DefaultExampleType;
import com.github.nnest.sparrow.command.document.query.ExampleType;

/**
 * multiple match cross fields
 *
 * @author brad.wu
 * @since 0.0.1
 * @version 0.0.1
 */
public class MultiMatchCrossFields extends AbstractMultiMatch<MultiMatchCrossFields> {
	public MultiMatchCrossFields(String exampleText) {
		super(exampleText);
	}

	/**
	 * (non-Javadoc)
	 *
	 * @see com.github.nnest.sparrow.command.document.query.Example#getExampleType()
	 */
	@Override
	public ExampleType getExampleType() {
		return DefaultExampleType.MULTI_CROSS_FIELDS;
	}
}


text:
"""
Created on 14/8/2014

@author: victor
"""
import hivprotmut.tools as tools
import os

class PdbPseudoMutation(object):

    def __init__(self):
        pass

    @classmethod
    def get_mutated_residues(cls, master_sequence, target_sequence):
        """
        Precondition: SAME length
        TODO: generalize
        """
        mutations = {}
        for i in range(len(master_sequence)):
            if master_sequence[i] != target_sequence[i]:
                mutations[i+1] = tools.one_letter_residue_to_three(target_sequence[i]).upper()
        return mutations

    @classmethod
    def process_pdb(cls, mutations, input_pdb_path, parameters):
        handler = open(os.path.join(parameters["structure_database"],input_pdb_path),"r")
        mut_handler = open(parameters["output_file"], "w")
        cls.process_pdb_handlers(handler, mut_handler, mutations, parameters)
        handler.close()
        mut_handler.close()

    @classmethod
    def process_pdb_handlers(cls, input_handler, output_handler, mutations, parameters):
        backbone_atoms = [' N  ', ' CA ', ' C  ', ' O  ', ' OXT']
        for line in input_handler:
            if line[:4] == "ATOM":
                atom = line[12:16]
                resnumber = int(line[23:26])
                if resnumber in mutations:
                    if atom in backbone_atoms:
                        output_handler.write(line[0:17]+mutations[resnumber]+line[20:])
                else:
                    output_handler.write(line)
            else:
                output_handler.write(line)


text:
exports.config = {
  allScriptsTimeout: 11000,

  specs: [
    'e2e/*.js'
  ],

  capabilities: {
    //'browserName': 'chrome'
    'browserName': 'phantomjs'
  },

  chromeOnly: true,

  baseUrl: 'http://localhost:8080/',

  framework: 'jasmine',

  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }
};


text:
/*
 * NullMeshSceneNode.cpp
 *
 *  Created on: 2016年8月17日
 *      Author: lijing
 */

#include "NullMeshSceneNode.h"
#include "pola/log/Log.h"

namespace pola {
namespace scene {

NullMeshSceneNode::NullMeshSceneNode(IMesh* mesh) : mMesh(mesh) {
	mMesh->ref();
	LOG_FATAL_IF(mMesh->geometry() != nullptr, "Not null mesh.");
}

NullMeshSceneNode::~NullMeshSceneNode() {
	mMesh->deref();
}

} /* namespace scene */
} /* namespace pola */


text:
require 'rdoc/test_case'

class TestRDocRdInlineParser < RDoc::TestCase

  def setup
    super

    @block_parser = RDoc::RD::BlockParser.new
    @block_parser.instance_variable_set :@i, 0
    @inline_parser = RDoc::RD::InlineParser.new @block_parser
  end

  def test_parse
    assert_equal 'regular emphasis', parse('regular ((*emphasis*))')
  end

  def test_parse_code
    assert_equal 'text', parse('(({text}))')
  end

  def test_parse_em
    assert_equal 'text', parse('((*text*))')
  end

  def test_parse_footnote
    assert_equal '{*1}[rdoc-label:foottext-1:footmark-1]', parse('((-text-))')

    expected = [
      @RM::Paragraph.new('{^1}[rdoc-label:footmark-1:foottext-1]', 'text')
    ]

    assert_equal expected, @block_parser.footnotes
  end

  def test_parse_index
    assert_equal 'text', parse('((:text:))')

    assert_includes @block_parser.labels, 'text'
  end

  def test_parse_kbd
    assert_equal '<tt>text</tt>', parse('((%text%))')
  end

  def test_parse_multiple
    assert_equal 'one two', parse('((*one*)) ((*two*))')
  end

  def test_parse_newline
    assert_equal "one\ntwo", parse("one\ntwo")
  end

  def test_parse_quote
    assert_equal 'one " two', parse('one " two')
  end

  def test_parse_ref
    assert_equal '{text}[rdoc-label:text]', parse('((<text>))')
  end

  def test_parse_ref_em
    assert_equal '{text}[rdoc-label:text]', parse('((<((*text*))>))')
  end

  def test_parse_ref_filename_quote
    assert_equal '{RD/foo}[rdoc-label:RD/foo]', parse('((<RD/"foo">))')
  end

  def test_parse_ref_filename
    assert_equal '{RD}[rdoc-label:RD/]', parse('((<RD/>))')
  end

  def test_parse_ref_quote
    assert_equal '{text \\"}[rdoc-label:text \\"]', parse('((<text \">))')
  end

  def test_parse_ref_quote_content
    assert_equal '{text}[rdoc-label:text]',
                 parse('((<"((*text*))">))')
  end

  def test_parse_ref_quote_content_multi
    assert_equal '{one two}[rdoc-label:one two]',
                 parse('((<"((*one*)) ((*two*))">))')
  end

  def test_parse_ref_substitute
    assert_equal '{text}[rdoc-label:thing]', parse('((<text|thing>))')
  end

  def test_parse_ref_substitute_element_quote
    assert_equal '{text}[rdoc-label:"RD"]',
                 parse('((<text|"RD">))')
  end

  def test_parse_ref_substitute_filename
    assert_equal '{text}[rdoc-label:RD/]', parse('((<text|RD/>))')
  end

  def test_parse_ref_substitute_filename_label
    assert_equal '{text}[rdoc-label:RD/label]',
                 parse('((<text|RD/label>))')
  end

  def test_parse_ref_substitute_filename_quote
    assert_equal '{text}[rdoc-label:"RD"/]', parse('((<text|"RD"/>))')
  end

  def test_parse_ref_substitute_multi_content
    assert_equal '{one two}[rdoc-label:thing]',
                 parse('((<((*one*)) two|thing>))')
  end

  def test_parse_ref_substitute_multi_content2
    assert_equal '{one \\" two}[rdoc-label:thing]',
                 parse('((<((*one*)) \" two|thing>))')
  end

  def test_parse_ref_substitute_multi_content3
    assert_equal '{one \\" two}[rdoc-label:thing]',
                 parse('((<((*one*)) \" ((*two*))|thing>))')
  end

  def test_parse_ref_substitute_quote
    assert_equal '{one | two}[rdoc-label:thing]',
                 parse('((<"one | two"|thing>))')
  end

  def test_parse_ref_substitute_quote_content
    assert_equal '{text}[rdoc-label:thing]',
                 parse('((<"((*text*))"|thing>))')
  end

  def test_parse_ref_substitute_url
    assert_equal '{text}[http://example]',
                 parse('((<text|URL:http://example>))')
  end

  def test_parse_ref_url
    assert_equal '{http://example}[http://example]',
                 parse('((<URL:http://example>))')
  end

  def test_parse_var
    assert_equal '+text+', parse('((|text|))')
  end

  def test_parse_verb
    assert_equal '<tt>text</tt>', parse("(('text'))")
  end

  def test_parse_verb_backslash
    assert_equal "<tt>(('text'))</tt>", parse("(('(('text\\'))'))")
  end

  def test_parse_verb_backslash_backslash
    assert_equal '<tt>text \\</tt>', parse("(('text \\\\'))")
  end

  def test_parse_verb_backslash_quote
    assert_equal '<tt>text "</tt>', parse("(('text \\\"'))")
  end

  def test_parse_verb_multiple
    assert_equal '<tt>((*text*))</tt>', parse("(('((*text*))'))")
  end

  def parse text
    @inline_parser.parse text
  end

end


text:
import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_gbm, h2o_jobs as h2j, h2o_import
import h2o_exec as h2e, h2o_util
import math

print "Copy a version of this to a two cloud test. different failure mode"
DO_PLOT = False
COL = 1
PHRASE = "func1"
FUNC_PHRASE = "func1=function(x){max(x[,%s])}" % COL
REPEAT = 20

DO_KNOWN_FAIL = False
DO_APPEND_KNOWN_FAIL2 = True
DO_REALS = True

CLOUD_SIZE = 1

initList = [
    (None, FUNC_PHRASE),
    # (None, "func2=function(x){a=3;nrow(x[,%s])*a}" % COL),
    # (None, "func3=function(x){apply(x[,%s],2,sum)/nrow(x[,%s])}" % (COL, col) ),
    # (None, "function(x) { cbind( mean(x[,1]), mean(x[,%s]) ) }" % COL),
    # (None, "func4=function(x) { mean( x[,%s]) }" % COL),
    # (None, "func5=function(x) { sd( x[,%s]) }" % COL),
    # (None, "func6=function(x) { quantile(x[,%s] , c(0.9) ) }" % COL),
]

print "Data is all integers, minInt to maxInt..so it shouldn't have fp roundoff errors while summing the row counts I use?"
def write_syn_dataset(csvPathname, rowCount, colCount, minInt, maxInt, SEED):
    r1 = random.Random(SEED)
    dsf = open(csvPathname, "w+")

    for i in range(rowCount):
        rowData = []

        if DO_REALS:
            for j in range(colCount):
                # maybe do a significatly smaller range than min/max ints.
                # divide by pi to get some non-integerness
                ri = r1.randint(minInt,maxInt) / math.pi
                # make it a real?
                rowData.append("%+e" % ri)
        else:
            for j in range(colCount):
                # maybe do a significatly smaller range than min/max ints.
                ri = r1.randint(minInt,maxInt)
                rowData.append(ri)

        rowDataCsv = ",".join(map(str,rowData))
        dsf.write(rowDataCsv + "\n")

    dsf.close()

class Basic(unittest.TestCase):
    def tearDown(self):
        h2o.check_sandbox_for_errors()

    @classmethod
    def setUpClass(cls):
        global SEED
        SEED = h2o.setup_random_seed()
        h2o.init(CLOUD_SIZE,java_heap_GB=12/CLOUD_SIZE)

    @classmethod
    def tearDownClass(cls):
        ### time.sleep(3600)
        h2o.tear_down_cloud()

    def test_ddply_plot(self):
        SYNDATASETS_DIR = h2o.make_syn_dir()

        if DO_KNOWN_FAIL:
            tryList = [
                (1000000, 5, 'cD', 0, 320, 30),
            ]
        else:
            tryList = [
                # (1000000, 5, 'cD', 0, 10, 30),
                # (1000000, 5, 'cD', 0, 20, 30),
                # (1000000, 5, 'cD', 0, 40, 30),
                # (1000000, 5, 'cD', 0, 50, 30),
                (1000000, 5, 'cD', 0, 80, 30),
                (1000000, 5, 'cD', 0, 160, 30),
                # fails..don't do
                # (1000000, 5, 'cD', 0, 320, 30),
                # (1000000, 5, 'cD', 0, 320, 30),
                # starts to fail here. too many groups?
                # (1000000, 5, 'cD', 0, 640, 30),
                # (1000000, 5, 'cD', 0, 1280, 30),
                ]

        if DO_APPEND_KNOWN_FAIL2:
            tryList.append(
                (1000000, 5, 'cD', 0, 160, 30),
            )
            tryList.append(
                (1000000, 5, 'cD', 0, 320, 30),
            )
        ### h2b.browseTheCloud()
        xList = []
        eList = []
        fList = []
        trial = 0
        for (rowCount, colCount, hex_key, minInt, maxInt, timeoutSecs) in tryList:
            SEEDPERFILE = random.randint(0, sys.maxint)
            # csvFilename = 'syn_' + str(SEEDPERFILE) + "_" + str(rowCount) + 'x' + str(colCount) + '.csv'
            if DO_KNOWN_FAIL:
                # csvFilename = 'syn_binary_1000000x5.csv.gz' # fails
                # csvFilename = 'a1' # fails
                csvFilename = "syn_ddply_1Mx5_0_320.gz"
                bucket = "home-0xdiag-datasets"
                csvPathname = "standard/" + csvFilename
                minInt = 0
                maxInt = 320
            else:
                bucket = None
                csvFilename = 'syn_' + "binary" + "_" + str(rowCount) + 'x' + str(colCount) + '.csv'
                csvPathname = SYNDATASETS_DIR + '/' + csvFilename
                print "Creating random", csvPathname, "with range", (maxInt-minInt)+1
                write_syn_dataset(csvPathname, rowCount, colCount, minInt, maxInt, SEEDPERFILE)

            for lll in range(5):
                # PARSE train****************************************
                hexKey = 'r.hex'
                parseResult = h2i.import_parse(bucket=bucket, path=csvPathname, schema='local', hex_key=hexKey)
                inspect = h2o_cmd.runInspect(key=hexKey)
                missingValuesList = h2o_cmd.infoFromInspect(inspect, csvFilename)
                self.assertEqual(missingValuesList, [], "a1 should have no NAs in parsed dataset: %s" % missingValuesList)

                for resultKey, execExpr in initList:
                    h2e.exec_expr(h2o.nodes[0], execExpr, resultKey=resultKey, timeoutSecs=60)

                #*****************************************************************************************
                # two columns. so worse case every combination of each possible value
                # only true if enough rows (more than the range?)
                maxExpectedGroups = ((maxInt - minInt) + 1) ** 2
                # do it twice..to get the optimal cached delay for time?
                execExpr = "a1 = ddply(r.hex, c(1,2), " + PHRASE + ")"
                start = time.time()
                (execResult, result) = h2e.exec_expr(h2o.nodes[0], execExpr, resultKey=None, timeoutSecs=90)
                groups = execResult['num_rows']
                # this is a coarse comparision, statistically not valid for small rows, and certain ranges?
                h2o_util.assertApproxEqual(groups, maxExpectedGroups,  rel=0.2,
                    msg="groups %s isn't close to expected amount %s, minInt: %s maxInt: %s" % (groups, maxExpectedGroups, minInt, maxInt))
                ddplyElapsed = time.time() - start
                print "ddplyElapsed:", ddplyElapsed
                print "execResult", h2o.dump_json(execResult)

                a1dump = h2o_cmd.runInspect(key="a1")
                print "a1", h2o.dump_json(a1dump)
                # should never have any NAs in this result
                missingValuesList = h2o_cmd.infoFromInspect(a1dump, "a1")
                self.assertEqual(missingValuesList, [], "a1 should have no NAs: %s trial: %s" % (missingValuesList, trial))

                #*****************************************************************************************

                execExpr = "a2 = ddply(r.hex, c(1,2), " + PHRASE + ")"
                start = time.time()
                (execResult, result) = h2e.exec_expr(h2o.nodes[0], execExpr, resultKey=None, timeoutSecs=90)
                groups = execResult['num_rows']
                # this is a coarse comparision, statistically not valid for small rows, and certain ranges?
                h2o_util.assertApproxEqual(groups, maxExpectedGroups,  rel=0.2,
                    msg="groups %s isn't close to expected amount %s, minInt: %s maxInt: %s" % (groups, maxExpectedGroups, minInt, maxInt))
                ddplyElapsed = time.time() - start
                print "ddplyElapsed:", ddplyElapsed
                print "execResult", h2o.dump_json(execResult)

                a2dump = h2o_cmd.runInspect(key="a2")
                print "a2", h2o.dump_json(a2dump)
                # should never have any NAs in this result
                missingValuesList = h2o_cmd.infoFromInspect(a2dump, "a2")
                self.assertEqual(missingValuesList, [], "a2 should have no NAs: %s trial: %s" % (missingValuesList, trial))

                #*****************************************************************************************
                # should be same answer in both cases
                execExpr = "sum(a1!=a2)==0"
                (execResult, result) = h2e.exec_expr(h2o.nodes[0], execExpr, resultKey=None, timeoutSecs=120)
                execExpr = "s=c(0); s=(a1!=a2)"
                (execResult1, result1) = h2e.exec_expr(h2o.nodes[0], execExpr, resultKey=None, timeoutSecs=90)
                print "execResult", h2o.dump_json(execResult)

                #*****************************************************************************************

                # should never have any NAs in this result
                sdump = h2o_cmd.runInspect(key="s")
                print "s", h2o.dump_json(sdump)
                self.assertEqual(result, 1, "a1 and a2 weren't equal? Maybe ddply can vary execution order (fp error? so multiple ddply() can have different answer. %s %s %s" % (FUNC_PHRASE, result, h2o.dump_json(execResult)))

                # xList.append(ntrees)
                trial += 1
                # this is the biggest it might be ..depends on the random combinations
                # groups = ((maxInt - minInt) + 1) ** 2
                xList.append(groups)
                eList.append(ddplyElapsed)
                fList.append(ddplyElapsed)

        if DO_PLOT:
            xLabel = 'groups'
            eLabel = 'ddplyElapsed'
            fLabel = 'ddplyElapsed'
            eListTitle = ""
            fListTitle = ""
            h2o_gbm.plotLists(xList, xLabel, eListTitle, eList, eLabel, fListTitle, fList, fLabel)

if __name__ == '__main__':
    h2o.unit_main()


text:
from m1 import <error descr="Unresolved reference 'foo'">foo</error>
from m1 import <error descr="Unresolved reference 'bar'">bar</error>
from m1 import bar_imported
from m1 import <error descr="Unresolved reference 'm2'">m2</error>
from m1 import m2_imported

print(foo, bar, bar_imported, m2, m2_imported)


text:
(function StringTrim() {
"use strict";

if (!%IsCompatibilityOptionEnabled("StringTrim")) {
  const global = %GlobalTemplate();

  const {
    Object, String, TypeError
  } = global;

  const trimLeftRE = /^\s+/, trimRightRE = /\s+$/;

  /*
   * Add 'trimLeft' and 'trimRight' to String.prototype
   */
  Object.defineProperties(Object.assign(String.prototype, {
    trimLeft() {
      if (this == null) throw TypeError();
      return %RegExpReplace(trimLeftRE, %ToString(this), "");
    },
    trimRight() {
      if (this == null) throw TypeError();
      return %RegExpReplace(trimRightRE, %ToString(this), "");
    },
  }), {
    trimLeft: {enumerable: false},
    trimRight: {enumerable: false},
  });
}

})();


text:
@interface PodsDummy_HZExtend : NSObject
@end
@implementation PodsDummy_HZExtend
@end


text:
<?php
require_once "helpers/WCRequest.php";
class WCRequestHandler{
	public function __construct(){

	}

	public static function kickOffPendingJobs($mode){
		$mapper = "/home/hduser/hadoop-sandbox/perl/mapper.pl";
		$reducer = "/home/hduser/hadoop-sandbox/perl/reducer.pl";
		WCRequestHandler::llog($mode, "Looking for new requests...");
		print("Current working directory is " . getcwd());
		$requests = WCRequest::getNew();
		foreach ($requests as $request){
			$tokenid = $request->tokenid;
			WCRequestHandler::llog($mode, "Found new request. Processing " . $tokenid);
			$app_name = $request->app_name;
			$input_file = getcwd() . '/' . $request->input_file;
			$logfile = getcwd() . '/logs/' . $tokenid . '.log';
			$outputDir = getcwd() . "/out/$tokenid";
			//$statDir = getcwd() . "/out/$tokenid.stats";
			$command = "/home/hduser/analyseData.pl -dataset \"$input_file\" -outputDir \"$outputDir\" -mode stream -mapper \"$mapper\" -reducer \"$reducer\" -package -tokenid $tokenid > $logfile 2>&1";
			$request->start();
			WCRequestHandler::llog($mode, "Started processing $tokenid");
			$rc = system($command);
			if($rc == 0){
				echo "success";
				WCRequestHandler::llog($mode, "Processing for $tokenid was successful.");
				$request->complete($outputDir . ".tar.gz");
			} else {
				echo "fail";
				WCRequestHandler::llog($mode, "Processing failed for $tokenid. Moving on.");
			}
		}
	}

	private static function llog($mode, $str){
		if(isset($mode)){
			if($mode == "debug"){
				echo date("Y-m-d H:i:s") . "\t$str\n";
			}
		}
	}
}
?>


text:
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// cgo should reject the use of mangled C names.

package main

/*
typedef struct a {
	int i;
} a;
void fn(void) {}
*/
import "C"

type B _Ctype_struct_a // ERROR HERE

var a _Ctype_struct_a // ERROR HERE

type A struct {
	a *_Ctype_struct_a // ERROR HERE
}

var notExist _Ctype_NotExist // ERROR HERE

func main() {
	_Cfunc_fn() // ERROR HERE
}


text:
package cn.enilu.flash.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class HttpUtil {

    public static String getIp() {
        HttpServletRequest request = HttpUtil.getRequest();
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        return ip;
    }

    /**
     * 获取所有请求的值
     */
    public static Map<String, String> getRequestParameters() {
        HashMap<String, String> values = new HashMap<>(20);
        HttpServletRequest request = HttpUtil.getRequest();
        Enumeration enums = request.getParameterNames();
        while (enums.hasMoreElements()) {
            String paramName = (String) enums.nextElement();
            String paramValue = request.getParameter(paramName);
            values.put(paramName, paramValue);
        }
        return values;
    }

    /**
     * 获取 HttpServletRequest
     */
    public static HttpServletResponse getResponse() {
        HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
        return response;
    }

    /**
     * 获取 包装防Xss Sql注入的 HttpServletRequest
     *
     * @return request
     */
    public static HttpServletRequest getRequest() {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        return new WafRequestWrapper(request);
    }

    public static String getToken() {
        return getRequest().getHeader("Authorization");
    }

    /**
     * 向指定URL发送GET方法的请求
     *
     * @param url   发送请求的URL
     * @param param 请求参数
     * @return URL 所代表远程资源的响应结果
     */
    public static String sendGet(String url, Map<String, String> param) {
        String result = "";
        BufferedReader in = null;
        try {
            StringBuffer query = new StringBuffer();

            for (Map.Entry<String, String> kv : param.entrySet()) {
                query.append(URLEncoder.encode(kv.getKey(), "UTF-8") + "=");
                query.append(URLEncoder.encode(kv.getValue(), "UTF-8") + "&");
            }
            if (query.lastIndexOf("&") > 0) {
                query.deleteCharAt(query.length() - 1);
            }

            String urlNameString = url + "?" + query.toString();
            URL realUrl = new URL(urlNameString);
            // 打开和URL之间的连接
            URLConnection connection = realUrl.openConnection();
            // 设置通用的请求属性
            connection.setRequestProperty("accept", "*/*");
            connection.setRequestProperty("connection", "Keep-Alive");
            connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
            // 建立实际的连接
            connection.connect();
            // 获取所有响应头字段
            Map<String, List<String>> map = connection.getHeaderFields();
            // 遍历所有的响应头字段
            for (String key : map.keySet()) {
                System.out.println(key + "--->" + map.get(key));
            }
            // 定义 BufferedReader输入流来读取URL的响应
            in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String line;
            while ((line = in.readLine()) != null) {
                result += line;
            }
        } catch (Exception e) {
            System.out.println("发送GET请求出现异常!" + e);
            e.printStackTrace();
        }
        // 使用finally块来关闭输入流
        finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
        return result;
    }

    /**
     * 向指定 URL 发送POST方法的请求
     *
     * @param url   发送请求的 URL
     * @param param 请求参数
     * @return 所代表远程资源的响应结果
     */
    public static String sendPost(String url, Map<String, String> param) {
        PrintWriter out = null;
        BufferedReader in = null;
        String result = "";
        try {
            String para = "";
            for (String key : param.keySet()) {
                para += (key + "=" + param.get(key) + "&");
            }
            if (para.lastIndexOf("&") > 0) {
                para = para.substring(0, para.length() - 1);
            }
            String urlNameString = url + "?" + para;
            URL realUrl = new URL(urlNameString);
            // 打开和URL之间的连接
            HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
            // 设置通用的请求属性
            conn.setRequestProperty("accept", "*/*");
            conn.setRequestProperty("connection", "Keep-Alive");
            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
            // 发送POST请求必须设置如下两行
            conn.setDoOutput(true);
            conn.setDoInput(true);
            // 获取URLConnection对象对应的输出流
            out = new PrintWriter(conn.getOutputStream());
            // 发送请求参数
            out.print(param);
            // flush输出流的缓冲
            out.flush();
            int status = conn.getResponseCode();
            InputStream inputStream = null;
            if (status != HttpURLConnection.HTTP_OK) {
                inputStream = conn.getErrorStream();
            } else {
                inputStream = conn.getInputStream();
            }
            // 定义 BufferedReader输入流来读取URL的响应
            in = new BufferedReader(new InputStreamReader(inputStream));
            String line;
            while ((line = in.readLine()) != null) {
                result += line;
            }
        } catch (Exception e) {
            System.out.println("发送 POST 请求出现异常!" + e);
            e.printStackTrace();
        }
        // 使用finally块来关闭输出流、输入流
        finally {
            try {
                if (out != null) {
                    out.close();
                }
                if (in != null) {
                    in.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        return result;
    }

}


text:
// Windows/FileFind.cpp

#include "StdAfx.h"

#include "FileFind.h"
#include "../Common/StringConvert.h"

#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>

#ifdef ENV_HAVE_LSTAT
extern "C"
{

int global_use_lstat=1; // default behaviour : p7zip stores symlinks instead of dumping the files they point to
}
#endif

#define NEED_NAME_WINDOWS_TO_UNIX
#include "myPrivate.h"

// #define TRACEN(u) u;
#define TRACEN(u)  /* */

void my_windows_split_path(const AString &p_path, AString &dir , AString &base) {
  int pos = p_path.ReverseFind('/');
  if (pos == -1) {
    // no separator
    dir  = ".";
    if (p_path.IsEmpty())
      base = ".";
    else
      base = p_path;
  } else if ((pos+1) < p_path.Length()) {
    // true separator
    base = p_path.Mid(pos+1);
    while ((pos >= 1) && (p_path[pos-1] == '/'))
      pos--;
    if (pos == 0)
      dir = "/";
    else
      dir = p_path.Left(pos);
  } else {
    // separator at the end of the path
    // pos = p_path.find_last_not_of("/");
    pos = -1;
    int ind = 0;
    while (p_path[ind]) {
      if (p_path[ind] != '/')
        pos = ind;
      ind++;
    }
    if (pos == -1) {
      base = "/";
      dir = "/";
    } else {
      my_windows_split_path(p_path.Left(pos+1),dir,base);
    }
  }
}

static void my_windows_split_path(const UString &p_path, UString &dir , UString &base) {
  int pos = p_path.ReverseFind(L'/');
  if (pos == -1) {
    // no separator
    dir  = L".";
    if (p_path.IsEmpty())
      base = L".";
    else
      base = p_path;
  } else if ((pos+1) < p_path.Length()) {
    // true separator
    base = p_path.Mid(pos+1);
    while ((pos >= 1) && (p_path[pos-1] == L'/'))
      pos--;
    if (pos == 0)
      dir = L"/";
    else
      dir = p_path.Left(pos);
  } else {
    // separator at the end of the path
    // pos = p_path.find_last_not_of("/");
    pos = -1;
    int ind = 0;
    while (p_path[ind]) {
      if (p_path[ind] != L'/')
        pos = ind;
      ind++;
    }
    if (pos == -1) {
      base = L"/";
      dir = L"/";
    } else {
      my_windows_split_path(p_path.Left(pos+1),dir,base);
    }
  }
}

static int filter_pattern(const char *string , const char *pattern , int flags_nocase) {
  if ((string == 0) || (*string==0)) {
    if (pattern == 0)
      return 1;
    while (*pattern=='*')
      ++pattern;
    return (!*pattern);
  }

  switch (*pattern) {
  case '*':
    if (!filter_pattern(string+1,pattern,flags_nocase))
      return filter_pattern(string,pattern+1,flags_nocase);
    return 1;
  case 0:
    if (*string==0)
      return 1;
    break;
  case '?':
    return filter_pattern(string+1,pattern+1,flags_nocase);
  default:
    if (   ((flags_nocase) && (tolower(*pattern)==tolower(*string)))
           || (*pattern == *string)
       ) {
      return filter_pattern(string+1,pattern+1,flags_nocase);
    }
    break;
  }
  return 0;
}

namespace NWindows {
namespace NFile {
namespace NFind {

static const TCHAR kDot = TEXT('.');

bool CFileInfo::IsDots() const
{
  if (!IsDir() || Name.IsEmpty())
    return false;
  if (Name[0] != kDot)
    return false;
  return Name.Length() == 1 || (Name[1] == kDot && Name.Length() == 2);
}

bool CFileInfoW::IsDots() const
{
  if (!IsDir() || Name.IsEmpty())
    return false;
  if (Name[0] != kDot)
    return false;
  return Name.Length() == 1 || (Name[1] == kDot && Name.Length() == 2);
}

static bool originalFilename(const UString & src, AString & res)
{
  // Try to recover the original filename
  res = "";
  int i=0;
  while (src[i])
  {
    if (src[i] >= 256) {
      return false;
    } else {
      res += char(src[i]);
    }
    i++;
  }
  return true;
}

// Warning this function cannot update "fileInfo.Name"
static int fillin_CFileInfo(CFileInfo &fileInfo,const char *filename) {
  struct stat stat_info;

  int ret;
#ifdef ENV_HAVE_LSTAT
  if (global_use_lstat) {
    ret = lstat(filename,&stat_info);
  } else
#endif
  {
     ret = stat(filename,&stat_info);
  }

  if (ret != 0) return ret;

  /* FIXME : FILE_ATTRIBUTE_HIDDEN ? */
  if (S_ISDIR(stat_info.st_mode)) {
    fileInfo.Attrib = FILE_ATTRIBUTE_DIRECTORY;
  } else {
    fileInfo.Attrib = FILE_ATTRIBUTE_ARCHIVE;
  }

  if (!(stat_info.st_mode & S_IWUSR))
    fileInfo.Attrib |= FILE_ATTRIBUTE_READONLY;

  fileInfo.Attrib |= FILE_ATTRIBUTE_UNIX_EXTENSION + ((stat_info.st_mode & 0xFFFF) << 16);

  RtlSecondsSince1970ToFileTime( stat_info.st_ctime, &fileInfo.CTime );
  RtlSecondsSince1970ToFileTime( stat_info.st_mtime, &fileInfo.MTime );
  RtlSecondsSince1970ToFileTime( stat_info.st_atime, &fileInfo.ATime );

  fileInfo.IsDevice = false;

  if (S_ISDIR(stat_info.st_mode)) {
    fileInfo.Size = 0;
  } else { // file or symbolic link
    fileInfo.Size = stat_info.st_size; // for a symbolic link, size = size of filename
  }
  return 0;
}

static int fillin_CFileInfo(CFileInfo &fileInfo,const char *dir,const char *name) {
  char filename[MAX_PATHNAME_LEN];
  size_t dir_len = strlen(dir);
  size_t name_len = strlen(name);
  size_t total = dir_len + 1 + name_len + 1; // 1 = strlen("/"); + le zero character
  if (total >= MAX_PATHNAME_LEN) throw "fillin_CFileInfo - internal error - MAX_PATHNAME_LEN";
  memcpy(filename,dir,dir_len);
  if (dir_len >= 1)
  {
	if (filename[dir_len-1] == CHAR_PATH_SEPARATOR)
	{ // delete the '/'
		dir_len--;
	}
  }
  filename[dir_len] = CHAR_PATH_SEPARATOR;
  memcpy(filename+(dir_len+1),name,name_len+1); // copy also final '\0'

  fileInfo.Name = name;

  int ret = fillin_CFileInfo(fileInfo,filename);
  if (ret != 0) {
	AString err_msg = "stat error for ";
        err_msg += filename;
        err_msg += " (";
        err_msg += strerror(errno);
        err_msg += ")";
        throw err_msg;
  }
  return ret;
}

////////////////////////////////
// CFindFile

bool CFindFile::Close()
{

  if(_dirp == 0)
    return true;
  int ret = closedir(_dirp);
  if (ret == 0)
  {
    _dirp = 0;
    return true;
  }
  return false;
}

// bool CFindFile::FindFirst(LPCTSTR wildcard, CFileInfo &fileInfo)
bool CFindFile::FindFirst(LPCSTR wildcard, CFileInfo &fileInfo)
{
  if (!Close())
    return false;

  if ((!wildcard) || (wildcard[0]==0)) {
    SetLastError(ERROR_PATH_NOT_FOUND);
    return false;
  }

  my_windows_split_path(nameWindowToUnix(wildcard),_directory,_pattern);

  TRACEN((printf("CFindFile::FindFirst : %s (dirname=%s,pattern=%s)\n",wildcard,(const char *)_directory,(const char *)_pattern)))

  _dirp = ::opendir((const char *)_directory);
  TRACEN((printf("CFindFile::FindFirst : opendir=%p\n",_dirp)))

  if ((_dirp == 0) && (global_use_utf16_conversion)) {
    // Try to recover the original filename
    UString ustr = MultiByteToUnicodeString(_directory, 0);
    AString resultString;
    bool is_good = originalFilename(ustr, resultString);
    if (is_good) {
      _dirp = ::opendir((const char *)resultString);
      _directory = resultString;
    }
  }

  if (_dirp == 0) return false;

  struct dirent *dp;
  while ((dp = readdir(_dirp)) != NULL) {
    if (filter_pattern(dp->d_name,(const char *)_pattern,0) == 1) {
      int retf = fillin_CFileInfo(fileInfo,(const char *)_directory,dp->d_name);
      if (retf)
      {
         TRACEN((printf("CFindFile::FindFirst : closedir-1(dirp=%p)\n",_dirp)))
         closedir(_dirp);
         _dirp = 0;
         SetLastError( ERROR_NO_MORE_FILES );
         return false;
      }
      TRACEN((printf("CFindFile::FindFirst -%s- true\n",dp->d_name)))
      return true;
    }
  }

  TRACEN((printf("CFindFile::FindFirst : closedir-2(dirp=%p)\n",_dirp)))
  closedir(_dirp);
  _dirp = 0;
  SetLastError( ERROR_NO_MORE_FILES );
  return false;
}

bool CFindFile::FindFirst(LPCWSTR wildcard, CFileInfoW &fileInfo)
{
  if (!Close())
    return false;
  CFileInfo fileInfo0;
  AString Awildcard = UnicodeStringToMultiByte(wildcard, CP_ACP);
  bool bret = FindFirst((LPCSTR)Awildcard, fileInfo0);
  if (bret)
  {
     fileInfo.Attrib = fileInfo0.Attrib;
     fileInfo.CTime = fileInfo0.CTime;
     fileInfo.ATime = fileInfo0.ATime;
     fileInfo.MTime = fileInfo0.MTime;
     fileInfo.Size = fileInfo0.Size;
     fileInfo.IsDevice = fileInfo0.IsDevice;
     fileInfo.Name = GetUnicodeString(fileInfo0.Name, CP_ACP);
  }
  return bret;
}

bool CFindFile::FindNext(CFileInfo &fileInfo)
{
  if (_dirp == 0)
  {
    SetLastError( ERROR_INVALID_HANDLE );
    return false;
  }

  struct dirent *dp;
  while ((dp = readdir(_dirp)) != NULL) {
      if (filter_pattern(dp->d_name,(const char *)_pattern,0) == 1) {
        int retf = fillin_CFileInfo(fileInfo,(const char *)_directory,dp->d_name);
        if (retf)
        {
           TRACEN((printf("FindNextFileA -%s- ret_handle=FALSE (errno=%d)\n",dp->d_name,errno)))
           return false;

        }
        TRACEN((printf("FindNextFileA -%s- true\n",dp->d_name)))
        return true;
      }
    }
  TRACEN((printf("FindNextFileA ret_handle=FALSE (ERROR_NO_MORE_FILES)\n")))
  SetLastError( ERROR_NO_MORE_FILES );
  return false;
}

bool CFindFile::FindNext(CFileInfoW &fileInfo)
{
  CFileInfo fileInfo0;
  bool bret = FindNext(fileInfo0);
  if (bret)
  {
     fileInfo.Attrib = fileInfo0.Attrib;
     fileInfo.CTime = fileInfo0.CTime;
     fileInfo.ATime = fileInfo0.ATime;
     fileInfo.MTime = fileInfo0.MTime;
     fileInfo.Size = fileInfo0.Size;
     fileInfo.IsDevice = fileInfo0.IsDevice;
     fileInfo.Name = GetUnicodeString(fileInfo0.Name, CP_ACP);
  }
  return bret;
}

bool CFileInfo::Find(LPCSTR wildcard)
{
  #ifdef SUPPORT_DEVICE_FILE
  if (IsDeviceName(wildcard))
  {
    Clear();
    IsDevice = true;
    NIO::CInFile inFile;
    if (!inFile.Open(wildcard))
      return false;
    Name = wildcard + 4;
    if (inFile.LengthDefined)
      Size = inFile.Length;
    return true;
  }
  #endif
  CFindFile finder;
  return finder.FindFirst(wildcard, *this);
}

// #ifndef _UNICODE
bool CFileInfoW::Find(LPCWSTR wildcard)
{
  #ifdef SUPPORT_DEVICE_FILE
  if (IsDeviceName(wildcard))
  {
    Clear();
    IsDevice = true;
    NIO::CInFile inFile;
    if (!inFile.Open(wildcard))
      return false;
    Name = wildcard + 4;
    if (inFile.LengthDefined)
      Size = inFile.Length;
    return true;
  }
  #endif
  CFindFile finder;
  return finder.FindFirst(wildcard, *this);
}
// #endif

bool FindFile(LPCSTR wildcard, CFileInfo &fileInfo)
{
  // CFindFile finder;
  // return finder.FindFirst(wildcard, fileInfo);
  AString dir,base;
  my_windows_split_path(wildcard, dir , base);
  int ret = fillin_CFileInfo(fileInfo,nameWindowToUnix(wildcard));
  fileInfo.Name = base;
  TRACEN((printf("FindFile(%s,CFileInfo) ret=%d\n",wildcard,ret)))
  return (ret == 0);
}

bool FindFile(LPCWSTR wildcard, CFileInfoW &fileInfo)
{
  // CFindFile finder;
  // return finder.FindFirst(wildcard, fileInfo);
  AString name = UnicodeStringToMultiByte(wildcard, CP_ACP);
  CFileInfo fileInfo0;
  int ret = fillin_CFileInfo(fileInfo0,nameWindowToUnix((const char *)name));
  TRACEN((printf("FindFile-1(%s,CFileInfo) ret=%d\n",(const char *)name,ret)))
  if (ret != 0)
  {
    // Try to recover the original filename
    AString resultString;
    bool is_good = originalFilename(wildcard, resultString);
    if (is_good) {
       ret = fillin_CFileInfo(fileInfo0,nameWindowToUnix((const char *)resultString));
       TRACEN((printf("FindFile-2(%s,CFileInfo) ret=%d\n",(const char *)resultString,ret)))
    }
  }
  if (ret == 0)
  {
     UString dir,base;
     my_windows_split_path(wildcard, dir , base);
     fileInfo.Attrib = fileInfo0.Attrib;
     fileInfo.CTime = fileInfo0.CTime;
     fileInfo.ATime = fileInfo0.ATime;
     fileInfo.MTime = fileInfo0.MTime;
     fileInfo.Size = fileInfo0.Size;
     fileInfo.Name = base;
  }
  return (ret == 0);
}

bool DoesFileExist(LPCSTR name) // FIXME
{
  CFileInfo fi;
  int ret = fillin_CFileInfo(fi,nameWindowToUnix(name));
  TRACEN((printf("DoesFileExist(%s) ret=%d\n",name,ret)))
  return (ret == 0) && !fi.IsDir();;
}

bool DoesDirExist(LPCSTR name) // FIXME
{
  CFileInfo fi;
  int ret = fillin_CFileInfo(fi,nameWindowToUnix(name));
  TRACEN((printf("DoesDirExist(%s) ret=%d\n",name,ret)))
  return (ret == 0) && fi.IsDir();;
}

bool DoesFileOrDirExist(LPCSTR name)
{
  CFileInfo fileInfo;
  int ret = fillin_CFileInfo(fileInfo,nameWindowToUnix(name));
  TRACEN((printf("DoesFileOrDirExist(%s) ret=%d\n",name,ret)))
  return (ret == 0);
}

bool DoesFileExist(LPCWSTR name)
{
  AString Aname = UnicodeStringToMultiByte(name, CP_ACP);
  bool bret = DoesFileExist((LPCSTR)Aname);
  if (bret) return bret;

  // Try to recover the original filename
  AString resultString;
  bool is_good = originalFilename(name, resultString);
  if (is_good) {
     bret = DoesFileExist((const char *)resultString);
  }
  return bret;
}

bool DoesDirExist(LPCWSTR name)
{
  AString Aname = UnicodeStringToMultiByte(name, CP_ACP);
  bool bret = DoesDirExist((LPCSTR)Aname);
  if (bret) return bret;

  // Try to recover the original filename
  AString resultString;
  bool is_good = originalFilename(name, resultString);
  if (is_good) {
     bret = DoesDirExist((const char *)resultString);
  }
  return bret;
}

bool DoesFileOrDirExist(LPCWSTR name)
{
  AString Aname = UnicodeStringToMultiByte(name, CP_ACP);
  bool bret = DoesFileOrDirExist((LPCSTR)Aname);
  if (bret) return bret;

  // Try to recover the original filename
  AString resultString;
  bool is_good = originalFilename(name, resultString);
  if (is_good) {
     bret = DoesFileOrDirExist((const char *)resultString);
  }
  return bret;
}

/////////////////////////////////////
// CEnumerator

bool CEnumerator::NextAny(CFileInfo &fileInfo)
{
  if(_findFile.IsHandleAllocated())
    return _findFile.FindNext(fileInfo);
  else
    return _findFile.FindFirst(_wildcard, fileInfo);
}

bool CEnumerator::Next(CFileInfo &fileInfo)
{
  while(true)
  {
    if(!NextAny(fileInfo))
      return false;
    if(!fileInfo.IsDots())
      return true;
  }
}

bool CEnumerator::Next(CFileInfo &fileInfo, bool &found)
{
  if (Next(fileInfo))
  {
    found = true;
    return true;
  }
  found = false;
  return (::GetLastError() == ERROR_NO_MORE_FILES);
}

bool CEnumeratorW::NextAny(CFileInfoW &fileInfo)
{
  if(_findFile.IsHandleAllocated())
    return _findFile.FindNext(fileInfo);
  else
    return _findFile.FindFirst(_wildcard, fileInfo);
}

bool CEnumeratorW::Next(CFileInfoW &fileInfo)
{
  while(true)
  {
    if(!NextAny(fileInfo))
      return false;
    if(!fileInfo.IsDots())
      return true;
  }
}

bool CEnumeratorW::Next(CFileInfoW &fileInfo, bool &found)
{
  if (Next(fileInfo))
  {
    found = true;
    return true;
  }
  found = false;
  return (::GetLastError() == ERROR_NO_MORE_FILES);
}

}}}


text: var common = require('./common');


text:
#if __SC__ || __RCC__
#pragma once
#endif

#ifndef __HANDLE_H
#define __HANDLE_H 1

#if __cplusplus
extern "C" {
#endif

#define HANDLE_BASE	0xFE000000
#define HANDLE_MAX	((int)(0x10000 - (HANDLE_BASE >> 16)))
#define HANDLE_PAGESIZE		(16*1024)
int handle_ishandle(void __handle *h);
#define handle_ishandle(h) ((int)(((unsigned long) (h) >= HANDLE_BASE) != 0))
void __handle * __cdecl handle_malloc(unsigned);
void __handle * __cdecl handle_calloc(unsigned);
void __handle * __cdecl handle_realloc(void __handle *,unsigned);
char __handle * __cdecl handle_strdup(char __handle *);
void __cdecl handle_free(void __handle *);
int __cdecl handle_usingemm(void);
void __cdecl handle_remap(void);
#if NO_HANDLE || DOS16RM || __INTSIZE == 4 || __OS2__ || __NT__
#define __handle
#define handle_malloc(n)	malloc(n)
#define handle_calloc(n)	calloc((n),1)
#define handle_realloc(h,n)	realloc((h),(n))
#define handle_free(h)		free(h)
#define handle_strdup(h)	strdup(h)
#define handle_usingemm()	0
#define handle_remap()
#undef handle_ishandle
#define handle_ishandle(h)	0
#include	<stdlib.h>
#include	<string.h>
#endif

#if __cplusplus
}
#endif

#endif


text:
import { WatsonHealthScalpelLasso32 } from "../../../";

export = WatsonHealthScalpelLasso32;


text:
ZE2 interface and __construct
--FILE--
<?php

class MyObject {}

interface MyInterface
{
	public function __construct(MyObject $o);
}

class MyTestClass implements MyInterface
{
	public function __construct(MyObject $o)
	{
	}
}

$obj = new MyTestClass;

?>
===DONE===
--EXPECTF--

Catchable fatal error: Argument 1 passed to MyTestClass::__construct() must be an instance of MyObject, none given, called in %sinterfaces_003.php on line %d


text:
namespace Google.Cloud.GkeBackup.V1.Snippets
{
    // [START gkebackup_v1_generated_BackupForGKE_GetBackup_sync_flattened_resourceNames]
    using Google.Cloud.GkeBackup.V1;

    public sealed partial class GeneratedBackupForGKEClientSnippets
    {
        /// <summary>Snippet for GetBackup</summary>
        /// <remarks>
        /// This snippet has been automatically generated and should be regarded as a code template only.
        /// It will require modifications to work:
        /// - It may require correct/in-range values for request initialization.
        /// - It may require specifying regional endpoints when creating the service client as shown in
        ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
        /// </remarks>
        public void GetBackupResourceNames()
        {
            // Create client
            BackupForGKEClient backupForGKEClient = BackupForGKEClient.Create();
            // Initialize request argument(s)
            BackupName name = BackupName.FromProjectLocationBackupPlanBackup("[PROJECT]", "[LOCATION]", "[BACKUP_PLAN]", "[BACKUP]");
            // Make the request
            Backup response = backupForGKEClient.GetBackup(name);
        }
    }
    // [END gkebackup_v1_generated_BackupForGKE_GetBackup_sync_flattened_resourceNames]
}


text:
namespace ASC.Web.Calendar.UserControls
{

    public partial class CalendarControl
    {

        /// <summary>
        /// _sharingContainer control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.PlaceHolder _sharingContainer;

        /// <summary>
        /// _phDocUploader control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.PlaceHolder _phDocUploader;

        /// <summary>
        /// _commonPopup control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::ASC.Web.Studio.Controls.Common.Container _commonPopup;
    }
}


text:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

# subclass dict and define getter-setter. This behaves as both dict and obj
class AttrDict(dict):

    def __getattr__(self, key):
        return self[key]

    def __setattr__(self, key, value):
        if key in self.__dict__:
            self.__dict__[key] = value
        else:
            self[key] = value


text:
<?php

declare(strict_types = 1);
ini_set('memory_limit', '-1');
ini_set('max_execution_time', '-1');

$benchmarkPos = array_search('--benchmark', $argv);
$benchmark    = false;

if ($benchmarkPos !== false) {
    $benchmark = true;
    unset($argv[$benchmarkPos]);
    $argv = array_values($argv);
}

$agentListFile = $argv[1];

$results   = [];
$parseTime = 0;

$start = microtime(true);
require_once __DIR__ . '/../vendor/autoload.php';

use Jenssegers\Agent\Agent;

$agent = new Agent();
$agent->setUserAgent('Test String');
$agent->isDesktop();
$initTime = microtime(true) - $start;

$file = new SplFileObject($agentListFile);
$file->setFlags(SplFileObject::DROP_NEW_LINE);

while (!$file->eof()) {
    $agentString = $file->fgets();

    if (empty($agentString)) {
        continue;
    }

    $start = microtime(true);
    $agent->setUserAgent($agentString);
    $device          = $agent->device();
    $platform        = $agent->platform();
    $browser         = $agent->browser();
    $isMobile        = $agent->isMobile();
    $browserVersion  = $agent->version($browser);
    $platformVersion = $agent->version($platform);
    $type            = '';
    if ($agent->isDesktop()) {
        $type = 'desktop';
    } elseif ($agent->isPhone()) {
        $type = 'mobile phone';
    } elseif ($agent->isTablet()) {
        $type = 'tablet';
    } elseif ($agent->isBot()) {
        $type           = 'crawler';
        $browser        = $agent->robot() . ' Bot';
        $browserVersion = '';
    }
    $end = microtime(true) - $start;

    $parseTime += $end;

    if ($benchmark) {
        continue;
    }

    $results[] = [
        'useragent' => $agentString,
        'parsed'    => [
            'browser' => [
                'name'    => $browser,
                'version' => $browserVersion ? $browserVersion : null,
            ],
            'platform' => [
                'name'    => $platform,
                'version' => $platformVersion ? $platformVersion : null,
            ],
            'device' => [
                'name'     => ($device !== false ? $device : null),
                'brand'    => null,
                'type'     => $type,
                'ismobile' => $isMobile ? true : false,
            ],
        ],
        'time' => $end,
    ];
}

$file   = null;
$memory = memory_get_peak_usage();

// Get version from composer
$package = new \PackageInfo\Package('jenssegers/agent');

echo (new \JsonClass\Json())->encode([
    'results'     => $results,
    'parse_time'  => $parseTime,
    'init_time'   => $initTime,
    'memory_used' => $memory,
    'version'     => $package->getVersion(),
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);