text:
		HTML5 audio 详解

注:本文内容来源自W3C ,对原文进行了浓缩,但只对chrome浏览器进行了测试和验证。

W3C草案原文地址:http://www.w3.org/TR/html5/video.html

<audio> 标签属性:

src:音乐的URL

preload:预加载

autoplay:自动播放

loop:循环播放

controls:浏览器自带的控制条

1
<audio id="media" src="http://www.abc.com/test.mp3" controls></audio>

<video> 标签属性:

src:视频的URL

poster:视频封面,没有播放时显示的图片

preload:预加载

autoplay:自动播放

loop:循环播放

controls:浏览器自带的控制条

width:视频宽度

height:视频高度

1
<video id="media" src="http://www.abc.com/test.mp4" controls width="400px" heigt="400px"></video>

获取HTMLVideoElement和HTMLAudioElement对象

1
//audio可以直接通过new创建对象

2
Media = new Audio("http://www.abc.com/test.mp3");

3
//audio和video都可以通过标签获取对象

4
Media = document.getElementById("media");

Media方法和属性:

HTMLVideoElement 和 HTMLAudioElement 均继承自 HTMLMediaElement

01
//错误状态

02
Media.error; //null:正常

03
Media.error.code; //1.用户终止 2.网络错误 3.解码错误 4.URL无效

04

05
//网络状态

06
Media.currentSrc; //返回当前资源的URL

07
Media.src = value; //返回或设置当前资源的URL

08
Media.canPlayType(type); //是否能播放某种格式的资源

09
Media.networkState; //0.此元素未初始化  1.正常但没有使用网络  2.正在下载数据  3.没有找到资源

10
Media.load(); //重新加载src指定的资源

11
Media.buffered; //返回已缓冲区域,TimeRanges

12
Media.preload; //none:不预载 metadata:预载资源信息 auto:

13

14
//准备状态

15
Media.readyState;   //1:HAVE_NOTHING 2:HAVE_METADATA 3.HAVE_CURRENT_DATA 4.HAVE_FUTURE_DATA 5.HAVE_ENOUGH_DATA

16
Media.seeking; //是否正在seeking

17

18
//回放状态

19
Media.currentTime = value; //当前播放的位置,赋值可改变位置

20
Media.startTime; //一般为0,如果为流媒体或者不从0开始的资源,则不为0

21
Media.duration; //当前资源长度 流返回无限

22
Media.paused; //是否暂停

23
Media.defaultPlaybackRate = value;//默认的回放速度,可以设置

24
Media.playbackRate = value;//当前播放速度,设置后马上改变

25
Media.played; //返回已经播放的区域,TimeRanges,关于此对象见下文

26
Media.seekable; //返回可以seek的区域 TimeRanges

27
Media.ended;    //是否结束

28
Media.autoPlay; //是否自动播放

29
Media.loop; //是否循环播放

30
Media.play();   //播放

31
Media.pause();  //暂停

32

33
//控制

34
Media.controls;//是否有默认控制条

35
Media.volume = value; //音量最大为1最小为0

36
Media.muted = value; //静音

37

38
//TimeRanges(区域)对象

39
TimeRanges.length; //区域段数

40
TimeRanges.start(index) //第index段区域的开始位置

41
TimeRanges.end(index) //第index段区域的结束位置

事件:

01
eventTester = function(e){

02
        Media.addEventListener(e,function(){

03
            console.log((new Date()).getTime(),e);

04
        });

05
    }

06

07
    eventTester("loadstart");   //客户端开始请求数据

08
    eventTester("progress");    //客户端正在请求数据

09
    eventTester("suspend");     //延迟下载

10
    eventTester("abort");       //客户端主动终止下载(不是因为错误引起),

11
    eventTester("error");       //请求数据时遇到错误

12
    eventTester("stalled");     //网速失速

13
    eventTester("play");        //play()和autoplay开始播放时触发

14
    eventTester("pause");       //pause()触发

15
    eventTester("loadedmetadata");  //成功获取资源长度

16
    eventTester("loadeddata");  //

17
    eventTester("waiting");     //等待数据,并非错误

18
    eventTester("playing");     //开始回放

19
    eventTester("canplay");     //可以播放,但中途可能因为加载而暂停

20
    eventTester("canplaythrough"); //可以播放,歌曲全部加载完毕

21
    eventTester("seeking");     //寻找中

22
    eventTester("seeked");      //寻找完毕

23
    eventTester("timeupdate");  //播放时间改变

24
    eventTester("ended");       //播放结束

25
    eventTester("ratechange");  //播放速率改变

26
    eventTester("durationchange");  //资源长度改变

27
    eventTester("volumechange");    //音量改变


text:
package google_datastore_v1beta3

import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gengo/grpc-gateway/third_party/googleapis/google/api"

// 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.
const _ = proto.GoGoProtoPackageIsVersion1

// Commit modes.
type CommitRequest_Mode int32

const (
	// Unspecified.
	CommitRequest_MODE_UNSPECIFIED CommitRequest_Mode = 0
	// Transactional.
	CommitRequest_TRANSACTIONAL CommitRequest_Mode = 1
	// Non-transactional.
	CommitRequest_NON_TRANSACTIONAL CommitRequest_Mode = 2
)

var CommitRequest_Mode_name = map[int32]string{
	0: "MODE_UNSPECIFIED",
	1: "TRANSACTIONAL",
	2: "NON_TRANSACTIONAL",
}
var CommitRequest_Mode_value = map[string]int32{
	"MODE_UNSPECIFIED":  0,
	"TRANSACTIONAL":     1,
	"NON_TRANSACTIONAL": 2,
}

func (x CommitRequest_Mode) String() string {
	return proto.EnumName(CommitRequest_Mode_name, int32(x))
}
func (CommitRequest_Mode) EnumDescriptor() ([]byte, []int) {
	return fileDescriptorDatastore, []int{8, 0}
}

// Read consistencies.
type ReadOptions_ReadConsistency int32

const (
	// Unspecified.
	ReadOptions_READ_CONSISTENCY_UNSPECIFIED ReadOptions_ReadConsistency = 0
	// Strong consistency.
	ReadOptions_STRONG ReadOptions_ReadConsistency = 1
	// Eventual consistency.
	ReadOptions_EVENTUAL ReadOptions_ReadConsistency = 2
)

var ReadOptions_ReadConsistency_name = map[int32]string{
	0: "READ_CONSISTENCY_UNSPECIFIED",
	1: "STRONG",
	2: "EVENTUAL",
}
var ReadOptions_ReadConsistency_value = map[string]int32{
	"READ_CONSISTENCY_UNSPECIFIED": 0,
	"STRONG":                       1,
	"EVENTUAL":                     2,
}

func (x ReadOptions_ReadConsistency) String() string {
	return proto.EnumName(ReadOptions_ReadConsistency_name, int32(x))
}
func (ReadOptions_ReadConsistency) EnumDescriptor() ([]byte, []int) {
	return fileDescriptorDatastore, []int{14, 0}
}

// The request for [google.datastore.v1beta3.Datastore.Lookup][google.datastore.v1beta3.Datastore.Lookup].
type LookupRequest struct {
	// Project ID against which to make the request.
	ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	// Options for this lookup request.
	ReadOptions *ReadOptions `protobuf:"bytes,1,opt,name=read_options,json=readOptions" json:"read_options,omitempty"`
	// Keys of entities to look up.
	Keys []*Key `protobuf:"bytes,3,rep,name=keys" json:"keys,omitempty"`
}

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

func (m *LookupRequest) GetReadOptions() *ReadOptions {
	if m != nil {
		return m.ReadOptions
	}
	return nil
}

func (m *LookupRequest) GetKeys() []*Key {
	if m != nil {
		return m.Keys
	}
	return nil
}

// The response for [google.datastore.v1beta3.Datastore.Lookup][google.datastore.v1beta3.Datastore.Lookup].
type LookupResponse struct {
	// Entities found as `ResultType.FULL` entities. The order of results in this
	// field is undefined and has no relation to the order of the keys in the
	// input.
	Found []*EntityResult `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"`
	// Entities not found as `ResultType.KEY_ONLY` entities. The order of results
	// in this field is undefined and has no relation to the order of the keys
	// in the input.
	Missing []*EntityResult `protobuf:"bytes,2,rep,name=missing" json:"missing,omitempty"`
	// A list of keys that were not looked up due to resource constraints. The
	// order of results in this field is undefined and has no relation to the
	// order of the keys in the input.
	Deferred []*Key `protobuf:"bytes,3,rep,name=deferred" json:"deferred,omitempty"`
}

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

func (m *LookupResponse) GetFound() []*EntityResult {
	if m != nil {
		return m.Found
	}
	return nil
}

func (m *LookupResponse) GetMissing() []*EntityResult {
	if m != nil {
		return m.Missing
	}
	return nil
}

func (m *LookupResponse) GetDeferred() []*Key {
	if m != nil {
		return m.Deferred
	}
	return nil
}

// The request for [google.datastore.v1beta3.Datastore.RunQuery][google.datastore.v1beta3.Datastore.RunQuery].
type RunQueryRequest struct {
	// Project ID against which to make the request.
	ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	// Entities are partitioned into subsets, identified by a partition ID.
	// Queries are scoped to a single partition.
	// This partition ID is normalized with the standard default context
	// partition ID.
	PartitionId *PartitionId `protobuf:"bytes,2,opt,name=partition_id,json=partitionId" json:"partition_id,omitempty"`
	// The options for this query.
	ReadOptions *ReadOptions `protobuf:"bytes,1,opt,name=read_options,json=readOptions" json:"read_options,omitempty"`
	// The type of query.
	//
	// Types that are valid to be assigned to QueryType:
	//	*RunQueryRequest_Query
	//	*RunQueryRequest_GqlQuery
	QueryType isRunQueryRequest_QueryType `protobuf_oneof:"query_type"`
}

func (m *RunQueryRequest) Reset()                    { *m = RunQueryRequest{} }
func (m *RunQueryRequest) String() string            { return proto.CompactTextString(m) }
func (*RunQueryRequest) ProtoMessage()               {}
func (*RunQueryRequest) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{2} }

type isRunQueryRequest_QueryType interface {
	isRunQueryRequest_QueryType()
}

type RunQueryRequest_Query struct {
	Query *Query `protobuf:"bytes,3,opt,name=query,oneof"`
}
type RunQueryRequest_GqlQuery struct {
	GqlQuery *GqlQuery `protobuf:"bytes,7,opt,name=gql_query,json=gqlQuery,oneof"`
}

func (*RunQueryRequest_Query) isRunQueryRequest_QueryType()    {}
func (*RunQueryRequest_GqlQuery) isRunQueryRequest_QueryType() {}

func (m *RunQueryRequest) GetQueryType() isRunQueryRequest_QueryType {
	if m != nil {
		return m.QueryType
	}
	return nil
}

func (m *RunQueryRequest) GetPartitionId() *PartitionId {
	if m != nil {
		return m.PartitionId
	}
	return nil
}

func (m *RunQueryRequest) GetReadOptions() *ReadOptions {
	if m != nil {
		return m.ReadOptions
	}
	return nil
}

func (m *RunQueryRequest) GetQuery() *Query {
	if x, ok := m.GetQueryType().(*RunQueryRequest_Query); ok {
		return x.Query
	}
	return nil
}

func (m *RunQueryRequest) GetGqlQuery() *GqlQuery {
	if x, ok := m.GetQueryType().(*RunQueryRequest_GqlQuery); ok {
		return x.GqlQuery
	}
	return nil
}

// XXX_OneofFuncs is for the internal use of the proto package.
func (*RunQueryRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
	return _RunQueryRequest_OneofMarshaler, _RunQueryRequest_OneofUnmarshaler, _RunQueryRequest_OneofSizer, []interface{}{
		(*RunQueryRequest_Query)(nil),
		(*RunQueryRequest_GqlQuery)(nil),
	}
}

func _RunQueryRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*RunQueryRequest)
	// query_type
	switch x := m.QueryType.(type) {
	case *RunQueryRequest_Query:
		_ = b.EncodeVarint(3<<3 | proto.WireBytes)
		if err := b.EncodeMessage(x.Query); err != nil {
			return err
		}
	case *RunQueryRequest_GqlQuery:
		_ = b.EncodeVarint(7<<3 | proto.WireBytes)
		if err := b.EncodeMessage(x.GqlQuery); err != nil {
			return err
		}
	case nil:
	default:
		return fmt.Errorf("RunQueryRequest.QueryType has unexpected type %T", x)
	}
	return nil
}

func _RunQueryRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*RunQueryRequest)
	switch tag {
	case 3: // query_type.query
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(Query)
		err := b.DecodeMessage(msg)
		m.QueryType = &RunQueryRequest_Query{msg}
		return true, err
	case 7: // query_type.gql_query
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(GqlQuery)
		err := b.DecodeMessage(msg)
		m.QueryType = &RunQueryRequest_GqlQuery{msg}
		return true, err
	default:
		return false, nil
	}
}

func _RunQueryRequest_OneofSizer(msg proto.Message) (n int) {
	m := msg.(*RunQueryRequest)
	// query_type
	switch x := m.QueryType.(type) {
	case *RunQueryRequest_Query:
		s := proto.Size(x.Query)
		n += proto.SizeVarint(3<<3 | proto.WireBytes)
		n += proto.SizeVarint(uint64(s))
		n += s
	case *RunQueryRequest_GqlQuery:
		s := proto.Size(x.GqlQuery)
		n += proto.SizeVarint(7<<3 | proto.WireBytes)
		n += proto.SizeVarint(uint64(s))
		n += s
	case nil:
	default:
		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
	}
	return n
}

// The response for [google.datastore.v1beta3.Datastore.RunQuery][google.datastore.v1beta3.Datastore.RunQuery].
type RunQueryResponse struct {
	// A batch of query results (always present).
	Batch *QueryResultBatch `protobuf:"bytes,1,opt,name=batch" json:"batch,omitempty"`
	// The parsed form of the `GqlQuery` from the request, if it was set.
	Query *Query `protobuf:"bytes,2,opt,name=query" json:"query,omitempty"`
}

func (m *RunQueryResponse) Reset()                    { *m = RunQueryResponse{} }
func (m *RunQueryResponse) String() string            { return proto.CompactTextString(m) }
func (*RunQueryResponse) ProtoMessage()               {}
func (*RunQueryResponse) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{3} }

func (m *RunQueryResponse) GetBatch() *QueryResultBatch {
	if m != nil {
		return m.Batch
	}
	return nil
}

func (m *RunQueryResponse) GetQuery() *Query {
	if m != nil {
		return m.Query
	}
	return nil
}

// The request for [google.datastore.v1beta3.Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
type BeginTransactionRequest struct {
	// Project ID against which to make the request.
	ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
}

func (m *BeginTransactionRequest) Reset()                    { *m = BeginTransactionRequest{} }
func (m *BeginTransactionRequest) String() string            { return proto.CompactTextString(m) }
func (*BeginTransactionRequest) ProtoMessage()               {}
func (*BeginTransactionRequest) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{4} }

// The response for [google.datastore.v1beta3.Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
type BeginTransactionResponse struct {
	// The transaction identifier (always present).
	Transaction []byte `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"`
}

func (m *BeginTransactionResponse) Reset()         { *m = BeginTransactionResponse{} }
func (m *BeginTransactionResponse) String() string { return proto.CompactTextString(m) }
func (*BeginTransactionResponse) ProtoMessage()    {}
func (*BeginTransactionResponse) Descriptor() ([]byte, []int) {
	return fileDescriptorDatastore, []int{5}
}

// The request for [google.datastore.v1beta3.Datastore.Rollback][google.datastore.v1beta3.Datastore.Rollback].
type RollbackRequest struct {
	// Project ID against which to make the request.
	ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	// The transaction identifier, returned by a call to
	// [google.datastore.v1beta3.Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
	Transaction []byte `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"`
}

func (m *RollbackRequest) Reset()                    { *m = RollbackRequest{} }
func (m *RollbackRequest) String() string            { return proto.CompactTextString(m) }
func (*RollbackRequest) ProtoMessage()               {}
func (*RollbackRequest) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{6} }

// The response for [google.datastore.v1beta3.Datastore.Rollback][google.datastore.v1beta3.Datastore.Rollback]
// (an empty message).
type RollbackResponse struct {
}

func (m *RollbackResponse) Reset()                    { *m = RollbackResponse{} }
func (m *RollbackResponse) String() string            { return proto.CompactTextString(m) }
func (*RollbackResponse) ProtoMessage()               {}
func (*RollbackResponse) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{7} }

// The request for [google.datastore.v1beta3.Datastore.Commit][google.datastore.v1beta3.Datastore.Commit].
type CommitRequest struct {
	// Project ID against which to make the request.
	ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	// The type of commit to perform. Defaults to `TRANSACTIONAL`.
	Mode CommitRequest_Mode `protobuf:"varint,5,opt,name=mode,proto3,enum=google.datastore.v1beta3.CommitRequest_Mode" json:"mode,omitempty"`
	// Must be set when mode is `TRANSACTIONAL`.
	//
	// Types that are valid to be assigned to TransactionSelector:
	//	*CommitRequest_Transaction
	TransactionSelector isCommitRequest_TransactionSelector `protobuf_oneof:"transaction_selector"`
	// The mutations to perform.
	//
	// When mode is `TRANSACTIONAL`, mutations affecting a single entity are
	// applied in order. The following sequences of mutations affecting a single
	// entity are not permitted in a single `Commit` request:
	// - `insert` followed by `insert`
	// - `update` followed by `insert`
	// - `upsert` followed by `insert`
	// - `delete` followed by `update`
	//
	// When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
	// entity.
	Mutations []*Mutation `protobuf:"bytes,6,rep,name=mutations" json:"mutations,omitempty"`
}

func (m *CommitRequest) Reset()                    { *m = CommitRequest{} }
func (m *CommitRequest) String() string            { return proto.CompactTextString(m) }
func (*CommitRequest) ProtoMessage()               {}
func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{8} }

type isCommitRequest_TransactionSelector interface {
	isCommitRequest_TransactionSelector()
}

type CommitRequest_Transaction struct {
	Transaction []byte `protobuf:"bytes,1,opt,name=transaction,proto3,oneof"`
}

func (*CommitRequest_Transaction) isCommitRequest_TransactionSelector() {}

func (m *CommitRequest) GetTransactionSelector() isCommitRequest_TransactionSelector {
	if m != nil {
		return m.TransactionSelector
	}
	return nil
}

func (m *CommitRequest) GetTransaction() []byte {
	if x, ok := m.GetTransactionSelector().(*CommitRequest_Transaction); ok {
		return x.Transaction
	}
	return nil
}

func (m *CommitRequest) GetMutations() []*Mutation {
	if m != nil {
		return m.Mutations
	}
	return nil
}

// XXX_OneofFuncs is for the internal use of the proto package.
func (*CommitRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
	return _CommitRequest_OneofMarshaler, _CommitRequest_OneofUnmarshaler, _CommitRequest_OneofSizer, []interface{}{
		(*CommitRequest_Transaction)(nil),
	}
}

func _CommitRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*CommitRequest)
	// transaction_selector
	switch x := m.TransactionSelector.(type) {
	case *CommitRequest_Transaction:
		_ = b.EncodeVarint(1<<3 | proto.WireBytes)
		_ = b.EncodeRawBytes(x.Transaction)
	case nil:
	default:
		return fmt.Errorf("CommitRequest.TransactionSelector has unexpected type %T", x)
	}
	return nil
}

func _CommitRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*CommitRequest)
	switch tag {
	case 1: // transaction_selector.transaction
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeRawBytes(true)
		m.TransactionSelector = &CommitRequest_Transaction{x}
		return true, err
	default:
		return false, nil
	}
}

func _CommitRequest_OneofSizer(msg proto.Message) (n int) {
	m := msg.(*CommitRequest)
	// transaction_selector
	switch x := m.TransactionSelector.(type) {
	case *CommitRequest_Transaction:
		n += proto.SizeVarint(1<<3 | proto.WireBytes)
		n += proto.SizeVarint(uint64(len(x.Transaction)))
		n += len(x.Transaction)
	case nil:
	default:
		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
	}
	return n
}

// The response for [google.datastore.v1beta3.Datastore.Commit][google.datastore.v1beta3.Datastore.Commit].
type CommitResponse struct {
	// The result of performing the mutations.
	// The i-th mutation result corresponds to the i-th mutation in the request.
	MutationResults []*MutationResult `protobuf:"bytes,3,rep,name=mutation_results,json=mutationResults" json:"mutation_results,omitempty"`
	// The number of index entries updated during the commit.
	IndexUpdates int32 `protobuf:"varint,4,opt,name=index_updates,json=indexUpdates,proto3" json:"index_updates,omitempty"`
}

func (m *CommitResponse) Reset()                    { *m = CommitResponse{} }
func (m *CommitResponse) String() string            { return proto.CompactTextString(m) }
func (*CommitResponse) ProtoMessage()               {}
func (*CommitResponse) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{9} }

func (m *CommitResponse) GetMutationResults() []*MutationResult {
	if m != nil {
		return m.MutationResults
	}
	return nil
}

// The request for [google.datastore.v1beta3.Datastore.AllocateIds][google.datastore.v1beta3.Datastore.AllocateIds].
type AllocateIdsRequest struct {
	// Project ID against which to make the request.
	ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	// A list of keys with incomplete key paths for which to allocate IDs.
	// No key may be reserved/read-only.
	Keys []*Key `protobuf:"bytes,1,rep,name=keys" json:"keys,omitempty"`
}

func (m *AllocateIdsRequest) Reset()                    { *m = AllocateIdsRequest{} }
func (m *AllocateIdsRequest) String() string            { return proto.CompactTextString(m) }
func (*AllocateIdsRequest) ProtoMessage()               {}
func (*AllocateIdsRequest) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{10} }

func (m *AllocateIdsRequest) GetKeys() []*Key {
	if m != nil {
		return m.Keys
	}
	return nil
}

// The response for [google.datastore.v1beta3.Datastore.AllocateIds][google.datastore.v1beta3.Datastore.AllocateIds].
type AllocateIdsResponse struct {
	// The keys specified in the request (in the same order), each with
	// its key path completed with a newly allocated ID.
	Keys []*Key `protobuf:"bytes,1,rep,name=keys" json:"keys,omitempty"`
}

func (m *AllocateIdsResponse) Reset()                    { *m = AllocateIdsResponse{} }
func (m *AllocateIdsResponse) String() string            { return proto.CompactTextString(m) }
func (*AllocateIdsResponse) ProtoMessage()               {}
func (*AllocateIdsResponse) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{11} }

func (m *AllocateIdsResponse) GetKeys() []*Key {
	if m != nil {
		return m.Keys
	}
	return nil
}

// A mutation to apply to an entity.
type Mutation struct {
	// The mutation operation.
	//
	// For `insert`, `update`, and `upsert`:
	// - The entity's key must not be reserved/read-only.
	// - No property in the entity may have a reserved name,
	//   not even a property in an entity in a value.
	// - No value in the entity may have meaning 18,
	//   not even a value in an entity in another value.
	//
	// Types that are valid to be assigned to Operation:
	//	*Mutation_Insert
	//	*Mutation_Update
	//	*Mutation_Upsert
	//	*Mutation_Delete
	Operation isMutation_Operation `protobuf_oneof:"operation"`
}

func (m *Mutation) Reset()                    { *m = Mutation{} }
func (m *Mutation) String() string            { return proto.CompactTextString(m) }
func (*Mutation) ProtoMessage()               {}
func (*Mutation) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{12} }

type isMutation_Operation interface {
	isMutation_Operation()
}

type Mutation_Insert struct {
	Insert *Entity `protobuf:"bytes,4,opt,name=insert,oneof"`
}
type Mutation_Update struct {
	Update *Entity `protobuf:"bytes,5,opt,name=update,oneof"`
}
type Mutation_Upsert struct {
	Upsert *Entity `protobuf:"bytes,6,opt,name=upsert,oneof"`
}
type Mutation_Delete struct {
	Delete *Key `protobuf:"bytes,7,opt,name=delete,oneof"`
}

func (*Mutation_Insert) isMutation_Operation() {}
func (*Mutation_Update) isMutation_Operation() {}
func (*Mutation_Upsert) isMutation_Operation() {}
func (*Mutation_Delete) isMutation_Operation() {}

func (m *Mutation) GetOperation() isMutation_Operation {
	if m != nil {
		return m.Operation
	}
	return nil
}

func (m *Mutation) GetInsert() *Entity {
	if x, ok := m.GetOperation().(*Mutation_Insert); ok {
		return x.Insert
	}
	return nil
}

func (m *Mutation) GetUpdate() *Entity {
	if x, ok := m.GetOperation().(*Mutation_Update); ok {
		return x.Update
	}
	return nil
}

func (m *Mutation) GetUpsert() *Entity {
	if x, ok := m.GetOperation().(*Mutation_Upsert); ok {
		return x.Upsert
	}
	return nil
}

func (m *Mutation) GetDelete() *Key {
	if x, ok := m.GetOperation().(*Mutation_Delete); ok {
		return x.Delete
	}
	return nil
}

// XXX_OneofFuncs is for the internal use of the proto package.
func (*Mutation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
	return _Mutation_OneofMarshaler, _Mutation_OneofUnmarshaler, _Mutation_OneofSizer, []interface{}{
		(*Mutation_Insert)(nil),
		(*Mutation_Update)(nil),
		(*Mutation_Upsert)(nil),
		(*Mutation_Delete)(nil),
	}
}

func _Mutation_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*Mutation)
	// operation
	switch x := m.Operation.(type) {
	case *Mutation_Insert:
		_ = b.EncodeVarint(4<<3 | proto.WireBytes)
		if err := b.EncodeMessage(x.Insert); err != nil {
			return err
		}
	case *Mutation_Update:
		_ = b.EncodeVarint(5<<3 | proto.WireBytes)
		if err := b.EncodeMessage(x.Update); err != nil {
			return err
		}
	case *Mutation_Upsert:
		_ = b.EncodeVarint(6<<3 | proto.WireBytes)
		if err := b.EncodeMessage(x.Upsert); err != nil {
			return err
		}
	case *Mutation_Delete:
		_ = b.EncodeVarint(7<<3 | proto.WireBytes)
		if err := b.EncodeMessage(x.Delete); err != nil {
			return err
		}
	case nil:
	default:
		return fmt.Errorf("Mutation.Operation has unexpected type %T", x)
	}
	return nil
}

func _Mutation_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Mutation)
	switch tag {
	case 4: // operation.insert
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(Entity)
		err := b.DecodeMessage(msg)
		m.Operation = &Mutation_Insert{msg}
		return true, err
	case 5: // operation.update
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(Entity)
		err := b.DecodeMessage(msg)
		m.Operation = &Mutation_Update{msg}
		return true, err
	case 6: // operation.upsert
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(Entity)
		err := b.DecodeMessage(msg)
		m.Operation = &Mutation_Upsert{msg}
		return true, err
	case 7: // operation.delete
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(Key)
		err := b.DecodeMessage(msg)
		m.Operation = &Mutation_Delete{msg}
		return true, err
	default:
		return false, nil
	}
}

func _Mutation_OneofSizer(msg proto.Message) (n int) {
	m := msg.(*Mutation)
	// operation
	switch x := m.Operation.(type) {
	case *Mutation_Insert:
		s := proto.Size(x.Insert)
		n += proto.SizeVarint(4<<3 | proto.WireBytes)
		n += proto.SizeVarint(uint64(s))
		n += s
	case *Mutation_Update:
		s := proto.Size(x.Update)
		n += proto.SizeVarint(5<<3 | proto.WireBytes)
		n += proto.SizeVarint(uint64(s))
		n += s
	case *Mutation_Upsert:
		s := proto.Size(x.Upsert)
		n += proto.SizeVarint(6<<3 | proto.WireBytes)
		n += proto.SizeVarint(uint64(s))
		n += s
	case *Mutation_Delete:
		s := proto.Size(x.Delete)
		n += proto.SizeVarint(7<<3 | proto.WireBytes)
		n += proto.SizeVarint(uint64(s))
		n += s
	case nil:
	default:
		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
	}
	return n
}

// The result of applying a mutation.
type MutationResult struct {
	// The automatically allocated key.
	// Set only when the mutation allocated a key.
	Key *Key `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"`
}

func (m *MutationResult) Reset()                    { *m = MutationResult{} }
func (m *MutationResult) String() string            { return proto.CompactTextString(m) }
func (*MutationResult) ProtoMessage()               {}
func (*MutationResult) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{13} }

func (m *MutationResult) GetKey() *Key {
	if m != nil {
		return m.Key
	}
	return nil
}

// Options shared by read requests.
type ReadOptions struct {
	// If not specified, lookups and ancestor queries default to
	// `read_consistency`=`STRONG`, global queries default to
	// `read_consistency`=`EVENTUAL`.
	//
	// Types that are valid to be assigned to ConsistencyType:
	//	*ReadOptions_ReadConsistency_
	//	*ReadOptions_Transaction
	ConsistencyType isReadOptions_ConsistencyType `protobuf_oneof:"consistency_type"`
}

func (m *ReadOptions) Reset()                    { *m = ReadOptions{} }
func (m *ReadOptions) String() string            { return proto.CompactTextString(m) }
func (*ReadOptions) ProtoMessage()               {}
func (*ReadOptions) Descriptor() ([]byte, []int) { return fileDescriptorDatastore, []int{14} }

type isReadOptions_ConsistencyType interface {
	isReadOptions_ConsistencyType()
}

type ReadOptions_ReadConsistency_ struct {
	ReadConsistency ReadOptions_ReadConsistency `protobuf:"varint,1,opt,name=read_consistency,json=readConsistency,proto3,enum=google.datastore.v1beta3.ReadOptions_ReadConsistency,oneof"`
}
type ReadOptions_Transaction struct {
	Transaction []byte `protobuf:"bytes,2,opt,name=transaction,proto3,oneof"`
}

func (*ReadOptions_ReadConsistency_) isReadOptions_ConsistencyType() {}
func (*ReadOptions_Transaction) isReadOptions_ConsistencyType()      {}

func (m *ReadOptions) GetConsistencyType() isReadOptions_ConsistencyType {
	if m != nil {
		return m.ConsistencyType
	}
	return nil
}

func (m *ReadOptions) GetReadConsistency() ReadOptions_ReadConsistency {
	if x, ok := m.GetConsistencyType().(*ReadOptions_ReadConsistency_); ok {
		return x.ReadConsistency
	}
	return ReadOptions_READ_CONSISTENCY_UNSPECIFIED
}

func (m *ReadOptions) GetTransaction() []byte {
	if x, ok := m.GetConsistencyType().(*ReadOptions_Transaction); ok {
		return x.Transaction
	}
	return nil
}

// XXX_OneofFuncs is for the internal use of the proto package.
func (*ReadOptions) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
	return _ReadOptions_OneofMarshaler, _ReadOptions_OneofUnmarshaler, _ReadOptions_OneofSizer, []interface{}{
		(*ReadOptions_ReadConsistency_)(nil),
		(*ReadOptions_Transaction)(nil),
	}
}

func _ReadOptions_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*ReadOptions)
	// consistency_type
	switch x := m.ConsistencyType.(type) {
	case *ReadOptions_ReadConsistency_:
		_ = b.EncodeVarint(1<<3 | proto.WireVarint)
		_ = b.EncodeVarint(uint64(x.ReadConsistency))
	case *ReadOptions_Transaction:
		_ = b.EncodeVarint(2<<3 | proto.WireBytes)
		_ = b.EncodeRawBytes(x.Transaction)
	case nil:
	default:
		return fmt.Errorf("ReadOptions.ConsistencyType has unexpected type %T", x)
	}
	return nil
}

func _ReadOptions_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*ReadOptions)
	switch tag {
	case 1: // consistency_type.read_consistency
		if wire != proto.WireVarint {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeVarint()
		m.ConsistencyType = &ReadOptions_ReadConsistency_{ReadOptions_ReadConsistency(x)}
		return true, err
	case 2: // consistency_type.transaction
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		x, err := b.DecodeRawBytes(true)
		m.ConsistencyType = &ReadOptions_Transaction{x}
		return true, err
	default:
		return false, nil
	}
}

func _ReadOptions_OneofSizer(msg proto.Message) (n int) {
	m := msg.(*ReadOptions)
	// consistency_type
	switch x := m.ConsistencyType.(type) {
	case *ReadOptions_ReadConsistency_:
		n += proto.SizeVarint(1<<3 | proto.WireVarint)
		n += proto.SizeVarint(uint64(x.ReadConsistency))
	case *ReadOptions_Transaction:
		n += proto.SizeVarint(2<<3 | proto.WireBytes)
		n += proto.SizeVarint(uint64(len(x.Transaction)))
		n += len(x.Transaction)
	case nil:
	default:
		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
	}
	return n
}

func init() {
	proto.RegisterType((*LookupRequest)(nil), "google.datastore.v1beta3.LookupRequest")
	proto.RegisterType((*LookupResponse)(nil), "google.datastore.v1beta3.LookupResponse")
	proto.RegisterType((*RunQueryRequest)(nil), "google.datastore.v1beta3.RunQueryRequest")
	proto.RegisterType((*RunQueryResponse)(nil), "google.datastore.v1beta3.RunQueryResponse")
	proto.RegisterType((*BeginTransactionRequest)(nil), "google.datastore.v1beta3.BeginTransactionRequest")
	proto.RegisterType((*BeginTransactionResponse)(nil), "google.datastore.v1beta3.BeginTransactionResponse")
	proto.RegisterType((*RollbackRequest)(nil), "google.datastore.v1beta3.RollbackRequest")
	proto.RegisterType((*RollbackResponse)(nil), "google.datastore.v1beta3.RollbackResponse")
	proto.RegisterType((*CommitRequest)(nil), "google.datastore.v1beta3.CommitRequest")
	proto.RegisterType((*CommitResponse)(nil), "google.datastore.v1beta3.CommitResponse")
	proto.RegisterType((*AllocateIdsRequest)(nil), "google.datastore.v1beta3.AllocateIdsRequest")
	proto.RegisterType((*AllocateIdsResponse)(nil), "google.datastore.v1beta3.AllocateIdsResponse")
	proto.RegisterType((*Mutation)(nil), "google.datastore.v1beta3.Mutation")
	proto.RegisterType((*MutationResult)(nil), "google.datastore.v1beta3.MutationResult")
	proto.RegisterType((*ReadOptions)(nil), "google.datastore.v1beta3.ReadOptions")
	proto.RegisterEnum("google.datastore.v1beta3.CommitRequest_Mode", CommitRequest_Mode_name, CommitRequest_Mode_value)
	proto.RegisterEnum("google.datastore.v1beta3.ReadOptions_ReadConsistency", ReadOptions_ReadConsistency_name, ReadOptions_ReadConsistency_value)
}

var fileDescriptorDatastore = []byte{
	// 1086 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x57, 0x5f, 0x73, 0xe2, 0x54,
	0x14, 0xdf, 0xd0, 0x42, 0xe1, 0x40, 0x29, 0x7b, 0x5d, 0x95, 0x61, 0xba, 0x23, 0x73, 0xb5, 0x6e,
	0x65, 0x56, 0xd8, 0xb2, 0x76, 0x56, 0x3b, 0xfb, 0x50, 0xa0, 0xec, 0x96, 0x71, 0x0b, 0x35, 0x50,
	0x67, 0x7c, 0xca, 0x04, 0x72, 0x8b, 0xb1, 0x21, 0x49, 0x93, 0xe0, 0xc8, 0x38, 0xbe, 0x38, 0x3e,
	0xe9, 0xf8, 0xe4, 0xf8, 0x01, 0x7c, 0xf6, 0x59, 0xfd, 0x10, 0xce, 0xf8, 0xe2, 0x57, 0xf0, 0x43,
	0xf8, 0xe8, 0xcd, 0xcd, 0x0d, 0x21, 0x6c, 0x03, 0xa9, 0xb3, 0x6f, 0xe4, 0x70, 0x7e, 0xe7, 0xfc,
	0xce, 0xff, 0x04, 0xf6, 0xc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 0x7c, 0x9e, 0x63, 0xd7, 0x97, 0x03, 0x5d, 0x5e, 0xbf, 0xd0, 0x85, 0xb0, 0xb0,
	0xa5, 0xd1, 0x8a, 0x1b, 0xfd, 0xf2, 0xd1, 0x28, 0xbd, 0x1f, 0x53, 0x9b, 0x13, 0x3c, 0x64, 0x04,
	0x6b, 0xb8, 0xb2, 0x86, 0xa0, 0x1c, 0x60, 0x29, 0xc7, 0xe6, 0x23, 0xd8, 0xa5, 0x89, 0x8c, 0x74,
	0xd5, 0xcc, 0xcf, 0xc7, 0xfa, 0xdc, 0xfd, 0xc2, 0x39, 0x17, 0x86, 0x29, 0xf6, 0xa9, 0xf3, 0xf8,
	0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xa9, 0xa3, 0x78, 0x9b, 0x0d, 0x00, 0x00,
}

redpajama_set_name: RedPajamaGithub


text:
import React from 'react'
import { Comment, Icon } from 'semantic-ui-react'

const CommentExampleActions = () => (
  <Comment.Group>
    <Comment>
      <Comment.Avatar as='a' src='/assets/images/avatar/small/joe.jpg' />
      <Comment.Content>
        <Comment.Author>Tom Lukic</Comment.Author>
        <Comment.Text>
          This will be great for business reports. I will definitely download this.
        </Comment.Text>
        <Comment.Actions>
          <Comment.Action>Reply</Comment.Action>
          <Comment.Action>Save</Comment.Action>
          <Comment.Action>Hide</Comment.Action>
          <Comment.Action>
            <Icon name='expand' />
            Full-screen
          </Comment.Action>
        </Comment.Actions>
      </Comment.Content>
    </Comment>
  </Comment.Group>
)

export default CommentExampleActions


text:
package com.cloudera.oryx.lambda.serving;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.typesafe.config.Config;
import org.junit.After;
import org.junit.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.cloudera.oryx.common.io.IOUtils;
import com.cloudera.oryx.common.settings.ConfigUtils;
import com.cloudera.oryx.kafka.util.ProduceData;
import com.cloudera.oryx.kafka.util.DatumGenerator;
import com.cloudera.oryx.lambda.AbstractLambdaIT;

public abstract class AbstractServingIT extends AbstractLambdaIT {

  private static final Logger log = LoggerFactory.getLogger(AbstractServingIT.class);

  private ServingLayer servingLayer;
  private ProduceData updateProducer;
  private int httpPort;
  private int httpsPort;

  @Before
  public final void allocateHTTPPorts() throws IOException {
    httpPort = IOUtils.chooseFreePort();
    httpsPort = IOUtils.chooseFreePort();
  }

  @Override
  protected Config getConfig() throws IOException {
    Map<String,Object> overlay = new HashMap<>();
    // Non-privileged ports
    overlay.put("oryx.serving.api.port", httpPort);
    overlay.put("oryx.serving.api.secure-port", httpsPort);
    return ConfigUtils.overlayOn(overlay, super.getConfig());
  }

  protected final void startServer(Config config) throws IOException {
    servingLayer = new ServingLayer(config);
    log.info("Starting serving layer");
    servingLayer.start();
  }

  protected final void startUpdateTopics(DatumGenerator<String,String> updateGenerator,
                                         int howManyUpdate) throws InterruptedException {

    int zkPort = getZKPort();
    int kafkaPort = getKafkaBrokerPort();

    updateProducer = new ProduceData(updateGenerator,
        zkPort,
        kafkaPort,
        UPDATE_TOPIC,
        howManyUpdate,
        0);

    log.info("Producing updates");
    updateProducer.start();
  }

  protected ServingLayer getServingLayer() {
    return servingLayer;
  }

  @After
  public void tearDownServingLayer() throws IOException {
    if (servingLayer != null) {
      servingLayer.close();
    }
  }

  protected final int getHTTPPort() {
    return httpPort;
  }

  protected final int getHTTPSPort() {
    return httpsPort;
  }

}


text:
namespace g{namespace Uno{namespace Graphics{struct IndexBuffer;}}}
namespace g{namespace Uno{struct Buffer;}}

namespace g{
namespace Uno{
namespace Graphics{

// public sealed class IndexBuffer :525
// {
::g::Uno::Graphics::DeviceBuffer_type* IndexBuffer_typeof();
void IndexBuffer__ctor_2_fn(IndexBuffer* __this, ::g::Uno::Buffer* data, int* usage);
void IndexBuffer__New2_fn(::g::Uno::Buffer* data, int* usage, IndexBuffer** __retval);

struct IndexBuffer : ::g::Uno::Graphics::DeviceBuffer
{
    void ctor_2(::g::Uno::Buffer* data, int usage);
    static IndexBuffer* New2(::g::Uno::Buffer* data, int usage);
};
// }

}}} // ::g::Uno::Graphics


text:
<!DOCTYPE html>

	<meta charset="utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
	<meta name="format-detection" content="telephone=no"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

	<title>AdminExample</title>

	<link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.min.css"/>
	<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
	<link rel="stylesheet" href="css/whirl.css"/>
	<link rel="stylesheet" href="css/sb-admin-2.css"/>

		<side-nav params="option:sideNav"></side-nav>

	<modal params="option:modal"></modal>

		Admin Example


text:
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
// ReSharper disable All

namespace Com.Ericmas001.Userbase.Entities
{
    [Table("UserSettings")]
    public class UserSetting : IEntityWithId
    {
        [NotMapped]
        public int Id
        {
            get { return IdUser; }
            set { IdUser = value; }
        }

        [Key]
        [ForeignKey("User")]
        public int IdUser { get; set; }

        public int IdUserAccessTypeListFriends { get; set; }

        public virtual UserAccessType UserAccessTypeListFriends { get; set; }

        public virtual User User { get; set; }
    }
}


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/mainLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <ScrollView
        android:id="@+id/SCROLLER_ID"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true"
        android:scrollbars="vertical" >

        <LinearLayout
            android:id="@+id/mygallery"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >
        </LinearLayout>
    </ScrollView>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView android:id="@+id/imgSplash"
            android:layout_centerInParent="true"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/portal"/>

        <TextView
            android:id="@+id/tvStatus"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="10dp"
            android:paddingTop="10dp"
            android:textColor="#FFFFFF" />
    </RelativeLayout>

</LinearLayout>


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ghidra.trace.database.listing;

import java.util.List;

import ghidra.program.model.address.AddressRange;
import ghidra.trace.model.Lifespan;
import ghidra.trace.model.listing.*;

/**
 * The implementation of {@link TraceCodeSpace#codeUnits()}
 */
public class DBTraceCodeUnitsView extends
		AbstractComposedDBTraceCodeUnitsView<DBTraceCodeUnitAdapter, AbstractSingleDBTraceCodeUnitsView<? extends DBTraceCodeUnitAdapter>>
		implements TraceCodeUnitsView, InternalBaseCodeUnitsView<TraceCodeUnit> {

	/**
	 * Construct the view
	 *
	 * @param space the space, bound to an address space
	 */
	public DBTraceCodeUnitsView(DBTraceCodeSpace space) {
		super(space, List.of(space.instructions, space.definedData, space.undefinedData));
	}

	@Override
	public boolean coversRange(Lifespan span, AddressRange range) {
		// Every address has a code unit, defined or undefined
		return true;
	}

	@Override
	public boolean intersectsRange(Lifespan span, AddressRange range) {
		// Every address has a code unit, defined or undefined
		return true;
	}
}


text:
<?php
try {
    /**************************************
    * Create databases and                *
    * open connections                    *
    **************************************/

    // Create (connect to) SQLite database in file
    $file_db = new PDO('sqlite:likes.sqlite');
    // Set errormode to exceptions
    $file_db->setAttribute(PDO::ATTR_ERRMODE,
                            PDO::ERRMODE_EXCEPTION);

if(isset($_GET['isliked']))
{

$pageID = isset($_GET['pageid'])?$_GET['pageid']:0;
$unique = md5($_SERVER['REMOTE_ADDR']. $_SERVER['HTTP_USER_AGENT']);

if(!is_numeric($pageID)) die('ID is not in correct types');

$query = "SELECT COUNT(*) as count FROM tblLikes where pageID=$pageID AND CheckMD5='$unique'";

$result = $file_db->query($query);

foreach($result as $rows) {
$row = $rows['count'];
}

if($row > 0 )
echo 'yes';
else
echo 'no';

die;

}
$pageID = isset($_GET['pageid'])?$_GET['pageid']:0;

if(!is_numeric($pageID)) die('ID is not in correct types');

$query = "SELECT COUNT(*) as count FROM tblLikes where pageID=$pageID";

$result = $file_db->query($query);

foreach($result as $rows) {
$row = $rows['count'];
}

if($row > 0 )
echo $row;

  }
  catch(PDOException $e) {
    // Print PDOException message
    echo $e->getMessage();
  }


text:
html {
    font-family: sans-serif;
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%
}

body {
    margin: 0
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
    display: block
}

audio,
canvas,
progress,
video {
    display: inline-block;
    vertical-align: baseline
}

audio:not([controls]) {
    display: none;
    height: 0
}

[hidden],
template {
    display: none
}

a {
    background-color: transparent
}

a:active,
a:hover {
    outline: 0
}

abbr[title] {
    border-bottom: 1px dotted
}

b,
strong {
    font-weight: bold
}

dfn {
    font-style: italic
}

h1 {
    font-size: 2em;
    margin: 0.67em 0
}

mark {
    background: #ff0;
    color: #000
}

small {
    font-size: 80%
}

sub,
sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline
}

sup {
    top: -0.5em
}

sub {
    bottom: -0.25em
}

img {
    border: 0
}

svg:not(:root) {
    overflow: hidden
}

figure {
    margin: 1em 40px
}

hr {
    box-sizing: content-box;
    height: 0
}

pre {
    overflow: auto
}

code,
kbd,
pre,
samp {
    font-family: monospace, monospace;
    font-size: 1em
}

button,
input,
optgroup,
select,
textarea {
    color: inherit;
    font: inherit;
    margin: 0
}

button {
    overflow: visible
}

button,
select {
    text-transform: none
}

button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
    -webkit-appearance: button;
    cursor: pointer
}

button[disabled],
html input[disabled] {
    cursor: default
}

button::-moz-focus-inner,
input::-moz-focus-inner {
    border: 0;
    padding: 0
}

input {
    line-height: normal
}

input[type="checkbox"],
input[type="radio"] {
    box-sizing: border-box;
    padding: 0
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    height: auto
}

input[type="search"] {
    -webkit-appearance: textfield;
    box-sizing: content-box
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none
}

fieldset {
    border: 1px solid #c0c0c0;
    margin: 0 2px;
    padding: 0.35em 0.625em 0.75em
}

legend {
    border: 0;
    padding: 0
}

textarea {
    overflow: auto
}

optgroup {
    font-weight: bold
}

table {
    border-collapse: collapse;
    border-spacing: 0
}

td,
th {
    padding: 0
}

html,
body {
    height: 100%;
    font-family: 'Lato', sans-serif;
    font-size: 1.2em;
    font-weight: 300;
    color: #fff;
    overflow: hidden;
    background: -webkit-linear-gradient(#29B6F6, #7E57C2) left repeat;
    background: linear-gradient(#29B6F6, #7E57C2) left repeat
}

#calculator {
    height: 100%
}

#top {
    height: 20%
}

#keys-upper-part {
    height: 16%
}

#drawing-board {
    height: 64%;
}

#keys-lower-part {
    height: 64%;
}

#display {
    height: 100%;
    width: 100%;
    display: block;
    position: relative;
    float: left;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px
}

#display span {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    font-weight: 400;
    -webkit-transform: translateY(-50%);
    -moz-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    -o-transform: translateY(-50%);
    transform: translateY(-50%)
}

#keys-upper-part button {
    height: 100%;
    width: 25%;
    display: block;
    float: left;
    margin-right: 0
}

#keys-lower-part button {
    height: 25%;
    width: 25%;
    display: block;
    float: left;
    margin-right: 0
}

button {
    border-top: 1px solid #fff;
    border-right: 1px solid #fff;
    border-bottom: none;
    border-left: none;
    background-color: transparent;
    -webkit-transition: all 0.1s ease-in-out;
    -moz-transition: all 0.1s ease-in-out;
    transition: all 0.1s ease-in-out
}

button:active {
    background: rgba(255, 255, 255, 0.3)
}

button:nth-child(4n) {
    border-right: none
}

#clear-tape {
    border-bottom: 1px solid #fff;
    border-left: 1px solid #fff;
}

#tape {
    position: absolute;
    right: 0;
    margin: 0 10px 0 0;
    border: 0;
    display: inline-block;
    z-index: 2;
    padding: 15px;
    cursor: pointer;
    border-radius: 50%;
    -webkit-transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out
}

#tape:before {
    content: "";
    position: absolute;
    left: 50%;
    margin-left: -10px;
    width: 20px;
    height: 2px;
    background-color: #fff
}

#tape:hover:before {
    background-color: #fff
}

#tape:after {
    content: "";
    position: absolute;
    left: 50%;
    margin-top: 7px;
    margin-left: -10px;
    width: 20px;
    height: 2px;
    background-color: #fff
}

#tape:hover:after {
    background-color: #fff
}

#tape:hover {
    background-color: transparent
}

#tape:focus {
    outline: 0
}

#tape.active:before {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg)
}

#tape.active:after {
    margin-top: 0;
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg)
}

#tape-content {
    display: none;
    text-align: center;
    padding-top: 20px;
    padding-bottom: 20px
}

ul#tape-list {
    padding: 0;
    list-style-type: none;
    text-align: center
}

@media (min-width: 1024px) {
    html,
    body {
        font-size: 1.5em
    }
    #display span {
        font-weight: 300
    }
}


text:
package com.upnext.blekit.actions.foursquare;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.upnext.blekit.R;
import com.upnext.blekit.actions.BLEAction;

/**
 * Action responsible for check-in to Foursquare.
 *
 * In foreground launches a new transparent activity ({@link com.upnext.blekit.actions.foursquare.FoursquareCheckinActivity} which tires to check-in user.
 *
 * In background displays a notification + behaves like in foreground after click.
 *
 * @author Roman Wozniak (roman@up-next.com)
 */
public class FoursquareCheckinAction extends BLEAction<FoursquareCheckinActionParams> {

    public static final String TYPE = "foursquare-checkin";
    public static final int NOTIFICATION_ID = 2451134;

    /**
     * {@inheritDoc}
     */
    @Override
    public String getType() {
        return TYPE;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Class<FoursquareCheckinActionParams> getParameterClass() {
        return FoursquareCheckinActionParams.class;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void performInBackground(Context context) {
        displayNotification( context, parameters.notification_title, parameters.notification_message, TYPE, R.drawable.ic_notification, NOTIFICATION_ID );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void performInForeground(Activity activity) {
        activity.startActivity( new Intent(activity, FoursquareCheckinActivity.class) );
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void processIntent(Intent intent, Activity activity) {
        performInForeground(activity);
    }
}


text:
RequireJS is designed to meet the following requirements:

## Go with the grain of the browser

XMLHttpRequest(XHR) loaders are limited to the same domain as the page, and make debugging harder. Certain browsers allow cross-domain XHR calls and better conventions for debugging when eval is used, but support is inconsistent across browsers.

eval-based loaders should be avoided since eval is not a JavaScript best practice and it is not allowed in some environments. There is a time and place for eval, but a module loader can do better than to use it.

A server process that transforms scripts on the fly should also not be needed. Getting everyone to use the same server process or even making specs for a common format they can all emit is more overhead, more stuff to write. Front-end developers have a long established practice of being able to author plain text files and having them load in the browser without a bunch of server hardware.

Scripts loaded via script tags work everywhere and work across domains. It is a much simpler loading style that uses the natural way browsers load scripts.

## Load code before and after page load

The same system should be usable before and after page load. Delaying loading of code until a later page action is a key performance benefit.

## Scripts should be able to specify dependencies.

It is very easy for a project to beyond needing a couple of scripts. It is hard to manually track all the dependencies and the correct loading order. A script should be able to specify its immediate dependencies. The developer should not have to worry about what those dependencies need to load and work out the correct loading order.

## The loader should be able to load nested dependencies

If each module specifies its own direct dependencies, the loader should be able to work out the correct dependencies across the whole system, even nested dependencies, for dependencies of dependencies.

## Scripts can be evaluated out of order, but modules need to be evaluated according to dependencies

Using the browser-native script loading that has nested dependency resolution and works after page load means that scripts will need to be loaded at least part of the time via using appendChild for script elements.

IE and WebKit will execute scripts added via appendChild out of DOM order, they
execute them in network receive order. Even if they executed scripts in the order
they were added to the DOM, dependencies for a module are discovered after
the module script has been loaded, so scripts for the dependencies will always be added
after the script that needs them.

This leads to constructing a module format for a script, one that puts the bulk of the script in a function, with its dependencies specified outside of that function wrapper. This allows scripts to be evaluated out of order by the browser, but gives the chance to properly work out the dependencies, then call the function wrappers in the right sequence to bring the scripts into being.

## The module format should be compact

Boilerplate code is a pain. However a function wrapper is needed as part of the boilerplate. Prefer making the boilerplate as terse as possible, to allow easy hand-coding by developers. Avoid overly-explicit module formats that use a name/value pair for each property, since developer will have to code these by hand.

## Have a streamlined core loader, but allow for the future.

The core of the loader, module format support with nested dependency resolution, should be compact, but allow for plugins to expand the concept of dependencies and what it means to load them.

In Dojo, it is common to need i18n string bundles and text strings of HTML for widget constructions. Allow the loader to be able to load these things, but as plugins, so the core stays lightweight.

## Allow modules to keep a clean global namespace

As projects get bigger, it is more common to need to load two versions of a module in a page. This should be possible by allowing a module system that does not define modules in the globale namespace.

If a module wants to work with the global namespace, but that is normally easy to allow in a module spec. The harder part is constructing a format that works well to avoid the global namespace.

## Load any script

Not all scripts will be using the module format. Allow existing scripts to be loaded and treated as a dependency.

## Allow for performance upgrades

This mainly means have a build system that can combine and optimize modules. It also means the loader should allow loading a script with multiple modules defined in it, and only fetch dependencies that are not already included in that script file.


text:
module Releaf::ActionController::Search
  extend ActiveSupport::Concern

  included do
    helper_method :searchable_fields
  end

  def searchable_fields
    @searchable_fields ||= Releaf::DefaultSearchableFields.new(resource_class).find
  end

  def search(text)
    return unless feature_available?(:search)
    return if text.blank?
    return if searchable_fields.blank?
    @collection = searcher_class.prepare(relation: @collection, fields: searchable_fields, text: text)
  end

  def searcher_class
    Releaf::Search
  end
end


text:
package org.kie.dmn.core.compiler.profiles;

import java.util.Collections;
import java.util.List;

import org.kie.dmn.api.marshalling.DMNExtensionRegister;
import org.kie.dmn.core.compiler.DMNProfile;
import org.kie.dmn.core.compiler.DRGElementCompiler;
import org.kie.dmn.feel.runtime.FEELFunction;

public class Just47DMNProfile implements DMNProfile {

    @Override
    public List<FEELFunction> getFEELFunctions() {
        return Collections.singletonList(new Just47Function());
    }

    @Override
    public List<DMNExtensionRegister> getExtensionRegisters() {
        return Collections.emptyList();
    }

    @Override
    public List<DRGElementCompiler> getDRGElementCompilers() {
        return Collections.emptyList();
    }

}


text:
<?php

namespace Tests\Unit;

use App\IntlString;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

use \App\JaroWinkler;

/**
 * @requires extension mbstring
 * @requires extension intl
 *
 * @covers \App\IntlString
 * @covers \App\JaroWinkler
 */
class JaroWinklerTest extends TestCase
{
    /**
     * @testWith ["Urusei Yatsura", "Urusei Yatsura"]
     */
    public function testdistanceLatinExact(string $left, $right)
    {
        $this->assertEquals(1.0, JaroWinkler::distance($left, $right));
    }

    /**
     * @testWith ["うる星やつら", "うる星やつら"]
     */
    public function testdistanceJapaneseExact(string $left, $right)
    {
        $this->assertEquals(1.0, JaroWinkler::distance($left, $right));
    }

    /**
     * @testWith ["Urusei", "Urus"]
     */
    public function testdistanceLatinNotExact(string $left, string $right)
    {
        $this->assertEquals(0.9333, floatval(number_format(JaroWinkler::distance($left, $right), 4)));
    }

    /**
     * @testWith ["うる星やつら", "うる星や"]
     */
    public function testdistanceJapaneseNotExact(string $left, string $right)
    {
        $this->assertEquals(0.9333, floatval(number_format(JaroWinkler::distance($left, $right), 4)));
    }

    /**
     * @testWith ["asd", "xyz"]
     */
    public function testdistanceLatinZero(string $left, string $right)
    {
        $this->assertEquals(0.0, JaroWinkler::distance($left, $right));
    }

    /**
     * @testWith ["あえい", "ンおう"]
     */
    public function testdistanceJapaneseZero(string $left, string $right)
    {
        $this->assertEquals(0.0, JaroWinkler::distance($left, $right));
    }
}